mirror of https://github.com/apache/nifi.git
NIFI-1721 updated mock framework to return correct number of threads from mock context
Signed-off-by: Matt Burgess <mattyb149@apache.org> This closes #408
This commit is contained in:
parent
defb6f5b61
commit
194fc048fb
|
@ -55,6 +55,7 @@ public class MockProcessContext extends MockControllerServiceLookup implements S
|
|||
private boolean allowExpressionValidation = true;
|
||||
private volatile boolean incomingConnection = true;
|
||||
private volatile boolean nonLoopConnection = true;
|
||||
private int numThreads = 1;
|
||||
|
||||
private volatile Set<Relationship> connections = new HashSet<>();
|
||||
private volatile Set<Relationship> unavailableRelationships = new HashSet<>();
|
||||
|
@ -174,7 +175,7 @@ public class MockProcessContext extends MockControllerServiceLookup implements S
|
|||
|
||||
@Override
|
||||
public int getMaxConcurrentTasks() {
|
||||
return 1;
|
||||
return numThreads;
|
||||
}
|
||||
|
||||
public void setAnnotationData(final String annotationData) {
|
||||
|
@ -360,4 +361,8 @@ public class MockProcessContext extends MockControllerServiceLookup implements S
|
|||
public String getName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
protected void setNumThreads(int numThreads) {
|
||||
this.numThreads = numThreads;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -531,6 +531,7 @@ public class StandardProcessorTestRunner implements TestRunner {
|
|||
}
|
||||
|
||||
this.numThreads = threadCount;
|
||||
this.context.setNumThreads(threadCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -47,6 +47,15 @@ public class TestStandardProcessorTestRunner {
|
|||
assertEquals(1, proc.getOnStoppedCallsWithoutContext());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNumThreads() {
|
||||
final ProcessorWithOnStop proc = new ProcessorWithOnStop();
|
||||
final TestRunner runner = TestRunners.newTestRunner(proc);
|
||||
runner.setThreadCount(5);
|
||||
runner.run(1, true);
|
||||
assertEquals(5, runner.getProcessContext().getMaxConcurrentTasks());
|
||||
}
|
||||
|
||||
@Test(expected = AssertionError.class)
|
||||
@Ignore("This should not be enabled until we actually fail processor unit tests for using deprecated methods")
|
||||
public void testFailOnDeprecatedTypeAnnotation() {
|
||||
|
|
Loading…
Reference in New Issue