use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class AbstractMessagingHATestCase method setUp.
@Before
public void setUp() throws Exception {
// start server1 and reload it in admin-only
container.start(SERVER1);
ModelControllerClient client1 = createClient1();
snapshotForServer1 = takeSnapshot(client1);
executeReloadAndWaitForCompletionOfServer1(client1, true);
client1 = createClient1();
// start server2 and reload it in admin-only
container.start(SERVER2);
ModelControllerClient client2 = createClient2();
snapshotForServer2 = takeSnapshot(client2);
executeReloadAndWaitForCompletionOfServer2(client2, true);
client2 = createClient2();
// setup both servers
try {
setUpServer1(client1);
setUpServer2(client2);
} catch (Exception e) {
tearDown();
throw e;
}
// reload server1 in normal mode
executeReloadAndWaitForCompletionOfServer1(client1, false);
client1 = createClient1();
// reload server2 in normal mode
executeReloadAndWaitForCompletionOfServer2(client2, false);
client2 = createClient2();
// both servers are started and configured
assertTrue(container.isStarted(SERVER1));
client1.close();
assertTrue(container.isStarted(SERVER2));
client2.close();
}
use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class AbstractIdentityManagementServerSetupTask method tearDown.
@Override
public void tearDown(ManagementClient managementClient, String containerId) throws Exception {
ModelControllerClient controllerClient = managementClient.getControllerClient();
removeIdentityManagementConfiguration(controllerClient);
applyUpdate(Util.createRemoveOperation(PathAddress.pathAddress().append(SUBSYSTEM, SUBSYSTEM_NAME)), controllerClient);
applyUpdate(Util.createRemoveOperation(PathAddress.pathAddress().append(EXTENSION, EXTENSION_MODULE_NAME)), controllerClient);
}
use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class AccessConstraintUtilizationTestCase method testConstraintUtilization.
@Test
public void testConstraintUtilization() throws Exception {
ModelControllerClient client = managementClient.getControllerClient();
for (ExpectedDef expectedDef : EXPECTED_DEFS) {
AccessConstraintKey acdKey = expectedDef.key;
String constraint = ModelDescriptionConstants.SENSITIVE.equals(acdKey.getType()) ? ModelDescriptionConstants.SENSITIVITY_CLASSIFICATION : ModelDescriptionConstants.APPLICATION_CLASSIFICATION;
String acdType = acdKey.isCore() ? "core" : acdKey.getSubsystemName();
String path = String.format(ADDR_FORMAT, acdKey.getType(), acdType, acdKey.getName());
ModelNode op = createOpNode(path, READ_CHILDREN_RESOURCES_OPERATION);
op.get(ModelDescriptionConstants.CHILD_TYPE).set(ModelDescriptionConstants.APPLIES_TO);
//System.out.println("Testing " + acdKey);
ModelNode result = RbacUtil.executeOperation(client, op, Outcome.SUCCESS).get(ModelDescriptionConstants.RESULT);
Assert.assertTrue(acdKey + "result is defined", result.isDefined());
Assert.assertTrue(acdKey + "result has content", result.asInt() > 0);
boolean foundResource = false;
boolean foundAttr = false;
boolean foundOps = false;
for (Property prop : result.asPropertyList()) {
ModelNode pathResult = prop.getValue();
if (pathResult.get(ModelDescriptionConstants.ENTIRE_RESOURCE).asBoolean()) {
Assert.assertTrue(acdKey + " -- " + prop.getName() + " resource", expectedDef.expectResource);
foundResource = true;
}
ModelNode attrs = pathResult.get(ATTRIBUTES);
if (attrs.isDefined() && attrs.asInt() > 0) {
Assert.assertTrue(acdKey + " -- " + prop.getName() + " attributes = " + attrs.asString(), expectedDef.expectAttributes);
foundAttr = true;
}
ModelNode ops = pathResult.get(OPERATIONS);
if (ops.isDefined() && ops.asInt() > 0) {
Assert.assertTrue(acdKey + " -- " + prop.getName() + " operations = " + ops.asString(), expectedDef.expectOps);
foundOps = true;
}
}
Assert.assertEquals(acdKey + " -- resource", expectedDef.expectResource, foundResource);
Assert.assertEquals(acdKey + " -- attributes", expectedDef.expectAttributes, foundAttr);
Assert.assertEquals(acdKey + " -- operations", expectedDef.expectOps, foundOps);
}
}
use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class DomainHostExcludesTest method test001SlaveBoot.
@Test
public void test001SlaveBoot() throws Exception {
ModelControllerClient slaveClient = testSupport.getDomainSlaveLifecycleUtil().getDomainClient();
checkExtensions(slaveClient);
checkProfiles(slaveClient);
checkSocketBindingGroups(slaveClient);
checkSockets(slaveClient, PathAddress.pathAddress(SOCKET_BINDING_GROUP, "full-sockets"));
checkSockets(slaveClient, PathAddress.pathAddress(SOCKET_BINDING_GROUP, "full-ha-sockets"));
}
use of org.jboss.as.controller.client.ModelControllerClient in project wildfly by wildfly.
the class DomainHostExcludesTest method stopSlave.
private static void stopSlave() throws IOException, MgmtOperationException, InterruptedException {
ModelControllerClient client = testSupport.getDomainMasterLifecycleUtil().getDomainClient();
executeForResult(Util.createEmptyOperation(SHUTDOWN, PathAddress.pathAddress(HOST)), client);
boolean gone = false;
long timeout = TimeoutUtil.adjust(30000);
long deadline = System.currentTimeMillis() + timeout;
do {
ModelNode hosts = readChildrenNames(client, PathAddress.EMPTY_ADDRESS, HOST.getKey());
gone = true;
for (ModelNode host : hosts.asList()) {
if (HOST.getValue().equals(host.asString())) {
gone = false;
Thread.sleep(100);
break;
}
}
} while (!gone && System.currentTimeMillis() < deadline);
Assert.assertTrue("Slave was not removed within " + timeout + " ms", gone);
testSupport.getDomainSlaveLifecycleUtil().stop();
}
Aggregations