Search in sources :

Example 71 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 72 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(), "remote+http");
    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 73 with ModelControllerClient

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

the class AbstractDwmTestCase method setUpServer.

@SuppressWarnings("unused")
private void setUpServer(ModelControllerClient client, String containerId) throws IOException {
    ModelControllerClient mcc = CONTAINER_0.equals(containerId) ? createClient1() : createClient2();
    log.debugf("Setting up Policy/Selector: %s/%s on server %s", getPolicy(), getSelector(), containerId);
    ModelNode addBasicDwm = addBasicDwm();
    ModelNode setUpPolicy = setUpPolicy(getPolicy());
    ModelNode setUpPolicyOptions = setUpWatermarkPolicyOption(getWatermarkPolicyOption());
    ModelNode setUpSelector = setUpSelector(getSelector());
    ModelNode setUpShortRunningThreads = setUpShortRunningThreads(getSrtMaxThreads(), getSrtQueueLength());
    List<ModelNode> operationList = new ArrayList<>(Arrays.asList(addBasicDwm, setUpPolicy, setUpSelector, setUpShortRunningThreads));
    if (getPolicy().equals(Policy.WATERMARK)) {
        operationList.add(setUpPolicyOptions);
    }
    ModelNode compositeOp = ModelUtil.createCompositeNode(operationList.toArray(new ModelNode[1]));
    ModelNode result = mcc.execute(compositeOp);
    log.debugf("Setting up DWM on server %s: %s", containerId, result);
    result = mcc.execute(setUpCustomContext());
    log.debugf("Setting up CustomContext on server %s: %s", containerId, result);
    mcc.close();
}
Also used : ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) ArrayList(java.util.ArrayList) ModelNode(org.jboss.dmr.ModelNode)

Example 74 with ModelControllerClient

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

the class AbstractJcaSetup method doSetup.

@Override
public void doSetup(ManagementClient managementClient, String containerId) throws Exception {
    ModelControllerClient mcc = managementClient.getControllerClient();
    addWM(mcc);
    addThreadPool(mcc);
    addBootstrapContext(mcc);
}
Also used : ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient)

Example 75 with ModelControllerClient

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

the class StartWorkersInSuspendedModeTestCase method assertWorkerNodeContextIsStopped.

private void assertWorkerNodeContextIsStopped() throws Exception {
    ModelNode op = createOpNode("subsystem=undertow/configuration=filter/mod-cluster=load-balancer/balancer=mycluster/node=" + NODE_1, READ_RESOURCE_OPERATION);
    op.get(ADDRESS).add("context", "/" + MODULE_NAME);
    op.get(RECURSIVE).set(true);
    op.get(INCLUDE_RUNTIME).set(true);
    final ModelControllerClient client = TestSuiteEnvironment.getModelControllerClient(null, TestSuiteEnvironment.getServerAddress(), TestSuiteEnvironment.getServerPort() + LB_OFFSET);
    // might need to wait for mod_cluster nodes to be registered
    long start = System.currentTimeMillis();
    ModelNode modelNode = null;
    while (System.currentTimeMillis() - start < STATUS_REFRESH_TIMEOUT) {
        modelNode = client.execute(op);
        if (modelNode.has(RESULT) && modelNode.get(RESULT).has(STATUS)) {
            break;
        }
        Thread.sleep(100);
    }
    Assert.assertEquals(SUCCESS, modelNode.get(OUTCOME).asString());
    Assert.assertEquals("stopped", modelNode.get(RESULT).get(STATUS).asString());
}
Also used : ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) ModelNode(org.jboss.dmr.ModelNode)

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