Search in sources :

Example 16 with ManagementClient

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

the class WSAttributesChangesTestCase method performWsdlPortAttributeTest.

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);
        //update successful, no need to reload
        applyUpdate(client, op, false);
        //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);
            //update again, but we'll need to reload, as there's an active deployment
            applyUpdate(client, opB, true);
            //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();
        }
    }
}
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 17 with ManagementClient

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

the class ReloadWSDLPublisherTestCase method testHelloStringAfterReload.

@Test
@OperateOnDeployment(DEPLOYMENT)
public void testHelloStringAfterReload() throws Exception {
    Assert.assertTrue(containerController.isStarted(DEFAULT_JBOSSAS));
    ManagementClient managementClient = new ManagementClient(TestSuiteEnvironment.getModelControllerClient(), TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
    QName serviceName = new QName("http://jbossws.org/basic", "POJOService");
    URL wsdlURL = new URL(managementClient.getWebUri().toURL(), '/' + DEPLOYMENT + "/POJOService?wsdl");
    checkWsdl(wsdlURL);
    Service service = Service.create(wsdlURL, serviceName);
    EndpointIface proxy = service.getPort(EndpointIface.class);
    Assert.assertEquals("Hello World!", proxy.helloString("World"));
    executeReloadAndWaitForCompletion(managementClient.getControllerClient(), 100000);
    checkWsdl(wsdlURL);
    serviceName = new QName("http://jbossws.org/basic", "POJOService");
    service = Service.create(wsdlURL, serviceName);
    proxy = service.getPort(EndpointIface.class);
    Assert.assertEquals("Hello World!", proxy.helloString("World"));
    Assert.assertTrue(containerController.isStarted(DEFAULT_JBOSSAS));
}
Also used : ManagementClient(org.jboss.as.arquillian.container.ManagementClient) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 18 with ManagementClient

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

the class OutboundLdapConnectionTestCase method restoreRoleConfiguration.

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

Example 19 with ManagementClient

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

the class SSLEJBRemoteClientTestCase method tearDown.

@AfterClass
public static void tearDown() throws Exception {
    final ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient();
    final ManagementClient mClient = new ManagementClient(client, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
    SSLRealmSetupTool.tearDown(mClient, container);
}
Also used : ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) ManagementClient(org.jboss.as.arquillian.container.ManagementClient) AfterClass(org.junit.AfterClass)

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