Search in sources :

Example 1 with ManagementClient

use of org.jboss.as.arquillian.container.ManagementClient in project wildfly by wildfly.

the class WSAttributesChangesTestCase method performWsdlUriSchemeAttributeTest.

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();
        }
    }
}
Also used : ManagementClient(org.jboss.as.arquillian.container.ManagementClient) ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) ModelNode(org.jboss.dmr.ModelNode)

Example 2 with ManagementClient

use of org.jboss.as.arquillian.container.ManagementClient in project wildfly by wildfly.

the class OutboundLdapConnectionTestCase method initializeRoleConfiguration.

@Before
public void initializeRoleConfiguration() throws Exception {
    if (containerController.isStarted(CONTAINER) && !serverConfigured) {
        final ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient();
        ManagementClient mgmtClient = new ManagementClient(client, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
        prepareServer(mgmtClient);
    }
}
Also used : ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) ManagementClient(org.jboss.as.arquillian.container.ManagementClient) Before(org.junit.Before)

Example 3 with ManagementClient

use of org.jboss.as.arquillian.container.ManagementClient in project wildfly by wildfly.

the class VaultSystemPropertyOnServerStartTestCase method beforeTest.

@Before
public void beforeTest() throws Exception {
    LOGGER.trace("*** starting server");
    container.start(CONTAINER);
    final ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient();
    managementClient = new ManagementClient(client, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
    serverSetup.setup(managementClient, CONTAINER);
    LOGGER.trace("Add system property: " + TESTING_SYSTEM_PROPERTY);
    ModelNode op = Util.createAddOperation(SYSTEM_PROPERTIES_PATH);
    op.get(VALUE).set(BasicVaultServerSetupTask.VAULTED_PROPERTY);
    Utils.applyUpdate(op, managementClient.getControllerClient());
    LOGGER.trace("*** stoping server");
    container.stop(CONTAINER);
    Thread.sleep(1000);
    int i = 0;
    while (managementClient.isServerInRunningState() && ++i < 200) {
        Thread.sleep(50);
    }
}
Also used : ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) ManagementClient(org.jboss.as.arquillian.container.ManagementClient) ModelNode(org.jboss.dmr.ModelNode) Before(org.junit.Before)

Example 4 with ManagementClient

use of org.jboss.as.arquillian.container.ManagementClient 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 5 with ManagementClient

use of org.jboss.as.arquillian.container.ManagementClient 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)

Aggregations

ManagementClient (org.jboss.as.arquillian.container.ManagementClient)19 ModelControllerClient (org.jboss.as.controller.client.ModelControllerClient)17 Test (org.junit.Test)9 URL (java.net.URL)6 InSequence (org.jboss.arquillian.junit.InSequence)6 ModelNode (org.jboss.dmr.ModelNode)6 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)3 Before (org.junit.Before)3 QName (javax.xml.namespace.QName)1 Service (javax.xml.ws.Service)1 After (org.junit.After)1 AfterClass (org.junit.AfterClass)1