use of org.jboss.as.test.integration.domain.management.util.WildFlyManagedConfiguration in project wildfly by wildfly.
the class OrderedChildResourcesTestCase method testOrderedChildResources.
@Test
public void testOrderedChildResources() throws Exception {
final WildFlyManagedConfiguration masterConfig = createConfiguration("domain.xml", "host-master.xml", getClass().getSimpleName());
final DomainLifecycleUtil masterUtils = new DomainLifecycleUtil(masterConfig);
final WildFlyManagedConfiguration slaveConfig = createConfiguration("domain.xml", "host-slave.xml", getClass().getSimpleName(), "slave", slaveAddress, 19999);
final DomainLifecycleUtil slaveUtils = new DomainLifecycleUtil(slaveConfig);
try {
masterUtils.start();
slaveUtils.start();
PathAddress jgroupsTcpAddr = PathAddress.pathAddress(PROFILE, "full-ha").append(SUBSYSTEM, "jgroups").append("stack", "tcp");
final ModelNode originalMasterStack = readResource(masterUtils.getDomainClient(), jgroupsTcpAddr);
originalMasterStack.protect();
final ModelNode originalSlaveStack = readResource(slaveUtils.getDomainClient(), jgroupsTcpAddr);
originalSlaveStack.protect();
Assert.assertEquals(originalMasterStack, originalSlaveStack);
//FD is normally in the middle somewhere
final String protocolName = "FD";
int index = -1;
ModelNode value = null;
Iterator<Property> it = originalMasterStack.get(PROTOCOL).asPropertyList().iterator();
for (int i = 0; it.hasNext(); i++) {
Property property = it.next();
if (property.getName().equals(protocolName)) {
value = property.getValue();
index = i;
break;
}
}
//Make sure that we found the protocol and that it is not at the end
Assert.assertTrue(0 <= index);
Assert.assertTrue(index < originalMasterStack.get(PROTOCOL).keys().size() - 2);
//Remove the protocol
DomainTestUtils.executeForResult(Util.createRemoveOperation(jgroupsTcpAddr.append(PROTOCOL, protocolName)), masterUtils.getDomainClient());
//Reload the master into admin-only and re-add the protocol
reloadMaster(masterUtils, true);
ModelNode add = value.clone();
add.get(OP).set(ADD);
add.get(OP_ADDR).set(jgroupsTcpAddr.append(PROTOCOL, protocolName).toModelNode());
add.get(ADD_INDEX).set(index);
DomainTestUtils.executeForResult(add, masterUtils.getDomainClient());
//Reload the master into normal mode and check the protocol is in the right place on the slave
reloadMaster(masterUtils, false);
ModelNode slaveStack = readResource(slaveUtils.getDomainClient(), jgroupsTcpAddr);
Assert.assertEquals(originalMasterStack, slaveStack);
//Check that :read-operation-description has add-index defined; WFLY-6782
ModelNode rodOp = Util.createOperation(READ_OPERATION_DESCRIPTION_OPERATION, jgroupsTcpAddr.append(PROTOCOL, protocolName));
rodOp.get(NAME).set(ADD);
ModelNode result = DomainTestUtils.executeForResult(rodOp, masterUtils.getDomainClient());
Assert.assertTrue(result.get(REQUEST_PROPERTIES).hasDefined(ADD_INDEX));
} finally {
try {
slaveUtils.stop();
} finally {
masterUtils.stop();
}
}
}
use of org.jboss.as.test.integration.domain.management.util.WildFlyManagedConfiguration in project wildfly by wildfly.
the class DefaultConfigSmokeTestCase method testMasterAndSlave.
@Test
public void testMasterAndSlave() throws Exception {
final WildFlyManagedConfiguration masterConfig = createConfiguration("domain.xml", "host-master.xml", getClass().getSimpleName());
final DomainLifecycleUtil masterUtils = new DomainLifecycleUtil(masterConfig);
final WildFlyManagedConfiguration slaveConfig = createConfiguration("domain.xml", "host-slave.xml", getClass().getSimpleName(), "slave", slaveAddress, 19999);
final DomainLifecycleUtil slaveUtils = new DomainLifecycleUtil(slaveConfig);
try {
masterUtils.start();
slaveUtils.start();
// Double-check server status by confirming server-one can accept a web request to the root
URLConnection connection = new URL("http://" + TestSuiteEnvironment.formatPossibleIpv6Address(slaveAddress) + ":8080").openConnection();
connection.connect();
} finally {
try {
slaveUtils.stop();
} finally {
masterUtils.stop();
}
}
}
Aggregations