diff --git a/testsuite/shared/src/main/java/org/jboss/as/test/integration/domain/management/util/DomainLifecycleUtil.java b/testsuite/shared/src/main/java/org/jboss/as/test/integration/domain/management/util/DomainLifecycleUtil.java index 9afe880b85f..b2317bbd798 100644 --- a/testsuite/shared/src/main/java/org/jboss/as/test/integration/domain/management/util/DomainLifecycleUtil.java +++ b/testsuite/shared/src/main/java/org/jboss/as/test/integration/domain/management/util/DomainLifecycleUtil.java @@ -4,6 +4,15 @@ */ package org.jboss.as.test.integration.domain.management.util; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADDRESS; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DOMAIN_CONFIG; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST_CONFIG; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RELOAD; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RELOAD_ENHANCED; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RESTART_SERVERS; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.STABILITY; import static org.jboss.as.test.integration.domain.management.util.DomainTestSupport.safeClose; import java.io.File; @@ -104,7 +113,7 @@ private DomainLifecycleUtil(final WildFlyManagedConfiguration configuration, assert clientConfiguration != null : "clientConfiguration is null"; this.configuration = configuration; this.clientConfiguration = clientConfiguration; - this.address = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.HOST, configuration.getHostName())); + this.address = PathAddress.pathAddress(PathElement.pathElement(HOST, configuration.getHostName())); this.closeClientConfig = closeClientConfig; } @@ -444,17 +453,29 @@ public void reloadAdminOnly(String host, Long timeout) throws IOException, Inter */ public void reload(String host, ReloadParameters parameters) throws IOException, InterruptedException, TimeoutException { ModelNode op = new ModelNode(); - op.get(ModelDescriptionConstants.ADDRESS).add(ModelDescriptionConstants.HOST, host); - op.get(ModelDescriptionConstants.OP).set("reload"); + op.get(ADDRESS).add(HOST, host); + op.get(OP).set(RELOAD); op.get("admin-only").set(parameters.adminOnly); - op.get(ModelDescriptionConstants.RESTART_SERVERS).set(parameters.restartServers); + op.get(RESTART_SERVERS).set(parameters.restartServers); long startupTimeout; if (parameters.timeout == null) { startupTimeout = configuration.getStartupTimeoutInSeconds(); } else { startupTimeout = parameters.timeout; } - + if (parameters.hostConfig != null) { + op.get(HOST_CONFIG).set(parameters.hostConfig); + } + if (parameters.domainConfig != null) { + op.get(DOMAIN_CONFIG).set(parameters.domainConfig); + } + if (parameters instanceof ReloadEnhancedParameters) { + Stability stabilityParam = ((ReloadEnhancedParameters) parameters).stability; + if (stabilityParam != null) { + op.get(OP).set(RELOAD_ENHANCED); + op.get(STABILITY).set(stabilityParam.toString()); + } + } executeAwaitConnectionClosed(op); // Try to reconnect to the hc connect(); @@ -480,6 +501,10 @@ public static class ReloadParameters { Long timeout = null; + String hostConfig; + + String domainConfig; + /** * Sets the adminOnly * @@ -526,6 +551,46 @@ public ReloadParameters setTimeout(Long timeout) { this.timeout = timeout; return this; } + + /** + * Sets the hostConfig + * + * @param hostConfig the path to the host configuration file to use + * @return this ReloadParameters object + */ + public ReloadParameters setHostConfig(String hostConfig) { + this.hostConfig = hostConfig; + return this; + } + + /** + * Sets the domainConfig + * + * @param domainConfig the path to the domain configuration file to use + * @return this ReloadParameters object + */ + public ReloadParameters setDomainConfig(String domainConfig) { + this.domainConfig = domainConfig; + return this; + } + } + + /** + * Reload parameters to execute reload-enhanced operation + */ + public static class ReloadEnhancedParameters extends ReloadParameters { + Stability stability; + + /** + * Sets the stability + * + * @param stability the stability level to use + * @return this ReloadParameters object + */ + public ReloadParameters setStability(Stability stability) { + this.stability = stability; + return this; + } } /** diff --git a/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java b/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java index a69b36acf3f..ebbf85df58a 100644 --- a/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java +++ b/testsuite/shared/src/main/java/org/wildfly/test/snapshot/DomainSnapshot.java @@ -69,7 +69,12 @@ public static AutoCloseable takeSnapshot(DomainTestSupport testSupport) { @Override public void close() throws Exception { for (Snapshot snapshot : snapShots) { - snapshot.lifecycleUtil.reload(snapshot.hostName, snapshot.stability, snapshot.hostConfig, snapshot.domainConfig); + DomainLifecycleUtil.ReloadEnhancedParameters reloadParams = new DomainLifecycleUtil.ReloadEnhancedParameters(); + reloadParams.setStability(snapshot.stability) + .setHostConfig(snapshot.hostConfig) + .setDomainConfig(snapshot.domainConfig); + + snapshot.lifecycleUtil.reload(snapshot.hostName, reloadParams); PathAddress hostAddress = PathAddress.pathAddress(HOST, snapshot.hostName); Stability reloadedStability = getStability(hostAddress, snapshot.lifecycleUtil.getDomainClient()); Assert.assertSame(reloadedStability, snapshot.stability); diff --git a/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityDomainSetupSnapshotRestoreTasks.java b/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityDomainSetupSnapshotRestoreTasks.java index 4f29f541779..53ab62829d6 100644 --- a/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityDomainSetupSnapshotRestoreTasks.java +++ b/testsuite/shared/src/main/java/org/wildfly/test/stability/StabilityDomainSetupSnapshotRestoreTasks.java @@ -159,7 +159,9 @@ private void reloadToDesiredStability(PathAddress hostAddress, DomainLifecycleUt } //Reload the server to the desired stability level - domainLifecycleUtil.reload(hostAddress.getLastElement().getValue(), stability, null, null); + DomainLifecycleUtil.ReloadEnhancedParameters reload = new DomainLifecycleUtil.ReloadEnhancedParameters(); + reload.setStability(stability); + domainLifecycleUtil.reload(hostAddress.getLastElement().getValue(), reload); client = domainLifecycleUtil.getDomainClient(); Stability reloadedStability = readCurrentStability(hostAddress, client); Assert.assertEquals(stability, reloadedStability);