@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 String runIf(CommandContext ctx, String comparison, String logical, String value) throws Exception { ctx.handle(getIfStatement(comparison, logical, value)); ctx.handle(this.getWritePropertyReq("\"true\"")); ctx.handle("end-if"); cliOut.reset(); ctx.handle(getReadPropertyReq()); return getValue(); }
@Before public void beforeTest() throws Exception { ctx = CLITestUtil.getCommandContext(); ctx.connectController(); ctx.handle("deploy --server-groups=" + sgOne + ' ' + cliTestApp1War.getAbsolutePath()); ctx.handle("deploy --server-groups=" + sgOne + ' ' + cliTestAnotherWar.getAbsolutePath()); ctx.handle("deploy --server-groups=" + sgTwo + ' ' + cliTestApp2War.getAbsolutePath()); ctx.handle( "deploy --server-groups=" + sgTwo + ',' + sgOne + ' ' + cliTestAppEar.getAbsolutePath()); afterTestDeployments = new HashSet<String>(); }
public void execute() { log.info("execute cli command"); try { ctx.handle(CMD_READ_MSG); } catch (CommandLineException e) { e.printStackTrace(); } }
public static void reloadServer() throws Exception { final CommandContext ctx = CLITestUtil.getCommandContext( "remoting", TestSuiteEnvironment.getServerAddress(), MANAGEMENT_NATIVE_PORT); try { ctx.connectController(); ctx.handle("reload"); } finally { ctx.terminateSession(); } }
@Test public void testGreaterThan() throws Exception { final CommandContext ctx = CLITestUtil.getCommandContext(cliOut); try { ctx.connectController(); ctx.handle(this.getAddPropertyReq("\"5\"")); assertEquals("5", runIf(ctx, ">", "&&", "\"1\"")); assertEquals("true", runIf(ctx, ">", "||", "\"1\"")); } finally { ctx.handleSafe(this.getRemovePropertyReq()); ctx.terminateSession(); cliOut.reset(); } }
@Test public void testUndeployTestAWARs() throws Exception { ctx.handle("undeploy *test-a*.war --all-relevant-server-groups"); afterTestDeployments.add(cliTestAppEar.getName()); }
@Test public void testUndeployTestAs() throws Exception { ctx.handle("undeploy *test-a* --all-relevant-server-groups"); }
@Test public void testUndeployCliTestApps() throws Exception { ctx.handle("undeploy cli-test-app* --all-relevant-server-groups"); afterTestDeployments.add(cliTestAnotherWar.getName()); }