From 81c5b7b44e2774d644d3a07b6e0dff30489b6173 Mon Sep 17 00:00:00 2001 From: Ken Finnigan Date: Tue, 1 Dec 2020 15:10:17 -0500 Subject: [PATCH] Move non application endpoints to separate URL path - Fixes #13144 - OpenAPI, Metrics, Micrometer, Health, Health UI endpoints are all now served under /q by default - Previous behavior can be attained by setting `quarkus.http.framework-root-path` to `/` Subsequent issue will be created for handling port and binding changes for non application endpoints --- .../export/JsonRegistryProcessor.java | 6 +- .../export/PrometheusRegistryProcessor.java | 12 ++- .../deployment/SmallRyeHealthProcessor.java | 87 ++++++++++------- .../health/test/DispatchedThreadTest.java | 4 +- .../smallrye/health/test/FailingUnitTest.java | 6 +- .../test/HealthCheckDefaultScopeTest.java | 4 +- .../HealthCheckProducerDefaultScopeTest.java | 4 +- .../health/test/HealthOpenAPITest.java | 2 +- .../smallrye/health/test/HealthUnitTest.java | 2 +- .../health/test/WellnessHealthCheckTest.java | 2 +- .../health/test/ui/CustomConfigTest.java | 4 +- .../smallrye/health/test/ui/DisabledTest.java | 2 +- .../deployment/SmallRyeMetricsProcessor.java | 19 +++- .../deployment/DevModeMetricsTest.java | 8 +- ...icrometerMetricsCompatibilityModeTest.java | 2 +- .../deployment/SmallRyeOpenApiProcessor.java | 8 +- .../test/hotreload/OpenApiHotReloadTest.java | 14 +-- .../jaxrs/OpenApiDefaultPathTestCase.java | 2 +- .../OpenApiHttpRootDefaultPathTestCase.java | 2 +- .../OpenApiPathWithSegmentsTestCase.java | 8 +- .../OpenApiPathWithoutSegmentsTestCase.java | 8 +- .../jaxrs/OpenApiRuntimeFilterTestCase.java | 2 +- .../test/jaxrs/OpenApiWithConfigTestCase.java | 2 +- ...steasyPathHttpRootDefaultPathTestCase.java | 2 +- .../OpenApiWithResteasyPathTestCase.java | 2 +- ...SwaggerAndOpenAPIWithCommonPrefixTest.java | 2 +- .../spring/OpenApiDefaultPathTestCase.java | 2 +- .../OpenApiHttpRootDefaultPathTestCase.java | 2 +- .../OpenApiPathWithSegmentsTestCase.java | 8 +- .../OpenApiPathWithoutSegmentsTestCase.java | 8 +- .../spring/OpenApiWithConfigTestCase.java | 2 +- ...SwaggerAndOpenAPIWithCommonPrefixTest.java | 2 +- .../vertx/OpenApiDefaultPathTestCase.java | 2 +- .../OpenApiHttpRootDefaultPathTestCase.java | 2 +- .../OpenApiPathWithSegmentsTestCase.java | 8 +- .../OpenApiPathWithoutSegmentsTestCase.java | 8 +- .../test/vertx/OpenApiWithConfigTestCase.java | 2 +- ...SwaggerAndOpenAPIWithCommonPrefixTest.java | 2 +- .../deployment/SwaggerUiProcessor.java | 16 +++- .../deployment/CustomHttpRootTest.java | 4 +- .../FrameworkRootPathBuildItem.java | 33 +++++++ .../vertx/http/deployment/RouteBuildItem.java | 95 +++++++++++++++++-- .../VertxFrameworkRouterBuildItem.java | 18 ++++ .../http/deployment/VertxHttpProcessor.java | 29 +++++- .../http/runtime/HttpBuildTimeConfig.java | 9 ++ .../vertx/http/runtime/VertxHttpRecorder.java | 5 + .../it/artemis/ArtemisHealthCheckTest.java | 2 +- .../it/artemis/ArtemisHealthCheckTest.java | 2 +- .../it/panache/PanacheFunctionalityTest.java | 2 +- .../KafkaStreamsStartupFailureTest.java | 2 +- .../it/kafka/streams/KafkaStreamsTest.java | 14 +-- .../it/kubernetes/KnativeWithHealthTest.java | 4 +- .../KubernetesWithHealthAndJibTest.java | 4 +- .../kubernetes/KubernetesWithHealthTest.java | 4 +- .../KubernetesWithRootAndHealthTest.java | 4 +- .../kubernetes/OpenshiftWithHealthTest.java | 2 +- .../io/quarkus/it/main/HealthTestCase.java | 10 +- .../io/quarkus/it/main/OpenApiTestCase.java | 2 +- .../micrometer/mpmetrics/MPMetricsTest.java | 6 +- .../PrometheusMetricsRegistryTest.java | 2 +- .../quarkus/it/mongodb/BookResourceTest.java | 2 +- .../it/metrics/MetricsOnClassTestCase.java | 4 +- .../quarkus/it/metrics/MetricsTestCase.java | 20 ++-- tcks/microprofile-health/pom.xml | 4 + tcks/microprofile-metrics/optional/pom.xml | 2 + tcks/microprofile-metrics/rest/pom.xml | 2 + tcks/microprofile-openapi/pom.xml | 2 + 67 files changed, 402 insertions(+), 167 deletions(-) create mode 100644 extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/FrameworkRootPathBuildItem.java create mode 100644 extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxFrameworkRouterBuildItem.java diff --git a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/JsonRegistryProcessor.java b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/JsonRegistryProcessor.java index 15be27a8885da..7cecabf0baa2c 100644 --- a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/JsonRegistryProcessor.java +++ b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/JsonRegistryProcessor.java @@ -41,7 +41,11 @@ public void initializeJsonRegistry(MicrometerConfig config, .addBeanClass(JsonMeterRegistryProvider.class) .setUnremovable().build()); registryProviders.produce(new MicrometerRegistryProviderBuildItem(JsonMeterRegistry.class)); - routes.produce(new RouteBuildItem(recorder.route(config.export.json.path), recorder.getHandler())); + routes.produce(new RouteBuildItem.Builder() + .routeFunction(recorder.route(config.export.json.path)) + .handler(recorder.getHandler()) + .nonApplicationRoute() + .build()); reflectiveClasses.produce(ReflectiveClassBuildItem .builder("org.HdrHistogram.Histogram", "org.HdrHistogram.DoubleHistogram", diff --git a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/PrometheusRegistryProcessor.java b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/PrometheusRegistryProcessor.java index 87fd0474d22bc..e0d9f33bfe6a6 100644 --- a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/PrometheusRegistryProcessor.java +++ b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/PrometheusRegistryProcessor.java @@ -59,10 +59,18 @@ void createPrometheusRoute(BuildProducer routes, log.debug("PROMETHEUS CONFIG: " + pConfig); // Exact match for resources matched to the root path - routes.produce(new RouteBuildItem(recorder.route(pConfig.path), recorder.getHandler())); + routes.produce(new RouteBuildItem.Builder() + .routeFunction(recorder.route(pConfig.path)) + .handler(recorder.getHandler()) + .nonApplicationRoute() + .build()); // Match paths that begin with the deployment path String matchPath = pConfig.path + (pConfig.path.endsWith("/") ? "*" : "/*"); - routes.produce(new RouteBuildItem(recorder.route(matchPath), recorder.getHandler())); + routes.produce(new RouteBuildItem.Builder() + .routeFunction(recorder.route(matchPath)) + .handler(recorder.getHandler()) + .nonApplicationRoute() + .build()); } } diff --git a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java index a32f3ef859a30..f4914bd72ac4f 100644 --- a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java +++ b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java @@ -66,11 +66,10 @@ import io.quarkus.smallrye.health.runtime.SmallRyeReadinessHandler; import io.quarkus.smallrye.health.runtime.SmallRyeWellnessHandler; import io.quarkus.smallrye.openapi.deployment.spi.AddToOpenAPIDefinitionBuildItem; +import io.quarkus.vertx.http.deployment.FrameworkRootPathBuildItem; import io.quarkus.vertx.http.deployment.HttpRootPathBuildItem; import io.quarkus.vertx.http.deployment.RouteBuildItem; import io.quarkus.vertx.http.deployment.devmode.NotFoundPageDisplayableEndpointBuildItem; -import io.quarkus.vertx.http.runtime.HandlerType; -import io.quarkus.vertx.http.runtime.HttpBuildTimeConfig; import io.smallrye.health.SmallRyeHealthReporter; import io.smallrye.health.api.HealthGroup; import io.smallrye.health.api.HealthGroups; @@ -193,17 +192,28 @@ public void defineHealthRoutes(BuildProducer routes, warnIfJaxRsPathUsed(index, WELLNESS); // Register the health handler - routes.produce(new RouteBuildItem(healthConfig.rootPath, new SmallRyeHealthHandler(), HandlerType.BLOCKING)); + routes.produce(new RouteBuildItem.Builder() + .route(healthConfig.rootPath) + .handler(new SmallRyeHealthHandler()) + .blockingRoute() + .nonApplicationRoute() + .build()); // Register the liveness handler - routes.produce( - new RouteBuildItem(healthConfig.rootPath + healthConfig.livenessPath, new SmallRyeLivenessHandler(), - HandlerType.BLOCKING)); + routes.produce(new RouteBuildItem.Builder() + .route(healthConfig.rootPath + healthConfig.livenessPath) + .handler(new SmallRyeLivenessHandler()) + .blockingRoute() + .nonApplicationRoute() + .build()); // Register the readiness handler - routes.produce( - new RouteBuildItem(healthConfig.rootPath + healthConfig.readinessPath, new SmallRyeReadinessHandler(), - HandlerType.BLOCKING)); + routes.produce(new RouteBuildItem.Builder() + .route(healthConfig.rootPath + healthConfig.readinessPath) + .handler(new SmallRyeReadinessHandler()) + .blockingRoute() + .nonApplicationRoute() + .build()); // Find all health groups Set healthGroups = new HashSet<>(); @@ -219,21 +229,30 @@ public void defineHealthRoutes(BuildProducer routes, } // Register the health group handlers - routes.produce( - new RouteBuildItem(healthConfig.rootPath + healthConfig.groupPath, new SmallRyeHealthGroupHandler(), - HandlerType.BLOCKING)); + routes.produce(new RouteBuildItem.Builder() + .route(healthConfig.rootPath + healthConfig.groupPath) + .handler(new SmallRyeHealthGroupHandler()) + .blockingRoute() + .nonApplicationRoute() + .build()); SmallRyeIndividualHealthGroupHandler handler = new SmallRyeIndividualHealthGroupHandler(); for (String healthGroup : healthGroups) { - routes.produce( - new RouteBuildItem(healthConfig.rootPath + healthConfig.groupPath + "/" + healthGroup, - handler, HandlerType.BLOCKING)); + routes.produce(new RouteBuildItem.Builder() + .route(healthConfig.rootPath + healthConfig.groupPath + "/" + healthGroup) + .handler(handler) + .blockingRoute() + .nonApplicationRoute() + .build()); } // Register the wellness handler - routes.produce( - new RouteBuildItem(healthConfig.rootPath + healthConfig.wellnessPath, new SmallRyeWellnessHandler(), - HandlerType.BLOCKING)); + routes.produce(new RouteBuildItem.Builder() + .route(healthConfig.rootPath + healthConfig.wellnessPath) + .handler(new SmallRyeWellnessHandler()) + .blockingRoute() + .nonApplicationRoute() + .build()); } @@ -275,21 +294,17 @@ private void warnIfJaxRsPathUsed(IndexView index, DotName healthAnnotation) { } @BuildStep - public void kubernetes(HttpBuildTimeConfig httpConfig, + public void kubernetes(FrameworkRootPathBuildItem frameworkRootPath, SmallRyeHealthConfig healthConfig, BuildProducer livenessPathItemProducer, BuildProducer readinessPathItemProducer) { - if (httpConfig.rootPath == null) { - livenessPathItemProducer - .produce(new KubernetesHealthLivenessPathBuildItem(healthConfig.rootPath + healthConfig.livenessPath)); - readinessPathItemProducer - .produce(new KubernetesHealthReadinessPathBuildItem(healthConfig.rootPath + healthConfig.readinessPath)); - } else { - String basePath = httpConfig.rootPath.replaceAll("/$", "") + healthConfig.rootPath; - livenessPathItemProducer.produce(new KubernetesHealthLivenessPathBuildItem(basePath + healthConfig.livenessPath)); - readinessPathItemProducer - .produce(new KubernetesHealthReadinessPathBuildItem(basePath + healthConfig.readinessPath)); - } + + livenessPathItemProducer.produce( + new KubernetesHealthLivenessPathBuildItem( + frameworkRootPath.adjustPath(healthConfig.rootPath + healthConfig.livenessPath))); + readinessPathItemProducer.produce( + new KubernetesHealthReadinessPathBuildItem( + frameworkRootPath.adjustPath(healthConfig.rootPath + healthConfig.readinessPath))); } @BuildStep @@ -413,8 +428,16 @@ void registerHealthUiHandler( if (shouldInclude(launchMode, healthConfig)) { Handler handler = recorder.uiHandler(smallRyeHealthBuildItem.getHealthUiFinalDestination(), smallRyeHealthBuildItem.getHealthUiPath(), runtimeConfig); - routeProducer.produce(new RouteBuildItem(healthConfig.ui.rootPath, handler)); - routeProducer.produce(new RouteBuildItem(healthConfig.ui.rootPath + "/*", handler)); + routeProducer.produce(new RouteBuildItem.Builder() + .route(healthConfig.ui.rootPath) + .handler(handler) + .nonApplicationRoute() + .build()); + routeProducer.produce(new RouteBuildItem.Builder() + .route(healthConfig.ui.rootPath + "/*") + .handler(handler) + .nonApplicationRoute() + .build()); } } diff --git a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/DispatchedThreadTest.java b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/DispatchedThreadTest.java index 590514951ed18..f0f8df24e8099 100644 --- a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/DispatchedThreadTest.java +++ b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/DispatchedThreadTest.java @@ -31,7 +31,7 @@ public class DispatchedThreadTest { @Test public void check() { - RestAssured.when().get("/health/live").then() + RestAssured.when().get("/q/health/live").then() .body("status", is("UP"), "checks.status", contains("UP"), "checks.name", contains("my-liveness-check"), @@ -39,7 +39,7 @@ public void check() { "checks.data.thread[0]", not(stringContainsInOrder("loop")), "checks.data.request[0]", is(true)); - RestAssured.when().get("/health/ready").then() + RestAssured.when().get("/q/health/ready").then() .body("status", is("UP"), "checks.status", contains("UP"), "checks.name", contains("my-readiness-check"), diff --git a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/FailingUnitTest.java b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/FailingUnitTest.java index 46080336f115c..56cd5b0dcb594 100644 --- a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/FailingUnitTest.java +++ b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/FailingUnitTest.java @@ -33,9 +33,9 @@ public class FailingUnitTest { @Test public void testHealthServlet() { - RestAssured.when().get("/health/live").then().statusCode(503); - RestAssured.when().get("/health/ready").then().statusCode(503); - RestAssured.when().get("/health").then().statusCode(503); + RestAssured.when().get("/q/health/live").then().statusCode(503); + RestAssured.when().get("/q/health/ready").then().statusCode(503); + RestAssured.when().get("/q/health").then().statusCode(503); } @Test diff --git a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthCheckDefaultScopeTest.java b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthCheckDefaultScopeTest.java index 38426e7e6b2e9..f29fee4f3f965 100644 --- a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthCheckDefaultScopeTest.java +++ b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthCheckDefaultScopeTest.java @@ -28,11 +28,11 @@ public void testHealth() { // the health check does not set a content type so we need to force the parser try { RestAssured.defaultParser = Parser.JSON; - when().get("/health/live").then() + when().get("/q/health/live").then() .body("status", is("UP"), "checks.status", contains("UP"), "checks.name", contains("noScope")); - when().get("/health/live").then() + when().get("/q/health/live").then() .body("status", is("DOWN"), "checks.status", contains("DOWN"), "checks.name", contains("noScope")); diff --git a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthCheckProducerDefaultScopeTest.java b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthCheckProducerDefaultScopeTest.java index ebd89744bce6c..17444fd7bd9b2 100644 --- a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthCheckProducerDefaultScopeTest.java +++ b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthCheckProducerDefaultScopeTest.java @@ -33,11 +33,11 @@ public void testHealth() { // the health check does not set a content type so we need to force the parser try { RestAssured.defaultParser = Parser.JSON; - when().get("/health/ready").then() + when().get("/q/health/ready").then() .body("status", is("UP"), "checks.status", contains("UP", "UP"), "checks.name", containsInAnyOrder("alpha1", "bravo1")); - when().get("/health/ready").then() + when().get("/q/health/ready").then() .body("status", is("UP"), "checks.status", contains("UP", "UP"), "checks.name", containsInAnyOrder("alpha1", "bravo2")); diff --git a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthOpenAPITest.java b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthOpenAPITest.java index 414322cf39c4f..fd69f509ffa29 100644 --- a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthOpenAPITest.java +++ b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthOpenAPITest.java @@ -13,7 +13,7 @@ public class HealthOpenAPITest { - private static final String OPEN_API_PATH = "/openapi"; + private static final String OPEN_API_PATH = "/q/openapi"; @RegisterExtension static final QuarkusUnitTest config = new QuarkusUnitTest() diff --git a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthUnitTest.java b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthUnitTest.java index e82fddf806de8..91475a28d6276 100644 --- a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthUnitTest.java +++ b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/HealthUnitTest.java @@ -26,7 +26,7 @@ public void testHealth() { // the health check does not set a content type so we need to force the parser try { RestAssured.defaultParser = Parser.JSON; - RestAssured.when().get("/health/live").then() + RestAssured.when().get("/q/health/live").then() .body("status", is("UP"), "checks.status", contains("UP"), "checks.name", contains("basic")); diff --git a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/WellnessHealthCheckTest.java b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/WellnessHealthCheckTest.java index 171f24db8aed4..678a956f96527 100644 --- a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/WellnessHealthCheckTest.java +++ b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/WellnessHealthCheckTest.java @@ -27,7 +27,7 @@ public class WellnessHealthCheckTest { public void testWellness() { try { RestAssured.defaultParser = Parser.JSON; - when().get("/health/well").then() + when().get("/q/health/well").then() .body("status", is("UP"), "checks.status", contains("UP"), "checks.name", contains(WellnessHC.class.getName())); diff --git a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/ui/CustomConfigTest.java b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/ui/CustomConfigTest.java index 4068bb4e3adba..105b68b0eace6 100644 --- a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/ui/CustomConfigTest.java +++ b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/ui/CustomConfigTest.java @@ -20,7 +20,7 @@ public class CustomConfigTest { @Test public void shouldUseCustomConfig() { - RestAssured.when().get("/custom").then().statusCode(200).body(containsString("SmallRye Health")); - RestAssured.when().get("/custom/index.html").then().statusCode(200).body(containsString("SmallRye Health")); + RestAssured.when().get("/q/custom").then().statusCode(200).body(containsString("SmallRye Health")); + RestAssured.when().get("/q/custom/index.html").then().statusCode(200).body(containsString("SmallRye Health")); } } diff --git a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/ui/DisabledTest.java b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/ui/DisabledTest.java index 489c95b2b4a9f..76aad0f943cda 100644 --- a/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/ui/DisabledTest.java +++ b/extensions/smallrye-health/deployment/src/test/java/io/quarkus/smallrye/health/test/ui/DisabledTest.java @@ -18,6 +18,6 @@ public class DisabledTest { @Test public void shouldUseDefaultConfig() { - RestAssured.when().get("/health-ui").then().statusCode(404); + RestAssured.when().get("/q/health-ui").then().statusCode(404); } } diff --git a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java index 1a5ac2f0d1af0..17f0f8474c5b5 100644 --- a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java +++ b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java @@ -77,10 +77,9 @@ import io.quarkus.smallrye.metrics.runtime.MetadataHolder; import io.quarkus.smallrye.metrics.runtime.SmallRyeMetricsRecorder; import io.quarkus.smallrye.metrics.runtime.TagHolder; -import io.quarkus.vertx.http.deployment.HttpRootPathBuildItem; +import io.quarkus.vertx.http.deployment.FrameworkRootPathBuildItem; import io.quarkus.vertx.http.deployment.RouteBuildItem; import io.quarkus.vertx.http.deployment.devmode.NotFoundPageDisplayableEndpointBuildItem; -import io.quarkus.vertx.http.runtime.HandlerType; import io.smallrye.metrics.MetricProducer; import io.smallrye.metrics.MetricRegistries; import io.smallrye.metrics.MetricsRequestHandler; @@ -154,7 +153,7 @@ MetricsCapabilityBuildItem metricsCapabilityBuildItem() { @Record(STATIC_INIT) void createRoute(BuildProducer routes, SmallRyeMetricsRecorder recorder, - HttpRootPathBuildItem httpRoot, + FrameworkRootPathBuildItem frameworkRoot, BuildProducer displayableEndpoints, LaunchModeBuildItem launchModeBuildItem) { Function route = recorder.route(metrics.path + (metrics.path.endsWith("/") ? "*" : "/*")); @@ -164,8 +163,18 @@ void createRoute(BuildProducer routes, if (launchModeBuildItem.getLaunchMode().isDevOrTest()) { displayableEndpoints.produce(new NotFoundPageDisplayableEndpointBuildItem(metrics.path)); } - routes.produce(new RouteBuildItem(route, recorder.handler(httpRoot.adjustPath(metrics.path)), HandlerType.BLOCKING)); - routes.produce(new RouteBuildItem(slash, recorder.handler(httpRoot.adjustPath(metrics.path)), HandlerType.BLOCKING)); + routes.produce(new RouteBuildItem.Builder() + .routeFunction(route) + .handler(recorder.handler(frameworkRoot.adjustPath(metrics.path))) + .blockingRoute() + .nonApplicationRoute() + .build()); + routes.produce(new RouteBuildItem.Builder() + .routeFunction(slash) + .handler(recorder.handler(frameworkRoot.adjustPath(metrics.path))) + .blockingRoute() + .nonApplicationRoute() + .build()); } @BuildStep diff --git a/extensions/smallrye-metrics/deployment/src/test/java/io/quarkus/smallrye/metrics/deployment/DevModeMetricsTest.java b/extensions/smallrye-metrics/deployment/src/test/java/io/quarkus/smallrye/metrics/deployment/DevModeMetricsTest.java index 896ccf38fe904..79651f30a5772 100644 --- a/extensions/smallrye-metrics/deployment/src/test/java/io/quarkus/smallrye/metrics/deployment/DevModeMetricsTest.java +++ b/extensions/smallrye-metrics/deployment/src/test/java/io/quarkus/smallrye/metrics/deployment/DevModeMetricsTest.java @@ -70,7 +70,7 @@ public void test() { when().get("/getvalue/mycounter").then().body(equalTo("2")); // jax-rs metrics are disabled - when().get("/metrics").then() + when().get("/q/metrics").then() .body(not(containsString("io.quarkus.smallrye.metrics.deployment.DevModeMetricsTest$MetricsResource"))); // trigger a reload by adding a new metric (mycounter2) @@ -95,7 +95,7 @@ public void test() { when().get("/getvalue/mycounter2").then().body(equalTo("1")); // jax-rs metrics are enabled - when().get("/metrics").then() + when().get("/q/metrics").then() .body(containsString("io.quarkus.smallrye.metrics.deployment.DevModeMetricsTest$MetricsResource")); // disable jax-rs metrics via quarkus.resteasy.metrics.enabled @@ -111,7 +111,7 @@ public void test() { .statusCode(204); // jax-rs metrics are disabled - when().get("/metrics").then() + when().get("/q/metrics").then() .body(not(containsString("io.quarkus.smallrye.metrics.deployment.DevModeMetricsTest$MetricsResource"))); // enable jax-rs metrics via quarkus.resteasy.metrics.enabled @@ -123,7 +123,7 @@ public void test() { .statusCode(204); // jax-rs metrics are enabled - when().get("/metrics").then() + when().get("/q/metrics").then() .body(containsString("io.quarkus.smallrye.metrics.deployment.DevModeMetricsTest$MetricsResource")); } diff --git a/extensions/smallrye-metrics/deployment/src/test/java/io/quarkus/smallrye/metrics/test/MicrometerMetricsCompatibilityModeTest.java b/extensions/smallrye-metrics/deployment/src/test/java/io/quarkus/smallrye/metrics/test/MicrometerMetricsCompatibilityModeTest.java index a53c4b118168e..56203bcd2a861 100644 --- a/extensions/smallrye-metrics/deployment/src/test/java/io/quarkus/smallrye/metrics/test/MicrometerMetricsCompatibilityModeTest.java +++ b/extensions/smallrye-metrics/deployment/src/test/java/io/quarkus/smallrye/metrics/test/MicrometerMetricsCompatibilityModeTest.java @@ -25,7 +25,7 @@ public class MicrometerMetricsCompatibilityModeTest { @Test public void verifyOpenMetricsExport() { - RestAssured.when().get("/metrics").then() + RestAssured.when().get("/q/metrics").then() .body(containsString("jvm_memory_max_bytes{"), containsString("jvm_memory_used_bytes{"), containsString("jvm_memory_committed_bytes{"), diff --git a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java index c289c7e535240..84d4b693aa397 100644 --- a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java +++ b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java @@ -69,7 +69,6 @@ import io.quarkus.vertx.http.deployment.HttpRootPathBuildItem; import io.quarkus.vertx.http.deployment.RouteBuildItem; import io.quarkus.vertx.http.deployment.devmode.NotFoundPageDisplayableEndpointBuildItem; -import io.quarkus.vertx.http.runtime.HandlerType; import io.smallrye.openapi.api.OpenApiConfig; import io.smallrye.openapi.api.OpenApiConfigImpl; import io.smallrye.openapi.api.OpenApiDocument; @@ -169,7 +168,12 @@ RouteBuildItem handler(LaunchModeBuildItem launch, } Handler handler = recorder.handler(openApiRuntimeConfig); - return new RouteBuildItem(openApiConfig.path, handler, HandlerType.BLOCKING); + return new RouteBuildItem.Builder() + .route(openApiConfig.path) + .handler(handler) + .blockingRoute() + .nonApplicationRoute() + .build(); } @BuildStep diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/hotreload/OpenApiHotReloadTest.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/hotreload/OpenApiHotReloadTest.java index fe231bed73438..8b8071d3172dc 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/hotreload/OpenApiHotReloadTest.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/hotreload/OpenApiHotReloadTest.java @@ -20,7 +20,7 @@ public class OpenApiHotReloadTest { @Test public void testAddingAndDeletingEndpoint() { - RestAssured.get("/openapi").then() + RestAssured.get("/q/openapi").then() .statusCode(200) .body(containsString("/api")); @@ -30,14 +30,14 @@ public void testAddingAndDeletingEndpoint() { + " return \"bonjour\"; " + "}")); - RestAssured.get("/openapi").then() + RestAssured.get("/q/openapi").then() .statusCode(200) .body(containsString("/api")) .body(containsString("/api/foo")); TEST.modifySourceFile("MyResource.java", s -> s.replace("foo", "bar")); - RestAssured.get("/openapi").then() + RestAssured.get("/q/openapi").then() .statusCode(200) .body(containsString("/api")) .body(not(containsString("/api/foo"))) @@ -45,7 +45,7 @@ public void testAddingAndDeletingEndpoint() { TEST.modifySourceFile("MyResource.java", s -> s.replace("@GET @Path(\"bar\")", "")); - RestAssured.get("/openapi").then() + RestAssured.get("/q/openapi").then() .statusCode(200) .body(containsString("/api")) .body(not(containsString("/api/foo"))) @@ -54,20 +54,20 @@ public void testAddingAndDeletingEndpoint() { @Test public void testAddingAndUpdatingResource() { - RestAssured.get("/openapi").then() + RestAssured.get("/q/openapi").then() .statusCode(200) .body(containsString("/api")); TEST.addSourceFile(MySecondResource.class); - RestAssured.get("/openapi").then() + RestAssured.get("/q/openapi").then() .statusCode(200) .body(containsString("/api")) .body(containsString("/my-second-api")); TEST.modifySourceFile("MySecondResource.java", s -> s.replace("my-second-api", "/foo")); - RestAssured.get("/openapi").then() + RestAssured.get("/q/openapi").then() .statusCode(200) .body(containsString("/api")) .body(not(containsString("/my-second-api"))) diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiDefaultPathTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiDefaultPathTestCase.java index 20ed1b8b91dbe..364c50e384cee 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiDefaultPathTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiDefaultPathTestCase.java @@ -11,7 +11,7 @@ import io.restassured.RestAssured; public class OpenApiDefaultPathTestCase { - private static final String OPEN_API_PATH = "/openapi"; + private static final String OPEN_API_PATH = "/q/openapi"; @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiHttpRootDefaultPathTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiHttpRootDefaultPathTestCase.java index dc71e3b9ea7d4..c5903ab613a4e 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiHttpRootDefaultPathTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiHttpRootDefaultPathTestCase.java @@ -11,7 +11,7 @@ import io.restassured.RestAssured; public class OpenApiHttpRootDefaultPathTestCase { - private static final String OPEN_API_PATH = "/openapi"; + private static final String OPEN_API_PATH = "/q/openapi"; @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiPathWithSegmentsTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiPathWithSegmentsTestCase.java index 3ea5304666de2..40cc39f9d5576 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiPathWithSegmentsTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiPathWithSegmentsTestCase.java @@ -22,16 +22,16 @@ public class OpenApiPathWithSegmentsTestCase { @Test public void testOpenApiPathAccessResource() { RestAssured.given().header("Accept", "application/yaml") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/yaml;charset=UTF-8"); RestAssured.given().queryParam("format", "YAML") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/yaml;charset=UTF-8"); RestAssured.given().header("Accept", "application/json") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/json;charset=UTF-8"); RestAssured.given().queryParam("format", "JSON") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/json;charset=UTF-8"); } } diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiPathWithoutSegmentsTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiPathWithoutSegmentsTestCase.java index 9917da1167718..36e0bd5644fa8 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiPathWithoutSegmentsTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiPathWithoutSegmentsTestCase.java @@ -22,16 +22,16 @@ public class OpenApiPathWithoutSegmentsTestCase { @Test public void testOpenApiPathAccessResource() { RestAssured.given().header("Accept", "application/yaml") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/yaml;charset=UTF-8"); RestAssured.given().queryParam("format", "YAML") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/yaml;charset=UTF-8"); RestAssured.given().header("Accept", "application/json") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/json;charset=UTF-8"); RestAssured.given().queryParam("format", "JSON") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/json;charset=UTF-8"); } } diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiRuntimeFilterTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiRuntimeFilterTestCase.java index a73bce6c643be..45f8bf4c5ac67 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiRuntimeFilterTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiRuntimeFilterTestCase.java @@ -11,7 +11,7 @@ import io.restassured.RestAssured; public class OpenApiRuntimeFilterTestCase { - private static final String OPEN_API_PATH = "/openapi"; + private static final String OPEN_API_PATH = "/q/openapi"; @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiWithConfigTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiWithConfigTestCase.java index 9fee346a987e1..c81b59db2ce27 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiWithConfigTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiWithConfigTestCase.java @@ -11,7 +11,7 @@ import io.restassured.RestAssured; public class OpenApiWithConfigTestCase { - private static final String OPEN_API_PATH = "/openapi"; + private static final String OPEN_API_PATH = "/q/openapi"; @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiWithResteasyPathHttpRootDefaultPathTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiWithResteasyPathHttpRootDefaultPathTestCase.java index 21c3d69484bdb..21c569a6c1d1d 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiWithResteasyPathHttpRootDefaultPathTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiWithResteasyPathHttpRootDefaultPathTestCase.java @@ -11,7 +11,7 @@ import io.restassured.RestAssured; public class OpenApiWithResteasyPathHttpRootDefaultPathTestCase { - private static final String OPEN_API_PATH = "/openapi"; + private static final String OPEN_API_PATH = "/q/openapi"; @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiWithResteasyPathTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiWithResteasyPathTestCase.java index 916f3efa5c319..17500ff6aa2ee 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiWithResteasyPathTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiWithResteasyPathTestCase.java @@ -11,7 +11,7 @@ import io.restassured.RestAssured; public class OpenApiWithResteasyPathTestCase { - private static final String OPEN_API_PATH = "/openapi"; + private static final String OPEN_API_PATH = "/q/openapi"; @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/SwaggerAndOpenAPIWithCommonPrefixTest.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/SwaggerAndOpenAPIWithCommonPrefixTest.java index 6ff92ec81988c..3eb21e7efed77 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/SwaggerAndOpenAPIWithCommonPrefixTest.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/SwaggerAndOpenAPIWithCommonPrefixTest.java @@ -25,7 +25,7 @@ public class SwaggerAndOpenAPIWithCommonPrefixTest { @Test public void shouldWorkEvenWithCommonPrefix() { RestAssured.when().get("/swagger-ui/index.html").then().statusCode(200).body(containsString("/swagger")); - RestAssured.when().get("/swagger").then().statusCode(200) + RestAssured.when().get("/q/swagger").then().statusCode(200) .body(containsString("/resource"), containsString("QUERY_PARAM_1")); } } diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiDefaultPathTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiDefaultPathTestCase.java index fed3abcb987a4..bbe8fbe95f06f 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiDefaultPathTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiDefaultPathTestCase.java @@ -10,7 +10,7 @@ import io.restassured.RestAssured; public class OpenApiDefaultPathTestCase { - private static final String OPEN_API_PATH = "/openapi"; + private static final String OPEN_API_PATH = "/q/openapi"; @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiHttpRootDefaultPathTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiHttpRootDefaultPathTestCase.java index 020ecb7f7c006..949559709e7cf 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiHttpRootDefaultPathTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiHttpRootDefaultPathTestCase.java @@ -11,7 +11,7 @@ import io.restassured.RestAssured; public class OpenApiHttpRootDefaultPathTestCase { - private static final String OPEN_API_PATH = "/openapi"; + private static final String OPEN_API_PATH = "/q/openapi"; @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiPathWithSegmentsTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiPathWithSegmentsTestCase.java index 0229070b87efd..95285a8b6624a 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiPathWithSegmentsTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiPathWithSegmentsTestCase.java @@ -22,16 +22,16 @@ public class OpenApiPathWithSegmentsTestCase { @Test public void testOpenApiPathAccessResource() { RestAssured.given().header("Accept", "application/yaml") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/yaml;charset=UTF-8"); RestAssured.given().queryParam("format", "YAML") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/yaml;charset=UTF-8"); RestAssured.given().header("Accept", "application/json") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/json;charset=UTF-8"); RestAssured.given().queryParam("format", "JSON") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/json;charset=UTF-8"); } } \ No newline at end of file diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiPathWithoutSegmentsTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiPathWithoutSegmentsTestCase.java index c66593dd16b96..1972db5393f88 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiPathWithoutSegmentsTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiPathWithoutSegmentsTestCase.java @@ -22,16 +22,16 @@ public class OpenApiPathWithoutSegmentsTestCase { @Test public void testOpenApiPathAccessResource() { RestAssured.given().header("Accept", "application/yaml") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/yaml;charset=UTF-8"); RestAssured.given().queryParam("format", "YAML") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/yaml;charset=UTF-8"); RestAssured.given().header("Accept", "application/json") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/json;charset=UTF-8"); RestAssured.given().queryParam("format", "JSON") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/json;charset=UTF-8"); } } \ No newline at end of file diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiWithConfigTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiWithConfigTestCase.java index 671b82eac985e..6c3657b0e45e5 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiWithConfigTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiWithConfigTestCase.java @@ -11,7 +11,7 @@ import io.restassured.RestAssured; public class OpenApiWithConfigTestCase { - private static final String OPEN_API_PATH = "/openapi"; + private static final String OPEN_API_PATH = "/q/openapi"; @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/SwaggerAndOpenAPIWithCommonPrefixTest.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/SwaggerAndOpenAPIWithCommonPrefixTest.java index 1a44a4e06dd49..6dbf875f9d65e 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/SwaggerAndOpenAPIWithCommonPrefixTest.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/spring/SwaggerAndOpenAPIWithCommonPrefixTest.java @@ -25,7 +25,7 @@ public class SwaggerAndOpenAPIWithCommonPrefixTest { @Test public void shouldWorkEvenWithCommonPrefix() { RestAssured.when().get("/swagger-ui/index.html").then().statusCode(200).body(containsString("/swagger")); - RestAssured.when().get("/swagger").then().statusCode(200) + RestAssured.when().get("/q/swagger").then().statusCode(200) .body(containsString("/resource"), containsString("QUERY_PARAM_1")); } } \ No newline at end of file diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiDefaultPathTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiDefaultPathTestCase.java index 6854c698b8fcc..5825bfdd7a6af 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiDefaultPathTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiDefaultPathTestCase.java @@ -10,7 +10,7 @@ import io.restassured.RestAssured; public class OpenApiDefaultPathTestCase { - private static final String OPEN_API_PATH = "/openapi"; + private static final String OPEN_API_PATH = "/q/openapi"; @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiHttpRootDefaultPathTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiHttpRootDefaultPathTestCase.java index 035a4c36d843b..5a9b04d055d76 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiHttpRootDefaultPathTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiHttpRootDefaultPathTestCase.java @@ -11,7 +11,7 @@ import io.restassured.RestAssured; public class OpenApiHttpRootDefaultPathTestCase { - private static final String OPEN_API_PATH = "/openapi"; + private static final String OPEN_API_PATH = "/q/openapi"; @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiPathWithSegmentsTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiPathWithSegmentsTestCase.java index ea70432bf77b6..0fc066d70de20 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiPathWithSegmentsTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiPathWithSegmentsTestCase.java @@ -22,16 +22,16 @@ public class OpenApiPathWithSegmentsTestCase { @Test public void testOpenApiPathAccessResource() { RestAssured.given().header("Accept", "application/yaml") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/yaml;charset=UTF-8"); RestAssured.given().queryParam("format", "YAML") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/yaml;charset=UTF-8"); RestAssured.given().header("Accept", "application/json") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/json;charset=UTF-8"); RestAssured.given().queryParam("format", "JSON") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/json;charset=UTF-8"); } } \ No newline at end of file diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiPathWithoutSegmentsTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiPathWithoutSegmentsTestCase.java index 70d2aec284029..cd7f7152e1adc 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiPathWithoutSegmentsTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiPathWithoutSegmentsTestCase.java @@ -22,16 +22,16 @@ public class OpenApiPathWithoutSegmentsTestCase { @Test public void testOpenApiPathAccessResource() { RestAssured.given().header("Accept", "application/yaml") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/yaml;charset=UTF-8"); RestAssured.given().queryParam("format", "YAML") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/yaml;charset=UTF-8"); RestAssured.given().header("Accept", "application/json") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/json;charset=UTF-8"); RestAssured.given().queryParam("format", "JSON") - .when().get(OPEN_API_PATH) + .when().get("/q" + OPEN_API_PATH) .then().header("Content-Type", "application/json;charset=UTF-8"); } } \ No newline at end of file diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiWithConfigTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiWithConfigTestCase.java index 1b03f5e2961a6..d39013cf37770 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiWithConfigTestCase.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiWithConfigTestCase.java @@ -11,7 +11,7 @@ import io.restassured.RestAssured; public class OpenApiWithConfigTestCase { - private static final String OPEN_API_PATH = "/openapi"; + private static final String OPEN_API_PATH = "/q/openapi"; @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/SwaggerAndOpenAPIWithCommonPrefixTest.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/SwaggerAndOpenAPIWithCommonPrefixTest.java index 7f3ac9e0ebe8c..d368fd3cbb93f 100644 --- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/SwaggerAndOpenAPIWithCommonPrefixTest.java +++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/SwaggerAndOpenAPIWithCommonPrefixTest.java @@ -25,7 +25,7 @@ public class SwaggerAndOpenAPIWithCommonPrefixTest { @Test public void shouldWorkEvenWithCommonPrefix() { RestAssured.when().get("/swagger-ui/index.html").then().statusCode(200).body(containsString("/swagger")); - RestAssured.when().get("/swagger").then().statusCode(200) + RestAssured.when().get("/q/swagger").then().statusCode(200) .body(containsString("/resource"), containsString("QUERY_PARAM_1")); } } \ No newline at end of file diff --git a/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiProcessor.java b/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiProcessor.java index 75585f51fbf72..ee15b1a16dd82 100644 --- a/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiProcessor.java +++ b/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiProcessor.java @@ -22,6 +22,7 @@ import io.quarkus.smallrye.openapi.common.deployment.SmallRyeOpenApiConfig; import io.quarkus.swaggerui.runtime.SwaggerUiRecorder; import io.quarkus.swaggerui.runtime.SwaggerUiRuntimeConfig; +import io.quarkus.vertx.http.deployment.FrameworkRootPathBuildItem; import io.quarkus.vertx.http.deployment.HttpRootPathBuildItem; import io.quarkus.vertx.http.deployment.RouteBuildItem; import io.quarkus.vertx.http.deployment.devmode.NotFoundPageDisplayableEndpointBuildItem; @@ -52,6 +53,7 @@ public void getSwaggerUiFinalDestination( BuildProducer generatedResources, BuildProducer nativeImageResourceBuildItemBuildProducer, BuildProducer swaggerUiBuildProducer, + FrameworkRootPathBuildItem frameworkRootPathBuildItem, HttpRootPathBuildItem httpRootPathBuildItem, BuildProducer displayableEndpoints, CurateOutcomeBuildItem curateOutcomeBuildItem, @@ -65,7 +67,7 @@ public void getSwaggerUiFinalDestination( "quarkus.swagger-ui.path was set to \"/\", this is not allowed as it blocks the application from serving anything else."); } - String openApiPath = httpRootPathBuildItem.adjustPath(openapi.path); + String openApiPath = frameworkRootPathBuildItem.adjustPath(openapi.path); AppArtifact artifact = WebJarUtil.getAppArtifact(curateOutcomeBuildItem, SWAGGER_UI_WEBJAR_GROUP_ID, SWAGGER_UI_WEBJAR_ARTIFACT_ID); @@ -115,8 +117,16 @@ public void registerSwaggerUiHandler(SwaggerUiRecorder recorder, finalDestinationBuildItem.getSwaggerUiPath(), runtimeConfig); - routes.produce(new RouteBuildItem(swaggerUiConfig.path, handler)); - routes.produce(new RouteBuildItem(swaggerUiConfig.path + "/*", handler)); + routes.produce( + new RouteBuildItem.Builder() + .route(swaggerUiConfig.path) + .handler(handler) + .build()); + routes.produce( + new RouteBuildItem.Builder() + .route(swaggerUiConfig.path + "/*") + .handler(handler) + .build()); } } diff --git a/extensions/swagger-ui/deployment/src/test/java/io/quarkus/swaggerui/deployment/CustomHttpRootTest.java b/extensions/swagger-ui/deployment/src/test/java/io/quarkus/swaggerui/deployment/CustomHttpRootTest.java index e44ed275af59d..28a912bbb7886 100644 --- a/extensions/swagger-ui/deployment/src/test/java/io/quarkus/swaggerui/deployment/CustomHttpRootTest.java +++ b/extensions/swagger-ui/deployment/src/test/java/io/quarkus/swaggerui/deployment/CustomHttpRootTest.java @@ -20,7 +20,7 @@ public class CustomHttpRootTest { @Test public void shouldUseCustomConfig() { - RestAssured.when().get("/swagger-ui").then().statusCode(200).body(containsString("/foo/openapi")); - RestAssured.when().get("/swagger-ui/index.html").then().statusCode(200).body(containsString("/foo/openapi")); + RestAssured.when().get("/swagger-ui").then().statusCode(200).body(containsString("/q/openapi")); + RestAssured.when().get("/swagger-ui/index.html").then().statusCode(200).body(containsString("/q/openapi")); } } diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/FrameworkRootPathBuildItem.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/FrameworkRootPathBuildItem.java new file mode 100644 index 0000000000000..1ad1594a892d1 --- /dev/null +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/FrameworkRootPathBuildItem.java @@ -0,0 +1,33 @@ +package io.quarkus.vertx.http.deployment; + +import io.quarkus.builder.item.SimpleBuildItem; + +public final class FrameworkRootPathBuildItem extends SimpleBuildItem { + private final String frameworkRootPath; + private final boolean separateRoot; + + public FrameworkRootPathBuildItem(String frameworkRootPath) { + this.frameworkRootPath = frameworkRootPath; + this.separateRoot = frameworkRootPath != null + && !frameworkRootPath.equals("") + && !frameworkRootPath.equals("/"); + } + + public String getFrameworkRootPath() { + return frameworkRootPath; + } + + public boolean isSeparateRoot() { + return separateRoot; + } + + public String adjustPath(String path) { + if (!path.startsWith("/")) { + throw new IllegalArgumentException("Path must start with /"); + } + if (frameworkRootPath.equals("/")) { + return path; + } + return frameworkRootPath + path; + } +} diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/RouteBuildItem.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/RouteBuildItem.java index 544e93d6db884..306366a0b7011 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/RouteBuildItem.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/RouteBuildItem.java @@ -15,39 +15,64 @@ public final class RouteBuildItem extends MultiBuildItem { private final Function routeFunction; private final Handler handler; private final HandlerType type; + private final boolean frameworkRoute; + /** + * @deprecated Use the Builder instead. + */ @Deprecated - public RouteBuildItem(Function routeFunction, Handler handler, HandlerType type, - boolean resume) { - this.routeFunction = routeFunction; - this.handler = handler; - this.type = type; - } - public RouteBuildItem(Function routeFunction, Handler handler, HandlerType type) { - this(routeFunction, handler, type, true); + this(routeFunction, handler, type, false); } + /** + * @deprecated Use the Builder instead. + */ + @Deprecated public RouteBuildItem(Function routeFunction, Handler handler) { this(routeFunction, handler, HandlerType.NORMAL); } + /** + * @deprecated Use the Builder instead. + */ + @Deprecated public RouteBuildItem(String route, Handler handler, HandlerType type, boolean resume) { - this(new BasicRoute(route), handler, type, resume); + this(new BasicRoute(route), handler, type); } + /** + * @deprecated Use the Builder instead. + */ + @Deprecated public RouteBuildItem(String route, Handler handler, HandlerType type) { this(new BasicRoute(route), handler, type); } + /** + * @deprecated Use the Builder instead. + */ + @Deprecated public RouteBuildItem(String route, Handler handler, boolean resume) { - this(new BasicRoute(route), handler, HandlerType.NORMAL, resume); + this(new BasicRoute(route), handler, HandlerType.NORMAL); } + /** + * @deprecated Use the Builder instead. + */ + @Deprecated public RouteBuildItem(String route, Handler handler) { this(new BasicRoute(route), handler); } + private RouteBuildItem(Function routeFunction, Handler handler, HandlerType type, + boolean frameworkRoute) { + this.routeFunction = routeFunction; + this.handler = handler; + this.type = type; + this.frameworkRoute = frameworkRoute; + } + public Handler getHandler() { return handler; } @@ -59,4 +84,54 @@ public HandlerType getType() { public Function getRouteFunction() { return routeFunction; } + + public boolean isFrameworkRoute() { + return frameworkRoute; + } + + public static class Builder { + private Function routeFunction; + private Handler handler; + private HandlerType type = HandlerType.NORMAL; + private boolean frameworkRoute = false; + + public Builder routeFunction(Function routeFunction) { + this.routeFunction = routeFunction; + return this; + } + + public Builder route(String route) { + this.routeFunction = new BasicRoute(route); + return this; + } + + public Builder handler(Handler handler) { + this.handler = handler; + return this; + } + + public Builder handlerType(HandlerType handlerType) { + this.type = handlerType; + return this; + } + + public Builder blockingRoute() { + this.type = HandlerType.BLOCKING; + return this; + } + + public Builder failureRoute() { + this.type = HandlerType.FAILURE; + return this; + } + + public Builder nonApplicationRoute() { + this.frameworkRoute = true; + return this; + } + + public RouteBuildItem build() { + return new RouteBuildItem(routeFunction, handler, type, frameworkRoute); + } + } } diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxFrameworkRouterBuildItem.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxFrameworkRouterBuildItem.java new file mode 100644 index 0000000000000..a462120706d59 --- /dev/null +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxFrameworkRouterBuildItem.java @@ -0,0 +1,18 @@ +package io.quarkus.vertx.http.deployment; + +import io.quarkus.builder.item.SimpleBuildItem; +import io.quarkus.runtime.RuntimeValue; +import io.vertx.ext.web.Router; + +public final class VertxFrameworkRouterBuildItem extends SimpleBuildItem { + + private RuntimeValue router; + + VertxFrameworkRouterBuildItem(RuntimeValue router) { + this.router = router; + } + + public RuntimeValue getRouter() { + return router; + } +} diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java index 0d7907fa983e5..d38c460d75407 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java @@ -78,6 +78,11 @@ HttpRootPathBuildItem httpRoot(HttpBuildTimeConfig httpBuildTimeConfig) { return new HttpRootPathBuildItem(httpBuildTimeConfig.rootPath); } + @BuildStep + FrameworkRootPathBuildItem frameworkRoot(HttpBuildTimeConfig httpBuildTimeConfig) { + return new FrameworkRootPathBuildItem(httpBuildTimeConfig.frameworkRootPath); + } + @BuildStep @Record(ExecutionTime.RUNTIME_INIT) FilterBuildItem cors(CORSRecorder recorder, HttpConfiguration configuration) { @@ -117,11 +122,25 @@ public KubernetesPortBuildItem kubernetes() { VertxWebRouterBuildItem initializeRouter(VertxHttpRecorder recorder, CoreVertxBuildItem vertx, List routes, + FrameworkRootPathBuildItem frameworkRootPath, + BuildProducer frameworkRouterBuildProducer, ShutdownContextBuildItem shutdown) { RuntimeValue router = recorder.initializeRouter(vertx.getVertx()); + RuntimeValue frameworkRouter = recorder.initializeRouter(vertx.getVertx()); + boolean frameworkRouterFound = false; + for (RouteBuildItem route : routes) { - recorder.addRoute(router, route.getRouteFunction(), route.getHandler(), route.getType()); + if (frameworkRootPath.isSeparateRoot() && route.isFrameworkRoute()) { + frameworkRouterFound = true; + recorder.addRoute(frameworkRouter, route.getRouteFunction(), route.getHandler(), route.getType()); + } else { + recorder.addRoute(router, route.getRouteFunction(), route.getHandler(), route.getType()); + } + } + + if (frameworkRouterFound) { + frameworkRouterBuildProducer.produce(new VertxFrameworkRouterBuildItem(frameworkRouter)); } return new VertxWebRouterBuildItem(router); @@ -140,6 +159,8 @@ ServiceStartBuildItem finalizeRouter( LaunchModeBuildItem launchMode, List defaultRoutes, List filters, VertxWebRouterBuildItem router, + Optional frameworkRouter, + FrameworkRootPathBuildItem frameworkRootPathBuildItem, HttpBuildTimeConfig httpBuildTimeConfig, HttpConfiguration httpConfiguration, List requireBodyHandlerBuildItems, BodyHandlerBuildItem bodyHandlerBuildItem, @@ -174,6 +195,12 @@ ServiceStartBuildItem finalizeRouter( Handler bodyHandler = !requireBodyHandlerBuildItems.isEmpty() ? bodyHandlerBuildItem.getHandler() : null; + if (frameworkRouter.isPresent()) { + recorder.mountFrameworkRouter(router.getRouter(), + frameworkRouter.get().getRouter(), + frameworkRootPathBuildItem.getFrameworkRootPath()); + } + recorder.finalizeRouter(beanContainer.getValue(), defaultRoute.map(DefaultRouteBuildItem::getRoute).orElse(null), listOfFilters, vertx.getVertx(), lrc, router.getRouter(), httpBuildTimeConfig.rootPath, diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HttpBuildTimeConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HttpBuildTimeConfig.java index 4e9b881c9e900..6fda289c12de3 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HttpBuildTimeConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/HttpBuildTimeConfig.java @@ -35,4 +35,13 @@ public class HttpBuildTimeConfig { */ @ConfigItem(defaultValue = "/quarkus") public String consolePath; + + /** + * The HTTP root path for framework endpoints. Various endpoints such as metrics, health, + * and open api are deployed under this path. + * Setting the value to "/" disables the separate framework root, + * resulting in all framework endpoints being served from "/" along with the application. + */ + @ConfigItem(defaultValue = "/q") + public String frameworkRootPath; } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java index ce5e8b2de692a..e33b4bf3fdd98 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java @@ -250,6 +250,11 @@ public void startServer(Supplier vertx, ShutdownContext shutdown, } } + public void mountFrameworkRouter(RuntimeValue mainRouter, RuntimeValue frameworkRouter, + String frameworkPath) { + mainRouter.getValue().mountSubRouter(frameworkPath, frameworkRouter.getValue()); + } + public void finalizeRouter(BeanContainer container, Consumer defaultRouteHandler, List filterList, Supplier vertx, LiveReloadConfig liveReloadConfig, diff --git a/integration-tests/artemis-core/src/test/java/io/quarkus/it/artemis/ArtemisHealthCheckTest.java b/integration-tests/artemis-core/src/test/java/io/quarkus/it/artemis/ArtemisHealthCheckTest.java index c641e781346c4..131c0521b3f62 100644 --- a/integration-tests/artemis-core/src/test/java/io/quarkus/it/artemis/ArtemisHealthCheckTest.java +++ b/integration-tests/artemis-core/src/test/java/io/quarkus/it/artemis/ArtemisHealthCheckTest.java @@ -21,7 +21,7 @@ public class ArtemisHealthCheckTest { @Test public void test() { - Response response = RestAssured.with().get("/health/ready"); + Response response = RestAssured.with().get("/q/health/ready"); Assertions.assertEquals(Status.OK.getStatusCode(), response.statusCode()); Map body = response.as(new TypeRef>() { diff --git a/integration-tests/artemis-jms/src/test/java/io/quarkus/it/artemis/ArtemisHealthCheckTest.java b/integration-tests/artemis-jms/src/test/java/io/quarkus/it/artemis/ArtemisHealthCheckTest.java index ba46719e31f66..26c266fcdc397 100644 --- a/integration-tests/artemis-jms/src/test/java/io/quarkus/it/artemis/ArtemisHealthCheckTest.java +++ b/integration-tests/artemis-jms/src/test/java/io/quarkus/it/artemis/ArtemisHealthCheckTest.java @@ -21,7 +21,7 @@ public class ArtemisHealthCheckTest { @Test public void test() { - Response response = RestAssured.with().get("/health/ready"); + Response response = RestAssured.with().get("/q/health/ready"); Assertions.assertEquals(Status.OK.getStatusCode(), response.statusCode()); Map body = response.as(new TypeRef>() { diff --git a/integration-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/PanacheFunctionalityTest.java b/integration-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/PanacheFunctionalityTest.java index 0052834825d9d..d6a62d946eb01 100644 --- a/integration-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/PanacheFunctionalityTest.java +++ b/integration-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/PanacheFunctionalityTest.java @@ -181,7 +181,7 @@ public void testBug9036() { @Test public void testMetrics() { RestAssured.when() - .get("/metrics") + .get("/q/metrics") .then() .body(containsString("vendor_hibernate_cache_update_timestamps_requests_total{entityManagerFactory=\"" + PersistenceUnitUtil.DEFAULT_PERSISTENCE_UNIT_NAME + "\",result=\"miss\"}")); diff --git a/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsStartupFailureTest.java b/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsStartupFailureTest.java index 5f3f1669b4473..147e6ebead36c 100644 --- a/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsStartupFailureTest.java +++ b/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsStartupFailureTest.java @@ -38,7 +38,7 @@ public class KafkaStreamsStartupFailureTest { @Timeout(5) public void testShutdownBeforeKStreamsStarted() throws Exception { assertEquals(State.CREATED, kafkaStreams.state()); - RestAssured.get("/health/ready").then() + RestAssured.get("/q/health/ready").then() .statusCode(HttpStatus.SC_SERVICE_UNAVAILABLE) .body("checks[0].name", CoreMatchers.is("Kafka Streams topics health check")) .body("checks[0].status", CoreMatchers.is("DOWN")) diff --git a/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsTest.java b/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsTest.java index 24ab982e973ab..35f57feacfb00 100644 --- a/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsTest.java +++ b/integration-tests/kafka-streams/src/test/java/io/quarkus/it/kafka/streams/KafkaStreamsTest.java @@ -147,42 +147,42 @@ record = records.get(3); private void testMetricsPresent() { // Look for kafka consumer metrics (add .log().all() to examine what they are - RestAssured.when().get("/metrics").then() + RestAssured.when().get("/q/metrics").then() .statusCode(200) .body(containsString("kafka_stream_")); } public void testKafkaStreamsNotAliveAndNotReady() throws Exception { - RestAssured.get("/health/ready").then() + RestAssured.get("/q/health/ready").then() .statusCode(HttpStatus.SC_SERVICE_UNAVAILABLE) .body("checks[0].name", CoreMatchers.is("Kafka Streams topics health check")) .body("checks[0].status", CoreMatchers.is("DOWN")) .body("checks[0].data.missing_topics", CoreMatchers.is("streams-test-customers,streams-test-categories")); - RestAssured.when().get("/health/live").then() + RestAssured.when().get("/q/health/live").then() .statusCode(HttpStatus.SC_SERVICE_UNAVAILABLE) .body("checks[0].name", CoreMatchers.is("Kafka Streams state health check")) .body("checks[0].status", CoreMatchers.is("DOWN")) .body("checks[0].data.state", CoreMatchers.is("CREATED")); - RestAssured.when().get("/health").then() + RestAssured.when().get("/q/health").then() .statusCode(HttpStatus.SC_SERVICE_UNAVAILABLE); } public void testKafkaStreamsAliveAndReady() throws Exception { - RestAssured.get("/health/ready").then() + RestAssured.get("/q/health/ready").then() .statusCode(HttpStatus.SC_OK) .body("checks[0].name", CoreMatchers.is("Kafka Streams topics health check")) .body("checks[0].status", CoreMatchers.is("UP")) .body("checks[0].data.available_topics", CoreMatchers.is("streams-test-categories,streams-test-customers")); - RestAssured.when().get("/health/live").then() + RestAssured.when().get("/q/health/live").then() .statusCode(HttpStatus.SC_OK) .body("checks[0].name", CoreMatchers.is("Kafka Streams state health check")) .body("checks[0].status", CoreMatchers.is("UP")) .body("checks[0].data.state", CoreMatchers.is("RUNNING")); - RestAssured.when().get("/health").then() + RestAssured.when().get("/q/health").then() .statusCode(HttpStatus.SC_OK); } diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KnativeWithHealthTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KnativeWithHealthTest.java index 84963b56b933d..cf2a6c4178057 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KnativeWithHealthTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KnativeWithHealthTest.java @@ -64,14 +64,14 @@ public void assertGeneratedResources() throws IOException { }); assertThat(c.getReadinessProbe()).isNotNull().satisfies(p -> { assertThat(p.getInitialDelaySeconds()).isEqualTo(0); - assertProbePath(p, "/health/ready"); + assertProbePath(p, "/q/health/ready"); assertNotNull(p.getHttpGet()); assertNull(p.getHttpGet().getPort()); }); assertThat(c.getLivenessProbe()).isNotNull().satisfies(p -> { assertThat(p.getInitialDelaySeconds()).isEqualTo(20); - assertProbePath(p, "/health/live"); + assertProbePath(p, "/q/health/live"); assertNotNull(p.getHttpGet()); assertNull(p.getHttpGet().getPort()); diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithHealthAndJibTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithHealthAndJibTest.java index 280350cf0dbe1..4ea49ab62364f 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithHealthAndJibTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithHealthAndJibTest.java @@ -57,10 +57,10 @@ public void assertGeneratedResources() throws IOException { assertThat(t.getSpec()).satisfies(podSpec -> { assertThat(podSpec.getContainers()).singleElement().satisfies(container -> { assertThat(container.getReadinessProbe()).isNotNull().satisfies(p -> { - assertProbePath(p, "/health/ready"); + assertProbePath(p, "/q/health/ready"); }); assertThat(container.getLivenessProbe()).isNotNull().satisfies(p -> { - assertProbePath(p, "/health/live"); + assertProbePath(p, "/q/health/live"); }); assertThat(container.getImagePullPolicy()).isEqualTo("Always"); }); diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithHealthTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithHealthTest.java index 9ccf05e7390ce..af0b2a0d66a8e 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithHealthTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithHealthTest.java @@ -77,14 +77,14 @@ public void assertGeneratedResources() throws IOException { assertThat(podSpec.getContainers()).singleElement().satisfies(container -> { assertThat(container.getReadinessProbe()).isNotNull().satisfies(p -> { assertThat(p.getInitialDelaySeconds()).isEqualTo(0); - assertProbePath(p, "/health/ready"); + assertProbePath(p, "/q/health/ready"); assertNotNull(p.getHttpGet()); assertEquals(p.getHttpGet().getPort().getIntVal(), 9090); }); assertThat(container.getLivenessProbe()).isNotNull().satisfies(p -> { assertThat(p.getInitialDelaySeconds()).isEqualTo(20); - assertProbePath(p, "/health/live"); + assertProbePath(p, "/q/health/live"); assertNotNull(p.getHttpGet()); assertEquals(p.getHttpGet().getPort().getIntVal(), 9090); diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithRootAndHealthTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithRootAndHealthTest.java index 0ce0c8bf4bb32..88653566a76b8 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithRootAndHealthTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithRootAndHealthTest.java @@ -54,10 +54,10 @@ public void assertGeneratedResources() throws IOException { assertThat(t.getSpec()).satisfies(podSpec -> { assertThat(podSpec.getContainers()).singleElement().satisfies(container -> { assertThat(container.getReadinessProbe()).satisfies(p -> { - assertProbePath(p, "/api/health/ready"); + assertProbePath(p, "/q/health/ready"); }); assertThat(container.getLivenessProbe()).satisfies(p -> { - assertProbePath(p, "/api/health/liveness"); + assertProbePath(p, "/q/health/liveness"); }); }); }); diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithHealthTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithHealthTest.java index 79c9843401c98..cbf2aa897bca1 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithHealthTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithHealthTest.java @@ -74,7 +74,7 @@ public void assertGeneratedResources() throws IOException { assertThat(container.getReadinessProbe()).isNotNull().satisfies(p -> { assertThat(p.getPeriodSeconds()).isEqualTo(10); assertThat(p.getHttpGet()).satisfies(h1 -> { - assertThat(h1.getPath()).isEqualTo("/health/ready"); + assertThat(h1.getPath()).isEqualTo("/q/health/ready"); }); }); assertThat(container.getLivenessProbe()).isNotNull().satisfies(p -> { diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/HealthTestCase.java b/integration-tests/main/src/test/java/io/quarkus/it/main/HealthTestCase.java index 7cf6b2a9989fd..5b4a84168daf4 100644 --- a/integration-tests/main/src/test/java/io/quarkus/it/main/HealthTestCase.java +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/HealthTestCase.java @@ -16,35 +16,35 @@ public class HealthTestCase { @Test public void testHealthCheck() { try { - RestAssured.when().get("/health/live").then() + RestAssured.when().get("/q/health/live").then() .contentType(ContentType.JSON) .header("Content-Type", containsString("charset=UTF-8")) .body("status", is("UP"), "checks.status", containsInAnyOrder("UP", "UP"), "checks.name", containsInAnyOrder("basic", "basic-with-builder")); - RestAssured.when().get("/health/ready").then() + RestAssured.when().get("/q/health/ready").then() .contentType(ContentType.JSON) .header("Content-Type", containsString("charset=UTF-8")) .body("status", is("UP"), "checks.status", containsInAnyOrder("UP"), "checks.name", containsInAnyOrder("Database connections health check")); - RestAssured.when().get("/health/group/group1").then() + RestAssured.when().get("/q/health/group/group1").then() .contentType(ContentType.JSON) .header("Content-Type", containsString("charset=UTF-8")) .body("status", is("UP"), "checks.status", containsInAnyOrder("UP", "UP"), "checks.name", containsInAnyOrder("single", "combined")); - RestAssured.when().get("/health/group/group2").then() + RestAssured.when().get("/q/health/group/group2").then() .contentType(ContentType.JSON) .header("Content-Type", containsString("charset=UTF-8")) .body("status", is("UP"), "checks.status", containsInAnyOrder("UP"), "checks.name", containsInAnyOrder("combined")); - RestAssured.when().get("/health/group").then() + RestAssured.when().get("/q/health/group").then() .contentType(ContentType.JSON) .header("Content-Type", containsString("charset=UTF-8")) .body("status", is("UP"), diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/OpenApiTestCase.java b/integration-tests/main/src/test/java/io/quarkus/it/main/OpenApiTestCase.java index 63264a2eb0b79..18e328346355a 100644 --- a/integration-tests/main/src/test/java/io/quarkus/it/main/OpenApiTestCase.java +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/OpenApiTestCase.java @@ -22,7 +22,7 @@ public class OpenApiTestCase { private static final String DEFAULT_MEDIA_TYPE = "application/json"; - @TestHTTPResource("openapi") + @TestHTTPResource("q/openapi") URL uri; @Test diff --git a/integration-tests/micrometer-mp-metrics/src/test/java/io/quarkus/it/micrometer/mpmetrics/MPMetricsTest.java b/integration-tests/micrometer-mp-metrics/src/test/java/io/quarkus/it/micrometer/mpmetrics/MPMetricsTest.java index 38af8afa3ed0e..3bd6bff0f5a81 100644 --- a/integration-tests/micrometer-mp-metrics/src/test/java/io/quarkus/it/micrometer/mpmetrics/MPMetricsTest.java +++ b/integration-tests/micrometer-mp-metrics/src/test/java/io/quarkus/it/micrometer/mpmetrics/MPMetricsTest.java @@ -47,7 +47,7 @@ void callPrimeGen_3() { @Order(4) void validateMetricsOutput_1() { given() - .when().get("/metrics") + .when().get("/q/metrics") .then() .statusCode(200) @@ -84,7 +84,7 @@ void callPrimeGen_4() { @Order(6) void validateMetricsOutput_2() { given() - .when().get("/metrics") + .when().get("/q/metrics") .then() .log().body() .statusCode(200) @@ -103,7 +103,7 @@ void validateMetricsOutput_2() { void validateJsonOutput() { given() .header("Accept", "application/json") - .when().get("/metrics") + .when().get("/q/metrics") .then() .log().body() .statusCode(200) diff --git a/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/PrometheusMetricsRegistryTest.java b/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/PrometheusMetricsRegistryTest.java index 3982a70db294a..95cd2e7667c09 100644 --- a/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/PrometheusMetricsRegistryTest.java +++ b/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/PrometheusMetricsRegistryTest.java @@ -95,7 +95,7 @@ void testAllTheThings() { @Order(10) void testPrometheusScrapeEndpoint() { given() - .when().get("/metrics") + .when().get("/q/metrics") .then() .statusCode(200) diff --git a/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/BookResourceTest.java b/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/BookResourceTest.java index 0f089631b1513..a46fbd778b4b1 100644 --- a/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/BookResourceTest.java +++ b/integration-tests/mongodb-client/src/test/java/io/quarkus/it/mongodb/BookResourceTest.java @@ -43,7 +43,7 @@ public void testReactiveClients() { @Test public void health() throws Exception { - RestAssured.when().get("/health/ready").then() + RestAssured.when().get("/q/health/ready").then() .body("status", is("UP"), "checks.data", containsInAnyOrder(hasKey(MongoHealthCheck.CLIENT_DEFAULT)), "checks.data", containsInAnyOrder(hasKey(MongoHealthCheck.CLIENT_DEFAULT_REACTIVE)), diff --git a/integration-tests/smallrye-metrics/src/test/java/io/quarkus/it/metrics/MetricsOnClassTestCase.java b/integration-tests/smallrye-metrics/src/test/java/io/quarkus/it/metrics/MetricsOnClassTestCase.java index 3c11a738bc290..ad13ca45399b6 100644 --- a/integration-tests/smallrye-metrics/src/test/java/io/quarkus/it/metrics/MetricsOnClassTestCase.java +++ b/integration-tests/smallrye-metrics/src/test/java/io/quarkus/it/metrics/MetricsOnClassTestCase.java @@ -23,12 +23,12 @@ public void testCounterOnConstructor() { } private void assertMetricExactValue(String scope, String name, String expectedNameInOutput, String val) { - RestAssured.when().get("/metrics/" + scope + "/" + name).then() + RestAssured.when().get("/q/metrics/" + scope + "/" + name).then() .body(containsString(expectedNameInOutput + " " + val)); } private void assertMetricExists(String scope, String name, String expectedNameInOutput) { - RestAssured.when().get("/metrics/" + scope + "/" + name).then() + RestAssured.when().get("/q/metrics/" + scope + "/" + name).then() .body(containsString(expectedNameInOutput + " ")); } diff --git a/integration-tests/smallrye-metrics/src/test/java/io/quarkus/it/metrics/MetricsTestCase.java b/integration-tests/smallrye-metrics/src/test/java/io/quarkus/it/metrics/MetricsTestCase.java index 75e6529f7eca7..0ffc3daec8c7e 100644 --- a/integration-tests/smallrye-metrics/src/test/java/io/quarkus/it/metrics/MetricsTestCase.java +++ b/integration-tests/smallrye-metrics/src/test/java/io/quarkus/it/metrics/MetricsTestCase.java @@ -96,9 +96,9 @@ public void testHistogram() { @Test public void testScopes() { - RestAssured.when().get("/metrics/base").then().statusCode(200); - RestAssured.when().get("/metrics/vendor").then().statusCode(200); - RestAssured.when().get("/metrics/application").then().statusCode(200); + RestAssured.when().get("/q/metrics/base").then().statusCode(200); + RestAssured.when().get("/q/metrics/vendor").then().statusCode(200); + RestAssured.when().get("/q/metrics/application").then().statusCode(200); } @Test @@ -115,15 +115,15 @@ public void testMetricWithCustomTags() { @Test public void testInvalidScopes() { - RestAssured.when().get("/metrics/foo").then().statusCode(404) + RestAssured.when().get("/q/metrics/foo").then().statusCode(404) .body(containsString("Scope foo not found")); - RestAssured.when().get("/metrics/vendor/foo").then().statusCode(404) + RestAssured.when().get("/q/metrics/vendor/foo").then().statusCode(404) .body(containsString("Metric vendor/foo not found")); } @Test public void testBaseMetrics() { - RestAssured.when().get("/metrics/base").then().statusCode(200) + RestAssured.when().get("/q/metrics/base").then().statusCode(200) // the spaces at the end are there on purpose to make sure the metrics are named exactly this way .body(containsString("base_classloader_loadedClasses_total ")) .body(containsString("base_cpu_systemLoadAverage ")) @@ -141,7 +141,7 @@ public void testBaseMetrics() { @Test public void testVendorMetrics() { - RestAssured.when().get("/metrics/vendor").then().statusCode(200) + RestAssured.when().get("/q/metrics/vendor").then().statusCode(200) // the spaces at the end are there on purpose to make sure the metrics are named exactly this way .body(containsString("vendor_memory_committedNonHeap_bytes ")) .body(containsString("vendor_memory_usedNonHeap_bytes ")) @@ -164,7 +164,7 @@ public void testEndpointWithMetricsThrowingException() { */ @Test public void testNoMetricsFromSmallRyeInternalClasses() { - RestAssured.when().get("/metrics/application").then() + RestAssured.when().get("/q/metrics/application").then() .body(not(containsString("io_smallrye_metrics"))); } @@ -186,12 +186,12 @@ public void testDummyGaugeNoReflectionAnnotation() { } private void assertMetricExactValue(String name, String val) { - RestAssured.when().get("/metrics").then() + RestAssured.when().get("/q/metrics").then() .body(containsString(name + " " + val)); } private void assertMetricExists(String name) { - RestAssured.when().get("/metrics").then() + RestAssured.when().get("/q/metrics").then() .body(containsString(name)); } diff --git a/tcks/microprofile-health/pom.xml b/tcks/microprofile-health/pom.xml index 50ccd22d069ac..2166efe596237 100644 --- a/tcks/microprofile-health/pom.xml +++ b/tcks/microprofile-health/pom.xml @@ -18,6 +18,10 @@ org.apache.maven.plugins maven-surefire-plugin + + + / + tck-suite.xml diff --git a/tcks/microprofile-metrics/optional/pom.xml b/tcks/microprofile-metrics/optional/pom.xml index d679e143f631d..b7f54678900bb 100644 --- a/tcks/microprofile-metrics/optional/pom.xml +++ b/tcks/microprofile-metrics/optional/pom.xml @@ -22,6 +22,8 @@ false true + + / false + + / diff --git a/tcks/microprofile-openapi/pom.xml b/tcks/microprofile-openapi/pom.xml index 37a893333db14..61feeed606d99 100644 --- a/tcks/microprofile-openapi/pom.xml +++ b/tcks/microprofile-openapi/pom.xml @@ -23,6 +23,8 @@ false http://localhost:8081 + + /