Search in sources :

Example 6 with ModelControllerClient

use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.

the class HTTPSWebConnectorTestCase method startAndSetupContainer.

@Test
@InSequence(-1)
public void startAndSetupContainer() throws Exception {
    LOGGER.trace("*** starting server");
    containerController.start(CONTAINER);
    ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient();
    ManagementClient managementClient = new ManagementClient(client, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
    LOGGER.trace("*** will configure server now");
    serverSetup(managementClient);
    deployer.deploy(APP_CONTEXT);
}
Also used : ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) ManagementClient(org.jboss.as.arquillian.container.ManagementClient) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Example 7 with ModelControllerClient

use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.

the class HTTPSWebConnectorTestCase method serverTearDown.

private void serverTearDown(ManagementClient managementClient) throws Exception {
    // delete test security domains
    SecurityDomainsSetup.INSTANCE.tearDown(managementClient, null);
    final ModelControllerClient client = managementClient.getControllerClient();
    // delete https web connectors
    ModelNode operation = createOpNode("subsystem=undertow/server=default-server/https-listener=" + HTTPS, ModelDescriptionConstants.REMOVE);
    Utils.applyUpdate(operation, client);
    rmHttpsConnector(HTTPS_NAME_VERIFY_NOT_REQUESTED, client);
    rmHttpsConnector(HTTPS_NAME_VERIFY_REQUESTED, client);
    rmHttpsConnector(HTTPS_NAME_VERIFY_REQUIRED, client);
    operation = createOpNode("core-service=management/security-realm=" + HTTPS_REALM, ModelDescriptionConstants.REMOVE);
    Utils.applyUpdate(operation, client);
    FileUtils.deleteDirectory(WORK_DIR);
    TRACE_SECURITY.tearDown(managementClient, null);
}
Also used : ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) ModelNode(org.jboss.dmr.ModelNode)

Example 8 with ModelControllerClient

use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.

the class ReloadRequiringChangesTestCase method testWSDLHostChangeRequiresReloadAndDoesNotAffectRuntime.

@Test
@OperateOnDeployment(DEPLOYMENT)
public void testWSDLHostChangeRequiresReloadAndDoesNotAffectRuntime() 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 = getWsdlHost(client);
        //change wsdl-host to "foo-host" and reload
        final String hostname = "foo-host";
        setWsdlHost(client, hostname);
        ServerReload.executeReloadAndWaitForCompletion(client);
        //change wsdl-host to "bar-host" and verify deployment still uses "foo-host"
        setWsdlHost(client, "bar-host");
        URL wsdlURL = new URL(managementClient.getWebUri().toURL(), '/' + DEPLOYMENT + "/POJOService?wsdl");
        checkWsdl(wsdlURL, hostname);
    } finally {
        try {
            if (initialWsdlHost != null) {
                setWsdlHost(client, initialWsdlHost);
            }
        } finally {
            managementClient.close();
        }
    }
}
Also used : ManagementClient(org.jboss.as.arquillian.container.ManagementClient) ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) URL(java.net.URL) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 9 with ModelControllerClient

use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.

the class ReloadRequiringChangesTestCase method testWSDLHostUndefineRequiresReloadAndDoesNotAffectRuntime.

@Test
@OperateOnDeployment(DEPLOYMENT)
public void testWSDLHostUndefineRequiresReloadAndDoesNotAffectRuntime() 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 = getWsdlHost(client);
        //change wsdl-host to "my-host" and reload
        final String hostname = "my-host";
        setWsdlHost(client, hostname);
        ServerReload.executeReloadAndWaitForCompletion(client);
        //undefine wsdl-host and verify deployment still uses "foo-host"
        setWsdlHost(client, null);
        URL wsdlURL = new URL(managementClient.getWebUri().toURL(), '/' + DEPLOYMENT + "/POJOService?wsdl");
        checkWsdl(wsdlURL, hostname);
    } finally {
        try {
            if (initialWsdlHost != null) {
                setWsdlHost(client, initialWsdlHost);
            }
        } finally {
            managementClient.close();
        }
    }
}
Also used : ManagementClient(org.jboss.as.arquillian.container.ManagementClient) ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) URL(java.net.URL) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 10 with ModelControllerClient

use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.

the class WSAttributesChangesTestCase method performWsdlPathRewriteRuleAttributeTest.

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);
        //update successful, no need to reload
        applyUpdate(client, op, false);
        //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);
            //update again, but we'll need to reload, as there's an active deployment
            applyUpdate(client, opB, true);
            //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();
        }
    }
}
Also used : ManagementClient(org.jboss.as.arquillian.container.ManagementClient) ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) ModelNode(org.jboss.dmr.ModelNode) URL(java.net.URL)

Aggregations

ModelControllerClient (org.jboss.as.controller.client.ModelControllerClient)58 ModelNode (org.jboss.dmr.ModelNode)27 Test (org.junit.Test)21 ManagementClient (org.jboss.as.arquillian.container.ManagementClient)17 IOException (java.io.IOException)11 InSequence (org.jboss.arquillian.junit.InSequence)8 URL (java.net.URL)5 PathAddress (org.jboss.as.controller.PathAddress)5 Before (org.junit.Before)5 JMSOperations (org.jboss.as.test.integration.common.jms.JMSOperations)4 UnknownHostException (java.net.UnknownHostException)3 InitialContext (javax.naming.InitialContext)2 NamingException (javax.naming.NamingException)2 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)2 CommandContext (org.jboss.as.cli.CommandContext)2 CommandFormatException (org.jboss.as.cli.CommandFormatException)2 OperationFormatException (org.jboss.as.cli.operation.OperationFormatException)2 DefaultOperationRequestBuilder (org.jboss.as.cli.operation.impl.DefaultOperationRequestBuilder)2 After (org.junit.After)2 BeforeClass (org.junit.BeforeClass)2