diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/KeycloakContainerFeaturesController.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/KeycloakContainerFeaturesController.java index ccffbf14c2a6..22fd47aa7f49 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/KeycloakContainerFeaturesController.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/KeycloakContainerFeaturesController.java @@ -29,6 +29,7 @@ import java.util.Arrays; import java.util.HashSet; import java.util.Objects; +import java.util.Optional; import java.util.Set; import java.util.function.BiConsumer; import java.util.stream.Collectors; @@ -191,15 +192,17 @@ private void checkAnnotatedElementForFeatureAnnotations(AnnotatedElement annotat private Set getUpdateFeaturesSet(AnnotatedElement annotatedElement, State state) { Set ret = new HashSet<>(); + Profile activeProfile = Optional.ofNullable(Profile.getInstance()).orElse(Profile.defaults()); + ret.addAll(Arrays.stream(annotatedElement.getAnnotationsByType(EnableFeature.class)) .map(annotation -> { if (state == State.BEFORE) { - return new UpdateFeature(annotation.value(), annotation.skipRestart(),FeatureAction.ENABLE, annotatedElement); - } else if (Profile.getInstance().getDisabledFeatures().contains(annotation.value())) { + return new UpdateFeature(annotation.value(), annotation.skipRestart(), FeatureAction.ENABLE, annotatedElement); + } else if (activeProfile.getDisabledFeatures().contains(annotation.value())) { // only disable if it should be - return new UpdateFeature(annotation.value(), annotation.skipRestart(),FeatureAction.DISABLE_AND_RESET, annotatedElement); + return new UpdateFeature(annotation.value(), annotation.skipRestart(), FeatureAction.DISABLE_AND_RESET, annotatedElement); } else { - return new UpdateFeature(annotation.value(), annotation.skipRestart(),FeatureAction.ENABLE, annotatedElement); + return new UpdateFeature(annotation.value(), annotation.skipRestart(), FeatureAction.ENABLE, annotatedElement); } }) .collect(Collectors.toSet())); @@ -208,7 +211,7 @@ private Set getUpdateFeaturesSet(AnnotatedElement annotatedElemen .map(annotation -> { if (state == State.BEFORE) { return new UpdateFeature(annotation.value(), annotation.skipRestart(), FeatureAction.DISABLE, annotatedElement); - } else if (Profile.getInstance().getDisabledFeatures().contains(annotation.value())) { + } else if (activeProfile.getDisabledFeatures().contains(annotation.value())) { // we do not want to enable features that should be disabled by default return new UpdateFeature(annotation.value(), annotation.skipRestart(), FeatureAction.DISABLE_AND_RESET, annotatedElement); } else {