From 9528cb8a058102a3af13f774cfde39a5c32c1840 Mon Sep 17 00:00:00 2001 From: Ondrej Kotek Date: Wed, 20 Mar 2024 11:35:42 +0100 Subject: [PATCH] Removing MP Metrics tests MP Metrics are no longer supported in WildFly and EAP, see https://issues.redhat.com/browse/WFLY-17138 --- .../MicroprofileMetricsFixtures.java | 13 -- .../metrics/MicroprofileMetricsTest.java | 133 ------------------ 2 files changed, 146 deletions(-) delete mode 100644 resources-subsystem-fixtures/src/main/java/org/jboss/hal/testsuite/fixtures/microprofile/MicroprofileMetricsFixtures.java delete mode 100644 tests-configuration-microprofile/src/test/java/org/jboss/hal/testsuite/test/configuration/microprofile/metrics/MicroprofileMetricsTest.java diff --git a/resources-subsystem-fixtures/src/main/java/org/jboss/hal/testsuite/fixtures/microprofile/MicroprofileMetricsFixtures.java b/resources-subsystem-fixtures/src/main/java/org/jboss/hal/testsuite/fixtures/microprofile/MicroprofileMetricsFixtures.java deleted file mode 100644 index 66ff73ed..00000000 --- a/resources-subsystem-fixtures/src/main/java/org/jboss/hal/testsuite/fixtures/microprofile/MicroprofileMetricsFixtures.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.jboss.hal.testsuite.fixtures.microprofile; - -import org.wildfly.extras.creaper.core.online.operations.Address; - -public class MicroprofileMetricsFixtures { - - public static final Address MICROPROFILE_METRICS_ADDRESS = Address.subsystem("microprofile-metrics-smallrye"); - public static final String EXPOSE_ALL_SUBSYSTEMS = "expose-all-subsystems"; - public static final String EXPOSED_SUBSYSTEMS = "exposed-subsystems"; - public static final String SECURITY_ENABLED = "security-enabled"; - - private MicroprofileMetricsFixtures() { } -} diff --git a/tests-configuration-microprofile/src/test/java/org/jboss/hal/testsuite/test/configuration/microprofile/metrics/MicroprofileMetricsTest.java b/tests-configuration-microprofile/src/test/java/org/jboss/hal/testsuite/test/configuration/microprofile/metrics/MicroprofileMetricsTest.java deleted file mode 100644 index f5ff3a9f..00000000 --- a/tests-configuration-microprofile/src/test/java/org/jboss/hal/testsuite/test/configuration/microprofile/metrics/MicroprofileMetricsTest.java +++ /dev/null @@ -1,133 +0,0 @@ -package org.jboss.hal.testsuite.test.configuration.microprofile.metrics; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.atomic.AtomicReference; - -import org.jboss.arquillian.core.api.annotation.Inject; -import org.jboss.arquillian.drone.api.annotation.Drone; -import org.jboss.arquillian.graphene.page.Page; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.dmr.ModelNode; -import org.jboss.hal.testsuite.CrudOperations; -import org.jboss.hal.testsuite.Random; -import org.jboss.hal.testsuite.category.Microprofile; -import org.jboss.hal.testsuite.creaper.ManagementClientProvider; -import org.jboss.hal.testsuite.dmr.ModelNodeGenerator; -import org.jboss.hal.testsuite.page.configuration.MicroprofileMetricsPage; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.runner.RunWith; -import org.openqa.selenium.WebDriver; -import org.wildfly.extras.creaper.core.online.OnlineManagementClient; -import org.wildfly.extras.creaper.core.online.operations.Operations; - -import static org.jboss.hal.dmr.ModelDescriptionConstants.PREFIX; -import static org.jboss.hal.testsuite.fixtures.microprofile.MicroprofileMetricsFixtures.EXPOSED_SUBSYSTEMS; -import static org.jboss.hal.testsuite.fixtures.microprofile.MicroprofileMetricsFixtures.EXPOSE_ALL_SUBSYSTEMS; -import static org.jboss.hal.testsuite.fixtures.microprofile.MicroprofileMetricsFixtures.MICROPROFILE_METRICS_ADDRESS; -import static org.jboss.hal.testsuite.fixtures.microprofile.MicroprofileMetricsFixtures.SECURITY_ENABLED; - -@Category(Microprofile.class) -@RunWith(Arquillian.class) -public class MicroprofileMetricsTest { - - private static final OnlineManagementClient client = ManagementClientProvider.createOnlineManagementClient(); - private static final Operations operations = new Operations(client); - private static final String STAR = "*"; - - private static String defaultPrefixValue = ""; - private static ModelNode defaultExposedSystem; - - @BeforeClass - public static void getInitialPrefixValue() throws IOException { - defaultPrefixValue = operations.readAttribute(MICROPROFILE_METRICS_ADDRESS, PREFIX).stringValue("result"); - defaultExposedSystem = operations.readAttribute(MICROPROFILE_METRICS_ADDRESS, EXPOSED_SUBSYSTEMS).value(); - operations.writeListAttribute(MICROPROFILE_METRICS_ADDRESS, EXPOSED_SUBSYSTEMS, STAR).assertSuccess(); - } - - @AfterClass - public static void cleanUpAndCloseClient() throws IOException { - operations.writeAttribute(MICROPROFILE_METRICS_ADDRESS, PREFIX, defaultPrefixValue).assertSuccess(); - operations.writeAttribute(MICROPROFILE_METRICS_ADDRESS, EXPOSED_SUBSYSTEMS, defaultExposedSystem).assertSuccess(); - client.close(); - } - - @After - public void exposeAllSubsystems() throws Exception { - operations.writeListAttribute(MICROPROFILE_METRICS_ADDRESS, EXPOSED_SUBSYSTEMS, STAR).assertSuccess(); - } - - @Drone - private WebDriver browser; - - @Page - private MicroprofileMetricsPage page; - - @Inject - private CrudOperations crudOperations; - - @Test - public void toggleExposeAllSubsystems() throws Exception { - boolean exposeAllSubsystems = - operations.readAttribute(MICROPROFILE_METRICS_ADDRESS, - EXPOSED_SUBSYSTEMS) - .value() - .equals(new ModelNodeGenerator.ModelNodeListBuilder().addAll(STAR).build()); - final AtomicReference>> exposedSubsystems = new AtomicReference<>(Optional.empty()); - page.navigate(); - crudOperations.update(MICROPROFILE_METRICS_ADDRESS, page.getMicroprofileMetricsForm(), - formFragment -> { - if (exposeAllSubsystems) { - formFragment.flip(EXPOSE_ALL_SUBSYSTEMS, false); - exposedSubsystems.set(Optional.of(Arrays.asList(Random.name(), Random.name()))); - formFragment.list(EXPOSED_SUBSYSTEMS).add(exposedSubsystems.get().get()); - } else { - formFragment.flip(EXPOSE_ALL_SUBSYSTEMS, true); - } - }, resourceVerifier -> { - ModelNode value = new ModelNodeGenerator.ModelNodeListBuilder().addAll(STAR).build(); - if (exposeAllSubsystems) { - List exposedSubsystemsList = exposedSubsystems.get().get(); - value = - new ModelNodeGenerator.ModelNodeListBuilder().addAll( - exposedSubsystemsList.toArray(new String[exposedSubsystemsList.size()])).build(); - } - resourceVerifier.verifyAttribute(EXPOSED_SUBSYSTEMS, value); - }); - } - - @Test - public void editExposedSubsystems() throws Exception { - boolean exposeAllSubsystems = - operations.readAttribute(MICROPROFILE_METRICS_ADDRESS, - EXPOSED_SUBSYSTEMS) - .value().equals(new ModelNodeGenerator.ModelNodeListBuilder().addAll(STAR).build()); - String[] exposedSubsystems = new String[] {Random.name(), Random.name()}; - page.navigate(); - crudOperations.update(MICROPROFILE_METRICS_ADDRESS, page.getMicroprofileMetricsForm(), - formFragment -> { - if (exposeAllSubsystems) { - formFragment.flip(EXPOSE_ALL_SUBSYSTEMS, false); - } - formFragment.list(EXPOSED_SUBSYSTEMS).add(Arrays.asList(exposedSubsystems)); - }, resourceVerifier -> resourceVerifier.verifyAttribute(EXPOSED_SUBSYSTEMS, - new ModelNodeGenerator.ModelNodeListBuilder().addAll(exposedSubsystems).build())); - } - - @Test - public void toggleSecurityEnabled() throws Exception { - boolean securityEnabled = - operations.readAttribute(MICROPROFILE_METRICS_ADDRESS, - SECURITY_ENABLED) - .booleanValue(false); - page.navigate(); - crudOperations.update(MICROPROFILE_METRICS_ADDRESS, - page.getMicroprofileMetricsForm(), SECURITY_ENABLED, !securityEnabled); - } -}