mirror of https://github.com/apache/nifi.git
NIFI-268: Change Assert.fail to logger.warn if using deprecated annotation for processors. This will be cahnged to Assert.fail in 0.1.0 but should not happen for version 0.0.2
This commit is contained in:
parent
10714efbd3
commit
3b399d7504
|
@ -66,6 +66,8 @@ import org.apache.nifi.processor.Relationship;
|
|||
import org.apache.nifi.provenance.ProvenanceReporter;
|
||||
import org.apache.nifi.reporting.InitializationException;
|
||||
import org.junit.Assert;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class StandardProcessorTestRunner implements TestRunner {
|
||||
|
||||
|
@ -80,6 +82,7 @@ public class StandardProcessorTestRunner implements TestRunner {
|
|||
private int numThreads = 1;
|
||||
private final AtomicInteger invocations = new AtomicInteger(0);
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(StandardProcessorTestRunner.class);
|
||||
private static final Set<Class<? extends Annotation>> deprecatedTypeAnnotations = new HashSet<>();
|
||||
private static final Set<Class<? extends Annotation>> deprecatedMethodAnnotations = new HashSet<>();
|
||||
|
||||
|
@ -134,14 +137,14 @@ public class StandardProcessorTestRunner implements TestRunner {
|
|||
private static void detectDeprecatedAnnotations(final Processor processor) {
|
||||
for ( final Class<? extends Annotation> annotationClass : deprecatedTypeAnnotations ) {
|
||||
if ( processor.getClass().isAnnotationPresent(annotationClass) ) {
|
||||
Assert.fail("Processor is using deprecated Annotation " + annotationClass.getCanonicalName());
|
||||
logger.warn("Processor is using deprecated Annotation " + annotationClass.getCanonicalName());
|
||||
}
|
||||
}
|
||||
|
||||
for ( final Class<? extends Annotation> annotationClass : deprecatedMethodAnnotations ) {
|
||||
for ( final Method method : processor.getClass().getMethods() ) {
|
||||
if ( method.isAnnotationPresent(annotationClass) ) {
|
||||
Assert.fail("Processor is using deprecated Annotation " + annotationClass.getCanonicalName() + " for method " + method);
|
||||
logger.warn("Processor is using deprecated Annotation " + annotationClass.getCanonicalName() + " for method " + method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue