Search in sources :

Example 11 with ManagementClient

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

the class DatabaseCertLoginModuleTestCase 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);
    DataSourcesSetup.INSTANCE.setup(managementClient, CONTAINER);
    DBSetup.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 12 with ManagementClient

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

the class SSLEJBRemoteClientTestCase method prepareServerOnce.

@Before
public void prepareServerOnce() throws Exception {
    if (!serverConfigDone) {
        // prepare server config and then restart
        log.trace("*** preparing server configuration");
        ManagementClient managementClient;
        log.trace("*** starting server");
        container.start(DEFAULT_JBOSSAS);
        final ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient();
        managementClient = new ManagementClient(client, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
        log.trace("*** will configure server now");
        SSLRealmSetupTool.setup(managementClient);
        log.trace("*** 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);
        serverConfigDone = true;
    } else {
        log.trace("*** Server already prepared, skipping config procedure");
    }
}
Also used : ManagementClient(org.jboss.as.arquillian.container.ManagementClient) ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) Before(org.junit.Before)

Example 13 with ManagementClient

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

the class ClusterTestUtil method executeOnNodesAndReload.

// Model management convenience methods
public static void executeOnNodesAndReload(String cli, ManagementClient... clients) throws Exception {
    ModelNode request = CLITestUtil.getCommandContext().buildRequest(cli);
    for (ManagementClient client : clients) {
        client.getControllerClient().execute(request);
        ServerReload.executeReloadAndWaitForCompletion(client.getControllerClient(), ServerReload.TIMEOUT, false, client.getMgmtAddress(), client.getMgmtPort());
    }
}
Also used : ManagementClient(org.jboss.as.arquillian.container.ManagementClient) ModelNode(org.jboss.dmr.ModelNode)

Example 14 with ManagementClient

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

the class HTTPSWebConnectorTestCase method stopContainer.

@Test
@InSequence(3)
public void stopContainer() throws Exception {
    deployer.undeploy(APP_CONTEXT);
    final ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient();
    final ManagementClient managementClient = new ManagementClient(client, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort(), "http-remoting");
    LOGGER.trace("*** reseting test configuration");
    serverTearDown(managementClient);
    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 15 with ManagementClient

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

the class WSAttributesChangesTestCase method performWsdlHostAttributeTest.

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);
        //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, 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);
            //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, 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();
        }
    }
}
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

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