Repository: smallrye/smallrye-health
Pull request #422 (2022-09-06 12:05:04)

Refactor testsuite to use WildFly Full
For easier transitions to jakarta namespace.


Patch:
diff --git a/pom.xml b/pom.xml
index a481b1b..fa3dbc7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,11 +35,12 @@
   <properties>
     <version.eclipse.microprofile.config>2.0</version.eclipse.microprofile.config>
     <version.eclipse.microprofile.health>3.1</version.eclipse.microprofile.health>
+    <version.httpclient>4.5.13</version.httpclient>
     <version.jakarta.servlet>4.0.4</version.jakarta.servlet>
     <version.mutiny>1.7.0</version.mutiny>
     <version.smallrye-config>2.11.1</version.smallrye-config>
     <version.smallrye-common>1.13.0</version.smallrye-common>
-    <version.wildfly>26.0.0.Final</version.wildfly>
+    <version.wildfly>26.1.2.Final</version.wildfly>
 
     <version.smallrye.testing.utilities>1.0.0</version.smallrye.testing.utilities>
 


Test patch:
diff --git a/testsuite/experimental/pom.xml b/testsuite/experimental/pom.xml
index 78b8dad..ca3d21e 100644
--- a/testsuite/experimental/pom.xml
+++ b/testsuite/experimental/pom.xml
@@ -25,15 +25,22 @@
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient</artifactId>
+      <version>${version.httpclient}</version>
+      <scope>compile</scope>
+    </dependency>
+
   </dependencies>
 
   <profiles>
     <profile>
-      <id>wildfly-servlet</id>
+      <id>wildfly</id>
       <activation>
         <property>
           <!-- use property rather than activeByDefault, see https://issues.apache.org/jira/browse/MNG-4917 -->
-          <name>!noWildflyServlet</name>
+          <name>!noWildfly</name>
         </property>
       </activation>
       <dependencies>
@@ -53,7 +60,7 @@
                 <jboss.options>${jboss.extra.opts}</jboss.options>
               </systemProperties>
               <environmentVariables>
-                <JBOSS_HOME>${project.build.directory}/wildfly-servlet-${version.wildfly}</JBOSS_HOME>
+                <JBOSS_HOME>${project.build.directory}/wildfly-${version.wildfly}</JBOSS_HOME>
               </environmentVariables>
             </configuration>
           </plugin>
@@ -71,7 +78,7 @@
                   <artifactItems>
                     <artifactItem>
                       <groupId>org.wildfly</groupId>
-                      <artifactId>wildfly-servlet-dist</artifactId>
+                      <artifactId>wildfly-dist</artifactId>
                       <version>${version.wildfly}</version>
                       <type>zip</type>
                       <overWrite>false</overWrite>
@@ -91,7 +98,7 @@
         <jdk>[11,)</jdk>
       </activation>
       <properties>
-        <jboss.extra.opts>--add-modules java.se</jboss.extra.opts>
+        <jboss.extra.opts>--add-modules java.se --add-opens=java.base/java.util=ALL-UNNAMED</jboss.extra.opts>
       </properties>
     </profile>
   </profiles>
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/SmallRyeBeanArchiveHandler.java b/testsuite/experimental/src/test/java/io/smallrye/health/SmallRyeBeanArchiveHandler.java
deleted file mode 100644
index 1ac0130..0000000
--- a/testsuite/experimental/src/test/java/io/smallrye/health/SmallRyeBeanArchiveHandler.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2018 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.smallrye.health;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import javax.annotation.Priority;
-
-import org.jboss.weld.environment.deployment.discovery.BeanArchiveBuilder;
-import org.jboss.weld.environment.deployment.discovery.BeanArchiveHandler;
-import org.jboss.weld.environment.util.Files;
-
-/**
- * Special handler for WildFly VFS urls.
- *
- * @author Martin Kouba
- */
-@Priority(1)
-public class SmallRyeBeanArchiveHandler implements BeanArchiveHandler {
-
-    @Override
-    public BeanArchiveBuilder handle(String beanArchiveReference) {
-
-        // An external form of a wildfly beans.xml URL will be something like:
-        // vfs:/content/_DEFAULT___DEFAULT__1f4a3572-fc97-41f5-8fed-0e7e7f7895df.war/WEB-INF/lib/4e0a1b50-4a74-429d-b519-9eedcac11046.jar/META-INF/beans.xml
-        beanArchiveReference = beanArchiveReference.substring(0, beanArchiveReference.lastIndexOf("/META-INF/beans.xml"));
-
-        if (beanArchiveReference.endsWith(".war")) {
-            // We only use this handler for libraries - WEB-INF classes are handled by ServletContextBeanArchiveHandler
-            return null;
-        }
-
-        try {
-            URL url = new URL(beanArchiveReference);
-            try (ZipInputStream in = openStream(url)) {
-                BeanArchiveBuilder builder = new BeanArchiveBuilder();
-                handleLibrary(url, in, builder);
-                return builder;
-            }
-        } catch (IOException e) {
-            throw new IllegalStateException(e);
-        }
-    }
-
-    ZipInputStream openStream(URL url) throws IOException {
-        InputStream in = url.openStream();
-        return (in instanceof ZipInputStream) ? (ZipInputStream) in : new ZipInputStream(in);
-    }
-
-    private void handleLibrary(URL url, ZipInputStream zip, BeanArchiveBuilder builder) throws IOException {
-        ZipEntry entry = null;
-        while ((entry = zip.getNextEntry()) != null) {
-            if (Files.isClass(entry.getName())) {
-                builder.addClass(Files.filenameToClassname(entry.getName()));
-            }
-        }
-    }
-}
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/SmallRyeHealthArchiveProcessor.java b/testsuite/experimental/src/test/java/io/smallrye/health/SmallRyeHealthArchiveProcessor.java
index 1bcbb1f..a799186 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/SmallRyeHealthArchiveProcessor.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/SmallRyeHealthArchiveProcessor.java
@@ -22,7 +22,8 @@ import org.jboss.arquillian.test.spi.TestClass;
 import org.jboss.shrinkwrap.api.Archive;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
 import org.jboss.shrinkwrap.resolver.api.maven.Maven;
-import org.jboss.weld.environment.deployment.discovery.BeanArchiveHandler;
+
+import com.beust.jcommander.ParameterException;
 
 public class SmallRyeHealthArchiveProcessor implements ApplicationArchiveProcessor {
 
@@ -30,21 +31,19 @@ public class SmallRyeHealthArchiveProcessor implements ApplicationArchiveProcess
     public void process(Archive<?> applicationArchive, TestClass testClass) {
         if (applicationArchive instanceof WebArchive) {
             WebArchive testDeployment = (WebArchive) applicationArchive;
-            // Register SmallRyeBeanArchiveHandler using the ServiceLoader mechanism
-            testDeployment.addClass(SmallRyeBeanArchiveHandler.class);
-            testDeployment.addAsServiceProvider(BeanArchiveHandler.class, SmallRyeBeanArchiveHandler.class);
 
             String[] deps = {
                     "io.smallrye:smallrye-health",
                     "io.smallrye.config:smallrye-config",
                     "io.smallrye:smallrye-health-tck",
-                    "org.eclipse.microprofile.health:microprofile-health-tck",
-                    "org.jboss.weld.servlet:weld-servlet-core" };
+                    "org.apache.httpcomponents:httpclient" };
 
             File[] dependencies = Maven.resolver().loadPomFromFile(new File("pom.xml")).resolve(deps).withTransitivity()
                     .asFile();
 
             testDeployment.addAsLibraries(dependencies);
+            // needed because of unnecessary NCDF exceptions in the test runs
+            testDeployment.addClass(ParameterException.class);
         }
     }
 
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/AdditionalHealthPropertiesTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/AdditionalHealthPropertiesTest.java
index 21306af..48f1db1 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/AdditionalHealthPropertiesTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/AdditionalHealthPropertiesTest.java
@@ -22,25 +22,21 @@
 
 package io.smallrye.health.test;
 
-import javax.inject.Inject;
 import javax.json.JsonArray;
 import javax.json.JsonObject;
 
-import org.jboss.arquillian.container.spi.client.container.LifecycleException;
 import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
 import org.jboss.shrinkwrap.api.Archive;
 import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import io.smallrye.health.SmallRyeHealthReporter;
 import io.smallrye.health.deployment.SuccessLiveness;
 
+@RunAsClient
 public class AdditionalHealthPropertiesTest extends TCKBase {
 
-    @Inject
-    SmallRyeHealthReporter smallRyeHealthReporter;
-
     @Deployment
     public static Archive getDeployment() {
         return DeploymentUtils.createWarFileWithClasses(AdditionalHealthPropertiesTest.class.getSimpleName(),
@@ -52,8 +48,13 @@ public class AdditionalHealthPropertiesTest extends TCKBase {
     }
 
     @Test
-    public void testAdditionalProperties() throws LifecycleException {
-        JsonObject json = smallRyeHealthReporter.getHealth().getPayload();
+    public void testAdditionalProperties() {
+        Response response = getUrlHealthContents();
+
+        // status code
+        Assert.assertEquals(response.getStatus(), 200);
+
+        JsonObject json = readJson(response);
 
         // response size
         JsonArray checks = json.getJsonArray("checks");
@@ -65,8 +66,6 @@ public class AdditionalHealthPropertiesTest extends TCKBase {
 
         assertOverallSuccess(json);
 
-        smallRyeHealthReporter.reportHealth(System.out, smallRyeHealthReporter.getHealth());
-
         Assert.assertEquals(json.getString("testProperty1", "no value provided"), "testValue1");
         Assert.assertEquals(json.getString("testProperty2", "no value provided"), "testValue2");
         Assert.assertEquals(json.getString("testProperty3", "no value provided"), "testValue3");
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/AllCustomFailedTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/AllCustomFailedTest.java
index 6614f2b..828e62a 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/AllCustomFailedTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/AllCustomFailedTest.java
@@ -34,6 +34,7 @@ import org.testng.annotations.Test;
 import io.smallrye.health.deployment.FailedCustom;
 import io.smallrye.health.deployment.SuccessfulCustom;
 
+@RunAsClient
 public class AllCustomFailedTest extends TCKBase {
 
     @Deployment
@@ -46,7 +47,6 @@ public class AllCustomFailedTest extends TCKBase {
      * Verifies the custom health integration with CDI at the scope of a server runtime, by retrieving all the custom checks.
      */
     @Test
-    @RunAsClient
     public void testFailureResponsePayload() {
         Response response = getUrlAllCustomHealthContents();
 
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/AsyncFailedHealthTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/AsyncFailedHealthTest.java
index 916a2cb..d432593 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/AsyncFailedHealthTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/AsyncFailedHealthTest.java
@@ -22,26 +22,21 @@
 
 package io.smallrye.health.test;
 
-import java.time.Duration;
-
-import javax.inject.Inject;
 import javax.json.JsonArray;
 import javax.json.JsonObject;
 
 import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
 import org.jboss.shrinkwrap.api.Archive;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import io.smallrye.health.SmallRyeHealthReporter;
 import io.smallrye.health.deployment.FailedLivenessAsync;
 import io.smallrye.health.deployment.FailedReadinessAsync;
 
+@RunAsClient
 public class AsyncFailedHealthTest extends TCKBase {
 
-    @Inject
-    SmallRyeHealthReporter smallRyeHealthReporter;
-
     @Deployment
     public static Archive getDeployment() {
         return DeploymentUtils.createWarFileWithClasses(AsyncFailedHealthTest.class.getSimpleName(),
@@ -50,30 +45,38 @@ public class AsyncFailedHealthTest extends TCKBase {
 
     @Test
     public void testAsyncLiveness() {
-        JsonObject json = smallRyeHealthReporter.getLivenessAsync().await().atMost(Duration.ofSeconds(5)).getPayload();
+        Response response = getUrlLiveContents();
+
+        // status code
+        Assert.assertEquals(response.getStatus(), 503);
+
+        JsonObject json = readJson(response);
 
         // response size
         JsonArray checks = json.getJsonArray("checks");
-        Assert.assertEquals(checks.size(), 1, "Expected one check response");
+        Assert.assertEquals(checks.size(), 1, "Expected a single check response");
 
-        JsonObject checkJson = checks.getJsonObject(0);
-        Assert.assertEquals(FailedLivenessAsync.class.getName(), checkJson.getString("name"));
-        verifyFailureStatus(checkJson);
+        // single procedure response
+        assertFailureCheck(checks.getJsonObject(0), FailedLivenessAsync.class.getName());
 
         assertOverallFailure(json);
     }
 
     @Test
     public void testAsyncReadiness() {
-        JsonObject json = smallRyeHealthReporter.getReadinessAsync().await().atMost(Duration.ofSeconds(5)).getPayload();
+        Response response = getUrlReadyContents();
+
+        // status code
+        Assert.assertEquals(response.getStatus(), 503);
+
+        JsonObject json = readJson(response);
 
         // response size
         JsonArray checks = json.getJsonArray("checks");
-        Assert.assertEquals(checks.size(), 1, "Expected one check response");
+        Assert.assertEquals(checks.size(), 1, "Expected a single check response");
 
-        JsonObject checkJson = checks.getJsonObject(0);
-        Assert.assertEquals(FailedReadinessAsync.class.getName(), checkJson.getString("name"));
-        verifyFailureStatus(checkJson);
+        // single procedure response
+        assertFailureCheck(checks.getJsonObject(0), FailedReadinessAsync.class.getName());
 
         assertOverallFailure(json);
     }
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/AsyncHealthTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/AsyncHealthTest.java
index 50da56c..0fce406 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/AsyncHealthTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/AsyncHealthTest.java
@@ -22,26 +22,21 @@
 
 package io.smallrye.health.test;
 
-import java.time.Duration;
-
-import javax.inject.Inject;
 import javax.json.JsonArray;
 import javax.json.JsonObject;
 
 import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
 import org.jboss.shrinkwrap.api.Archive;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import io.smallrye.health.SmallRyeHealthReporter;
 import io.smallrye.health.deployment.SuccessLivenessAsync;
 import io.smallrye.health.deployment.SuccessReadinessAsync;
 
+@RunAsClient
 public class AsyncHealthTest extends TCKBase {
 
-    @Inject
-    SmallRyeHealthReporter smallRyeHealthReporter;
-
     @Deployment
     public static Archive getDeployment() {
         return DeploymentUtils.createWarFileWithClasses(AsyncHealthTest.class.getSimpleName(),
@@ -50,30 +45,38 @@ public class AsyncHealthTest extends TCKBase {
 
     @Test
     public void testAsyncLiveness() {
-        JsonObject json = smallRyeHealthReporter.getLivenessAsync().await().atMost(Duration.ofSeconds(5)).getPayload();
+        Response response = getUrlLiveContents();
+
+        // status code
+        Assert.assertEquals(response.getStatus(), 200);
+
+        JsonObject json = readJson(response);
 
         // response size
         JsonArray checks = json.getJsonArray("checks");
-        Assert.assertEquals(checks.size(), 1, "Expected one check response");
+        Assert.assertEquals(checks.size(), 1, "Expected a single check response");
 
-        JsonObject checkJson = checks.getJsonObject(0);
-        Assert.assertEquals(SuccessLivenessAsync.class.getName(), checkJson.getString("name"));
-        verifySuccessStatus(checkJson);
+        // single procedure response
+        assertSuccessfulCheck(checks.getJsonObject(0), SuccessLivenessAsync.class.getName());
 
         assertOverallSuccess(json);
     }
 
     @Test
     public void testAsyncReadiness() {
-        JsonObject json = smallRyeHealthReporter.getReadinessAsync().await().atMost(Duration.ofSeconds(5)).getPayload();
+        Response response = getUrlReadyContents();
+
+        // status code
+        Assert.assertEquals(response.getStatus(), 200);
+
+        JsonObject json = readJson(response);
 
         // response size
         JsonArray checks = json.getJsonArray("checks");
-        Assert.assertEquals(checks.size(), 1, "Expected one check response");
+        Assert.assertEquals(checks.size(), 1, "Expected a single check response");
 
-        JsonObject checkJson = checks.getJsonObject(0);
-        Assert.assertEquals(SuccessReadinessAsync.class.getName(), checkJson.getString("name"));
-        verifySuccessStatus(checkJson);
+        // single procedure response
+        assertSuccessfulCheck(checks.getJsonObject(0), SuccessReadinessAsync.class.getName());
 
         assertOverallSuccess(json);
     }
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/AsyncSyncHealthTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/AsyncSyncHealthTest.java
index 2be6c7c..9bc3141 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/AsyncSyncHealthTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/AsyncSyncHealthTest.java
@@ -22,28 +22,23 @@
 
 package io.smallrye.health.test;
 
-import java.time.Duration;
-
-import javax.inject.Inject;
 import javax.json.JsonArray;
 import javax.json.JsonObject;
 
 import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
 import org.jboss.shrinkwrap.api.Archive;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-import io.smallrye.health.SmallRyeHealthReporter;
 import io.smallrye.health.deployment.SuccessLiveness;
 import io.smallrye.health.deployment.SuccessLivenessAsync;
 import io.smallrye.health.deployment.SuccessReadiness;
 import io.smallrye.health.deployment.SuccessReadinessAsync;
 
+@RunAsClient
 public class AsyncSyncHealthTest extends TCKBase {
 
-    @Inject
-    SmallRyeHealthReporter smallRyeHealthReporter;
-
     @Deployment
     public static Archive getDeployment() {
         return DeploymentUtils.createWarFileWithClasses(AsyncSyncHealthTest.class.getSimpleName(),
@@ -53,38 +48,52 @@ public class AsyncSyncHealthTest extends TCKBase {
 
     @Test
     public void testLiveness() {
-        JsonObject json = smallRyeHealthReporter.getLivenessAsync().await().atMost(Duration.ofSeconds(5)).getPayload();
+        Response response = getUrlLiveContents();
+
+        // status code
+        Assert.assertEquals(response.getStatus(), 200);
+
+        JsonObject json = readJson(response);
 
         // response size
         JsonArray checks = json.getJsonArray("checks");
-        Assert.assertEquals(checks.size(), 2, "Expected one check response");
+        Assert.assertEquals(checks.size(), 2, "Expected two checks in the response");
 
-        JsonObject checkJson = checks.getJsonObject(0);
-        Assert.assertEquals(SuccessLiveness.class.getName(), checkJson.getString("name"));
-        verifySuccessStatus(checkJson);
+        for (JsonObject check : checks.getValuesAs(JsonObject.class)) {
+            String id = check.getString("name");
 
-        checkJson = checks.getJsonObject(1);
-        Assert.assertEquals(SuccessLivenessAsync.class.getName(), checkJson.getString("name"));
-        verifySuccessStatus(checkJson);
+            if (id.equals(SuccessLiveness.class.getName()) || id.equals(SuccessLivenessAsync.class.getName())) {
+                verifySuccessStatus(check);
+            } else {
+                Assert.fail("Unexpected response payload structure");
+            }
+        }
 
         assertOverallSuccess(json);
     }
 
     @Test
     public void testReadiness() {
-        JsonObject json = smallRyeHealthReporter.getReadinessAsync().await().atMost(Duration.ofSeconds(5)).getPayload();
+        Response response = getUrlReadyContents();
+
+        // status code
+        Assert.assertEquals(response.getStatus(), 200);
+
+        JsonObject json = readJson(response);
 
         // response size
         JsonArray checks = json.getJsonArray("checks");
-        Assert.assertEquals(checks.size(), 2, "Expected one check response");
+        Assert.assertEquals(checks.size(), 2, "Expected two checks in the response");
 
-        JsonObject checkJson = checks.getJsonObject(0);
-        Assert.assertEquals(SuccessReadiness.class.getName(), checkJson.getString("name"));
-        verifySuccessStatus(checkJson);
+        for (JsonObject check : checks.getValuesAs(JsonObject.class)) {
+            String id = check.getString("name");
 
-        checkJson = checks.getJsonObject(1);
-        Assert.assertEquals(SuccessReadinessAsync.class.getName(), checkJson.getString("name"));
-        verifySuccessStatus(checkJson);
+            if (id.equals(SuccessReadiness.class.getName()) || id.equals(SuccessReadinessAsync.class.getName())) {
+                verifySuccessStatus(check);
+            } else {
+                Assert.fail("Unexpected response payload structure");
+            }
+        }
 
         assertOverallSuccess(json);
     }
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/ChangingHealthTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/ChangingHealthTest.java
index 4ddf1ca..800c1a3 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/ChangingHealthTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/ChangingHealthTest.java
@@ -36,6 +36,7 @@ import org.testng.annotations.Test;
 import io.smallrye.health.deployment.ChangingLivenessHealthCheck;
 import io.smallrye.health.deployment.ChangingReadinessHealthCheckAsync;
 
+@RunAsClient
 public class ChangingHealthTest extends TCKBase {
 
     @Deployment
@@ -45,13 +46,11 @@ public class ChangingHealthTest extends TCKBase {
     }
 
     @Test
-    @RunAsClient
     public void testChangingHealthCheck() {
         testChangingHealth(this::getUrlLiveContents);
     }
 
     @Test
-    @RunAsClient
     public void testChangingAsyncHealthCheck() {
         testChangingHealth(this::getUrlReadyContents);
     }
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/DisableHealthCheckTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/DisableHealthCheckTest.java
index 42e31ba..1ba172e 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/DisableHealthCheckTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/DisableHealthCheckTest.java
@@ -27,6 +27,7 @@ import javax.json.JsonObject;
 
 import org.jboss.arquillian.container.test.api.Deployment;
 import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
 import org.jboss.shrinkwrap.api.Archive;
 import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.testng.Assert;
@@ -37,6 +38,7 @@ import io.smallrye.health.deployment.SuccessLivenessAsync;
 import io.smallrye.health.deployment.SuccessReadiness;
 import io.smallrye.health.deployment.SuccessReadinessAsync;
 
+@RunAsClient
 public class DisableHealthCheckTest extends TCKBase {
 
     private static final String SYNC_DEPLOYMENT = "syncDeployment";
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/MultipleCustomFailedTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/MultipleCustomFailedTest.java
index 1d34e03..353d2b2 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/MultipleCustomFailedTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/MultipleCustomFailedTest.java
@@ -37,6 +37,7 @@ import io.smallrye.health.deployment.SuccessfulCustom;
 /**
  * @author Antoine Sabot-Durand
  */
+@RunAsClient
 public class MultipleCustomFailedTest extends TCKBase {
 
     @Deployment
@@ -49,7 +50,6 @@ public class MultipleCustomFailedTest extends TCKBase {
      * Verifies the custom health integration with CDI at the scope of a server runtime
      */
     @Test
-    @RunAsClient
     public void testFailureResponsePayload() {
         Response response = getUrlCustomHealthContents("group2");
 
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/NullHealthCheckProducerTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/NullHealthCheckProducerTest.java
index 288efc6..60cb8f0 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/NullHealthCheckProducerTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/NullHealthCheckProducerTest.java
@@ -36,6 +36,7 @@ import io.smallrye.health.deployment.NullHealthCheckProducer;
 /**
  * @author Martin Stefanko
  */
+@RunAsClient
 public class NullHealthCheckProducerTest extends TCKBase {
 
     @Deployment
@@ -49,7 +50,6 @@ public class NullHealthCheckProducerTest extends TCKBase {
      * throw NullPointerException
      */
     @Test
-    @RunAsClient
     public void testSuccessResponsePayload() {
         Response response = getUrlLiveContents();
 
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/SingleCustomSuccessfulTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/SingleCustomSuccessfulTest.java
index b49f904..7a29c5f 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/SingleCustomSuccessfulTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/SingleCustomSuccessfulTest.java
@@ -36,6 +36,7 @@ import io.smallrye.health.deployment.SuccessfulCustom;
 /**
  * @author Antoine Sabot-Durand
  */
+@RunAsClient
 public class SingleCustomSuccessfulTest extends TCKBase {
 
     @Deployment
@@ -48,7 +49,6 @@ public class SingleCustomSuccessfulTest extends TCKBase {
      * Verifies the custom health integration with CDI at the scope of a server runtime
      */
     @Test
-    @RunAsClient
     public void testSuccessResponsePayload() {
         Response response = getUrlCustomHealthContents("group1");
 
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/SingleStartupAsyncFailedTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/SingleStartupAsyncFailedTest.java
index 6e0579e..50f9911 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/SingleStartupAsyncFailedTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/SingleStartupAsyncFailedTest.java
@@ -36,6 +36,7 @@ import io.smallrye.health.deployment.FailedStartupAsync;
 /**
  * @author Martin Stefanko
  */
+@RunAsClient
 public class SingleStartupAsyncFailedTest extends TCKBase {
 
     @Deployment
@@ -48,7 +49,6 @@ public class SingleStartupAsyncFailedTest extends TCKBase {
      * Verifies the startup async integration
      */
     @Test
-    @RunAsClient
     public void testFailedResponsePayload() {
         Response response = getUrlStartedContents();
 
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/SingleStartupAsyncSuccessfulTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/SingleStartupAsyncSuccessfulTest.java
index 00c658f..7f15e9c 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/SingleStartupAsyncSuccessfulTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/SingleStartupAsyncSuccessfulTest.java
@@ -36,6 +36,7 @@ import io.smallrye.health.deployment.SuccessfulStartupAsync;
 /**
  * @author Martin Stefanko
  */
+@RunAsClient
 public class SingleStartupAsyncSuccessfulTest extends TCKBase {
 
     @Deployment
@@ -48,7 +49,6 @@ public class SingleStartupAsyncSuccessfulTest extends TCKBase {
      * Verifies the startup async integration
      */
     @Test
-    @RunAsClient
     public void testSuccessResponsePayload() {
         Response response = getUrlStartedContents();
 
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/WellnessFailedTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/WellnessFailedTest.java
index 833e996..69f9db2 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/WellnessFailedTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/WellnessFailedTest.java
@@ -36,6 +36,7 @@ import io.smallrye.health.deployment.FailedWellness;
 /**
  * @author Antoine Sabot-Durand
  */
+@RunAsClient
 public class WellnessFailedTest extends TCKBase {
 
     @Deployment
@@ -48,7 +49,6 @@ public class WellnessFailedTest extends TCKBase {
      * Verifies the wellness integration with CDI at the scope of a server runtime
      */
     @Test
-    @RunAsClient
     public void testFailedResponsePayload() {
         Response response = getUrlWellContents();
 
diff --git a/testsuite/experimental/src/test/java/io/smallrye/health/test/WellnessSuccessfulTest.java b/testsuite/experimental/src/test/java/io/smallrye/health/test/WellnessSuccessfulTest.java
index e4accce..55aa47f 100644
--- a/testsuite/experimental/src/test/java/io/smallrye/health/test/WellnessSuccessfulTest.java
+++ b/testsuite/experimental/src/test/java/io/smallrye/health/test/WellnessSuccessfulTest.java
@@ -37,6 +37,7 @@ import io.smallrye.health.deployment.SuccessfulWellnessAsync;
 /**
  * @author Antoine Sabot-Durand
  */
+@RunAsClient
 public class WellnessSuccessfulTest extends TCKBase {
 
     @Deployment
@@ -49,7 +50,6 @@ public class WellnessSuccessfulTest extends TCKBase {
      * Verifies the wellness integration with CDI at the scope of a server runtime
      */
     @Test
-    @RunAsClient
     public void testSuccessResponsePayload() {
         Response response = getUrlWellContents();
 
diff --git a/testsuite/tck/pom.xml b/testsuite/tck/pom.xml
index c347964..5621e5a 100644
--- a/testsuite/tck/pom.xml
+++ b/testsuite/tck/pom.xml
@@ -61,7 +61,7 @@
     <dependency>
       <groupId>org.jboss.weld.servlet</groupId>
       <artifactId>weld-servlet-core</artifactId>
-      <scope>compile</scope>
+      <scope>provided</scope>
     </dependency>
 
     <dependency>
@@ -120,11 +120,11 @@
 
   <profiles>
     <profile>
-      <id>wildfly-servlet</id>
+      <id>wildfly</id>
       <activation>
         <property>
           <!-- use property rather than activeByDefault, see https://issues.apache.org/jira/browse/MNG-4917 -->
-          <name>!noWildflyServlet</name>
+          <name>!noWildfly</name>
         </property>
       </activation>
       <dependencies>
@@ -150,7 +150,7 @@
                 <jboss.options>${jboss.extra.opts}</jboss.options>
               </systemProperties>
               <environmentVariables>
-                <JBOSS_HOME>${project.build.directory}/wildfly-servlet-${version.wildfly}</JBOSS_HOME>
+                <JBOSS_HOME>${project.build.directory}/wildfly-${version.wildfly}</JBOSS_HOME>
               </environmentVariables>
             </configuration>
           </plugin>
@@ -168,7 +168,7 @@
                   <artifactItems>
                     <artifactItem>
                       <groupId>org.wildfly</groupId>
-                      <artifactId>wildfly-servlet-dist</artifactId>
+                      <artifactId>wildfly-dist</artifactId>
                       <version>${version.wildfly}</version>
                       <type>zip</type>
                       <overWrite>false</overWrite>
@@ -188,7 +188,7 @@
         <jdk>[11,)</jdk>
       </activation>
       <properties>
-        <jboss.extra.opts>--add-modules java.se</jboss.extra.opts>
+        <jboss.extra.opts>--add-modules java.se --add-opens=java.base/java.util=ALL-UNNAMED</jboss.extra.opts>
       </properties>
     </profile>
   </profiles>
diff --git a/testsuite/tck/src/test/java/io/smallrye/health/SmallRyeBeanArchiveHandler.java b/testsuite/tck/src/test/java/io/smallrye/health/SmallRyeBeanArchiveHandler.java
deleted file mode 100644
index 1ac0130..0000000
--- a/testsuite/tck/src/test/java/io/smallrye/health/SmallRyeBeanArchiveHandler.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2018 Red Hat, Inc, and individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.smallrye.health;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import javax.annotation.Priority;
-
-import org.jboss.weld.environment.deployment.discovery.BeanArchiveBuilder;
-import org.jboss.weld.environment.deployment.discovery.BeanArchiveHandler;
-import org.jboss.weld.environment.util.Files;
-
-/**
- * Special handler for WildFly VFS urls.
- *
- * @author Martin Kouba
- */
-@Priority(1)
-public class SmallRyeBeanArchiveHandler implements BeanArchiveHandler {
-
-    @Override
-    public BeanArchiveBuilder handle(String beanArchiveReference) {
-
-        // An external form of a wildfly beans.xml URL will be something like:
-        // vfs:/content/_DEFAULT___DEFAULT__1f4a3572-fc97-41f5-8fed-0e7e7f7895df.war/WEB-INF/lib/4e0a1b50-4a74-429d-b519-9eedcac11046.jar/META-INF/beans.xml
-        beanArchiveReference = beanArchiveReference.substring(0, beanArchiveReference.lastIndexOf("/META-INF/beans.xml"));
-
-        if (beanArchiveReference.endsWith(".war")) {
-            // We only use this handler for libraries - WEB-INF classes are handled by ServletContextBeanArchiveHandler
-            return null;
-        }
-
-        try {
-            URL url = new URL(beanArchiveReference);
-            try (ZipInputStream in = openStream(url)) {
-                BeanArchiveBuilder builder = new BeanArchiveBuilder();
-                handleLibrary(url, in, builder);
-                return builder;
-            }
-        } catch (IOException e) {
-            throw new IllegalStateException(e);
-        }
-    }
-
-    ZipInputStream openStream(URL url) throws IOException {
-        InputStream in = url.openStream();
-        return (in instanceof ZipInputStream) ? (ZipInputStream) in : new ZipInputStream(in);
-    }
-
-    private void handleLibrary(URL url, ZipInputStream zip, BeanArchiveBuilder builder) throws IOException {
-        ZipEntry entry = null;
-        while ((entry = zip.getNextEntry()) != null) {
-            if (Files.isClass(entry.getName())) {
-                builder.addClass(Files.filenameToClassname(entry.getName()));
-            }
-        }
-    }
-}
diff --git a/testsuite/tck/src/test/java/io/smallrye/health/SmallRyeHealthArchiveProcessor.java b/testsuite/tck/src/test/java/io/smallrye/health/SmallRyeHealthArchiveProcessor.java
index 8cc0d0b..c54f7d0 100644
--- a/testsuite/tck/src/test/java/io/smallrye/health/SmallRyeHealthArchiveProcessor.java
+++ b/testsuite/tck/src/test/java/io/smallrye/health/SmallRyeHealthArchiveProcessor.java
@@ -17,12 +17,12 @@ package io.smallrye.health;
 
 import java.io.File;
 
+import org.eclipse.microprofile.health.tck.TCKBase;
 import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
 import org.jboss.arquillian.test.spi.TestClass;
 import org.jboss.shrinkwrap.api.Archive;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
 import org.jboss.shrinkwrap.resolver.api.maven.Maven;
-import org.jboss.weld.environment.deployment.discovery.BeanArchiveHandler;
 
 public class SmallRyeHealthArchiveProcessor implements ApplicationArchiveProcessor {
 
@@ -30,22 +30,19 @@ public class SmallRyeHealthArchiveProcessor implements ApplicationArchiveProcess
     public void process(Archive<?> applicationArchive, TestClass testClass) {
         if (applicationArchive instanceof WebArchive) {
             WebArchive testDeployment = (WebArchive) applicationArchive;
-            // Register SmallRyeBeanArchiveHandler using the ServiceLoader mechanism
-            testDeployment.addClass(SmallRyeBeanArchiveHandler.class);
-            testDeployment.addAsServiceProvider(BeanArchiveHandler.class, SmallRyeBeanArchiveHandler.class);
 
             String[] deps = {
                     "io.smallrye:smallrye-health",
                     "io.smallrye.config:smallrye-config",
-                    "io.smallrye:smallrye-health-tck",
-                    "org.eclipse.microprofile.health:microprofile-health-tck",
-                    "org.jboss.weld.servlet:weld-servlet-core" };
+                    "io.smallrye:smallrye-health-tck" };
 
             File[] dependencies = Maven.resolver().loadPomFromFile(new File("pom.xml")).resolve(deps).withTransitivity()
                     .asFile();
 
             testDeployment.addAsLibraries(dependencies);
+            // needed because of unnecessary NCDF exceptions in the test runs
+            testDeployment.addClass(TCKBase.class);
         }
     }
 
-}
\ No newline at end of file
+}