use of org.talend.sdk.component.api.component.Icon in project component-runtime by Talend.
the class ComponentValidator method run.
@Override
public void run() {
final AnnotationFinder finder = newFinder();
final List<Class<?>> components = componentMarkers().flatMap(a -> finder.findAnnotatedClasses(a).stream()).collect(toList());
components.forEach(c -> log.debug("Found component: " + c));
final Set<String> errors = new HashSet<>();
if (configuration.isValidateFamily()) {
// todo: better fix is to get the package with @Components then check it has an icon
// but it should be enough for now
components.forEach(c -> {
try {
findPackageOrFail(c, Icon.class);
} catch (final IllegalArgumentException iae) {
errors.add(iae.getMessage());
}
});
}
if (configuration.isValidateSerializable()) {
final Collection<Class<?>> copy = new ArrayList<>(components);
copy.removeIf(this::isSerializable);
errors.addAll(copy.stream().map(c -> c + " is not Serializable").collect(toList()));
}
if (configuration.isValidateInternationalization()) {
validateInternationalization(finder, components, errors);
}
if (configuration.isValidateHttpClient()) {
validateHttpClient(finder, errors);
}
if (configuration.isValidateModel()) {
validateModel(finder, components, errors);
}
if (configuration.isValidateMetadata()) {
validateMetadata(components, errors);
}
if (configuration.isValidateDataStore()) {
validateDataStore(finder, errors);
}
if (configuration.isValidateDataSet()) {
validateDataSet(finder, errors);
}
if (configuration.isValidateActions()) {
validateActions(finder, errors);
}
if (configuration.isValidateDocumentation()) {
validateDocumentation(finder, components, errors);
}
if (configuration.isValidateLayout()) {
validateLayout(finder, components, errors);
}
if (!errors.isEmpty()) {
errors.forEach(log::error);
throw new IllegalStateException("Some error were detected:" + errors.stream().collect(joining("\n- ", "\n- ", "")));
}
}
Aggregations