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