Search in sources :

Example 6 with ManagementClient

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

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

Example 8 with ManagementClient

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

the class CertificateRolesLoginModuleTestCase method stopContainer.

@Test
@InSequence(3)
public void stopContainer() throws Exception {
    deployer.undeploy(APP_NAME);
    final ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient();
    final ManagementClient managementClient = new ManagementClient(client, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
    LOGGER.trace("*** reseting test configuration");
    AbstractCertificateLoginModuleTestCase.HTTPSConnectorSetup.INSTANCE.tearDown(managementClient, CONTAINER);
    SecurityDomainsSetup.INSTANCE.tearDown(managementClient, CONTAINER);
    LOGGER.trace("*** stopping container");
    containerController.stop(CONTAINER);
}
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 9 with ManagementClient

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

the class CertificateRolesLoginModuleTestCase 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");
    AbstractCertificateLoginModuleTestCase.HTTPSConnectorSetup.INSTANCE.setup(managementClient, CONTAINER);
    SecurityDomainsSetup.INSTANCE.setup(managementClient, CONTAINER);
    LOGGER.trace("*** reloading server");
    executeReloadAndWaitForCompletion(client, 100000);
    deployer.deploy(APP_NAME);
}
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 10 with ManagementClient

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

the class DatabaseCertLoginModuleTestCase method stopContainer.

@Test
@InSequence(3)
public void stopContainer() throws Exception {
    deployer.undeploy(APP_NAME);
    final ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient();
    final ManagementClient managementClient = new ManagementClient(client, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
    LOGGER.trace("*** reseting test configuration");
    AbstractCertificateLoginModuleTestCase.HTTPSConnectorSetup.INSTANCE.tearDown(managementClient, CONTAINER);
    SecurityDomainsSetup.INSTANCE.tearDown(managementClient, CONTAINER);
    DBSetup.INSTANCE.tearDown(managementClient, CONTAINER);
    DataSourcesSetup.INSTANCE.tearDown(managementClient, CONTAINER);
    LOGGER.trace("*** stopping container");
    containerController.stop(CONTAINER);
}
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)

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