Search in sources :

Example 1 with DomainLifecycleUtil

use of org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil in project wildfly by wildfly.

the class DefaultConfigSmokeTestCase method testStandardHost.

@Test
public void testStandardHost() throws Exception {
    final WildFlyManagedConfiguration config = createConfiguration("domain.xml", "host.xml", getClass().getSimpleName());
    final DomainLifecycleUtil utils = new DomainLifecycleUtil(config);
    try {
        utils.start();
        // Double-check server status by confirming server-one can accept a web request to the root
        URLConnection connection = new URL("http://" + TestSuiteEnvironment.formatPossibleIpv6Address(masterAddress) + ":8080").openConnection();
        connection.connect();
        if (Boolean.getBoolean("expression.audit")) {
            writeExpressionAudit(utils);
        }
    } finally {
        // Stop
        utils.stop();
    }
}
Also used : WildFlyManagedConfiguration(org.jboss.as.test.integration.domain.management.util.WildFlyManagedConfiguration) DomainLifecycleUtil(org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil) URLConnection(java.net.URLConnection) URL(java.net.URL) Test(org.junit.Test)

Example 2 with DomainLifecycleUtil

use of org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil in project wildfly by wildfly.

the class ExpressionSupportSmokeTestCase method setUp.

@Before
public void setUp() throws IOException {
    final WildFlyManagedConfiguration config = createConfiguration("domain.xml", "host.xml", getClass().getSimpleName());
    config.setAdminOnly(true);
    // Trigger the servers to fail on boot if there are runtime errors
    String hostProps = config.getHostCommandLineProperties();
    hostProps = hostProps == null ? "" : hostProps;
    config.setHostCommandLineProperties(hostProps + "\n-Djboss.unsupported.fail-boot-on-runtime-failure=true");
    domainMasterLifecycleUtil = new DomainLifecycleUtil(config);
    //        domainMasterLifecycleUtil.getConfiguration().addHostCommandLineProperty("-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=y");
    // Start
    domainMasterLifecycleUtil.start();
    conflicts = noSimple = noSimpleCollection = noComplexList = noComplexProperty = noObject = noComplexProperty = supportedUndefined = simple = simpleCollection = object = complexProperty = complexList = 0;
}
Also used : WildFlyManagedConfiguration(org.jboss.as.test.integration.domain.management.util.WildFlyManagedConfiguration) DomainLifecycleUtil(org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil) Before(org.junit.Before)

Example 3 with DomainLifecycleUtil

use of org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil in project wildfly by wildfly.

the class MixedDomainTestSupport method startAndAdjust.

private void startAndAdjust() {
    String jbossDomainServerArgsValue = null;
    try {
        if (version.isEAP6Version()) {
            jbossDomainServerArgsValue = System.getProperty(JBOSS_DOMAIN_SERVER_ARGS);
            if (jbossDomainServerArgsValue != null) {
                System.setProperty(JBOSS_DOMAIN_SERVER_ARGS, "-DnotUsed");
            }
        }
        //Start the master in admin only  and reconfigure the domain with what
        //we want to test in the mixed domain and have the DomainAdjuster
        //strip down the domain model to something more workable. The domain
        //adjusters will also make adjustments for the legacy version being
        //tested.
        DomainLifecycleUtil masterUtil = getDomainMasterLifecycleUtil();
        masterUtil.getConfiguration().setAdminOnly(true);
        //masterUtil.getConfiguration().addHostCommandLineProperty("-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=y");
        masterUtil.start();
        if (legacyConfig) {
            LegacyConfigAdjuster.adjustForVersion(masterUtil.getDomainClient(), version);
        } else {
            DomainAdjuster.adjustForVersion(masterUtil.getDomainClient(), version);
        }
        //Now reload the master in normal mode
        masterUtil.executeAwaitConnectionClosed(Util.createEmptyOperation("reload", PathAddress.pathAddress(HOST, "master")));
        masterUtil.connect();
        masterUtil.awaitHostController(System.currentTimeMillis());
        //Start the slaves
        DomainLifecycleUtil slaveUtil = getDomainSlaveLifecycleUtil();
        if (slaveUtil != null) {
            //slaveUtil.getConfiguration().addHostCommandLineProperty("-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=y");
            slaveUtil.start();
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    } finally {
        if (version.isEAP6Version() && jbossDomainServerArgsValue != null) {
            System.setProperty(JBOSS_DOMAIN_SERVER_ARGS, jbossDomainServerArgsValue);
        }
    }
}
Also used : DomainLifecycleUtil(org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil) MgmtOperationException(org.jboss.as.test.integration.management.util.MgmtOperationException) IOException(java.io.IOException)

Example 4 with DomainLifecycleUtil

use of org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil in project wildfly by wildfly.

the class DomainHostExcludesTest method startSlave.

private static void startSlave() throws TimeoutException, InterruptedException {
    DomainLifecycleUtil legacyUtil = testSupport.getDomainSlaveLifecycleUtil();
    long start = System.currentTimeMillis();
    legacyUtil.start();
    legacyUtil.awaitServers(start);
}
Also used : DomainLifecycleUtil(org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil)

Example 5 with DomainLifecycleUtil

use of org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil 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();
        }
    }
}
Also used : WildFlyManagedConfiguration(org.jboss.as.test.integration.domain.management.util.WildFlyManagedConfiguration) PathAddress(org.jboss.as.controller.PathAddress) DomainLifecycleUtil(org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil) ModelNode(org.jboss.dmr.ModelNode) Property(org.jboss.dmr.Property) Test(org.junit.Test)

Aggregations

DomainLifecycleUtil (org.jboss.as.test.integration.domain.management.util.DomainLifecycleUtil)6 WildFlyManagedConfiguration (org.jboss.as.test.integration.domain.management.util.WildFlyManagedConfiguration)4 Test (org.junit.Test)3 URL (java.net.URL)2 URLConnection (java.net.URLConnection)2 IOException (java.io.IOException)1 PathAddress (org.jboss.as.controller.PathAddress)1 MgmtOperationException (org.jboss.as.test.integration.management.util.MgmtOperationException)1 ModelNode (org.jboss.dmr.ModelNode)1 Property (org.jboss.dmr.Property)1 Before (org.junit.Before)1