예제 #1
0
 /**
  * Log Get Request Event.
  *
  * @param requestParameters is the requested parameters
  */
 public void logGetRequestEvent(RequestParameters requestParameters) {
   String text = "Sending GET request to URL: " + requestParameters.getTestServerUrl();
   if (requestParameters.isUseProxy()) {
     text +=
         "\nUsing proxy:"
             + requestParameters.getWilmaHost()
             + ":"
             + requestParameters.getWilmaPort();
   } else {
     text += "\nWithout any proxy.";
   }
   logComment(text);
 }
예제 #2
0
  /**
   * Log POST request event.
   *
   * @param requestParameters that was sent in the request.
   */
  public void logPostRequestEvent(RequestParameters requestParameters) {
    HtmlRunReporter reporter = getTestClassExecutionData().getHtmlRunReporter();
    LogFileWriter logWriter = reporter.getTestMethodHtmlLog();

    String text = "Sending POST request to URL: " + requestParameters.getTestServerUrl();
    if (requestParameters.isUseProxy()) {
      text +=
          "\nUsing proxy:"
              + requestParameters.getWilmaHost()
              + ":"
              + requestParameters.getWilmaPort();
    } else {
      text += "\nWithout any proxy.";
    }

    reporter.systemOutPrintLn(getStep() + ". " + text);

    String addStr = "";
    if (logWriter != null) {
      try {
        String dumpFileName = dumpSource(originalRequestMessage);
        File dumpFile = new File(dumpFileName);
        addStr =
            " <small>[<a href=\""
                + dumpFile.getName()
                + "\" target=\"_new\">request 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 align=\"center\">&nbsp;&nbsp;"
              + getStep()
              + ".&nbsp;&nbsp;</td><td bgcolor=\"#F0F0F0\">"
              + text
              + addStr
              + "</td></tr>\n");
    }
    increaseStep();
  }