use of org.keycloak.testsuite.arquillian.annotation.AppServerContainers in project keycloak by keycloak.
the class AdapterTestExecutionDecider method getCorrespondingAnnotation.
private AppServerContainer getCorrespondingAnnotation(Method method) {
AppServerContainers multipleAnnotations = method.getAnnotation(AppServerContainers.class);
List<AppServerContainer> appServerContainers;
if (multipleAnnotations != null) {
// more than one @AppServerContainer annotation
appServerContainers = Arrays.asList(multipleAnnotations.value());
} else {
// single @AppServerContainer annotation
appServerContainers = Arrays.asList(method.getAnnotation(AppServerContainer.class));
}
return appServerContainers.stream().filter(annotation -> annotation.value().equals(testContextInstance.get().getAppServerContainerName())).findFirst().orElse(null);
}
use of org.keycloak.testsuite.arquillian.annotation.AppServerContainers in project keycloak by keycloak.
the class AdapterTestExecutionDecider method getCorrespondingAnnotation.
private AppServerContainer getCorrespondingAnnotation(Class testClass) {
Class<?> annotatedClass = AppServerTestEnricher.getNearestSuperclassWithAppServerAnnotation(testClass);
AppServerContainers multipleAnnotations = annotatedClass.getAnnotation(AppServerContainers.class);
List<AppServerContainer> appServerContainers;
if (multipleAnnotations != null) {
// more than one @AppServerContainer annotation
appServerContainers = Arrays.asList(multipleAnnotations.value());
} else {
// single @AppServerContainer annotation
appServerContainers = Arrays.asList(annotatedClass.getAnnotation(AppServerContainer.class));
}
return appServerContainers.stream().filter(annotation -> annotation.value().equals(testContextInstance.get().getAppServerContainerName())).findFirst().orElse(null);
}
use of org.keycloak.testsuite.arquillian.annotation.AppServerContainers in project keycloak by keycloak.
the class AppServerTestEnricher method getAppServerQualifiers.
public static Set<String> getAppServerQualifiers(Class testClass) {
Set<String> appServerQualifiers = new HashSet<>();
Class<?> annotatedClass = getNearestSuperclassWithAppServerAnnotation(testClass);
if (annotatedClass != null) {
AppServerContainer[] appServerContainers = annotatedClass.getAnnotationsByType(AppServerContainer.class);
for (AppServerContainer appServerContainer : appServerContainers) {
appServerQualifiers.add(appServerContainer.value());
}
}
for (Method method : testClass.getDeclaredMethods()) {
if (method.isAnnotationPresent(AppServerContainers.class)) {
for (AppServerContainer appServerContainer : method.getAnnotation(AppServerContainers.class).value()) {
appServerQualifiers.add(appServerContainer.value());
}
}
if (method.isAnnotationPresent(AppServerContainer.class)) {
appServerQualifiers.add(method.getAnnotation(AppServerContainer.class).value());
}
}
return appServerQualifiers;
}
Aggregations