From eaee3db3047012378421bcf6ae2fb92410c1df02 Mon Sep 17 00:00:00 2001 From: Brian Stansberry Date: Tue, 26 Mar 2024 18:09:12 -0500 Subject: [PATCH] [WFLY-19170] Make WildFly Preview run at preview stability OOTB --- ee-feature-pack/product-conf/pom.xml | 2 + galleon-pack/product-conf/pom.xml | 2 + preview/product-conf/pom.xml | 2 + .../management/StabilityLevelTestCase.java | 64 +++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 testsuite/preview/basic/src/test/java/org/wildfly/test/preview/management/StabilityLevelTestCase.java diff --git a/ee-feature-pack/product-conf/pom.xml b/ee-feature-pack/product-conf/pom.xml index 8f62d734e9b3..7fe1ed096a2f 100644 --- a/ee-feature-pack/product-conf/pom.xml +++ b/ee-feature-pack/product-conf/pom.xml @@ -37,6 +37,8 @@ ${ee.dist.product.release.name} ${ee.dist.product.release.version} + community + experimental diff --git a/galleon-pack/product-conf/pom.xml b/galleon-pack/product-conf/pom.xml index 1d6a9f42ed61..dfc57754baa1 100644 --- a/galleon-pack/product-conf/pom.xml +++ b/galleon-pack/product-conf/pom.xml @@ -37,6 +37,8 @@ ${full.dist.product.release.name} ${full.dist.product.release.version} + community + experimental diff --git a/preview/product-conf/pom.xml b/preview/product-conf/pom.xml index 5eedd0261e82..397b073b8a4d 100644 --- a/preview/product-conf/pom.xml +++ b/preview/product-conf/pom.xml @@ -37,6 +37,8 @@ ${preview.dist.product.release.name} ${preview.dist.product.release.version} + preview + experimental diff --git a/testsuite/preview/basic/src/test/java/org/wildfly/test/preview/management/StabilityLevelTestCase.java b/testsuite/preview/basic/src/test/java/org/wildfly/test/preview/management/StabilityLevelTestCase.java new file mode 100644 index 000000000000..28931edc268a --- /dev/null +++ b/testsuite/preview/basic/src/test/java/org/wildfly/test/preview/management/StabilityLevelTestCase.java @@ -0,0 +1,64 @@ +/* + * Copyright The WildFly Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.wildfly.test.preview.management; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.EnumSet; +import java.util.Set; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.RunAsClient; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.as.arquillian.container.ManagementClient; +import org.jboss.as.controller.PathAddress; +import org.jboss.as.controller.operations.common.Util; +import org.jboss.as.test.shared.util.AssumeTestGroupUtil; +import org.jboss.as.version.Stability; +import org.jboss.dmr.ModelNode; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Test of stability level behavior for WildFly Preview. + */ +@RunWith(Arquillian.class) +@RunAsClient +public class StabilityLevelTestCase { + + @ArquillianResource + private ManagementClient managementClient; + + @Deployment() + public static WebArchive createDeployment1() { + return AssumeTestGroupUtil.emptyWar(); + } + + /** + * Tests that the server has the expected stability level and permissible stability levels. + * + * @throws IOException if a problem occurs connecting to the server + */ + @Test + public void testOOTBStability() throws IOException { + ModelNode op = Util.getReadAttributeOperation(PathAddress.pathAddress("core-service", "server-environment"), "stability"); + ModelNode response = managementClient.getControllerClient().execute(op); + assertEquals(response.toString(), "preview", response.get("result").asString()); + + op.get("name").set("permissible-stability-levels"); + response = managementClient.getControllerClient().execute(op); + Set stabilities = EnumSet.allOf(Stability.class); + ModelNode result = response.get("result"); + assertEquals(response.toString(), stabilities.size(), result.asInt()); + for (ModelNode permissible : result.asList()) { + assertTrue(permissible.asString(), stabilities.contains(Stability.fromString(permissible.asString()))); + } + } +}