Search in sources :

Example 51 with ModelControllerClient

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

the class PermissionsCoverageTestCase method testTheEntireDomainTreeHasPermissionsDefined.

@Test
public void testTheEntireDomainTreeHasPermissionsDefined() throws Exception {
    ModelControllerClient client = managementClient.getControllerClient();
    assertTheEntireDomainTreeHasPermissionsDefined(client);
}
Also used : ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) Test(org.junit.Test)

Example 52 with ModelControllerClient

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

the class LayeredDistributionTestCase method testLayeredProductVersion.

@Test
public void testLayeredProductVersion() throws Throwable {
    final ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient();
    ModelNode readAttrOp = new ModelNode();
    readAttrOp.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION);
    readAttrOp.get(ModelDescriptionConstants.NAME).set("product-name");
    ModelNode result = ManagementOperations.executeOperation(client, readAttrOp);
    Assert.assertEquals(result.asString(), PRODUCT_NAME);
    readAttrOp.get(ModelDescriptionConstants.NAME).set("product-version");
    result = ManagementOperations.executeOperation(client, readAttrOp);
    Assert.assertEquals(result.asString(), PRODUCT_VERSION);
}
Also used : ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) ModelNode(org.jboss.dmr.ModelNode) Test(org.junit.Test)

Example 53 with ModelControllerClient

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

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

Example 55 with ModelControllerClient

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

the class FailoverTestCase method testBackupFailoverAfterFailback.

@Test
public void testBackupFailoverAfterFailback() throws Exception {
    ModelControllerClient client2 = createClient2();
    JMSOperations backupJMSOperations = JMSOperationsProvider.getInstance(client2);
    checkJMSQueue(backupJMSOperations, jmsQueueName, false);
    InitialContext context1 = createJNDIContextFromServer1();
    String text = "sent to server1, received from server2 (after failover)";
    sendMessage(context1, jmsQueueLookup, text);
    context1.close();
    log.trace("############## 1 #############");
    //listSharedStoreDir();
    log.trace("===================");
    log.trace("STOP SERVER1...");
    log.trace("===================");
    container.stop(SERVER1);
    log.trace("############## 2 #############");
    //listSharedStoreDir();
    // let some time for the backup to detect the failure
    waitForHornetQServerActivation(backupJMSOperations, true);
    checkJMSQueue(backupJMSOperations, jmsQueueName, true);
    InitialContext context2 = createJNDIContextFromServer2();
    // receive the message that was sent to server1 before failover occurs
    receiveMessage(context2, jmsQueueLookup, text);
    // send a message to server2 before server1 fails back
    String text2 = "sent to server2, received from server 1 (after failback)";
    sendMessage(context2, jmsQueueLookup, text2);
    context2.close();
    log.trace("====================");
    log.trace("START SERVER1...");
    log.trace("====================");
    // restart the live server
    container.start(SERVER1);
    // let some time for the backup to detect the live node and failback
    ModelControllerClient client1 = createClient1();
    JMSOperations liveJMSOperations = JMSOperationsProvider.getInstance(client1);
    waitForHornetQServerActivation(liveJMSOperations, true);
    checkHornetQServerStartedAndActiveAttributes(liveJMSOperations, true, true);
    // let some time for the backup to detect the failure
    waitForHornetQServerActivation(backupJMSOperations, false);
    // backup server has been restarted in passive mode
    checkHornetQServerStartedAndActiveAttributes(backupJMSOperations, true, false);
    checkJMSQueue(backupJMSOperations, jmsQueueName, false);
    context1 = createJNDIContextFromServer1();
    // receive the message that was sent to server2 before failback
    receiveMessage(context1, jmsQueueLookup, text2);
    String text3 = "sent to server1, received from server2 (after 2nd failover)";
    // send a message to server1 before it is stopped a 2nd time
    sendMessage(context1, jmsQueueLookup, text3);
    context1.close();
    log.trace("==============================");
    log.trace("STOP SERVER1 A 2ND TIME...");
    log.trace("==============================");
    // shutdown server1 a 2nd time
    container.stop(SERVER1);
    // let some time for the backup to detect the failure
    waitForHornetQServerActivation(backupJMSOperations, true);
    checkHornetQServerStartedAndActiveAttributes(backupJMSOperations, true, true);
    checkJMSQueue(backupJMSOperations, jmsQueueName, true);
    context2 = createJNDIContextFromServer2();
    // receive the message that was sent to server1 before failover occurs a 2nd time
    receiveMessage(context2, jmsQueueLookup, text3);
    context2.close();
//Assert.fail("wth");
}
Also used : ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) JMSOperations(org.jboss.as.test.integration.common.jms.JMSOperations) InitialContext(javax.naming.InitialContext) Test(org.junit.Test)

Aggregations

ModelControllerClient (org.jboss.as.controller.client.ModelControllerClient)58 ModelNode (org.jboss.dmr.ModelNode)27 Test (org.junit.Test)21 ManagementClient (org.jboss.as.arquillian.container.ManagementClient)17 IOException (java.io.IOException)11 InSequence (org.jboss.arquillian.junit.InSequence)8 URL (java.net.URL)5 PathAddress (org.jboss.as.controller.PathAddress)5 Before (org.junit.Before)5 JMSOperations (org.jboss.as.test.integration.common.jms.JMSOperations)4 UnknownHostException (java.net.UnknownHostException)3 InitialContext (javax.naming.InitialContext)2 NamingException (javax.naming.NamingException)2 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)2 CommandContext (org.jboss.as.cli.CommandContext)2 CommandFormatException (org.jboss.as.cli.CommandFormatException)2 OperationFormatException (org.jboss.as.cli.operation.OperationFormatException)2 DefaultOperationRequestBuilder (org.jboss.as.cli.operation.impl.DefaultOperationRequestBuilder)2 After (org.junit.After)2 BeforeClass (org.junit.BeforeClass)2