public static void main(String args[]) { // The stat reporter writes out the test info and results // into the top-level quicklook directory during a run. stat.addDescription("Unit test for IT 13555"); WebTest webTest = new WebTest(args); int port = new Integer(webTest.portS).intValue(); String name; try { webTest.goGet(webTest.host, port, webTest.contextRoot + "/test"); } catch (Throwable t) { System.out.println(t.getMessage()); stat.addStatus(" Test " + TEST_NAME + " UNPREDICTED-FAILURE", stat.FAIL); } finally { try { if (webTest.sock != null) { webTest.sock.close(); } } catch (IOException ioe) { // ignore } } stat.printSummary(TEST_NAME + " ---> PASS"); }
public static void main(String[] args) { stat.addDescription("Unit test for resource injection into " + "ServletRequestListener"); WebTest webTest = new WebTest(args); try { webTest.doTest(); stat.addStatus(TEST_NAME, stat.PASS); } catch (Exception ex) { ex.printStackTrace(); stat.addStatus(TEST_NAME, stat.FAIL); } stat.printSummary(); }
public static void main(String[] args) { stat.addDescription( "Unit test for ensuring binary compatibility " + "of GlassFish-style valves compiled against the old Valve " + "interface"); WebTest webTest = new WebTest(args); try { webTest.doTest(); stat.addStatus(TEST_NAME, stat.PASS); } catch (Exception ex) { ex.printStackTrace(); stat.addStatus(TEST_NAME, stat.FAIL); } stat.printSummary(); }
private void ProcessResult(WebTest test, WebResponse response) { long pageLoadTime = response.getLoadTime(); int statusCode = response.getStatusCode(); String content = response.getContentAsString(); boolean responseContentValid = true; if (!test.getRespShouldContain().isEmpty()) { if (!content.contains(test.getRespShouldContain())) { responseContentValid = false; } } else if (!test.getRespShouldNotContain().isEmpty()) { if (content.contains(test.getRespShouldNotContain())) { responseContentValid = false; } } Orville.LOG() .info( String.format( "Page load status code: %d, page load time: %d ms, response valid: %s\n", statusCode, pageLoadTime, (responseContentValid == true) ? "true" : "false")); boolean statusCodeValid = (test.getRespHttpCode() != 0 ? statusCode == test.getRespHttpCode() : true); boolean testPassed = (statusCodeValid && responseContentValid) ? true : false; StringBuffer urlBuffer = new StringBuffer(); urlBuffer.append("http://orville-agent-management.herokuapp.com/test_results/"); // urlBuffer.append("http://localhost:3000/test_results/"); urlBuffer.append(test.getTestId() + "/"); urlBuffer.append(Orville.AgentGuid() + "/"); urlBuffer.append(testPassed + "/"); urlBuffer.append(pageLoadTime); // Need to make sure the URL doesn't have any spaces String url = urlBuffer.toString().replaceAll("\\s+", "%20"); Orville.LOG().info("Test result URL: " + url); DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httpPost = null; try { httpPost = new HttpPost(url); HttpResponse postResponse = httpclient.execute(httpPost); Orville.LOG() .fine( String.format( "Test result data posted, response code: %d\n", postResponse.getStatusLine().getStatusCode())); } catch (IOException e) { Orville.LOG() .warning( String.format( "Unable to connect with Redstone test results service: %s\n", e.getMessage())); } }
private void ProcessTest(WebTest test) { HtmlPage page = null; // Orville.LOG().info(String.format("Executing test %s\n", event)); WebClient webClient = new WebClient(); webClient.setRefreshHandler(new ThreadedRefreshHandler()); webClient.getOptions().setJavaScriptEnabled(false); try { if (test.getMethod().toLowerCase().equals("post")) { WebRequest request = new WebRequest(UrlUtils.toUrlUnsafe(test.getUrlString()), HttpMethod.POST); request.setRequestParameters(new ArrayList<NameValuePair>()); for (Map.Entry<String, String> entry : test.getPostData().entrySet()) { request.getRequestParameters().add(new NameValuePair(entry.getKey(), entry.getValue())); } page = webClient.getPage(request); } else { page = webClient.getPage(test.getUrlString()); } ProcessResult(test, page.getWebResponse()); } catch (FailingHttpStatusCodeException fsc) { Orville.LOG() .warning( String.format( "Failing HTTP Status code caught executing the test command: %s\n", fsc.getMessage())); } catch (IOException ioe) { Orville.LOG() .warning( String.format( "IO Exception caught executing the test command: %s\n", ioe.getMessage())); } webClient.closeAllWindows(); }
public static void main(String[] args) { stat.addDescription("Unit test for CR 6716503"); WebTest webTest = new WebTest(args); try { if ("first".equals(webTest.run)) { TEST_NAME = TEST_ROOT_NAME + "-first"; webTest.firstRun(); } else { TEST_NAME = TEST_ROOT_NAME + "-second"; webTest.secondRun(); } } catch (Exception ex) { ex.printStackTrace(); stat.addStatus(TEST_NAME, stat.FAIL); } stat.printSummary(); }
public static void main(String[] args) { stat.addDescription("Unit test for IT 12891, 17377"); WebTest webTest = new WebTest(args); try { webTest.doTest("hello", 200); webTest.doTest("hello", 200); webTest.doTest("hello2", 500); webTest.doTest("hello2", 200); webTest.doTest("pages/test.jsp", 200); stat.addStatus(TEST_NAME, stat.PASS); } catch (Exception ex) { ex.printStackTrace(); stat.addStatus(TEST_NAME, stat.FAIL); } stat.printSummary(); }
public static void main(String[] args) { stat.addDescription("Unit test for Bugzilla 30067"); WebTest webTest = new WebTest(args); webTest.doTest(); stat.printSummary(); }
public static void main(String[] args) { stat.addDescription("Unit test for one session cookie header"); WebTest webTest = new WebTest(args); webTest.doTest(); stat.printSummary(TEST_NAME); }
public static void main(String[] args) { stat.addDescription("Unit test for jsp:attribute with omit"); WebTest webTest = new WebTest(args); webTest.doTest(); stat.printSummary(); }
public static void main(String[] args) { stat.addDescription("Unit test for @WebServlet"); WebTest webTest = new WebTest(args); webTest.doTest(); stat.printSummary(TEST_NAME); }