You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2022/04/15 11:40:15 UTC
[tomee] 01/03: TOMEE-3897 Smallrye Health TCK fixes
This is an automated email from the ASF dual-hosted git repository.
jlmonteiro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git
commit d90ecd4e01d1cb731f0fdf044a00192cb8d55b7a
Author: Jean-Louis Monteiro <jl...@tomitribe.com>
AuthorDate: Fri Apr 15 13:38:21 2022 +0200
TOMEE-3897 Smallrye Health TCK fixes
---
.../health/src/test/resources/arquillian.xml | 5 ++++
tck/microprofile-tck/health/tck-dev.xml | 27 ++++++++++++++++++++++
.../microprofile/TomEEMicroProfileListener.java | 5 ++--
.../health/MicroProfileHealthChecksEndpoint.java | 7 ++++++
.../health/MicroProfileHealthReporterProducer.java | 2 +-
5 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/tck/microprofile-tck/health/src/test/resources/arquillian.xml b/tck/microprofile-tck/health/src/test/resources/arquillian.xml
index 44965b76e3..3f694f898c 100644
--- a/tck/microprofile-tck/health/src/test/resources/arquillian.xml
+++ b/tck/microprofile-tck/health/src/test/resources/arquillian.xml
@@ -32,6 +32,9 @@
<property name="dir">target/tomee</property>
<property name="appWorkingDir">target/workdir</property>
<property name="cleanOnStartUp">true</property>
+ <property name="properties">
+ mp.health.disable-default-procedures = true
+ </property>
</configuration>
</container>
<container qualifier="tomee-plus">
@@ -46,6 +49,7 @@
<property name="cleanOnStartUp">true</property>
<property name="properties">
tomee.mp.scan = all
+ mp.health.disable-default-procedures = true
</property>
</configuration>
</container>
@@ -61,6 +65,7 @@
<property name="cleanOnStartUp">true</property>
<property name="properties">
tomee.mp.scan = all
+ mp.health.disable-default-procedures = true
</property>
</configuration>
</container>
diff --git a/tck/microprofile-tck/health/tck-dev.xml b/tck/microprofile-tck/health/tck-dev.xml
new file mode 100644
index 0000000000..1ceecbb3d2
--- /dev/null
+++ b/tck/microprofile-tck/health/tck-dev.xml
@@ -0,0 +1,27 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+ -->
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+
+<suite name="microprofile-health-TCK" verbose="2" configfailurepolicy="continue" >
+
+ <test name="microprofile-health TCK">
+ <classes>
+ <class name="org.eclipse.microprofile.health.tck.SingleStartupSuccessfulTest"></class>
+ </classes>
+ </test>
+
+</suite>
\ No newline at end of file
diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java
index 418906f59c..33d81a9b6e 100644
--- a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java
+++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/TomEEMicroProfileListener.java
@@ -55,7 +55,6 @@ public class TomEEMicroProfileListener {
"io.smallrye.config.inject.ConfigExtension",
"io.smallrye.metrics.setup.MetricCdiInjectionExtension",
"io.smallrye.opentracing.SmallRyeTracingDynamicFeature",
- "io.smallrye.metrics.setup.MetricCdiInjectionExtension",
};
@SuppressWarnings("Duplicates")
@@ -105,7 +104,7 @@ public class TomEEMicroProfileListener {
final WebAppInfo webApp = afterApplicationCreated.getEvent().getWeb();
// These remove duplicated REST API endpoints.
- webApp.restClass.removeIf(className -> className.equals(MicroProfileHealthChecksEndpoint.class.getName()));
+ // webApp.restClass.removeIf(className -> className.equals(MicroProfileHealthChecksEndpoint.class.getName()));
// webApp.restClass.removeIf(className -> className.equals(MetricsEndpoints.class.getName()));
// There remove all of MP REST API endpoint if there is a servlet already registered in /*. The issue here is
@@ -119,7 +118,7 @@ public class TomEEMicroProfileListener {
.filter(mapping -> mapping.equals("/*"))
.findFirst()
.ifPresent(mapping -> {
- webApp.restClass.removeIf(className -> className.equals(MicroProfileHealthChecksEndpoint.class.getName()));
+ // webApp.restClass.removeIf(className -> className.equals(MicroProfileHealthChecksEndpoint.class.getName()));
// webApp.restClass.removeIf(className -> className.equals(CdiMetricsEndpoints.class.getName()));
// webApp.restClass.removeIf(className -> className.equals(OpenAPIEndpoint.class.getName()));
});
diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/health/MicroProfileHealthChecksEndpoint.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/health/MicroProfileHealthChecksEndpoint.java
index 173836477c..aca3bf13be 100644
--- a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/health/MicroProfileHealthChecksEndpoint.java
+++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/health/MicroProfileHealthChecksEndpoint.java
@@ -54,6 +54,13 @@ public class MicroProfileHealthChecksEndpoint {
return toResponse(reporter::getReadiness);
}
+ @GET
+ @Path("started")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getStartedChecks() {
+ return toResponse(reporter::getStartup);
+ }
+
private Response toResponse(final Supplier<SmallRyeHealth> health) {
return Response
diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/health/MicroProfileHealthReporterProducer.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/health/MicroProfileHealthReporterProducer.java
index 9fd8bd146a..9cc29ed1ce 100644
--- a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/health/MicroProfileHealthReporterProducer.java
+++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/health/MicroProfileHealthReporterProducer.java
@@ -24,7 +24,7 @@ import jakarta.enterprise.inject.Produces;
import org.eclipse.microprofile.config.ConfigProvider;
import org.eclipse.microprofile.health.HealthCheckResponse;
-@Dependent
+@ApplicationScoped
public class MicroProfileHealthReporterProducer {
@Produces