use of com.sequenceiq.authorization.service.ResourcePropertyProvider in project cloudbreak by hortonworks.
the class EnforcePropertyProviderTestUtil method validationAnnotationByProvider.
private static <T extends ResourcePropertyProvider> Optional<Class<? extends ResourcePropertyProvider>> validationAnnotationByProvider(Class<T> propertyProviderClass, Set<Predicate<Annotation>> validationPredicates, Annotation annotation) {
AuthorizationResourceAction action = getAction(annotation);
AuthorizationResourceType authorizationResourceType = action.getAuthorizationResourceType();
if (validationPredicates.stream().allMatch(predicate -> predicate.test(annotation))) {
return PROVIDER_SUBTYPES_MAP.get(propertyProviderClass).stream().filter(type -> {
ResourcePropertyProvider resourcePropertyProvider = (T) EnforceAuthorizationTestUtil.getSampleObjectFactory().manufacturePojo(type);
return authorizationResourceType.equals(resourcePropertyProvider.getSupportedAuthorizationResourceType());
}).findFirst();
}
return Optional.of(propertyProviderClass);
}
Aggregations