Search in sources :

Example 1 with Batch

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();
    }
}
Also used : CommandContext(org.jboss.as.cli.CommandContext) ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) Batch(org.jboss.as.cli.batch.Batch) ModelNode(org.jboss.dmr.ModelNode) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Aggregations

InSequence (org.jboss.arquillian.junit.InSequence)1 CommandContext (org.jboss.as.cli.CommandContext)1 Batch (org.jboss.as.cli.batch.Batch)1 ModelControllerClient (org.jboss.as.controller.client.ModelControllerClient)1 ModelNode (org.jboss.dmr.ModelNode)1 Test (org.junit.Test)1