use of org.jboss.as.cli.batch.Batch in project wildfly by wildfly.
the class ModClusterSubsystemAddTestCase method testModClusterAdd.
@Test
@InSequence(1)
public void testModClusterAdd() throws Exception {
final CommandContext ctx = CLITestUtil.getCommandContext();
final ModelControllerClient controllerClient = managementClient.getControllerClient();
try {
ctx.connectController();
// Add the mod_cluster extension first (not in this profile by default)
ModelNode request = ctx.buildRequest("/extension=org.jboss.as.modcluster:add");
ModelNode response = controllerClient.execute(request);
String outcome = response.get("outcome").asString();
Assert.assertEquals("Adding mod_cluster extension failed! " + request.toJSONString(false), "success", outcome);
// Now lets execute subsystem add operation but we need to specify a connector
ctx.getBatchManager().activateNewBatch();
Batch b = ctx.getBatchManager().getActiveBatch();
b.add(ctx.toBatchedCommand("/socket-binding-group=standard-sockets/socket-binding=modcluster:add(multicast-port=23364, multicast-address=224.0.1.105)"));
b.add(ctx.toBatchedCommand("/subsystem=modcluster:add"));
b.add(ctx.toBatchedCommand("/subsystem=modcluster/mod-cluster-config=configuration:add(connector=http,advertise-socket=modcluster)"));
request = b.toRequest();
b.clear();
ctx.getBatchManager().discardActiveBatch();
response = controllerClient.execute(request);
outcome = response.get("outcome").asString();
Assert.assertEquals("Adding mod_cluster subsystem failed! " + request.toJSONString(false), "success", outcome);
} finally {
ctx.terminateSession();
}
}
Aggregations