/**
   * Log response event.
   *
   * @param responseMessage that was received
   */
  public void logResponseEvent(ResponseHolder responseMessage) {
    HtmlRunReporter reporter = getTestClassExecutionData().getHtmlRunReporter();
    LogFileWriter logWriter = reporter.getTestMethodHtmlLog();

    String addStr = "";
    String text = "Receiving response, response code: " + responseMessage.getResponseCode();
    String message = responseMessage.getResponseMessage();

    reporter.systemOutPrintLn(text);

    if (logWriter != null) {
      try {
        String dumpFileName = dumpSource(message);
        File dumpFile = new File(dumpFileName);
        addStr =
            " <small>[<a href=\""
                + dumpFile.getName()
                + "\" target=\"_new\">response source</a>] </small>";
      } catch (Exception e) {
        addStr =
            " <small>[Dump failed:"
                + e.getMessage()
                + "]<br/><code><small><br><pre>"
                + getFullStackTrace(e)
                + "</pre></small></code></small>";
      }
    }
    if (logWriter != null) {
      logWriter.insertText(
          "<tr><td>&nbsp;</td><td bgcolor=\"#F0F0F0\">" + text + addStr + "</td></tr>\n");
    }
  }
Example #2
0
 /**
  * Saves the actual Stub Config that belongs to the Default group. This test runs as first test in
  * the functional test pack, and the last test will restore this.
  *
  * @throws Exception in case of problem
  */
 @Test
 public void testSaveStubConfig() throws Exception {
   RequestParameters requestParameters = createRequestParameters();
   ResponseHolder result = callWilmaWithPostMethod(requestParameters);
   logComment("Actual Stub Config Arrived");
   saveInFile(result.getResponseMessage());
   setMessageMarkingTo("off");
 }