[
https://issues.apache.org/jira/browse/NIFI-704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14594891#comment-14594891
]
Dan Bress commented on NIFI-704:
--------------------------------
[~markap14] After working on this, I started reading the docs for TestRunner,
and noticed this line
"As soon as the first thread finishes its execution of onTrigger, all methods
on the Processor that are annotated with the @OnUnscheduled annotation are
invoked. If any of these methods throws an Exception, the Unit Test will fail."
I have had test cases where I do not want @OnUnscheduled called until after all
the run iterations have finished which is why I explored this change. Is there
a reason why my change is a bad idea?
> StandardProcessorTestRunner should allow you to wait before calling
> OnUnScheduled methods
> -----------------------------------------------------------------------------------------
>
> Key: NIFI-704
> URL: https://issues.apache.org/jira/browse/NIFI-704
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Tools and Build
> Affects Versions: 0.1.0
> Reporter: Dan Bress
> Assignee: Dan Bress
> Priority: Minor
> Fix For: 0.2.0
>
> Attachments:
> 0001-NIFI-704-StandardProcessorTestRunner-should-allow-yo.patch
>
>
> [StandardProcessorTestRunner does not
> wait|https://github.com/apache/incubator-nifi/blob/develop/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java#L208-L210]
> for the processor 'run' calls to finish before invoking the @OnUnscheduled
> methods. This may result in the Processor 'run' calls acting weird, because
> @OnUnscheduled has been called.
> Notice that
> [ExecutorService.shutdown()|http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ExecutorService.html#shutdown%28%29]
> says _This method does not wait for previously submitted tasks to complete
> execution. Use awaitTermination to do that._
> I would suggest that the StandardProcessorTestRunner either always wait for
> the processor run calls to finish, or let you specify an amount of time to
> wait for them to finish.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)