Package org.jboss.as.controller.client.helpers.domain

Examples of org.jboss.as.controller.client.helpers.domain.DomainClient$Factory


    /**
     * Test for AS7-3600
     */
    @Test
    public void testAddRemoveHostInterface() throws Exception {
        final DomainClient masterClient = domainMasterLifecycleUtil.getDomainClient();
        final String ifaceName = "testing-interface";

        ModelNode add = new ModelNode();
        add.get(OP).set(ADD);
        add.get(OP_ADDR).add(HOST, "master").add(INTERFACE, ifaceName);
        add.get(ANY_ADDRESS).set(true);

        validateResponse(masterClient.execute(add));

        ModelNode read = new ModelNode();
        read.get(OP).set(READ_RESOURCE_OPERATION);
        read.get(OP_ADDR).add(HOST, "master").add(SERVER, "main-one").add(INTERFACE, ifaceName);
        validateResponse(masterClient.execute(read));

        ModelNode remove = new ModelNode();
        remove.get(OP).set(REMOVE);
        remove.get(OP_ADDR).add(HOST, "master").add(INTERFACE, ifaceName);
        validateResponse(masterClient.execute(remove));

        validateFailedResponse(masterClient.execute(read));
    }
View Full Code Here


        validateFailedResponse(masterClient.execute(read));
    }
   
    @Test
    public void testAddRemoveSocketBindingGroup() throws Exception {
        final DomainClient masterClient = domainMasterLifecycleUtil.getDomainClient();
        final String bindingGroupName = "testing-binding-group";
        final String serverGroupName = "testing-server-group";

        // add binding group
        ModelNode add = new ModelNode();
        add.get(OP).set(ADD);
        add.get(OP_ADDR).add(SOCKET_BINDING_GROUP, bindingGroupName);
        add.get(DEFAULT_INTERFACE).set("public");
        validateResponse(masterClient.execute(add));        
       
        // add server group using new binding group
        add = new ModelNode();
        add.get(OP).set(ADD);
        add.get(OP_ADDR).add(SERVER_GROUP, serverGroupName);
        add.get(PROFILE).set("default");
        validateResponse(masterClient.execute(add));       
       
        // remove server group
        ModelNode remove = new ModelNode();
        remove.get(OP).set(REMOVE);
        remove.get(OP_ADDR).add(SERVER_GROUP, serverGroupName);
        validateResponse(masterClient.execute(remove));       
       
        // remove binding group
        remove = new ModelNode();
        remove.get(OP).set(REMOVE);
        remove.get(OP_ADDR).add(SOCKET_BINDING_GROUP, bindingGroupName);
        validateResponse(masterClient.execute(remove));       
       
        // check the binding group is gone
        ModelNode read = new ModelNode();
        add.get(OP).set(READ_RESOURCE_OPERATION);
        add.get(OP_ADDR).add(SOCKET_BINDING_GROUP, bindingGroupName);
        validateFailedResponse(masterClient.execute(read));        
       
    }   
View Full Code Here

    /**
     * Test for AS7-3643
     */
    @Test
    public void testCanFindServerRestartRequiredAfterChangingSocketBindingPortOffset() throws Exception {
        final DomainClient masterClient = domainMasterLifecycleUtil.getDomainClient();

        ModelNode read = new ModelNode();
        read.get(OP).set(READ_ATTRIBUTE_OPERATION);
        read.get(OP_ADDR).add(HOST, "master").add(SERVER_CONFIG, "main-one");
        read.get(NAME).set("socket-binding-port-offset");
        ModelNode result = validateResponse(masterClient.execute(read));
        int original = result.isDefined() ? result.asInt() : 0;

        //The bug causing AS7-3643 caused execution of this op to fail
        ModelNode write = new ModelNode();
        write.get(OP).set(WRITE_ATTRIBUTE_OPERATION);
        write.get(OP_ADDR).add(HOST, "master").add(SERVER_CONFIG, "main-one");
        write.get(NAME).set("socket-binding-port-offset");
        write.get(VALUE).set(original + 1);
        ModelNode response = masterClient.execute(write);
        validateResponse(response);

        final String mainServerGroup = "main-server-group";
        Assert.assertEquals(SUCCESS, response.get(SERVER_GROUPS, mainServerGroup, "main-one", RESPONSE, OUTCOME).asString());
        ModelNode headers = response.get(SERVER_GROUPS, mainServerGroup, "main-one", RESPONSE, RESPONSE_HEADERS);
        Assert.assertEquals(RESTART_REQUIRED, headers.get(PROCESS_STATE).asString());
        Assert.assertTrue(RESTART_REQUIRED, headers.get(OPERATION_REQUIRES_RESTART).asBoolean());


        //Now just set back to the original
        write.get(VALUE).set(original);
        validateResponse(masterClient.execute(write));
    }
View Full Code Here

        write.get(VALUE).set(original);
        validateResponse(masterClient.execute(write));
    }

    private void testCannotInvokeManagedServerOperationsComposite(ModelNode stepAddress) throws Exception {
        final DomainClient masterClient = domainMasterLifecycleUtil.getDomainClient();

        ModelNode composite = new ModelNode();
        composite.get(OP).set(CompositeOperationHandler.NAME);
        composite.get(OP_ADDR).setEmptyList();
        composite.get(OPERATION_HEADERS, ROLLBACK_ON_RUNTIME_FAILURE).set(false);

        ModelNode goodServerOp = new ModelNode();
        goodServerOp.get(OP).set(READ_RESOURCE_OPERATION);
        goodServerOp.get(OP_ADDR).set(stepAddress);
        composite.get(STEPS).add(goodServerOp);
        composite.get(STEPS).add(getAddThreadFactoryOperation(stepAddress.clone().add("thread-factory", "test-pool-123abc")));

        ModelNode result = masterClient.execute(composite);

        validateFailedResponse(result);

        Set<String> keys = new HashSet<String>(result.get(RESULT).keys());
        keys.remove(SERVER_GROUPS);
View Full Code Here

            i++;
        }
    }

    private void testCannotInvokeManagedServerOperationsComposite(String host, String server, ModelNode stepAddress) throws Exception {
        final DomainClient masterClient = domainMasterLifecycleUtil.getDomainClient();

        ModelNode composite = new ModelNode();
        composite.get(OP).set(CompositeOperationHandler.NAME);
        composite.get(OP_ADDR).add(HOST, host);
        composite.get(OP_ADDR).add(SERVER, server);
        composite.get(OPERATION_HEADERS, ROLLBACK_ON_RUNTIME_FAILURE).set(false);

        ModelNode goodServerOp = new ModelNode();
        goodServerOp.get(OP).set(READ_RESOURCE_OPERATION);
        goodServerOp.get(OP_ADDR).set(stepAddress);
        composite.get(STEPS).add(goodServerOp);
        composite.get(STEPS).add(getAddThreadFactoryOperation(stepAddress.clone().add("thread-factory", "test-pool-123abc")));

        ModelNode result = masterClient.execute(composite);

        validateFailedResponse(result);

        Set<String> keys = new HashSet<String>(result.get(RESULT).keys());
        keys.remove(SERVER_GROUPS);
View Full Code Here

            return msg.substring(0, msg.indexOf(":"));
        }
    }

    private void testSnapshot(ModelNode addr) throws Exception {
        final DomainClient masterClient = domainMasterLifecycleUtil.getDomainClient();

        ModelNode snapshotOperation = new ModelNode();
        snapshotOperation.get(OP).set(SnapshotTakeHandler.OPERATION_NAME);
        snapshotOperation.get(OP_ADDR).set(addr);
        ModelNode response = masterClient.execute(snapshotOperation);
        final String snapshot = validateResponse(response).asString();
        Assert.assertNotNull(snapshot);
        Assert.assertFalse(snapshot.isEmpty());

        ModelNode listSnapshotOperation = new ModelNode();
        listSnapshotOperation.get(OP).set(SnapshotListHandler.OPERATION_NAME);
        listSnapshotOperation.get(OP_ADDR).set(addr);
        ModelNode listResult = validateResponse(masterClient.execute(listSnapshotOperation));
        Set<String> snapshots = new HashSet<String>();
        for (ModelNode curr : listResult.get(NAMES).asList()) {
            snapshots.add(listResult.get(DIRECTORY).asString() + fileSeparator + curr.asString());
        }

        Assert.assertTrue(snapshots.contains(snapshot));

        ModelNode deleteSnapshotOperation = new ModelNode();
        deleteSnapshotOperation.get(OP).set(SnapshotDeleteHandler.OPERATION_NAME);
        deleteSnapshotOperation.get(OP_ADDR).set(addr);
        deleteSnapshotOperation.get(NAME).set(snapshot.substring(snapshot.lastIndexOf(fileSeparator+ fileSeparator.length()));
        validateResponse(masterClient.execute(deleteSnapshotOperation));

        listResult = validateResponse(masterClient.execute(listSnapshotOperation));
        snapshots = new HashSet<String>();
        for (ModelNode curr : listResult.get(NAMES).asList()) {
            snapshots.add(listResult.get(DIRECTORY).asString() + fileSeparator + curr.asString());
        }
View Full Code Here

        domainSlaveLifecycleUtil = null;
    }

    @Test
    public void testDomainReadResource() throws IOException {
        DomainClient domainClient = domainMasterLifecycleUtil.getDomainClient();
        final ModelNode domainOp = new ModelNode();
        domainOp.get(OP).set(READ_RESOURCE_OPERATION);
        domainOp.get(OP_ADDR).setEmptyList();
        domainOp.get(RECURSIVE).set(true);
        domainOp.get(INCLUDE_RUNTIME).set(true);
        domainOp.get(PROXIES).set(false);

        ModelNode response = domainClient.execute(domainOp);
        validateResponse(response);

        // TODO make some more assertions about result content
    }
View Full Code Here

        // TODO make some more assertions about result content
    }

    @Test
    public void testHostReadResource() throws IOException {
        DomainClient domainClient = domainMasterLifecycleUtil.getDomainClient();
        final ModelNode hostOp = new ModelNode();
        hostOp.get(OP).set(READ_RESOURCE_OPERATION);
        hostOp.get(OP_ADDR).setEmptyList().add(HOST, "master");
        hostOp.get(RECURSIVE).set(true);
        hostOp.get(INCLUDE_RUNTIME).set(true);
        hostOp.get(PROXIES).set(false);

        ModelNode response = domainClient.execute(hostOp);
        validateResponse(response);
        // TODO make some more assertions about result content

        hostOp.get(OP_ADDR).setEmptyList().add(HOST, "slave");
        response = domainClient.execute(hostOp);
        validateResponse(response);
        // TODO make some more assertions about result content
    }
View Full Code Here

        // TODO make some more assertions about result content
    }

    @Test
    public void testHostReadResourceViaSlave() throws IOException {
        DomainClient domainClient = domainSlaveLifecycleUtil.getDomainClient();
        final ModelNode hostOp = new ModelNode();
        hostOp.get(OP).set(READ_RESOURCE_OPERATION);
        hostOp.get(OP_ADDR).setEmptyList().add(HOST, "slave");
        hostOp.get(RECURSIVE).set(true);
        hostOp.get(INCLUDE_RUNTIME).set(true);
        hostOp.get(PROXIES).set(false);

        ModelNode response = domainClient.execute(hostOp);
        validateResponse(response);
        // TODO make some more assertions about result content
    }
View Full Code Here

        // TODO make some more assertions about result content
    }

    @Test
    public void testServerReadResource() throws IOException {
        DomainClient domainClient = domainMasterLifecycleUtil.getDomainClient();
        final ModelNode serverOp = new ModelNode();
        serverOp.get(OP).set(READ_RESOURCE_OPERATION);
        ModelNode address = serverOp.get(OP_ADDR);
        address.add(HOST, "master");
        address.add(SERVER, "main-one");
        serverOp.get(RECURSIVE).set(true);
        serverOp.get(INCLUDE_RUNTIME).set(true);
        serverOp.get(PROXIES).set(false);

        ModelNode response = domainClient.execute(serverOp);
        validateResponse(response);
        // TODO make some more assertions about result content
        ModelNode result = response.get(RESULT);
        Assert.assertTrue(result.isDefined());
        Assert.assertTrue(result.hasDefined(PROFILE_NAME));

        address.setEmptyList();
        address.add(HOST, "slave");
        address.add(SERVER, "main-three");
        response = domainClient.execute(serverOp);
        validateResponse(response);
        // TODO make some more assertions about result content
        result = response.get(RESULT);
        Assert.assertTrue(result.isDefined());
        Assert.assertTrue(result.hasDefined(PROFILE_NAME));
View Full Code Here

TOP

Related Classes of org.jboss.as.controller.client.helpers.domain.DomainClient$Factory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.