From c70dc0e72db733429665588b28fcc750f30f9e3d Mon Sep 17 00:00:00 2001 From: Dominik Guhr Date: Tue, 14 Dec 2021 11:02:44 +0100 Subject: [PATCH] Add IsIntegrationTest BuildStep Annotation --- .../quarkus/deployment/IsIntegrationTest.java | 19 +++++++++++++++++++ ...ugmentation.java => IsReAugmentation.java} | 2 +- .../quarkus/deployment/KeycloakProcessor.java | 6 +++--- .../health/KeycloakReadyHealthCheckTest.java | 9 --------- .../TestKeycloakConfigSourceProvider.java | 2 +- 5 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/IsIntegrationTest.java rename quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/{isReAugmentation.java => IsReAugmentation.java} (93%) diff --git a/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/IsIntegrationTest.java b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/IsIntegrationTest.java new file mode 100644 index 0000000000..19a3522a5b --- /dev/null +++ b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/IsIntegrationTest.java @@ -0,0 +1,19 @@ +package org.keycloak.quarkus.deployment; + +import io.quarkus.deployment.IsTest; +import io.quarkus.runtime.LaunchMode; + +import static org.keycloak.quarkus.runtime.Environment.LAUNCH_MODE; + +public class IsIntegrationTest extends IsTest { + + public IsIntegrationTest(LaunchMode launchMode) { + super(launchMode); + } + + @Override + public boolean getAsBoolean() { + return super.getAsBoolean() && (System.getProperty(LAUNCH_MODE) != null && System.getProperty(LAUNCH_MODE).equals("test")); + } + +} diff --git a/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/isReAugmentation.java b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/IsReAugmentation.java similarity index 93% rename from quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/isReAugmentation.java rename to quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/IsReAugmentation.java index f97c8a444f..6d065d8158 100644 --- a/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/isReAugmentation.java +++ b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/IsReAugmentation.java @@ -20,7 +20,7 @@ package org.keycloak.quarkus.deployment; import java.util.function.BooleanSupplier; import org.keycloak.quarkus.runtime.Environment; -public class isReAugmentation implements BooleanSupplier { +public class IsReAugmentation implements BooleanSupplier { @Override public boolean getAsBoolean() { diff --git a/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java index 8c84ef577e..2398dbbd34 100644 --- a/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java +++ b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java @@ -267,12 +267,12 @@ class KeycloakProcessor { * * @param configSources */ - @BuildStep(onlyIf = IsNormal.class) + @BuildStep(onlyIfNot = IsIntegrationTest.class ) void configureConfigSources(BuildProducer configSources) { configSources.produce(new StaticInitConfigSourceProviderBuildItem(KeycloakConfigSourceProvider.class.getName())); } - @BuildStep(onlyIf = IsTest.class) + @BuildStep(onlyIf = IsIntegrationTest.class) void prepareTestEnvironment(BuildProducer configSources) { configSources.produce(new StaticInitConfigSourceProviderBuildItem("org.keycloak.quarkus.runtime.configuration.test.TestKeycloakConfigSourceProvider")); } @@ -281,7 +281,7 @@ class KeycloakProcessor { *

Make the build time configuration available at runtime so that the server can run without having to specify some of * the properties again. */ - @BuildStep(onlyIf = isReAugmentation.class) + @BuildStep(onlyIf = IsReAugmentation.class) void persistBuildTimeProperties(BuildProducer resources) { Properties properties = new Properties(); diff --git a/quarkus/deployment/src/test/java/test/org/keycloak/quarkus/services/health/KeycloakReadyHealthCheckTest.java b/quarkus/deployment/src/test/java/test/org/keycloak/quarkus/services/health/KeycloakReadyHealthCheckTest.java index 0600d12a2b..ad485e72da 100644 --- a/quarkus/deployment/src/test/java/test/org/keycloak/quarkus/services/health/KeycloakReadyHealthCheckTest.java +++ b/quarkus/deployment/src/test/java/test/org/keycloak/quarkus/services/health/KeycloakReadyHealthCheckTest.java @@ -52,13 +52,4 @@ public class KeycloakReadyHealthCheckTest { .statusCode(200) .body(Matchers.containsString("UP")); } - - @Test - @Disabled // Temporarily disabled. See KEYCLOAK-16382 and https://github.com/quarkusio/quarkus/issues/14705 - public void testMetricsUp() { - given() - .when().get("/metrics") - .then() - .statusCode(200); - } } diff --git a/quarkus/tests/integration/src/main/java/org/keycloak/quarkus/runtime/configuration/test/TestKeycloakConfigSourceProvider.java b/quarkus/tests/integration/src/main/java/org/keycloak/quarkus/runtime/configuration/test/TestKeycloakConfigSourceProvider.java index 4153e7046b..b7476f4e4a 100644 --- a/quarkus/tests/integration/src/main/java/org/keycloak/quarkus/runtime/configuration/test/TestKeycloakConfigSourceProvider.java +++ b/quarkus/tests/integration/src/main/java/org/keycloak/quarkus/runtime/configuration/test/TestKeycloakConfigSourceProvider.java @@ -46,4 +46,4 @@ public class TestKeycloakConfigSourceProvider extends KeycloakConfigSourceProvid } }).collect(Collectors.toList()); } -} \ No newline at end of file +}