[29/50] [abbrv] incubator-nifi git commit: NIFI-704 StandardProcessorTestRunner should allow you to wait before calling OnUnScheduled methods

2015-06-26 Thread danbress
NIFI-704 StandardProcessorTestRunner should allow you to wait before calling 
OnUnScheduled methods

Signed-off-by: Mark Payne marka...@hotmail.com


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/5d8bfa7c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/5d8bfa7c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/5d8bfa7c

Branch: refs/heads/NIFI-680
Commit: 5d8bfa7c806549f5ede6eec5047dc66696bc95d8
Parents: f2f9056
Author: danbress dbr...@onyxconsults.com
Authored: Sat Jun 20 19:53:13 2015 -0400
Committer: Mark Payne marka...@hotmail.com
Committed: Mon Jun 22 12:08:41 2015 -0400

--
 .../nifi/util/StandardProcessorTestRunner.java  | 10 +++
 .../java/org/apache/nifi/util/TestRunner.java   | 45 +
 .../CurrentTestStandardProcessorTestRunner.java | 71 
 3 files changed, 126 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/5d8bfa7c/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
--
diff --git 
a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
index 655f2df..8938547 100644
--- 
a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
+++ 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
@@ -39,6 +39,7 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -182,6 +183,11 @@ public class StandardProcessorTestRunner implements 
TestRunner {
 
 @Override
 public void run(final int iterations, final boolean stopOnFinish, final 
boolean initialize) {
+run(iterations, stopOnFinish, initialize, 5000);
+}
+
+@Override
+public void run(final int iterations, final boolean stopOnFinish, final 
boolean initialize, final long runWait) {
 if (iterations  1) {
 throw new IllegalArgumentException();
 }
@@ -207,6 +213,10 @@ public class StandardProcessorTestRunner implements 
TestRunner {
 }
 
 executorService.shutdown();
+try {
+executorService.awaitTermination(runWait, 
TimeUnit.MILLISECONDS);
+} catch (InterruptedException e1) {
+}
 
 int finishedCount = 0;
 boolean unscheduledRun = false;

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/5d8bfa7c/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
--
diff --git a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
index a599e5b..fb9fc78 100644
--- a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
+++ b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
@@ -126,6 +126,51 @@ public interface TestRunner {
 void run(int iterations, boolean stopOnFinish, final boolean initialize);
 
 /**
+ * This method runs the {@link Processor} codeiterations/code times,
+ * using the sequence of steps below:
+ * ul
+ * li
+ * If {@code initialize} is true, run all methods on the Processor that are
+ * annotated with the
+ * {@link nifi.processor.annotation.OnScheduled @OnScheduled} annotation. 
If
+ * any of these methods throws an Exception, the Unit Test will fail.
+ * /li
+ * li
+ * Schedule the
+ * {@link Processor#onTrigger(ProcessContext, ProcessSessionFactory) 
onTrigger}
+ * method to be invoked codeiterations/code times. The number of 
threads
+ * used to run these iterations is determined by the ThreadCount of this
+ * codeTestRunner/code. By default, the value is set to 1, but it can 
be
+ * modified by calling the {@link #setThreadCount(int)} method.
+ * /li
+ * li
+ * As soon as the first thread finishes its execution of
+ * {@link Processor#onTrigger(ProcessContext, ProcessSessionFactory) 
onTrigger},
+ * all methods on the Processor that are annotated with the
+ * {@link nifi.processor.annotation.OnUnscheduled @OnUnscheduled} 
annotation
+ * are invoked. If any of these methods throws an Exception, the Unit Test
+ * will fail.
+ * /li
+ * li
+ * Waits for all threads to finish execution.
+ * /li
+ * li
+ * If and only if the value of codeshutdown/code is 

[15/35] incubator-nifi git commit: NIFI-704 StandardProcessorTestRunner should allow you to wait before calling OnUnScheduled methods

2015-06-26 Thread danbress
NIFI-704 StandardProcessorTestRunner should allow you to wait before calling 
OnUnScheduled methods

Signed-off-by: Mark Payne marka...@hotmail.com


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/5d8bfa7c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/5d8bfa7c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/5d8bfa7c

Branch: refs/heads/NIFI-632
Commit: 5d8bfa7c806549f5ede6eec5047dc66696bc95d8
Parents: f2f9056
Author: danbress dbr...@onyxconsults.com
Authored: Sat Jun 20 19:53:13 2015 -0400
Committer: Mark Payne marka...@hotmail.com
Committed: Mon Jun 22 12:08:41 2015 -0400

--
 .../nifi/util/StandardProcessorTestRunner.java  | 10 +++
 .../java/org/apache/nifi/util/TestRunner.java   | 45 +
 .../CurrentTestStandardProcessorTestRunner.java | 71 
 3 files changed, 126 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/5d8bfa7c/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
--
diff --git 
a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
index 655f2df..8938547 100644
--- 
a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
+++ 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
@@ -39,6 +39,7 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -182,6 +183,11 @@ public class StandardProcessorTestRunner implements 
TestRunner {
 
 @Override
 public void run(final int iterations, final boolean stopOnFinish, final 
boolean initialize) {
+run(iterations, stopOnFinish, initialize, 5000);
+}
+
+@Override
+public void run(final int iterations, final boolean stopOnFinish, final 
boolean initialize, final long runWait) {
 if (iterations  1) {
 throw new IllegalArgumentException();
 }
@@ -207,6 +213,10 @@ public class StandardProcessorTestRunner implements 
TestRunner {
 }
 
 executorService.shutdown();
+try {
+executorService.awaitTermination(runWait, 
TimeUnit.MILLISECONDS);
+} catch (InterruptedException e1) {
+}
 
 int finishedCount = 0;
 boolean unscheduledRun = false;

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/5d8bfa7c/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
--
diff --git a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
index a599e5b..fb9fc78 100644
--- a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
+++ b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
@@ -126,6 +126,51 @@ public interface TestRunner {
 void run(int iterations, boolean stopOnFinish, final boolean initialize);
 
 /**
+ * This method runs the {@link Processor} codeiterations/code times,
+ * using the sequence of steps below:
+ * ul
+ * li
+ * If {@code initialize} is true, run all methods on the Processor that are
+ * annotated with the
+ * {@link nifi.processor.annotation.OnScheduled @OnScheduled} annotation. 
If
+ * any of these methods throws an Exception, the Unit Test will fail.
+ * /li
+ * li
+ * Schedule the
+ * {@link Processor#onTrigger(ProcessContext, ProcessSessionFactory) 
onTrigger}
+ * method to be invoked codeiterations/code times. The number of 
threads
+ * used to run these iterations is determined by the ThreadCount of this
+ * codeTestRunner/code. By default, the value is set to 1, but it can 
be
+ * modified by calling the {@link #setThreadCount(int)} method.
+ * /li
+ * li
+ * As soon as the first thread finishes its execution of
+ * {@link Processor#onTrigger(ProcessContext, ProcessSessionFactory) 
onTrigger},
+ * all methods on the Processor that are annotated with the
+ * {@link nifi.processor.annotation.OnUnscheduled @OnUnscheduled} 
annotation
+ * are invoked. If any of these methods throws an Exception, the Unit Test
+ * will fail.
+ * /li
+ * li
+ * Waits for all threads to finish execution.
+ * /li
+ * li
+ * If and only if the value of codeshutdown/code is 

[10/35] incubator-nifi git commit: NIFI-704 StandardProcessorTestRunner should allow you to wait before calling OnUnScheduled methods

2015-06-26 Thread danbress
NIFI-704 StandardProcessorTestRunner should allow you to wait before calling 
OnUnScheduled methods


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/6b4e90dd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/6b4e90dd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/6b4e90dd

Branch: refs/heads/NIFI-680
Commit: 6b4e90dd5dabff82b1aeae8d9c64cdd32112b33d
Parents: 47847ab
Author: danbress dbr...@onyxconsults.com
Authored: Sat Jun 20 19:48:02 2015 -0400
Committer: danbress dbr...@onyxconsults.com
Committed: Sat Jun 20 19:48:02 2015 -0400

--
 .../nifi/util/StandardProcessorTestRunner.java  | 10 +++
 .../java/org/apache/nifi/util/TestRunner.java   | 45 +
 .../CurrentTestStandardProcessorTestRunner.java | 71 
 3 files changed, 126 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/6b4e90dd/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
--
diff --git 
a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
index 655f2df..1505899 100644
--- 
a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
+++ 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
@@ -39,6 +39,7 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -182,6 +183,11 @@ public class StandardProcessorTestRunner implements 
TestRunner {
 
 @Override
 public void run(final int iterations, final boolean stopOnFinish, final 
boolean initialize) {
+run(iterations, stopOnFinish, initialize, 5000);
+}
+
+@Override
+public void run(final int iterations, final boolean stopOnFinish, final 
boolean initialize, final long runWait) {
 if (iterations  1) {
 throw new IllegalArgumentException();
 }
@@ -207,6 +213,10 @@ public class StandardProcessorTestRunner implements 
TestRunner {
 }
 
 executorService.shutdown();
+try {
+executorService.awaitTermination(runWait, TimeUnit.SECONDS);
+} catch (InterruptedException e1) {
+}
 
 int finishedCount = 0;
 boolean unscheduledRun = false;

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/6b4e90dd/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
--
diff --git a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
index a599e5b..f0fbea8 100644
--- a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
+++ b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
@@ -126,6 +126,51 @@ public interface TestRunner {
 void run(int iterations, boolean stopOnFinish, final boolean initialize);
 
 /**
+ * This method runs the {@link Processor} codeiterations/code times,
+ * using the sequence of steps below:
+ * ul
+ * li
+ * If {@code initialize} is true, run all methods on the Processor that are
+ * annotated with the
+ * {@link nifi.processor.annotation.OnScheduled @OnScheduled} annotation. 
If
+ * any of these methods throws an Exception, the Unit Test will fail.
+ * /li
+ * li
+ * Schedule the
+ * {@link Processor#onTrigger(ProcessContext, ProcessSessionFactory) 
onTrigger}
+ * method to be invoked codeiterations/code times. The number of 
threads
+ * used to run these iterations is determined by the ThreadCount of this
+ * codeTestRunner/code. By default, the value is set to 1, but it can 
be
+ * modified by calling the {@link #setThreadCount(int)} method.
+ * /li
+ * li
+ * As soon as the first thread finishes its execution of
+ * {@link Processor#onTrigger(ProcessContext, ProcessSessionFactory) 
onTrigger},
+ * all methods on the Processor that are annotated with the
+ * {@link nifi.processor.annotation.OnUnscheduled @OnUnscheduled} 
annotation
+ * are invoked. If any of these methods throws an Exception, the Unit Test
+ * will fail.
+ * /li
+ * li
+ * Waits for all threads to finish execution.
+ * /li
+ * li
+ * If and only if the value of codeshutdown/code is true: Call all
+ * methods on the Processor that 

incubator-nifi git commit: NIFI-704 StandardProcessorTestRunner should allow you to wait before calling OnUnScheduled methods

2015-06-22 Thread markap14
Repository: incubator-nifi
Updated Branches:
  refs/heads/develop f2f905605 - 5d8bfa7c8


NIFI-704 StandardProcessorTestRunner should allow you to wait before calling 
OnUnScheduled methods

Signed-off-by: Mark Payne marka...@hotmail.com


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/5d8bfa7c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/5d8bfa7c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/5d8bfa7c

Branch: refs/heads/develop
Commit: 5d8bfa7c806549f5ede6eec5047dc66696bc95d8
Parents: f2f9056
Author: danbress dbr...@onyxconsults.com
Authored: Sat Jun 20 19:53:13 2015 -0400
Committer: Mark Payne marka...@hotmail.com
Committed: Mon Jun 22 12:08:41 2015 -0400

--
 .../nifi/util/StandardProcessorTestRunner.java  | 10 +++
 .../java/org/apache/nifi/util/TestRunner.java   | 45 +
 .../CurrentTestStandardProcessorTestRunner.java | 71 
 3 files changed, 126 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/5d8bfa7c/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
--
diff --git 
a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
index 655f2df..8938547 100644
--- 
a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
+++ 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
@@ -39,6 +39,7 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -182,6 +183,11 @@ public class StandardProcessorTestRunner implements 
TestRunner {
 
 @Override
 public void run(final int iterations, final boolean stopOnFinish, final 
boolean initialize) {
+run(iterations, stopOnFinish, initialize, 5000);
+}
+
+@Override
+public void run(final int iterations, final boolean stopOnFinish, final 
boolean initialize, final long runWait) {
 if (iterations  1) {
 throw new IllegalArgumentException();
 }
@@ -207,6 +213,10 @@ public class StandardProcessorTestRunner implements 
TestRunner {
 }
 
 executorService.shutdown();
+try {
+executorService.awaitTermination(runWait, 
TimeUnit.MILLISECONDS);
+} catch (InterruptedException e1) {
+}
 
 int finishedCount = 0;
 boolean unscheduledRun = false;

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/5d8bfa7c/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
--
diff --git a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
index a599e5b..fb9fc78 100644
--- a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
+++ b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
@@ -126,6 +126,51 @@ public interface TestRunner {
 void run(int iterations, boolean stopOnFinish, final boolean initialize);
 
 /**
+ * This method runs the {@link Processor} codeiterations/code times,
+ * using the sequence of steps below:
+ * ul
+ * li
+ * If {@code initialize} is true, run all methods on the Processor that are
+ * annotated with the
+ * {@link nifi.processor.annotation.OnScheduled @OnScheduled} annotation. 
If
+ * any of these methods throws an Exception, the Unit Test will fail.
+ * /li
+ * li
+ * Schedule the
+ * {@link Processor#onTrigger(ProcessContext, ProcessSessionFactory) 
onTrigger}
+ * method to be invoked codeiterations/code times. The number of 
threads
+ * used to run these iterations is determined by the ThreadCount of this
+ * codeTestRunner/code. By default, the value is set to 1, but it can 
be
+ * modified by calling the {@link #setThreadCount(int)} method.
+ * /li
+ * li
+ * As soon as the first thread finishes its execution of
+ * {@link Processor#onTrigger(ProcessContext, ProcessSessionFactory) 
onTrigger},
+ * all methods on the Processor that are annotated with the
+ * {@link nifi.processor.annotation.OnUnscheduled @OnUnscheduled} 
annotation
+ * are invoked. If any of these methods throws an Exception, the Unit Test
+ * will fail.
+ * /li
+ * li
+ * Waits for all threads to finish 

incubator-nifi git commit: NIFI-704 StandardProcessorTestRunner should allow you to wait before calling OnUnScheduled methods

2015-06-20 Thread danbress
Repository: incubator-nifi
Updated Branches:
  refs/heads/NIFI-704 a0e5c0e57 - 54a49bb40 (forced update)


NIFI-704 StandardProcessorTestRunner should allow you to wait before calling 
OnUnScheduled methods


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/54a49bb4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/54a49bb4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/54a49bb4

Branch: refs/heads/NIFI-704
Commit: 54a49bb40834d78305f07c859abba50371a41bb6
Parents: 33848b3
Author: danbress dbr...@onyxconsults.com
Authored: Sat Jun 20 19:53:13 2015 -0400
Committer: danbress dbr...@onyxconsults.com
Committed: Sat Jun 20 19:53:13 2015 -0400

--
 .../nifi/util/StandardProcessorTestRunner.java  | 10 +++
 .../java/org/apache/nifi/util/TestRunner.java   | 45 +
 .../CurrentTestStandardProcessorTestRunner.java | 71 
 3 files changed, 126 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/54a49bb4/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
--
diff --git 
a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
index 655f2df..8938547 100644
--- 
a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
+++ 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
@@ -39,6 +39,7 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -182,6 +183,11 @@ public class StandardProcessorTestRunner implements 
TestRunner {
 
 @Override
 public void run(final int iterations, final boolean stopOnFinish, final 
boolean initialize) {
+run(iterations, stopOnFinish, initialize, 5000);
+}
+
+@Override
+public void run(final int iterations, final boolean stopOnFinish, final 
boolean initialize, final long runWait) {
 if (iterations  1) {
 throw new IllegalArgumentException();
 }
@@ -207,6 +213,10 @@ public class StandardProcessorTestRunner implements 
TestRunner {
 }
 
 executorService.shutdown();
+try {
+executorService.awaitTermination(runWait, 
TimeUnit.MILLISECONDS);
+} catch (InterruptedException e1) {
+}
 
 int finishedCount = 0;
 boolean unscheduledRun = false;

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/54a49bb4/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
--
diff --git a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
index a599e5b..fb9fc78 100644
--- a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
+++ b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
@@ -126,6 +126,51 @@ public interface TestRunner {
 void run(int iterations, boolean stopOnFinish, final boolean initialize);
 
 /**
+ * This method runs the {@link Processor} codeiterations/code times,
+ * using the sequence of steps below:
+ * ul
+ * li
+ * If {@code initialize} is true, run all methods on the Processor that are
+ * annotated with the
+ * {@link nifi.processor.annotation.OnScheduled @OnScheduled} annotation. 
If
+ * any of these methods throws an Exception, the Unit Test will fail.
+ * /li
+ * li
+ * Schedule the
+ * {@link Processor#onTrigger(ProcessContext, ProcessSessionFactory) 
onTrigger}
+ * method to be invoked codeiterations/code times. The number of 
threads
+ * used to run these iterations is determined by the ThreadCount of this
+ * codeTestRunner/code. By default, the value is set to 1, but it can 
be
+ * modified by calling the {@link #setThreadCount(int)} method.
+ * /li
+ * li
+ * As soon as the first thread finishes its execution of
+ * {@link Processor#onTrigger(ProcessContext, ProcessSessionFactory) 
onTrigger},
+ * all methods on the Processor that are annotated with the
+ * {@link nifi.processor.annotation.OnUnscheduled @OnUnscheduled} 
annotation
+ * are invoked. If any of these methods throws an Exception, the Unit Test
+ * will fail.
+ * /li
+ * li
+ * Waits for all threads to finish execution.
+ * /li
+ * 

incubator-nifi git commit: NIFI-704 StandardProcessorTestRunner should allow you to wait before calling OnUnScheduled methods

2015-06-20 Thread danbress
Repository: incubator-nifi
Updated Branches:
  refs/heads/NIFI-704 [created] a0e5c0e57


NIFI-704 StandardProcessorTestRunner should allow you to wait before calling 
OnUnScheduled methods


Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/a0e5c0e5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/a0e5c0e5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/a0e5c0e5

Branch: refs/heads/NIFI-704
Commit: a0e5c0e57f9378c4019d157dac56c3bdab287875
Parents: 33848b3
Author: danbress dbr...@onyxconsults.com
Authored: Sat Jun 20 19:48:02 2015 -0400
Committer: danbress dbr...@onyxconsults.com
Committed: Sat Jun 20 19:48:58 2015 -0400

--
 .../nifi/util/StandardProcessorTestRunner.java  | 10 +++
 .../java/org/apache/nifi/util/TestRunner.java   | 45 +
 .../CurrentTestStandardProcessorTestRunner.java | 71 
 3 files changed, 126 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/a0e5c0e5/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
--
diff --git 
a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
index 655f2df..1505899 100644
--- 
a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
+++ 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/StandardProcessorTestRunner.java
@@ -39,6 +39,7 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -182,6 +183,11 @@ public class StandardProcessorTestRunner implements 
TestRunner {
 
 @Override
 public void run(final int iterations, final boolean stopOnFinish, final 
boolean initialize) {
+run(iterations, stopOnFinish, initialize, 5000);
+}
+
+@Override
+public void run(final int iterations, final boolean stopOnFinish, final 
boolean initialize, final long runWait) {
 if (iterations  1) {
 throw new IllegalArgumentException();
 }
@@ -207,6 +213,10 @@ public class StandardProcessorTestRunner implements 
TestRunner {
 }
 
 executorService.shutdown();
+try {
+executorService.awaitTermination(runWait, TimeUnit.SECONDS);
+} catch (InterruptedException e1) {
+}
 
 int finishedCount = 0;
 boolean unscheduledRun = false;

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/a0e5c0e5/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
--
diff --git a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java 
b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
index a599e5b..f0fbea8 100644
--- a/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
+++ b/nifi/nifi-mock/src/main/java/org/apache/nifi/util/TestRunner.java
@@ -126,6 +126,51 @@ public interface TestRunner {
 void run(int iterations, boolean stopOnFinish, final boolean initialize);
 
 /**
+ * This method runs the {@link Processor} codeiterations/code times,
+ * using the sequence of steps below:
+ * ul
+ * li
+ * If {@code initialize} is true, run all methods on the Processor that are
+ * annotated with the
+ * {@link nifi.processor.annotation.OnScheduled @OnScheduled} annotation. 
If
+ * any of these methods throws an Exception, the Unit Test will fail.
+ * /li
+ * li
+ * Schedule the
+ * {@link Processor#onTrigger(ProcessContext, ProcessSessionFactory) 
onTrigger}
+ * method to be invoked codeiterations/code times. The number of 
threads
+ * used to run these iterations is determined by the ThreadCount of this
+ * codeTestRunner/code. By default, the value is set to 1, but it can 
be
+ * modified by calling the {@link #setThreadCount(int)} method.
+ * /li
+ * li
+ * As soon as the first thread finishes its execution of
+ * {@link Processor#onTrigger(ProcessContext, ProcessSessionFactory) 
onTrigger},
+ * all methods on the Processor that are annotated with the
+ * {@link nifi.processor.annotation.OnUnscheduled @OnUnscheduled} 
annotation
+ * are invoked. If any of these methods throws an Exception, the Unit Test
+ * will fail.
+ * /li
+ * li
+ * Waits for all threads to finish execution.
+ * /li
+ * li
+ * If and only