@Test public void testUnDeployArchive() throws Exception { final CommandContext ctx = CommandContextFactory.getInstance().newCommandContext(); try { ctx.connectController(); ctx.handle("deploy " + cliArchiveFile.getAbsolutePath() + " --script=install.scr"); // check that now both wars are deployed String response = HttpRequest.get(getBaseURL(url) + "deployment0/SimpleServlet", 10, TimeUnit.SECONDS); assertTrue("Invalid response: " + response, response.indexOf("SimpleServlet") >= 0); response = HttpRequest.get(getBaseURL(url) + "deployment1/SimpleServlet", 10, TimeUnit.SECONDS); assertTrue("Invalid response: " + response, response.indexOf("SimpleServlet") >= 0); ctx.handle( "undeploy " + "--path=" + cliArchiveFile.getAbsolutePath() + " --script=uninstall.scr"); // check that both wars are undeployed assertTrue(checkUndeployed(getBaseURL(url) + "deployment0/SimpleServlet")); assertTrue(checkUndeployed(getBaseURL(url) + "deployment1/SimpleServlet")); } finally { ctx.terminateSession(); } }
protected boolean checkUndeployed(String spec) { try { final long firstTry = System.currentTimeMillis(); HttpRequest.get(spec, 10, TimeUnit.SECONDS); while (System.currentTimeMillis() - firstTry <= 1000) { try { Thread.sleep(500); } catch (InterruptedException e) { break; } finally { HttpRequest.get(spec, 10, TimeUnit.SECONDS); } } return false; } catch (Exception e) { } return true; }
@Test public void testHttpConnector() throws Exception { addConnector(Connector.HTTP); // check that the connector is live String cURL = "http://" + url.getHost() + ":8181"; String response = HttpRequest.get(cURL, 10, TimeUnit.SECONDS); assertTrue("Invalid response: " + response, response.indexOf("JBoss") >= 0); removeConnector(Connector.HTTP); }
private String performCall(String path) throws Exception { String urlspec = managementClient.getWebUri() + path; return HttpRequest.get(urlspec, 5, TimeUnit.SECONDS); }
private static String performCall(String urlPattern) throws Exception { return HttpRequest.get("http://localhost:8080/tranaction/" + urlPattern, 10, SECONDS); }
private String performCall(String urlPattern) throws Exception { return HttpRequest.get( managementClient.getWebUri() + "/war-example/" + urlPattern, 5, TimeUnit.SECONDS); }
@Test public void testLifeCycle() throws Exception { String result = HttpRequest.get(callEjbUrl.toExternalForm() + "CallEjbServlet", 1000, SECONDS); assertEquals("TestHello", result); }
private String performCall() throws Exception { URL url = new URL(this.url.toExternalForm() + "helloworld"); return HttpRequest.get(url.toExternalForm(), 10, TimeUnit.SECONDS); }
@Test public void testPostConstructCalled() throws Exception { Assert.assertEquals( "Hello World", HttpRequest.get("http://localhost:8080/simple/SimpleServlet", 2, TimeUnit.SECONDS)); }
protected static String performCall(final String url) throws ExecutionException, IOException, TimeoutException { return HttpRequest.get(url, TimeoutUtil.adjust(10), TimeUnit.SECONDS); }
private static String performCall(String urlPattern) throws Exception { return HttpRequest.get(url.toString() + urlPattern, 5, TimeUnit.SECONDS); }