use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.
the class ArchiveDefaultScriptNamesTestCase method testDeployUndeployArchive.
@Test
public void testDeployUndeployArchive() throws Exception {
final CommandContext ctx = CLITestUtil.getCommandContext();
try {
ctx.connectController();
ctx.handle("deploy " + cliArchiveFile.getAbsolutePath());
// 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);
assertTrue(checkUndeployed(getBaseURL(url) + "deployment2/SimpleServlet"));
ctx.handle("undeploy " + "--path=" + cliArchiveFile.getAbsolutePath());
// check that both wars are undeployed
assertTrue(checkUndeployed(getBaseURL(url) + "deployment0/SimpleServlet"));
assertTrue(checkUndeployed(getBaseURL(url) + "deployment1/SimpleServlet"));
} finally {
ctx.terminateSession();
}
}
use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.
the class BatchFileTestCase method testRunBatchFile.
// It does not work with 6.3.x
@Ignore
@Test
public void testRunBatchFile() throws Exception {
createFile(new String[] { "/system-property=batchfiletest:add(value=true)", "", "# comments", "/system-property=batchfiletest:write-attribute(value=false)" });
final CommandContext ctx = CLITestUtil.getCommandContext();
try {
ctx.connectController();
final ModelNode batchRequest = ctx.buildRequest("run-batch --file=" + TMP_FILE.getAbsolutePath() + " --headers={allow-resource-service-restart=true}");
assertTrue(batchRequest.hasDefined("operation"));
assertEquals("composite", batchRequest.get("operation").asString());
assertTrue(batchRequest.hasDefined("address"));
assertTrue(batchRequest.get("address").asList().isEmpty());
assertTrue(batchRequest.hasDefined("steps"));
List<ModelNode> steps = batchRequest.get("steps").asList();
assertEquals(2, steps.size());
ModelNode op = steps.get(0);
assertTrue(op.hasDefined("address"));
List<Property> address = op.get("address").asPropertyList();
assertEquals(1, address.size());
assertEquals("system-property", address.get(0).getName());
assertEquals("batchfiletest", address.get(0).getValue().asString());
assertTrue(op.hasDefined("operation"));
assertEquals("add", op.get("operation").asString());
assertEquals("true", op.get("value").asString());
op = steps.get(1);
assertTrue(op.hasDefined("address"));
address = op.get("address").asPropertyList();
assertEquals(1, address.size());
assertEquals("system-property", address.get(0).getName());
assertEquals("batchfiletest", address.get(0).getValue().asString());
assertTrue(op.hasDefined("operation"));
assertEquals("write-attribute", op.get("operation").asString());
assertEquals("false", op.get("value").asString());
assertTrue(batchRequest.hasDefined("operation-headers"));
final ModelNode headers = batchRequest.get("operation-headers");
assertEquals("true", headers.get("allow-resource-service-restart").asString());
} finally {
ctx.terminateSession();
}
}
use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.
the class CdTestCase method testValidAddress.
@Test
public void testValidAddress() throws Exception {
final CommandContext ctx = CLITestUtil.getCommandContext();
try {
ctx.connectController();
ctx.handle("cd subsystem=datasources");
} finally {
ctx.terminateSession();
}
}
use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.
the class ArchiveTestCase method testUnDeployArchive.
@Test
public void testUnDeployArchive() throws Exception {
final CommandContext ctx = CLITestUtil.getCommandContext();
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();
}
}
use of org.jboss.as.cli.CommandContext in project eap-additional-testsuite by jboss-set.
the class ArchiveTestCase method testUnDeployArchive.
@Test
public void testUnDeployArchive() throws Exception {
final CommandContext ctx = CLITestUtil.getCommandContext();
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();
}
}
Aggregations