Package org.jboss.as.arquillian.container

Examples of org.jboss.as.arquillian.container.ManagementClient


        }
    }

    @Test
    public void testOperations() throws Exception {
        final ManagementClient managementClient = createManagementClient();
        final ModelControllerClient client = managementClient.getControllerClient();
        try {

            // Create the custom formatter
            ModelNode op = Operations.createAddOperation(CUSTOM_FORMATTER_ADDRESS);
            op.get("class").set("org.jboss.logmanager.formatters.PatternFormatter");
View Full Code Here


        }
    }

    @Test
    public void testUsage(@ArquillianResource URL url) throws Exception {
        final ManagementClient managementClient = createManagementClient();
        final ModelControllerClient client = managementClient.getControllerClient();
        try {

            // Create the custom formatter
            ModelNode op = Operations.createAddOperation(CUSTOM_FORMATTER_ADDRESS);
            op.get("class").set("java.util.logging.XMLFormatter");
View Full Code Here

            Assert.assertTrue("Invalid response statusCode: " + response + " URL: " + url, response.statusCode == HttpServletResponse.SC_OK);
        }
    }

    static ManagementClient createManagementClient() {
        return new ManagementClient(TestSuiteEnvironment.getModelControllerClient(), TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
    }
View Full Code Here

        performWsdlHostAttributeTest(true);
    }
   
    private void performWsdlHostAttributeTest(boolean checkUpdateWithDeployedEndpoint) throws Exception {
        Assert.assertTrue(containerController.isStarted(DEFAULT_JBOSSAS));
        ManagementClient managementClient = new ManagementClient(TestSuiteEnvironment.getModelControllerClient(),
                TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
       
        ModelControllerClient client = managementClient.getControllerClient();
        String initialWsdlHost = null;
        try {
            initialWsdlHost = getAttribute("wsdl-host", client);
           
            final String hostnameA = "foo-host-a";
           
            ModelNode op = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
            op.get(NAME).set("wsdl-host");
            op.get(VALUE).set(hostnameA);
            applyUpdate(client, op, false); //update successful, no need to reload
           
            //now we deploy an endpoint...
            deployer.deploy(DEP_1);

            //verify the updated wsdl host is used...
            URL wsdlURL = new URL(managementClient.getWebUri().toURL(), '/' + DEP_1 + "/POJOService?wsdl");
            checkWsdl(wsdlURL, hostnameA);
           
            if (checkUpdateWithDeployedEndpoint) {
                final String hostnameB = "foo-host-b";
               
                ModelNode opB = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
                opB.get(NAME).set("wsdl-host");
                opB.get(VALUE).set(hostnameB);
                applyUpdate(client, opB, true); //update again, but we'll need to reload, as there's an active deployment
               
                //check the wsdl host is still the one we updated to before
                checkWsdl(wsdlURL, hostnameA);
               
                //and check that still applies even if we undeploy and redeploy the endpoint
                deployer.undeploy(DEP_1);
                deployer.deploy(DEP_1);
                checkWsdl(wsdlURL, hostnameA);
            }
        } finally {
            try {
                deployer.undeploy(DEP_1);
            } catch (Throwable t) {
                //ignore
            }
            try {
                if (initialWsdlHost != null) {
                    ModelNode op = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
                    op.get(NAME).set("wsdl-host");
                    op.get(VALUE).set(initialWsdlHost);
                    applyUpdate(client, op, checkUpdateWithDeployedEndpoint);
                }
            } finally {
                managementClient.close();
            }
        }
    }
View Full Code Here

        performWsdlPortAttributeTest(true);
    }
   
    private void performWsdlPortAttributeTest(boolean checkUpdateWithDeployedEndpoint) throws Exception {
        Assert.assertTrue(containerController.isStarted(DEFAULT_JBOSSAS));
        ManagementClient managementClient = new ManagementClient(TestSuiteEnvironment.getModelControllerClient(),
                TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
       
        ModelControllerClient client = managementClient.getControllerClient();
        try {
            final String portA = "55667";
           
            ModelNode op = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
            op.get(NAME).set("wsdl-port");
            op.get(VALUE).set(portA);
            applyUpdate(client, op, false); //update successful, no need to reload
           
            //now we deploy an endpoint...
            deployer.deploy(DEP_2);

            //verify the updated wsdl port is used...
            URL wsdlURL = new URL(managementClient.getWebUri().toURL(), '/' + DEP_2 + "/POJOService?wsdl");
            checkWsdl(wsdlURL, portA);
           
            if (checkUpdateWithDeployedEndpoint) {
                final String portB = "55668";
               
                ModelNode opB = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
                opB.get(NAME).set("wsdl-port");
                opB.get(VALUE).set(portB);
                applyUpdate(client, opB, true); //update again, but we'll need to reload, as there's an active deployment
               
                //check the wsdl port is still the one we updated to before
                checkWsdl(wsdlURL, portA);
               
                //and check that still applies even if we undeploy and redeploy the endpoint
                deployer.undeploy(DEP_2);
                deployer.deploy(DEP_2);
                checkWsdl(wsdlURL, portA);
            }
        } finally {
            try {
                deployer.undeploy(DEP_2);
            } catch (Throwable t) {
                //ignore
            }
            try {
                ModelNode op = createOpNode("subsystem=webservices/", UNDEFINE_ATTRIBUTE_OPERATION);
                op.get(NAME).set("wsdl-port");
                applyUpdate(client, op, checkUpdateWithDeployedEndpoint);
            } finally {
                managementClient.close();
            }
        }
    }
View Full Code Here

        performWsdlUriSchemeAttributeTest(true);
    }

    private void performWsdlUriSchemeAttributeTest(boolean checkUpdateWithDeployedEndpoint) throws Exception {
        Assert.assertTrue(containerController.isStarted(DEFAULT_JBOSSAS));
        ManagementClient managementClient = new ManagementClient(TestSuiteEnvironment.getModelControllerClient(),
                TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
       
        ModelControllerClient client = managementClient.getControllerClient();
        String initialWsdlUriScheme = null;
        try {
            //save initial wsdl-uri-schema value to restore later
            initialWsdlUriScheme = getAttribute("wsdl-uri-scheme", client, false);
            //set wsdl-uri-scheme value to https
            ModelNode op = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
            op.get(NAME).set("wsdl-uri-scheme");
            op.get(VALUE).set("https");
            applyUpdate(client, op, false);
            deployer.deploy(DEP_1);
            //check if it works for the deployed endpoint url
            checkWSDLUriScheme(client, DEP_1 + ".war", "https");
            deployer.undeploy(DEP_1);
           
            //set wsdl-uri-scheme value to http
            ModelNode op2 = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
            op2.get(NAME).set("wsdl-uri-scheme");
            op2.get(VALUE).set("http");
            applyUpdate(client, op2, false);
            deployer.deploy(DEP_1);
            //check if the uri scheme of soap address is modified to http
            checkWSDLUriScheme(client, DEP_1 + ".war", "http");
            if (checkUpdateWithDeployedEndpoint) {
                //set wsdl-uri-schema value to http
                ModelNode opB = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
                opB.get(NAME).set("wsdl-uri-scheme");
                opB.get(VALUE).set("https");
                applyUpdate(client, opB, true);
                //check this doesn't apply to endpointed which are deployed before this change
                checkWSDLUriScheme(client, DEP_1 + ".war", "http");
                deployer.undeploy(DEP_1);
                deployer.deploy(DEP_1);
                //check this will take effect to redeployed endpoint
                checkWSDLUriScheme(client, DEP_1 + ".war", "http");
            }
        } finally {
            try {
                deployer.undeploy(DEP_1);
            } catch (Throwable t) {
                //ignore
            }
            try {
                //restore the value of wsdl-uri-scheme attribute
                ModelNode op = null;
                if ("undefined".equals(initialWsdlUriScheme)) {
                    op = createOpNode("subsystem=webservices/", UNDEFINE_ATTRIBUTE_OPERATION);
                    op.get(NAME).set("wsdl-uri-scheme");
                } else {
                    op = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
                    op.get(NAME).set("wsdl-uri-scheme");
                    op.get(VALUE).set(initialWsdlUriScheme);
                }
                applyUpdate(client, op, checkUpdateWithDeployedEndpoint);
            } finally {
                managementClient.close();
            }
        }
    }
View Full Code Here

    }


    private void performWsdlPathRewriteRuleAttributeTest(boolean checkUpdateWithDeployedEndpoint) throws Exception {
        Assert.assertTrue(containerController.isStarted(DEFAULT_JBOSSAS));
        ManagementClient managementClient = new ManagementClient(TestSuiteEnvironment.getModelControllerClient(),
            TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");

        ModelControllerClient client = managementClient.getControllerClient();

        try {

            final String expectedContext = "xx/jaxws-manual-pojo-1";
            final String sedCmdA = "s/jaxws-manual-pojo-1/xx\\/jaxws-manual-pojo-1/g";

            ModelNode op = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
            op.get(NAME).set("wsdl-path-rewrite-rule");
            op.get(VALUE).set(sedCmdA);
            applyUpdate(client, op, false); //update successful, no need to reload

            //now we deploy an endpoint...
            deployer.deploy(DEP_1);

            //verify the updated wsdl host is used...
            URL wsdlURL = new URL(managementClient.getWebUri().toURL(), '/' + DEP_1 + "/POJOService?wsdl");
            checkWsdl(wsdlURL, expectedContext);

            if (checkUpdateWithDeployedEndpoint) {
                //final String hostnameB = "foo-host-b";
                final String sedCmdB = "s/jaxws-manual-pojo-1/FOO\\/jaxws-manual-pojo-1/g";

                ModelNode opB = createOpNode("subsystem=webservices/", WRITE_ATTRIBUTE_OPERATION);
                opB.get(NAME).set("wsdl-path-rewrite-rule");
                opB.get(VALUE).set(sedCmdB);
                applyUpdate(client, opB, true); //update again, but we'll need to reload, as there's an active deployment

                //check the wsdl host is still the one we updated to before
                checkWsdl(wsdlURL, expectedContext);

                //and check that still applies even if we undeploy and redeploy the endpoint
                deployer.undeploy(DEP_1);
                deployer.deploy(DEP_1);
                checkWsdl(wsdlURL, expectedContext);
            }
        } finally {
            try {
                deployer.undeploy(DEP_1);
            } catch (Throwable t) {
                //ignore
            }
            try {
                ModelNode op = createOpNode("subsystem=webservices/", UNDEFINE_ATTRIBUTE_OPERATION);
                op.get(NAME).set("wsdl-path-rewrite-rule");
                applyUpdate(client, op, checkUpdateWithDeployedEndpoint);
            } finally {
                managementClient.close();
            }
        }
    }
View Full Code Here

    @Before
    public void prepareServerOnce() throws Exception {
        if(!serverConfigDone) {
            // prepare server config and then restart
            log.info("*** preparing server configuration");
            ManagementClient managementClient;
            log.info("*** starting server");
            container.start(DEFAULT_JBOSSAS);
            final ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient();
            managementClient = new ManagementClient(client, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
            log.info("*** will configure server now");
            SSLRealmSetupTool.setup(managementClient);
            log.info("*** restarting server");
            container.stop(DEFAULT_JBOSSAS);
            container.start(DEFAULT_JBOSSAS);
            managementClient = new ManagementClient(client, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
            // write SSL realm config to output - debugging purposes
            SSLRealmSetupTool.readSSLRealmConfig(managementClient);
            previousClientContextSelector = setupEJBClientContextSelector();
            serverConfigDone = true;
        } else {
View Full Code Here

    public static void tearDown() throws Exception {
        if (previousClientContextSelector != null) {
            EJBClientContext.setSelector(previousClientContextSelector);
        }
        final ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient();
        final ManagementClient mClient = new ManagementClient(client, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
        SSLRealmSetupTool.tearDown(mClient, container);
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.arquillian.container.ManagementClient

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.