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

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


    }

    @Test
    public void testServerReadConfigAsXml() throws IOException {

        DomainClient domainClient = domainMasterLifecycleUtil.getDomainClient();
        ModelNode request = new ModelNode();
        request.get(OP).set("read-config-as-xml");
        ModelNode address = request.get(OP_ADDR);
        address.add(HOST, "master");
        address.add(SERVER, "main-one");

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

        address.setEmptyList();
        address.add(HOST, "slave");
        address.add(SERVER, "main-three");
        response = domainClient.execute(request);
        validateResponse(response);
        // TODO make some more assertions about result content
    }
View Full Code Here


    @Test
    public void testResolveExpressionOnDomain() throws Exception  {
        ModelNode op = testSupport.createOperationNode(null, "resolve-expression-on-domain");
        op.get("expression").set("${file.separator}");

        DomainClient domainClient = domainMasterLifecycleUtil.getDomainClient();
        ModelNode response = domainClient.execute(op);
        validateResponse(response);
        validateResolveExpressionOnMaster(response);
        validateResolveExpressionOnSlave(response);
    }
View Full Code Here

    @Test
    public void testResolveExpressionOnMasterHost() throws Exception  {
        ModelNode op = testSupport.createOperationNode("host=master", "resolve-expression-on-domain");
        op.get("expression").set("${file.separator}");

        DomainClient domainClient = domainMasterLifecycleUtil.getDomainClient();
        ModelNode response = domainClient.execute(op);
        validateResponse(response);
        validateResolveExpressionOnMaster(response);
    }
View Full Code Here

    }

    private void readHostState(String host) throws Exception {
        ModelNode op = testSupport.createOperationNode("host=" + host, READ_RESOURCE_OPERATION);
        op.get(INCLUDE_RUNTIME).set(true);
        DomainClient client = domainMasterLifecycleUtil.getDomainClient();
        ModelNode response = client.execute(op);
        ModelNode result = validateResponse(response);
        Assert.assertTrue(result.hasDefined(HOST_STATE));
        Assert.assertEquals("running", result.get(HOST_STATE).asString());
    }
View Full Code Here

    }

    @Test
    public void test2Versioning() throws Exception {

        DomainClient masterClient = support.getDomainMasterLifecycleUtil().createDomainClient();
        ModelNode masterModel;
        try {
            masterModel = readDomainModelForVersions(masterClient);
        } finally {
            IoUtils.safeClose(masterClient);
        }
        DomainClient slaveClient = support.getDomainSlaveLifecycleUtil().createDomainClient();
        ModelNode slaveModel;
        try {
            slaveModel = readDomainModelForVersions(slaveClient);
        } finally {
            IoUtils.safeClose(slaveClient);
View Full Code Here

        assertEquals(masterModel, slaveModel);
    }

    @Test
    public void test9SecurityTransformers() throws Exception {
        final DomainClient masterClient = support.getDomainMasterLifecycleUtil().createDomainClient();
        final DomainClient slaveClient = support.getDomainSlaveLifecycleUtil().createDomainClient();
        try {
            PathAddress  subsystem = PathAddress.pathAddress(PathElement.pathElement(PROFILE, getProfile()), PathElement.pathElement(SUBSYSTEM, SecurityExtension.SUBSYSTEM_NAME));
            PathAddress webPolicy = subsystem.append(Constants.SECURITY_DOMAIN, "jboss-web-policy").append(Constants.AUTHORIZATION, Constants.CLASSIC);
            ModelNode options = new ModelNode();
            options.add("a", "b");
            ModelNode op = Util.getWriteAttributeOperation(webPolicy.append(Constants.POLICY_MODULE, "Delegating"), Constants.MODULE_OPTIONS, options);
            DomainTestUtils.executeForResult(op, masterClient);

            //TODO check the resources
            //System.out.println(DomainTestUtils.executeForResult(Util.createOperation(READ_RESOURCE_OPERATION, address), modelControllerClient));

            PathAddress jaspi = subsystem.append(Constants.SECURITY_DOMAIN, "jaspi-test").append(Constants.AUTHENTICATION, Constants.JASPI);

            PathAddress jaspiLoginStack = jaspi.append(Constants.LOGIN_MODULE_STACK, "lm-stack");
            op = Util.createAddOperation(jaspiLoginStack.append(Constants.LOGIN_MODULE, "test2"));
            op.get(Constants.CODE).set("UserRoles");
            op.get(Constants.FLAG).set("required");
            op.get(Constants.MODULE).set("test-jaspi");
            DomainTestUtils.executeForResult(op, masterClient);

            op = Util.createAddOperation(jaspi.append(Constants.AUTH_MODULE, "Delegating"));
            op.get(Constants.CODE).set("Delegating");
            op.get(Constants.LOGIN_MODULE_STACK_REF).set("lm-stack");
            op.get(Constants.FLAG).set("optional");
            DomainTestUtils.executeForResult(op, masterClient);

            op = new ModelNode();
            op.get(OP).set(READ_RESOURCE_OPERATION);
            op.get(OP_ADDR).set(jaspi.toModelNode());
            op.get(INCLUDE_ALIASES).set(false);
            op.get(RECURSIVE).set(true);

            ModelNode masterResource = DomainTestUtils.executeForResult(op, masterClient);
            ModelNode slaveResource = DomainTestUtils.executeForResult(op, slaveClient);

            //TODO only check this for 7.1.x
            if (version == Version.AsVersion.AS_7_1_2_FINAL || version == Version.AsVersion.AS_7_1_3_FINAL) {
                ModelNode masterModules = masterResource.get(Constants.AUTH_MODULE);
                Assert.assertFalse(slaveResource.hasDefined(Constants.AUTH_MODULE));
                List<ModelNode> slaveModules = slaveResource.get(Constants.AUTH_MODULES).asList();
                Assert.assertEquals(masterModules.keys().size(), slaveModules.size());
                Set<ModelNode> masterSet = getAllChildren(masterModules);
                Assert.assertTrue(slaveModules.containsAll(masterSet));

                masterModules = masterResource.get(Constants.LOGIN_MODULE_STACK, "lm-stack", Constants.LOGIN_MODULE);
                Assert.assertFalse(slaveResource.get(Constants.LOGIN_MODULE_STACK, "lm-stack").hasDefined(Constants.LOGIN_MODULE));
                slaveModules = slaveResource.get(Constants.LOGIN_MODULE_STACK, "lm-stack", Constants.LOGIN_MODULES).asList();
                Assert.assertEquals(masterModules.keys().size(), slaveModules.size());
                masterSet = getAllChildren(masterModules);
                Assert.assertTrue(slaveModules.containsAll(masterSet));
            } else {
                ModelTestUtils.compare(masterResource, slaveResource, true);
            }


        } finally {
            try {
                //The server will be in restart-required mode, so restart it to get rid of the changes
                PathAddress serverAddress = PathAddress.pathAddress(HOST, "slave").append(SERVER_CONFIG, "server-one");
                ModelNode op = Util.createOperation(RESTART, PathAddress.pathAddress(serverAddress));
                op.get(BLOCKING).set(true);
                Assert.assertEquals("STARTED", validateResponse(slaveClient.execute(op), true).asString());
            } finally {
                IoUtils.safeClose(slaveClient);
                IoUtils.safeClose(masterClient);
            }
        }
View Full Code Here

        ModelNode composite = createDeploymentOperation(content, MAIN_SERVER_GROUP_DEPLOYMENT_ADDRESS);
        OperationBuilder builder = new OperationBuilder(composite, true);
        builder.addInputStream(webArchive.as(ZipExporter.class).exportAsInputStream());
        executeOnMaster(builder.build());

        DomainClient client = testSupport.getDomainMasterLifecycleUtil().createDomainClient();
        Assert.assertEquals("OVERRIDDEN", performHttpCall(client, "master", "main-one", "standard-sockets"));
        Assert.assertEquals("OVERRIDDEN", performHttpCall(client, "slave", "main-three", "standard-sockets"));

    }
View Full Code Here

        testDomainOperation(ModelUtil.createCompositeNode(steps));
    }

    private void testDomainOperation(ModelNode operation) throws Exception {

        DomainClient client = domainMasterLifecycleUtil.getDomainClient();
        CfgFileDescription lastBackupDesc = getLatestBackup(domainCurrentCfgDir);
        CfgFileDescription lastMasterBackupDesc = getLatestBackup(masterCurrentCfgDir);
        CfgFileDescription lastSlaveBackupDesc = getLatestBackup(slaveCurrentCfgDir);
        long lastFileHash = domainLastCfgFile.exists() ? FileUtils.checksumCRC32(domainLastCfgFile) : -1;
View Full Code Here

    }

    @Test
    public void testDomainOperationRollback() throws Exception {

        DomainClient client = domainMasterLifecycleUtil.getDomainClient();

        CfgFileDescription lastDomainBackupDesc = getLatestBackup(domainCurrentCfgDir);
        CfgFileDescription lastMasterBackupDesc = getLatestBackup(masterCurrentCfgDir);
        CfgFileDescription lastSlaveBackupDesc = getLatestBackup(slaveCurrentCfgDir);
View Full Code Here

    }

    @Test
    public void testHostOperationRollback() throws Exception {

        DomainClient client = domainMasterLifecycleUtil.getDomainClient();

        for (Host host : Host.values()) {

            CfgFileDescription lastDomainBackupDesc = getLatestBackup(domainCurrentCfgDir);
            CfgFileDescription lastMasterBackupDesc = getLatestBackup(masterCurrentCfgDir);
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.