You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jo...@apache.org on 2016/01/01 20:21:01 UTC
[2/3] nifi git commit: NIFI-1343 added unit tests to verify behavior
NIFI-1343 added unit tests to verify behavior
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/e16a9a0c
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/e16a9a0c
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/e16a9a0c
Branch: refs/heads/master
Commit: e16a9a0c68b1aad60921e78b93f24aeaa77e3524
Parents: 02b325b
Author: joewitt <jo...@apache.org>
Authored: Fri Jan 1 14:08:46 2016 -0500
Committer: joewitt <jo...@apache.org>
Committed: Fri Jan 1 14:08:46 2016 -0500
----------------------------------------------------------------------
.../nifi/processors/standard/TestRouteText.java | 36 ++++++++++++++++++++
1 file changed, 36 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/e16a9a0c/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestRouteText.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestRouteText.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestRouteText.java
index 760986d..7c40445 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestRouteText.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestRouteText.java
@@ -133,6 +133,42 @@ public class TestRouteText {
}
@Test
+ public void testSimpleCaseSensitiveStartsMatch() throws IOException {
+ final TestRunner runner = TestRunners.newTestRunner(new RouteText());
+ runner.setProperty(RouteText.MATCH_STRATEGY, RouteText.STARTS_WITH);
+ runner.setProperty(RouteText.IGNORE_CASE, "false");
+ runner.setProperty("simple", "start");
+
+ runner.enqueue("STart middle end\nstart middle end".getBytes("UTF-8"));
+ runner.run();
+
+ runner.assertTransferCount("simple", 1);
+ runner.assertTransferCount("unmatched", 1);
+ runner.assertTransferCount("original", 1);
+ final MockFlowFile outMatched = runner.getFlowFilesForRelationship("simple").get(0);
+ outMatched.assertContentEquals("start middle end".getBytes("UTF-8"));
+ final MockFlowFile outUnmatched = runner.getFlowFilesForRelationship("unmatched").get(0);
+ outUnmatched.assertContentEquals("STart middle end\n".getBytes("UTF-8"));
+ }
+
+ @Test
+ public void testSimpleCaseInsensitiveStartsMatch() throws IOException {
+ final TestRunner runner = TestRunners.newTestRunner(new RouteText());
+ runner.setProperty(RouteText.MATCH_STRATEGY, RouteText.STARTS_WITH);
+ runner.setProperty(RouteText.IGNORE_CASE, "true");
+ runner.setProperty("simple", "start");
+
+ runner.enqueue("start middle end\nSTart middle end".getBytes("UTF-8"));
+ runner.run();
+
+ runner.assertTransferCount("simple", 1);
+ runner.assertTransferCount("unmatched", 0);
+ runner.assertTransferCount("original", 1);
+ final MockFlowFile outMatched = runner.getFlowFilesForRelationship("simple").get(0);
+ outMatched.assertContentEquals("start middle end\nSTart middle end".getBytes("UTF-8"));
+ }
+
+ @Test
public void testSimpleDefaultEnd() throws IOException {
final TestRunner runner = TestRunners.newTestRunner(new RouteText());
runner.setProperty(RouteText.MATCH_STRATEGY, RouteText.ENDS_WITH);