Search in sources :

Example 1 with ModelControllerClient

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

the class ClusteredMessagingTestCase method setUp.

@Before
public void setUp() throws Exception {
    container.start(CONTAINER_0);
    container.start(CONTAINER_1);
    // both servers are started and configured
    assertTrue(container.isStarted(CONTAINER_0));
    assertTrue(container.isStarted(CONTAINER_1));
    try (ModelControllerClient client = createClient1()) {
        JMSOperations jmsOperations = JMSOperationsProvider.getInstance(client);
        jmsOperations.createJmsQueue(jmsQueueName, "java:jboss/exported/" + jmsQueueLookup);
        jmsOperations.createJmsTopic(jmsTopicName, "java:jboss/exported/" + jmsTopicLookup);
    }
    try (ModelControllerClient client = createClient2()) {
        JMSOperations jmsOperations = JMSOperationsProvider.getInstance(client);
        jmsOperations.createJmsQueue(jmsQueueName, "java:jboss/exported/" + jmsQueueLookup);
        jmsOperations.createJmsTopic(jmsTopicName, "java:jboss/exported/" + jmsTopicLookup);
    }
}
Also used : ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) JMSOperations(org.jboss.as.test.integration.common.jms.JMSOperations) Before(org.junit.Before)

Example 2 with ModelControllerClient

use of org.jboss.as.controller.client.ModelControllerClient 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 ModelControllerClient

use of org.jboss.as.controller.client.ModelControllerClient 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 ModelControllerClient

use of org.jboss.as.controller.client.ModelControllerClient 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 5 with ModelControllerClient

use of org.jboss.as.controller.client.ModelControllerClient 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)

Aggregations

ModelControllerClient (org.jboss.as.controller.client.ModelControllerClient)106 ModelNode (org.jboss.dmr.ModelNode)61 Test (org.junit.Test)30 IOException (java.io.IOException)20 ManagementClient (org.jboss.as.arquillian.container.ManagementClient)19 PathAddress (org.jboss.as.controller.PathAddress)10 ArrayList (java.util.ArrayList)9 InSequence (org.jboss.arquillian.junit.InSequence)8 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)7 URL (java.net.URL)6 UnknownHostException (java.net.UnknownHostException)6 JMSOperations (org.jboss.as.test.integration.common.jms.JMSOperations)6 Before (org.junit.Before)6 WildFlyElytronProvider (org.wildfly.security.WildFlyElytronProvider)4 NamingException (javax.naming.NamingException)3 CommandContext (org.jboss.as.cli.CommandContext)3 OperationBuilder (org.jboss.as.controller.client.OperationBuilder)3 After (org.junit.After)3 File (java.io.File)2 InitialContext (javax.naming.InitialContext)2