[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16794263#comment-16794263 ] ASF subversion and git services commented on NIFI-5318: --- Commit 43235724e2031c30fc48e05be0d2136fd58efa52 in nifi's branch refs/heads/master from Peter G. Horvath [ https://gitbox.apache.org/repos/asf?p=nifi.git;h=4323572 ] NIFI-5318 Implement NiFi test harness: initial commit NIFI-5318 Implement NiFi test harness: replaced original sample feed payload with synthetic content NIFI-5318 Implement NiFi test harness: fixed test harness run crash issue; better reporting of paths NIFI-5318 Implement NiFi test harness: added further states where NiFi version can be queried NIFI-5318 Implement NiFi test harness: fixed incorrect class reference NIFI-5318 Implement NiFi test harness: added type parameter bounding to setClassOfSingleProcessor to prevent configuring obviously incorrect classes NIFI-5318 Updated project version. This closes #3165 Signed-off-by: Mike Thomsen > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > Time Spent: 1h 50m > Remaining Estimate: 0h > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16794262#comment-16794262 ] ASF subversion and git services commented on NIFI-5318: --- Commit 43235724e2031c30fc48e05be0d2136fd58efa52 in nifi's branch refs/heads/master from Peter G. Horvath [ https://gitbox.apache.org/repos/asf?p=nifi.git;h=4323572 ] NIFI-5318 Implement NiFi test harness: initial commit NIFI-5318 Implement NiFi test harness: replaced original sample feed payload with synthetic content NIFI-5318 Implement NiFi test harness: fixed test harness run crash issue; better reporting of paths NIFI-5318 Implement NiFi test harness: added further states where NiFi version can be queried NIFI-5318 Implement NiFi test harness: fixed incorrect class reference NIFI-5318 Implement NiFi test harness: added type parameter bounding to setClassOfSingleProcessor to prevent configuring obviously incorrect classes NIFI-5318 Updated project version. This closes #3165 Signed-off-by: Mike Thomsen > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > Time Spent: 1h 50m > Remaining Estimate: 0h > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16794260#comment-16794260 ] ASF subversion and git services commented on NIFI-5318: --- Commit 43235724e2031c30fc48e05be0d2136fd58efa52 in nifi's branch refs/heads/master from Peter G. Horvath [ https://gitbox.apache.org/repos/asf?p=nifi.git;h=4323572 ] NIFI-5318 Implement NiFi test harness: initial commit NIFI-5318 Implement NiFi test harness: replaced original sample feed payload with synthetic content NIFI-5318 Implement NiFi test harness: fixed test harness run crash issue; better reporting of paths NIFI-5318 Implement NiFi test harness: added further states where NiFi version can be queried NIFI-5318 Implement NiFi test harness: fixed incorrect class reference NIFI-5318 Implement NiFi test harness: added type parameter bounding to setClassOfSingleProcessor to prevent configuring obviously incorrect classes NIFI-5318 Updated project version. This closes #3165 Signed-off-by: Mike Thomsen > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > Time Spent: 1h 50m > Remaining Estimate: 0h > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16794266#comment-16794266 ] ASF subversion and git services commented on NIFI-5318: --- Commit 43235724e2031c30fc48e05be0d2136fd58efa52 in nifi's branch refs/heads/master from Peter G. Horvath [ https://gitbox.apache.org/repos/asf?p=nifi.git;h=4323572 ] NIFI-5318 Implement NiFi test harness: initial commit NIFI-5318 Implement NiFi test harness: replaced original sample feed payload with synthetic content NIFI-5318 Implement NiFi test harness: fixed test harness run crash issue; better reporting of paths NIFI-5318 Implement NiFi test harness: added further states where NiFi version can be queried NIFI-5318 Implement NiFi test harness: fixed incorrect class reference NIFI-5318 Implement NiFi test harness: added type parameter bounding to setClassOfSingleProcessor to prevent configuring obviously incorrect classes NIFI-5318 Updated project version. This closes #3165 Signed-off-by: Mike Thomsen > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > Time Spent: 1h 50m > Remaining Estimate: 0h > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16794264#comment-16794264 ] ASF subversion and git services commented on NIFI-5318: --- Commit 43235724e2031c30fc48e05be0d2136fd58efa52 in nifi's branch refs/heads/master from Peter G. Horvath [ https://gitbox.apache.org/repos/asf?p=nifi.git;h=4323572 ] NIFI-5318 Implement NiFi test harness: initial commit NIFI-5318 Implement NiFi test harness: replaced original sample feed payload with synthetic content NIFI-5318 Implement NiFi test harness: fixed test harness run crash issue; better reporting of paths NIFI-5318 Implement NiFi test harness: added further states where NiFi version can be queried NIFI-5318 Implement NiFi test harness: fixed incorrect class reference NIFI-5318 Implement NiFi test harness: added type parameter bounding to setClassOfSingleProcessor to prevent configuring obviously incorrect classes NIFI-5318 Updated project version. This closes #3165 Signed-off-by: Mike Thomsen > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > Time Spent: 1h 50m > Remaining Estimate: 0h > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16794261#comment-16794261 ] ASF subversion and git services commented on NIFI-5318: --- Commit 43235724e2031c30fc48e05be0d2136fd58efa52 in nifi's branch refs/heads/master from Peter G. Horvath [ https://gitbox.apache.org/repos/asf?p=nifi.git;h=4323572 ] NIFI-5318 Implement NiFi test harness: initial commit NIFI-5318 Implement NiFi test harness: replaced original sample feed payload with synthetic content NIFI-5318 Implement NiFi test harness: fixed test harness run crash issue; better reporting of paths NIFI-5318 Implement NiFi test harness: added further states where NiFi version can be queried NIFI-5318 Implement NiFi test harness: fixed incorrect class reference NIFI-5318 Implement NiFi test harness: added type parameter bounding to setClassOfSingleProcessor to prevent configuring obviously incorrect classes NIFI-5318 Updated project version. This closes #3165 Signed-off-by: Mike Thomsen > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > Time Spent: 1h 50m > Remaining Estimate: 0h > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16794265#comment-16794265 ] ASF subversion and git services commented on NIFI-5318: --- Commit 43235724e2031c30fc48e05be0d2136fd58efa52 in nifi's branch refs/heads/master from Peter G. Horvath [ https://gitbox.apache.org/repos/asf?p=nifi.git;h=4323572 ] NIFI-5318 Implement NiFi test harness: initial commit NIFI-5318 Implement NiFi test harness: replaced original sample feed payload with synthetic content NIFI-5318 Implement NiFi test harness: fixed test harness run crash issue; better reporting of paths NIFI-5318 Implement NiFi test harness: added further states where NiFi version can be queried NIFI-5318 Implement NiFi test harness: fixed incorrect class reference NIFI-5318 Implement NiFi test harness: added type parameter bounding to setClassOfSingleProcessor to prevent configuring obviously incorrect classes NIFI-5318 Updated project version. This closes #3165 Signed-off-by: Mike Thomsen > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > Time Spent: 1h 50m > Remaining Estimate: 0h > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16719211#comment-16719211 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/3165 @peter-gergely-horvath Tried your latest change and still get these results: ``` [INFO] --- [INFO] Running org.apache.nifi.testharness.samples.NiFiFlowTest [INFO] Running org.apache.nifi.testharness.samples.NiFiMockFlowTest [INFO] [INFO] Results: [INFO] [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] [INFO] BUILD FAILURE [INFO] [INFO] Total time: 01:46 min [INFO] Finished at: 2018-12-12T11:20:20-05:00 [INFO] Final Memory: 36M/602M [INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project nifi-testharness: There are test failures. [ERROR] [ERROR] Please refer to /Users/michaelthomsen/workspace/nifi/nifi-testharness/target/surefire-reports for the individual test results. [ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream. [ERROR] ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called? [ERROR] Command was /bin/sh -c cd /Users/michaelthomsen/workspace/nifi/nifi-testharness/nifi_testharness_nifi_home && /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/bin/java -Xmx1G -Djava.net.preferIPv4Stack=true -jar /Users/michaelthomsen/workspace/nifi/nifi-testharness/target/surefire/surefirebooter5354893279908884469.jar /Users/michaelthomsen/workspace/nifi/nifi-testharness/target/surefire 2018-12-12T11-18-44_222-jvmRun1 surefire377069077642032tmp surefire_03864170411723641611tmp [ERROR] Error occurred in starting fork, check output in log [ERROR] Process Exit Code: 1 [ERROR] Crashed tests: [ERROR] org.apache.nifi.testharness.samples.NiFiFlowTest [ERROR] ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called? [ERROR] Command was /bin/sh -c cd /Users/michaelthomsen/workspace/nifi/nifi-testharness/nifi_testharness_nifi_home && /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/bin/java -Xmx1G -Djava.net.preferIPv4Stack=true -jar /Users/michaelthomsen/workspace/nifi/nifi-testharness/target/surefire/surefirebooter8415059538712188018.jar /Users/michaelthomsen/workspace/nifi/nifi-testharness/target/surefire 2018-12-12T11-18-44_222-jvmRun1 surefire7043843761330522886tmp surefire_12826311853280960897tmp [ERROR] Error occurred in starting fork, check output in log [ERROR] Process Exit Code: 1 [ERROR] Crashed tests: [ERROR] org.apache.nifi.testharness.samples.NiFiMockFlowTest [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called? [ERROR] Command was /bin/sh -c cd /Users/michaelthomsen/workspace/nifi/nifi-testharness/nifi_testharness_nifi_home && /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/bin/java -Xmx1G -Djava.net.preferIPv4Stack=true -jar /Users/michaelthomsen/workspace/nifi/nifi-testharness/target/surefire/surefirebooter5354893279908884469.jar /Users/michaelthomsen/workspace/nifi/nifi-testharness/target/surefire 2018-12-12T11-18-44_222-jvmRun1 surefire377069077642032tmp surefire_03864170411723641611tmp [ERROR] Error occurred in starting fork, check output in log [ERROR] Process Exit Code: 1 [ERROR] Crashed tests: [ERROR] org.apache.nifi.testharness.samples.NiFiFlowTest [ERROR] ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called? [ERROR] Command was /bin/sh -c cd /Users/michaelthomsen/workspace/nifi/nifi-testharness/nifi_testharness_nifi_home && /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/bin/java -Xmx1G -Djava.net.preferIPv4Stack=true -jar /Users/michaelthomsen/workspace/nifi/nifi-testharness/target/surefire/surefirebooter8415059538712188018.jar /Users/michaelthomsen/workspace/nifi/nifi-testharness/target/surefire 2018-12-12T11-18-44_222-jvmRun1 surefire7043843761330522886tmp surefire_12826311853280960897tmp [ERROR] Error occurred in starting fork, check output in log [ERROR] Process Exit Code: 1 [ERROR] Crashed tests: [ERROR] org.apache.nifi.testharness.samp
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16697873#comment-16697873 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/3165 Hi Guys, thank you for pointing this out. I've replaced it with some synthetic content. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16697858#comment-16697858 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/3165#discussion_r236045789 --- Diff: nifi-testharness/src/test/resources/sample_technology_rss.xml --- @@ -0,0 +1,28 @@ + + --- End diff -- Yes, it absolutely must be changed because the BBC is asserting its IP rights here: ``` ``` > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16697856#comment-16697856 ] ASF GitHub Bot commented on NIFI-5318: -- Github user joewitt commented on a diff in the pull request: https://github.com/apache/nifi/pull/3165#discussion_r236045703 --- Diff: nifi-testharness/src/test/resources/sample_technology_rss.xml --- @@ -0,0 +1,28 @@ + + --- End diff -- this xml document looks like a real http response. We cannot use it as test material unless we can assert its license and it is ALv2 compatible. Its better to use entirely synthetic test data. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16697854#comment-16697854 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/3165 Will try to get back into it soon. BTW, thanks for putting it all back onto a branch. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16682556#comment-16682556 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/3165 Hi @MikeThomsen I have opened this new pull request instead of #2872 according your suggestions. Here we have everything sorted out you mentioned earlier on. Now the build executes the test cases if you specify `run-testharness-tests` and you now have the option to get the flow file version updated to the version of NiFi you are using. :) > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16682552#comment-16682552 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath closed the pull request at: https://github.com/apache/nifi/pull/2872 > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16682551#comment-16682551 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2872 Closed an created a new pull request for the same issue from a clean state: https://github.com/apache/nifi/pull/3165 > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16682550#comment-16682550 ] ASF GitHub Bot commented on NIFI-5318: -- GitHub user peter-gergely-horvath opened a pull request: https://github.com/apache/nifi/pull/3165 NIFI-5318 Implement NiFi test harness Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [x] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [x] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [x] Is your initial contribution a single, squashed commit? ### For code changes: - [x] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [x] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/peter-gergely-horvath/nifi NIFI-5318 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/3165.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3165 commit 38878d267477454f9e126b4e784f79f80fb893f6 Author: Peter G. Horvath Date: 2018-11-10T19:05:58Z NIFI-5318 Implement NiFi test harness: initial commit > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665758#comment-16665758 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r228689270 --- Diff: nifi-testharness/src/test/java/org/apache/nifi/testharness/samples/Constants.java --- @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.nifi.testharness.samples; + +import java.io.File; + +public final class Constants { + +static final File OUTPUT_DIR = new File("./NiFiTest/NiFiReadTest"); + +// NOTE: you will have to have the NiFi distribution ZIP placed into this directory. +// Its version must be the same as the one referenced in the flow.xml, otherwise it will not work! +static final File NIFI_ZIP_DIR = new File(System.getProperty("user.home"), "Downloads"); --- End diff -- That folder evaluated to `$HOME/Downloads` for my user account when I ran it. Are you expecting the user to sudo or something? > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665467#comment-16665467 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2872 @MikeThomsen This is kind of tricky: NiFi flows refer the precise version of NiFi within the flow XML file, so you have something like this for the processor definitions: ``` org.apache.nifi.processors.standard.GetHTTP org.apache.nifi nifi-standard-nar 1.7.1 ``` When you export a flow file to test, I would expect the you to use precisely the same NiFi version as the one used to export the flow file. I think there is a little bit of confusion here: please note that these tests do not test the test-harness. The test-harness itself is not tested (kind of a chicken-and-egg issue): these test cases are merely _samples_, which are referenced in the documentation: they demonstrate how an _end-user_ could create test cases for his/her own flows. Please download the ZIP of NiFi 1.7.1 to the `Downloads` directory within your user home (referenced by `org.apache.nifi.testharness.samples.Constants#NIFI_ZIP_DIR` as `new File(System.getProperty("user.home"), "Downloads")` ) and try running the test case again. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665438#comment-16665438 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r228606645 --- Diff: nifi-testharness/src/test/java/org/apache/nifi/testharness/samples/Constants.java --- @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.nifi.testharness.samples; + +import java.io.File; + +public final class Constants { + +static final File OUTPUT_DIR = new File("./NiFiTest/NiFiReadTest"); + +// NOTE: you will have to have the NiFi distribution ZIP placed into this directory. +// Its version must be the same as the one referenced in the flow.xml, otherwise it will not work! +static final File NIFI_ZIP_DIR = new File(System.getProperty("user.home"), "Downloads"); --- End diff -- This will be relative to the `nifi_testharness_nifi_home` directory, from which the test cases are executed. Since the test case should clear up that directory automatically, I think this should be fine. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665124#comment-16665124 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r228511342 --- Diff: nifi-testharness/src/test/java/org/apache/nifi/testharness/samples/Constants.java --- @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.nifi.testharness.samples; + +import java.io.File; + +public final class Constants { + +static final File OUTPUT_DIR = new File("./NiFiTest/NiFiReadTest"); + +// NOTE: you will have to have the NiFi distribution ZIP placed into this directory. +// Its version must be the same as the one referenced in the flow.xml, otherwise it will not work! +static final File NIFI_ZIP_DIR = new File(System.getProperty("user.home"), "Downloads"); --- End diff -- Since this is an internal unit test, it should be pointing to the build output of nifi-assembly. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16658394#comment-16658394 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2872 > Hi @MikeThomsen sorry for the delay, I have been just very busy. Thanks. I've got a lot on my plate as well, but will try to find some time early this week to review. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16657991#comment-16657991 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2872 Hi @MikeThomsen sorry for the delay, I have been just very busy. It turns out there have been some changes in the flow XML format, which I have fixed against the latest GA version: now all of the tests are executed properly. I have also introduced strict version checking: the NiFi version referenced in the flow file is checked against the actual version of the NiFi distribution used so that we can avoid confusion in the future. If a user tries to run the test harness with a flow created using a different version of NiFi than the one actually used, this will fail fast, preventing a non functioning installation leaving the user being confused why it does not work properly. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16632213#comment-16632213 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2872 Hi @MikeThomsen , hi @alopresto , OK, I've implemented my changes according your recommendations: we now have a dedicated profile for running tests, which is disabled by default. (If you decide to make the squashed commit, please use the original `peter-gergely-horvath` as author) > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16627597#comment-16627597 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2872 That makes sense: I'll look into that... once I have a tiny bit of time... > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16627590#comment-16627590 ] ASF GitHub Bot commented on NIFI-5318: -- Github user alopresto commented on the issue: https://github.com/apache/nifi/pull/2872 I think there should be a Maven module for the test harness which is disabled by default and can be activated with a flag like `mvn clean test -Ptest-harness`. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16627588#comment-16627588 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2872 @peter-gergely-horvath ok. I'm pretty sure that the surefire plugin can be disabled in the POM, but manually activated, so we'll need to look at that because those tests should be runnable if someone wants to modify the test harness and not roll their own test case. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16627563#comment-16627563 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2872 Hi @MikeThomsen I _intentionally_ have no test configuration in the project (at least for now): they are merely *samples* of what can be done, but they should not be executed as part of the core NiFi build. NiFi is a beast, starting and stopping it takes some time, I do not want to add that to the each NiFi build. Please create a new Maven project quickstart project (that will have testing configuration enabled) and add the following (replacing `${nifi version}` with the current one) to the dependencies: ``` org.apache.nifi: nifi-testharness ${nifi version} ``` once done, you can take the samples into your own project, where you can experiment with the test harness. I understand piggybacking on the tests directory is maybe not the perfect place to deliver samples, but given the circumstances I think it is acceptable and could maybe be improved in the future. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16620399#comment-16620399 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r218744472 --- Diff: nifi-docs/src/main/asciidoc/developer-guide.adoc --- @@ -2296,6 +2296,32 @@ threads that should be used to run the Processor can be set via the `setThreadCount(int)` method. +=== Experimental NiFi Flow test harness + +NiFi now has an experimental feature for full end-to-end testing of flows. This allows us +to take a NiFi flow, install it to a test NiFi instance, run it and make Java unit test +like asserts regarding its behaviour. + +The class `org.apache.nifi.test.TestNiFiInstance` is a thin wrapper that allows us +to manipulate a NiFi installation and deploy a flow with some adjustments +to its configuration, including changing processor properties and replacing processor +classes with mocks. + +In order to add the necessary classes to your project, --- End diff -- Yes, absolutely. After reading the paragraph once again, I'm wondering if it would make sense to change `us` to `you` (referring to the user), but it is you call, really. If you think it makes sense, can you do it while you merge/squash the commit? > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16618030#comment-16618030 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r218193985 --- Diff: nifi-docs/src/main/asciidoc/developer-guide.adoc --- @@ -2296,6 +2296,32 @@ threads that should be used to run the Processor can be set via the `setThreadCount(int)` method. +=== Experimental NiFi Flow test harness + +NiFi now has an experimental feature for full end-to-end testing of flows. This allows us +to take a NiFi flow, install it to a test NiFi instance, run it and make Java unit test +like asserts regarding its behaviour. + +The class `org.apache.nifi.test.TestNiFiInstance` is a thin wrapper that allows us +to manipulate a NiFi installation and deploy a flow with some adjustments +to its configuration, including changing processor properties and replacing processor +classes with mocks. + +In order to add the necessary classes to your project, --- End diff -- Just to clarify, you mean external projects that use NiFi. To use this with NiFi's code base, a developer would have to add something to the end of the build system that would run the tests after the assembly is built based on what I've seen reviewing this. Is that right or am I missing something? Just want to make sure in case we have to answer questions from people come in and try to use this to test their contributions. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16610813#comment-16610813 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r216716909 --- Diff: nifi-testharness/src/test/java/org/apache/nifi/testharness/samples/Constants.java --- @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.nifi.testharness.samples; + +import java.io.File; + +public final class Constants { + +static final File OUTPUT_DIR = new File("./NiFiTest/NiFiReadTest"); +static final File NIFI_ZIP_DIR = new File("../../nifi-assembly/target"); --- End diff -- No, these are in the test cases directory: they are there as a *sample* (referred to in the documentation), and will not be packaged to the actual API artifact. The paths there refer the NiFi bundle produced during the NiFi build, which seems to be a good default in case you are working on the test harness itself. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16610799#comment-16610799 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r216713844 --- Diff: nifi-testharness/src/main/java/org/apache/nifi/testharness/util/FileUtils.java --- @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +package org.apache.nifi.testharness.util; + +import java.io.File; +import java.io.IOException; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.Arrays; + +public final class FileUtils { + + +private static final String MAC_DS_STORE_NAME = ".DS_Store"; + +private FileUtils() { +// no instances +} + +public static void deleteDirectoryRecursive(Path directory) throws IOException { +Files.walkFileTree(directory, new SimpleFileVisitor() { +@Override +public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { +Files.delete(file); +return FileVisitResult.CONTINUE; +} + +@Override +public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { +Files.delete(dir); +return FileVisitResult.CONTINUE; +} +}); +} + +public static void deleteDirectoryRecursive(File dir) { +try { +deleteDirectoryRecursive(dir.toPath()); +} catch (IOException e) { +throw new RuntimeException(e); +} +} + +public static void createLink(Path newLink, Path existingFile) { +try { +Files.createSymbolicLink(newLink, existingFile); --- End diff -- No, I have not tested this on Windows. I would expect it to work properly, since [Windows 10 does support symbolic links](https://blogs.windows.com/buildingapps/2016/12/02/symlinks-windows-10/). (you just need the [correct permission](https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links)) > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16609835#comment-16609835 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r216485286 --- Diff: nifi-testharness/src/test/java/org/apache/nifi/testharness/samples/Constants.java --- @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.apache.nifi.testharness.samples; + +import java.io.File; + +public final class Constants { + +static final File OUTPUT_DIR = new File("./NiFiTest/NiFiReadTest"); +static final File NIFI_ZIP_DIR = new File("../../nifi-assembly/target"); --- End diff -- Do these constants assume a particular location for the code that will instantiate the test harness? That `NIFI_ZIP_DIR` one looks particularly brittle. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16609837#comment-16609837 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r216484221 --- Diff: nifi-testharness/pom.xml --- @@ -0,0 +1,176 @@ + + +http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> +4.0.0 + +org.apache.nifi +nifi +1.8.0-SNAPSHOT + +nifi-testharness +A test harness for running NiFi flow tests +pom + + + + +org.apache.rat +apache-rat-plugin + + + nifi_testharness_nifi_home/NIFI_TESTHARNESS_README.txt + src/test/resources/sample_technology_rss.xml + src/test/resources/logback-test.xml +src/test/resources/flow.xml + + + + + +org.apache.maven.plugins +maven-compiler-plugin + + + +compile +testCompile + + + + +1.8 +1.8 + + + + +org.apache.maven.plugins +maven-surefire-plugin +2.20.1 + +1 +false + nifi_testharness_nifi_home + + + + + + + + + +UTF-8 +1.7.25 +9.4.3.v20170317 + + + --- End diff -- L&N looks good here. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16609836#comment-16609836 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r216484785 --- Diff: nifi-testharness/src/main/java/org/apache/nifi/testharness/util/FileUtils.java --- @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +package org.apache.nifi.testharness.util; + +import java.io.File; +import java.io.IOException; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.Arrays; + +public final class FileUtils { + + +private static final String MAC_DS_STORE_NAME = ".DS_Store"; + +private FileUtils() { +// no instances +} + +public static void deleteDirectoryRecursive(Path directory) throws IOException { +Files.walkFileTree(directory, new SimpleFileVisitor() { +@Override +public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { +Files.delete(file); +return FileVisitResult.CONTINUE; +} + +@Override +public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { +Files.delete(dir); +return FileVisitResult.CONTINUE; +} +}); +} + +public static void deleteDirectoryRecursive(File dir) { +try { +deleteDirectoryRecursive(dir.toPath()); +} catch (IOException e) { +throw new RuntimeException(e); +} +} + +public static void createLink(Path newLink, Path existingFile) { +try { +Files.createSymbolicLink(newLink, existingFile); --- End diff -- Have you tried this on Windows? > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16608458#comment-16608458 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2872 @MikeThomsen OK, in the future, I will follow that approach. For this pull request, please review as it is, since the current state contains everything in a squashed commit. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16608209#comment-16608209 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2872 @peter-gergely-horvath the consensus seems to be just keep pushing new commits and let us do a squashed commit for you because that helps GitHub maintain the context of feedback in a review. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16608193#comment-16608193 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2872 @MikeThomsen The pull request contains the latest changes; after @lfrancke had made his comments, I corrected the issues mentioned, nuked my whole fork and force-pushed my new version. (I'm wondering what the preferred approach is for you, when there are some suggestions regarding a pull request: maybe it would be worth documenting this in NiFi dev manual?) > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16599376#comment-16599376 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2872 @peter-gergely-horvath can you push that commit? > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16540031#comment-16540031 ] ASF GitHub Bot commented on NIFI-5318: -- Github user lfrancke commented on the issue: https://github.com/apache/nifi/pull/2872 Thanks! Unfortunately for some reason I can't see your new commit... (I should maybe also add that I'm not a committer, I wast just interested in this PR) > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16539888#comment-16539888 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2872 Hi @lfrancke I've fixed the issues you noticed. Can you please review the current state? > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16539244#comment-16539244 ] ASF GitHub Bot commented on NIFI-5318: -- Github user lfrancke commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r201489283 --- Diff: nifi-testharness/src/main/java/org/apache/nifi/testharness/TestNiFiInstance.java --- @@ -0,0 +1,485 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +package org.apache.nifi.testharness; + +import org.apache.nifi.testharness.api.FlowFileEditorCallback; +import org.apache.nifi.EmbeddedNiFi; +import org.apache.nifi.testharness.util.FileUtils; +import org.apache.nifi.testharness.util.NiFiCoreLibClassLoader; +import org.apache.nifi.testharness.util.XmlUtils; +import org.apache.nifi.testharness.util.Zip; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; +import java.util.zip.ZipEntry; + +/** + * + * An API wrapper of a "test" NiFi instance to which a flow definition is installed for testing. + * + * + * Due to NiFi design restrictions, {@code TestNiFiInstance} has to take full command + * of the current working directory: it installs a full NiFi installation to there. To ensure + * this is desired, it will only run if the current directory is called + * "nifi_testharness_nifi_home". As such the JVM process has to be started inside a directory + * called "nifi_testharness_nifi_home" so that the following is true: + * + * + * new File(System.getProperty("user.dir")).getName().equals("nifi_testharness_nifi_home") + * + * + * + * + * Before {@code TestNiFiInstance} can be used, it has to be configured via its builder + * interface: + * + * + * {@link Builder#setFlowXmlToInstallForTesting(File)} specifies the location of the NiFi binary + * distribution ZIP file to be used. + * + * + * {@link Builder#setFlowXmlToInstallForTesting(File)} specifies the location of the NiFi flow + * to install. + * + * + * {@link Builder#modifyFlowXmlBeforeInstalling(FlowFileEditorCallback)} allows on-the-fly + * changes to be performed to the Flow file before it is actually installed. + * + * + * + * Sample + * + * TestNiFiInstance testNiFiInstance = TestNiFiInstance.builder() + * .setNiFiBinaryDistributionZip(YourConstants.NIFI_ZIP_FILE) + * .setFlowXmlToInstallForTesting(YourConstants.FLOW_XML_FILE) + * .modifyFlowXmlBeforeInstalling(YourConstants.FLOW_FILE_CHANGES_FOR_TESTS) + * .build(); + * + * + * + * + * + * If the current working directory is called "nifi_testharness_nifi_home", the caller can + * {@link #install()} this {@code TestNiFiInstance}, which will + * + * + * (as a first cleanup step) erase all content of the current working directory. + * (NOTE: this potentially destructive operation is the reason why we have the + * "nifi_testharness_nifi_home" directory name guard in place!) + * + * + * Extracts the contents of the NiFi binary distribution ZIP file specified in + * the configuration to a to a temporary directory. + * + * Symlinks all files from the temporary directory to the current working + * directory, causing the to hold a fully functional + * NiFi installation. + * + * + * Installs the flow definition files(s) to the NiFi instance specified in + * the configuration. + * + * + * + *
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16539241#comment-16539241 ] ASF GitHub Bot commented on NIFI-5318: -- Github user lfrancke commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r201485489 --- Diff: nifi-testharness/src/main/java/org/apache/nifi/testharness/TestNiFiInstance.java --- @@ -0,0 +1,485 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +package org.apache.nifi.testharness; + +import org.apache.nifi.testharness.api.FlowFileEditorCallback; +import org.apache.nifi.EmbeddedNiFi; +import org.apache.nifi.testharness.util.FileUtils; +import org.apache.nifi.testharness.util.NiFiCoreLibClassLoader; +import org.apache.nifi.testharness.util.XmlUtils; +import org.apache.nifi.testharness.util.Zip; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; +import java.util.zip.ZipEntry; + +/** + * + * An API wrapper of a "test" NiFi instance to which a flow definition is installed for testing. + * + * + * Due to NiFi design restrictions, {@code TestNiFiInstance} has to take full command + * of the current working directory: it installs a full NiFi installation to there. To ensure + * this is desired, it will only run if the current directory is called + * "nifi_testharness_nifi_home". As such the JVM process has to be started inside a directory + * called "nifi_testharness_nifi_home" so that the following is true: + * + * + * new File(System.getProperty("user.dir")).getName().equals("nifi_testharness_nifi_home") + * + * + * + * + * Before {@code TestNiFiInstance} can be used, it has to be configured via its builder + * interface: + * + * + * {@link Builder#setFlowXmlToInstallForTesting(File)} specifies the location of the NiFi binary --- End diff -- I think this should refer to `setNiFiBinaryDistributionZip` instead > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16539242#comment-16539242 ] ASF GitHub Bot commented on NIFI-5318: -- Github user lfrancke commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r201489086 --- Diff: nifi-testharness/src/main/java/org/apache/nifi/testharness/TestNiFiInstance.java --- @@ -0,0 +1,485 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +package org.apache.nifi.testharness; + +import org.apache.nifi.testharness.api.FlowFileEditorCallback; +import org.apache.nifi.EmbeddedNiFi; +import org.apache.nifi.testharness.util.FileUtils; +import org.apache.nifi.testharness.util.NiFiCoreLibClassLoader; +import org.apache.nifi.testharness.util.XmlUtils; +import org.apache.nifi.testharness.util.Zip; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; +import java.util.zip.ZipEntry; + +/** + * + * An API wrapper of a "test" NiFi instance to which a flow definition is installed for testing. + * + * + * Due to NiFi design restrictions, {@code TestNiFiInstance} has to take full command + * of the current working directory: it installs a full NiFi installation to there. To ensure + * this is desired, it will only run if the current directory is called + * "nifi_testharness_nifi_home". As such the JVM process has to be started inside a directory + * called "nifi_testharness_nifi_home" so that the following is true: + * + * + * new File(System.getProperty("user.dir")).getName().equals("nifi_testharness_nifi_home") + * + * + * + * + * Before {@code TestNiFiInstance} can be used, it has to be configured via its builder + * interface: + * + * + * {@link Builder#setFlowXmlToInstallForTesting(File)} specifies the location of the NiFi binary + * distribution ZIP file to be used. + * + * + * {@link Builder#setFlowXmlToInstallForTesting(File)} specifies the location of the NiFi flow + * to install. + * + * + * {@link Builder#modifyFlowXmlBeforeInstalling(FlowFileEditorCallback)} allows on-the-fly + * changes to be performed to the Flow file before it is actually installed. + * + * + * + * Sample + * + * TestNiFiInstance testNiFiInstance = TestNiFiInstance.builder() + * .setNiFiBinaryDistributionZip(YourConstants.NIFI_ZIP_FILE) + * .setFlowXmlToInstallForTesting(YourConstants.FLOW_XML_FILE) + * .modifyFlowXmlBeforeInstalling(YourConstants.FLOW_FILE_CHANGES_FOR_TESTS) + * .build(); + * + * + * + * + * + * If the current working directory is called "nifi_testharness_nifi_home", the caller can + * {@link #install()} this {@code TestNiFiInstance}, which will + * + * + * (as a first cleanup step) erase all content of the current working directory. + * (NOTE: this potentially destructive operation is the reason why we have the + * "nifi_testharness_nifi_home" directory name guard in place!) + * + * + * Extracts the contents of the NiFi binary distribution ZIP file specified in + * the configuration to a to a temporary directory. + * + * Symlinks all files from the temporary directory to the current working + * directory, causing the to hold a fully functional + * NiFi installation. + * + * + * Installs the flow definition files(s) to the NiFi instance specified in + * the configuration. + * + * + * + *
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16539243#comment-16539243 ] ASF GitHub Bot commented on NIFI-5318: -- Github user lfrancke commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r201495972 --- Diff: nifi-testharness/src/test/java/org/apache/nifi/testharness/samples/TestUtils.java --- @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +package org.apache.nifi.testharness.samples; + +import java.io.File; + +final class TestUtils { + +private TestUtils() { +// no instances allowed +} + +static File getBinaryDistributionZipFile(File binaryDistributionZipDir) { + +File[] files = binaryDistributionZipDir.listFiles((dir, name) -> --- End diff -- This can return `null` which makes the next `if` statement fail with a NPE. I think the condition can be extended to ``` if (files == null || files.length == 0) ``` > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16539240#comment-16539240 ] ASF GitHub Bot commented on NIFI-5318: -- Github user lfrancke commented on a diff in the pull request: https://github.com/apache/nifi/pull/2872#discussion_r201488527 --- Diff: nifi-testharness/src/main/java/org/apache/nifi/testharness/TestNiFiInstance.java --- @@ -0,0 +1,485 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +package org.apache.nifi.testharness; + +import org.apache.nifi.testharness.api.FlowFileEditorCallback; +import org.apache.nifi.EmbeddedNiFi; +import org.apache.nifi.testharness.util.FileUtils; +import org.apache.nifi.testharness.util.NiFiCoreLibClassLoader; +import org.apache.nifi.testharness.util.XmlUtils; +import org.apache.nifi.testharness.util.Zip; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; +import java.util.zip.ZipEntry; + +/** + * + * An API wrapper of a "test" NiFi instance to which a flow definition is installed for testing. + * + * + * Due to NiFi design restrictions, {@code TestNiFiInstance} has to take full command + * of the current working directory: it installs a full NiFi installation to there. To ensure + * this is desired, it will only run if the current directory is called + * "nifi_testharness_nifi_home". As such the JVM process has to be started inside a directory + * called "nifi_testharness_nifi_home" so that the following is true: + * + * + * new File(System.getProperty("user.dir")).getName().equals("nifi_testharness_nifi_home") + * + * + * + * + * Before {@code TestNiFiInstance} can be used, it has to be configured via its builder + * interface: + * + * + * {@link Builder#setFlowXmlToInstallForTesting(File)} specifies the location of the NiFi binary + * distribution ZIP file to be used. + * + * + * {@link Builder#setFlowXmlToInstallForTesting(File)} specifies the location of the NiFi flow + * to install. + * + * + * {@link Builder#modifyFlowXmlBeforeInstalling(FlowFileEditorCallback)} allows on-the-fly + * changes to be performed to the Flow file before it is actually installed. + * + * + * + * Sample + * + * TestNiFiInstance testNiFiInstance = TestNiFiInstance.builder() + * .setNiFiBinaryDistributionZip(YourConstants.NIFI_ZIP_FILE) + * .setFlowXmlToInstallForTesting(YourConstants.FLOW_XML_FILE) + * .modifyFlowXmlBeforeInstalling(YourConstants.FLOW_FILE_CHANGES_FOR_TESTS) + * .build(); + * + * + * + * + * + * If the current working directory is called "nifi_testharness_nifi_home", the caller can + * {@link #install()} this {@code TestNiFiInstance}, which will + * + * + * (as a first cleanup step) erase all content of the current working directory. + * (NOTE: this potentially destructive operation is the reason why we have the + * "nifi_testharness_nifi_home" directory name guard in place!) + * + * + * Extracts the contents of the NiFi binary distribution ZIP file specified in + * the configuration to a to a temporary directory. + * + * Symlinks all files from the temporary directory to the current working + * directory, causing the to hold a fully functional --- End diff -- missing word causing the directory > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16538522#comment-16538522 ] ASF GitHub Bot commented on NIFI-5318: -- GitHub user peter-gergely-horvath opened a pull request: https://github.com/apache/nifi/pull/2872 NIFI-5318 Implement NiFi test harness: initial commit of nifi-testharness All issues are fixed from the previous pull request comments. Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [x] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [x] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [x] Is your initial contribution a single, squashed commit? ### For code changes: - [x] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [ ] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/peter-gergely-horvath/nifi master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2872.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2872 commit e4c08a17c6ecd81bbc2032cd7f0e799ab89bc7a4 Author: Peter G. Horvath Date: 2018-07-07T09:32:56Z NIFI-5318 Implement NiFi test harness: initial commit of nifi-testharness > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535712#comment-16535712 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2843 @joewitt The idea is that this component would allow you to write Java test cases against your NiFi flow. Something like [NiFiFlowTest](https://github.com/peter-gergely-horvath/nifi/blob/master/nifi-testharness/src/test/java/org/apache/nifi/testharness/samples/NiFiFlowTest.java#L101). The JavaDoc on [TestNiFiInstance](https://github.com/peter-gergely-horvath/nifi/blob/master/nifi-testharness/src/main/java/org/apache/nifi/testharness/TestNiFiInstance.java#L45) should explain the concept quite well. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535709#comment-16535709 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200807442 --- Diff: nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/test/util/FileUtils.java --- @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +package org.apache.nifi.test.util; + +import java.io.File; +import java.io.IOException; +import java.nio.file.*; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.Arrays; + +public final class FileUtils { + + +private static final String MAC_DS_STORE_NAME = ".DS_Store"; --- End diff -- I think this is probably fine: if you look at the code usages, it is used to avoid symlinking a Mac system directory; it should not have any side effect on other systems. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535707#comment-16535707 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200807322 --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java --- @@ -57,6 +57,9 @@ * @param extensionMapping extension mapping */ public static void generate(final NiFiProperties properties, final ExtensionMapping extensionMapping) { + --- End diff -- yes, indeed, this somehow slipped in: I'll fix in my fork and create a new pull request later on. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535708#comment-16535708 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200807326 --- Diff: nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/test/SimpleNiFiFlowDefinitionEditor.java --- @@ -0,0 +1,144 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +package org.apache.nifi.test; + +import org.apache.nifi.test.api.FlowFileEditorCallback; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathFactory; +import java.util.LinkedList; + + +/** + * + * A facility to describe simple, common changes to a NiFi flow before it is installed to the test + * NiFi instance. Intended to be used by + * {@link TestNiFiInstance.Builder#modifyFlowXmlBeforeInstalling(FlowFileEditorCallback)} + * + * + * + * The desired edits can be configured via the {@link Builder} object returned by the {@link #builder()} + * method. Once fully configured, the {@link Builder#build()} emits a {@code FlowFileEditorCallback} + * object that can be passed to + * {@link TestNiFiInstance.Builder#modifyFlowXmlBeforeInstalling(FlowFileEditorCallback)}. + * + * + * + * CAUTION: THIS IS AN EXPERIMENTAL API: EXPECT CHANGES! + * Efforts will be made to retain backwards API compatibility, but + * no guarantee is given. + * + * + * @see TestNiFiInstance.Builder#modifyFlowXmlBeforeInstalling(FlowFileEditorCallback) + * + * @author Peter G. Horvath --- End diff -- I'll fix in my fork and create a new pull request later on. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535706#comment-16535706 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200807310 --- Diff: nifi-docs/src/main/asciidoc/developer-guide.adoc --- @@ -2296,6 +2296,32 @@ threads that should be used to run the Processor can be set via the `setThreadCount(int)` method. +=== Experimental NiFi Flow test harness + +NiFi now has an experimental feature for full end-to-end testing of flows. This allows us +to take a NiFi flow, install it to a test NiFi instance, run it and make Java unit test +like asserts regarding its behaviour. + +The class `org.apache.nifi.test.TestNiFiInstance` is a thin wrapper that allows us +to manipulate a NiFi installation and deploy a flow with some adjustments +to its configuration, including changing processor properties and replacing processor +classes with mocks. + +In order to add the necessary classes to your project, +you can use the Maven dependency: + +[source] + + + org.apache.nifi + nifi-test + ${nifi version} + + + +For further documentation, please consult the JavaDoc of +`org.apache.nifi.test.TestNiFiInstance`. For samples, please take a look at +link:https://github.com/apache/nifi/tree/master/nifi-test/src/test/java/org/apache/test/samples[samples on GitHub^]. --- End diff -- The idea is that users should be able to write test cases in Java for NiFi flows: these code samples linked there would demonstrate creating a test case like that. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535702#comment-16535702 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2843 Hi @joewitt and @MikeThomsen I messed up this pull request with some incorrectly merged code changes including the non-NiFi groupId and the whitespace change in nifi-toolkit-tls module etc. Sorry about that! For now, I will close any pull requests. Since you had some really valuable ideas, could you please review the code in https://github.com/peter-gergely-horvath/nifi/tree/master/nifi-testharness and create issues with the inputs you have? I've implemented changes you mentioned in this pull request there already. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535704#comment-16535704 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200807283 --- Diff: nifi-test/pom.xml --- @@ -0,0 +1,145 @@ +http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> + +nifi +org.apache.nifi +1.8.0-SNAPSHOT + + +4.0.0 + --- End diff -- Yes, this was incorrect: I'll fix in my fork and create a new pull request later on. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535705#comment-16535705 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200807286 --- Diff: nifi-test/pom.xml --- @@ -0,0 +1,145 @@ +http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> + +nifi +org.apache.nifi +1.8.0-SNAPSHOT + + +4.0.0 + +com.thinkbiganalytics +nifi-test --- End diff -- It makes sense. I'll fix in my fork and create a new pull request later on. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535691#comment-16535691 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2855 Closed for now to avoid confusion > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535692#comment-16535692 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath closed the pull request at: https://github.com/apache/nifi/pull/2855 > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535690#comment-16535690 ] ASF GitHub Bot commented on NIFI-5318: -- GitHub user peter-gergely-horvath opened a pull request: https://github.com/apache/nifi/pull/2855 NIFI-5318 Implement NiFi test harness: initial commit of nifi-testharness Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [x] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [x] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [x] Is your initial contribution a single, squashed commit? ### For code changes: - [x] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [ ] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/peter-gergely-horvath/nifi master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2855.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2855 commit 7916daf9e3fcdc5a396ae7815069c3d8bfa168d6 Author: Peter G. Horvath Date: 2018-07-07T08:48:30Z NIFI-5318 Implement NiFi test harness: initial commit of nifi-testharness > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535569#comment-16535569 ] ASF GitHub Bot commented on NIFI-5318: -- Github user joewitt commented on the issue: https://github.com/apache/nifi/pull/2843 I dont fully understand what this aims to achieve so please understand that in my comments. However, changes to the nifi-toolkit-tls module dont seem to apply to wanting a test harness style capability for flows. Adding a series of 'test' packages to main/source code seems like an anti-pattern.We really need to reset on this effort and make sure it is clear what we're looking to achieve before this goes further as-is. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535568#comment-16535568 ] ASF GitHub Bot commented on NIFI-5318: -- Github user joewitt commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200799818 --- Diff: nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/test/util/FileUtils.java --- @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +package org.apache.nifi.test.util; + +import java.io.File; +import java.io.IOException; +import java.nio.file.*; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.Arrays; + +public final class FileUtils { + + +private static final String MAC_DS_STORE_NAME = ".DS_Store"; --- End diff -- the osx specific nature of this is concerning > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535567#comment-16535567 ] ASF GitHub Bot commented on NIFI-5318: -- Github user joewitt commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200799793 --- Diff: nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/test/SimpleNiFiFlowDefinitionEditor.java --- @@ -0,0 +1,144 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + +package org.apache.nifi.test; + +import org.apache.nifi.test.api.FlowFileEditorCallback; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathFactory; +import java.util.LinkedList; + + +/** + * + * A facility to describe simple, common changes to a NiFi flow before it is installed to the test + * NiFi instance. Intended to be used by + * {@link TestNiFiInstance.Builder#modifyFlowXmlBeforeInstalling(FlowFileEditorCallback)} + * + * + * + * The desired edits can be configured via the {@link Builder} object returned by the {@link #builder()} + * method. Once fully configured, the {@link Builder#build()} emits a {@code FlowFileEditorCallback} + * object that can be passed to + * {@link TestNiFiInstance.Builder#modifyFlowXmlBeforeInstalling(FlowFileEditorCallback)}. + * + * + * + * CAUTION: THIS IS AN EXPERIMENTAL API: EXPECT CHANGES! + * Efforts will be made to retain backwards API compatibility, but + * no guarantee is given. + * + * + * @see TestNiFiInstance.Builder#modifyFlowXmlBeforeInstalling(FlowFileEditorCallback) + * + * @author Peter G. Horvath --- End diff -- please remove all author tags from all javadocs > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535564#comment-16535564 ] ASF GitHub Bot commented on NIFI-5318: -- Github user joewitt commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200799698 --- Diff: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java --- @@ -57,6 +57,9 @@ * @param extensionMapping extension mapping */ public static void generate(final NiFiProperties properties, final ExtensionMapping extensionMapping) { + --- End diff -- these extra lines should be removed > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535563#comment-16535563 ] ASF GitHub Bot commented on NIFI-5318: -- Github user joewitt commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200799695 --- Diff: nifi-docs/src/main/asciidoc/developer-guide.adoc --- @@ -2296,6 +2296,32 @@ threads that should be used to run the Processor can be set via the `setThreadCount(int)` method. +=== Experimental NiFi Flow test harness + +NiFi now has an experimental feature for full end-to-end testing of flows. This allows us +to take a NiFi flow, install it to a test NiFi instance, run it and make Java unit test +like asserts regarding its behaviour. + +The class `org.apache.nifi.test.TestNiFiInstance` is a thin wrapper that allows us +to manipulate a NiFi installation and deploy a flow with some adjustments +to its configuration, including changing processor properties and replacing processor +classes with mocks. + +In order to add the necessary classes to your project, +you can use the Maven dependency: + +[source] + + + org.apache.nifi + nifi-test + ${nifi version} + + + +For further documentation, please consult the JavaDoc of +`org.apache.nifi.test.TestNiFiInstance`. For samples, please take a look at +link:https://github.com/apache/nifi/tree/master/nifi-test/src/test/java/org/apache/test/samples[samples on GitHub^]. --- End diff -- what is this link really meant to be? > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535540#comment-16535540 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200798916 --- Diff: nifi-test/pom.xml --- @@ -0,0 +1,145 @@ +http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> + +nifi +org.apache.nifi +1.8.0-SNAPSHOT + + +4.0.0 + +com.thinkbiganalytics +nifi-test --- End diff -- +1 > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16535539#comment-16535539 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200798895 --- Diff: nifi-test/pom.xml --- @@ -0,0 +1,145 @@ +http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> + +nifi +org.apache.nifi +1.8.0-SNAPSHOT + + +4.0.0 + --- End diff -- Agreed. AFAIK, things like this need to be refactored, where possible, to `org.apache.nifi.*` > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16534799#comment-16534799 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath closed the pull request at: https://github.com/apache/nifi/pull/2844 > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533660#comment-16533660 ] ASF GitHub Bot commented on NIFI-5318: -- Github user ottobackwards commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200353601 --- Diff: nifi-test/pom.xml --- @@ -0,0 +1,145 @@ +http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> + +nifi +org.apache.nifi +1.8.0-SNAPSHOT + + +4.0.0 + --- End diff -- I don't think this should be thingbiganalytics > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533661#comment-16533661 ] ASF GitHub Bot commented on NIFI-5318: -- Github user ottobackwards commented on a diff in the pull request: https://github.com/apache/nifi/pull/2843#discussion_r200353847 --- Diff: nifi-test/pom.xml --- @@ -0,0 +1,145 @@ +http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";> + +nifi +org.apache.nifi +1.8.0-SNAPSHOT + + +4.0.0 + +com.thinkbiganalytics +nifi-test --- End diff -- nifi-test seems too generic for this. why not nifi-test-harness ? > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533652#comment-16533652 ] ASF GitHub Bot commented on NIFI-5318: -- GitHub user peter-gergely-horvath opened a pull request: https://github.com/apache/nifi/pull/2844 NIFI-5318 Implement NiFi test harness: initial commit of nifi-test Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [x] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [x] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [x] Is your initial contribution a single, squashed commit? ### For code changes: - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? Could not run this, I have test failures in my environment, that are unrelated to the code changes: ``` [INFO] Running org.apache.nifi.provenance.index.lucene.TestLuceneEventIndex [ERROR] Tests run: 8, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 61.062 s <<< FAILURE! - in org.apache.nifi.provenance.index.lucene.TestLuceneEventIndex [ERROR] testUnauthorizedEventsGetPlaceholdersForExpandChildren(org.apache.nifi.provenance.index.lucene.TestLuceneEventIndex) Time elapsed: 60.014 s <<< ERROR! org.junit.runners.model.TestTimedOutException: test timed out after 6 milliseconds at org.apache.nifi.provenance.index.lucene.TestLuceneEventIndex.testUnauthorizedEventsGetPlaceholdersForExpandChildren(TestLuceneEventIndex.java:206) ``` - [ ] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/peter-gergely-horvath/nifi master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2844.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2844 commit 57a10ada3c00be30a39bd892fa634306626e89b2 Author: Peter G. Horvath Date: 2018-07-05T13:28:20Z NIFI-5318 Implement NiFi test harness: initial commit of nifi-test > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533533#comment-16533533 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2843 You can ping me when you're ready. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533521#comment-16533521 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath closed the pull request at: https://github.com/apache/nifi/pull/2843 > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533520#comment-16533520 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2843 OK, @MikeThomsen I see some further issues here: I'll close the pull request and try to rectify them. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533514#comment-16533514 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2843 @MikeThomsen I tried, but it kept failing with other tests cases, unrelated to my changes, see above in pull request: ``` At the moment, the build fails with unit test failures unrelated to this commit: [INFO] Running org.apache.nifi.csv.TestCSVValidators [INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.018 s - in org.apache.nifi.csv.TestCSVValidators [INFO] Running org.apache.nifi.csv.TestJacksonCSVRecordReader [ERROR] Tests run: 11, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.033 s <<< FAILURE! - in org.apache.nifi.csv.TestJacksonCSVRecordReader [ERROR] testUTF8(org.apache.nifi.csv.TestJacksonCSVRecordReader) Time elapsed: 0.002 s <<< FAILURE! org.junit.ComparisonFailure: expected:<[黃凱揚]> but was:<[???]> at org.apache.nifi.csv.TestJacksonCSVRecordReader.testUTF8(TestJ ``` The fact I cannot get a working build from original/master is kind of painful, do you see any way for me to remedy this? > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533510#comment-16533510 ] ASF GitHub Bot commented on NIFI-5318: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2843 @peter-gergely-horvath looks like you have a stylecheck failure. Did you build the maven module(s) you added using `mvn clean install -Pcontrib-check`? Looks like you have at least a few files that aren't licensed. Depending on what they are, you'll need to either add the license header or just exclude them from the RAT plugin's checks. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533360#comment-16533360 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2843 @MikeThomsen @joewitt please let me know if you need anything else from my end. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533359#comment-16533359 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath commented on the issue: https://github.com/apache/nifi/pull/2843 @MikeThomsen yes, this is fine from the standpoint of the IP. A bit of background: I had developed this piece of code internally, at my employer, which had to be pushed through _our_ open sourcing approval process. After that was done, I had internal talks with our practice director regarding contributing this back to NiFi and he confirmed this is to be done using the standard NiFi ASF license: so technically it is me, the person, who makes this contribution and not our organization. > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533008#comment-16533008 ] ASF GitHub Bot commented on NIFI-5318: -- GitHub user peter-gergely-horvath opened a pull request: https://github.com/apache/nifi/pull/2843 NIFI-5318 Implement NiFi test harness: initial commit of nifi-test Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [x] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [x] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [ x Is your initial contribution a single, squashed commit? ### For code changes: - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? At the moment, the build fails with unit test failures unrelated to this commit: ``` [INFO] Running org.apache.nifi.csv.TestCSVValidators [INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.018 s - in org.apache.nifi.csv.TestCSVValidators [INFO] Running org.apache.nifi.csv.TestJacksonCSVRecordReader [ERROR] Tests run: 11, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.033 s <<< FAILURE! - in org.apache.nifi.csv.TestJacksonCSVRecordReader [ERROR] testUTF8(org.apache.nifi.csv.TestJacksonCSVRecordReader) Time elapsed: 0.002 s <<< FAILURE! org.junit.ComparisonFailure: expected:<[黃凱揚]> but was:<[???]> at org.apache.nifi.csv.TestJacksonCSVRecordReader.testUTF8(TestJacksonCSVRecordReader.java:81) [INFO] Running org.apache.nifi.csv.TestCSVHeaderSchemaStrategy [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s - in org.apache.nifi.csv.TestCSVHeaderSchemaStrategy [INFO] Running org.apache.nifi.csv.TestCSVRecordReader [INFO] Tests run: 21, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 s - in org.apache.nifi.csv.TestCSVRecordReader [INFO] Running org.apache.nifi.csv.TestWriteCSVResult [INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s - in org.apache.nifi.csv.TestWriteCSVResult [INFO] [INFO] Results: [INFO] [ERROR] Failures: [ERROR] TestJacksonCSVRecordReader.testUTF8:81 expected:<[黃凱揚]> but was:<[???]> [ERROR] TestXMLReader.testAttributePrefix:133 expected:<... ATTR_ID=P3, NAME=Am[é]lie Bonfils, AGE=74}...> but was:<... ATTR_ID=P3, NAME=Am[?]lie Bonfils, AGE=74}...> [ERROR] TestXMLReader.testContentField:156 expected:<...apRecord[{CONTENT=Am[é]lie Bonfils, ATTR=at...> but was:<...apRecord[{CONTENT=Am[?]lie Bonfils, ATTR=at...> [INFO] [ERROR] Tests run: 221, Failures: 3, Errors: 0, Skipped: 2 [INFO] [INFO] ``` - [ ] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/peter-gergely-horvath/nifi master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2843.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2843 commit 02e338e3b2c53c6a0af8f83f44378b4a242e0ec1 Author: Peter G. Horvath Date: 2018-07-04T18:44:06Z NIFI-5318 Implement NiFi test harness: initial commit of nifi-test > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533005#comment-16533005 ] ASF GitHub Bot commented on NIFI-5318: -- Github user peter-gergely-horvath closed the pull request at: https://github.com/apache/nifi/pull/2842 > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache.org/jira/browse/NIFI-5318 > Project: Apache NiFi > Issue Type: New Feature >Reporter: Peter Horvath >Priority: Major > > Currently, it is not really possible to automatically test the behaviour of a > specific NiFi flow and make unit test type asserts if it works as expected. > For example, if the expected behaviour of a NiFi flow is that a file placed > to a specific directory will trigger some operation after which some output > file will appear at another directory, once currently can only do one thing: > test the NiFi flow manually. > Manual testing is especially hard to manage if a NiFi flow is being actively > developed: any change to a complex, existing NiFi flow might require a lot of > manual testing just to ensure there are no regressions introduced. > Some kind of Java API that allows managing a NiFi instance and manipulating > flow deployments like for example, [Codehaus > Cargo|]https://codehaus-cargo.github.io/] would be of great help. > > > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5318) Implement NiFi test harness
[ https://issues.apache.org/jira/browse/NIFI-5318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533001#comment-16533001 ] ASF GitHub Bot commented on NIFI-5318: -- GitHub user peter-gergely-horvath opened a pull request: https://github.com/apache/nifi/pull/2842 NIFI-5318 Implement NiFi test harness: initial commit of nifi-test Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [x] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [x] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [x] Is your initial contribution a single, squashed commit? ### For code changes: - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? At the moment, the build fails with unit **test failures unrelated to this commit**: ``` [INFO] Running org.apache.nifi.csv.TestCSVValidators [INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.018 s - in org.apache.nifi.csv.TestCSVValidators [INFO] Running org.apache.nifi.csv.TestJacksonCSVRecordReader [ERROR] Tests run: 11, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.033 s <<< FAILURE! - in org.apache.nifi.csv.TestJacksonCSVRecordReader [ERROR] testUTF8(org.apache.nifi.csv.TestJacksonCSVRecordReader) Time elapsed: 0.002 s <<< FAILURE! org.junit.ComparisonFailure: expected:<[黃凱揚]> but was:<[???]> at org.apache.nifi.csv.TestJacksonCSVRecordReader.testUTF8(TestJacksonCSVRecordReader.java:81) [INFO] Running org.apache.nifi.csv.TestCSVHeaderSchemaStrategy [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s - in org.apache.nifi.csv.TestCSVHeaderSchemaStrategy [INFO] Running org.apache.nifi.csv.TestCSVRecordReader [INFO] Tests run: 21, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 s - in org.apache.nifi.csv.TestCSVRecordReader [INFO] Running org.apache.nifi.csv.TestWriteCSVResult [INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s - in org.apache.nifi.csv.TestWriteCSVResult [INFO] [INFO] Results: [INFO] [ERROR] Failures: [ERROR] TestJacksonCSVRecordReader.testUTF8:81 expected:<[黃凱揚]> but was:<[???]> [ERROR] TestXMLReader.testAttributePrefix:133 expected:<... ATTR_ID=P3, NAME=Am[é]lie Bonfils, AGE=74}...> but was:<... ATTR_ID=P3, NAME=Am[?]lie Bonfils, AGE=74}...> [ERROR] TestXMLReader.testContentField:156 expected:<...apRecord[{CONTENT=Am[é]lie Bonfils, ATTR=at...> but was:<...apRecord[{CONTENT=Am[?]lie Bonfils, ATTR=at...> [INFO] [ERROR] Tests run: 221, Failures: 3, Errors: 0, Skipped: 2 [INFO] [INFO] ``` - [x] Have you written or updated unit tests to verify your changes? - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/peter-gergely-horvath/nifi master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2842.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2842 commit 7af1eebc61d764790fb108db0bed8eb63f050b96 Author: Peter G. Horvath Date: 2018-07-04T16:33:24Z NIFI-5318 Implement NiFi test harness: initial commit of nifi-test > Implement NiFi test harness > --- > > Key: NIFI-5318 > URL: https://issues.apache