Repository: nifi Updated Branches: refs/heads/master 372a316de -> 8c011d91e
NIFI-2060 - fixed unit tests to be compatible with 2.7.x This closes #547 Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/8c011d91 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/8c011d91 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/8c011d91 Branch: refs/heads/master Commit: 8c011d91e147a9bab0e2ab5b2d59f5926269a654 Parents: 372a316 Author: Pierre Villard <pierre.villard...@gmail.com> Authored: Mon Jun 20 19:15:09 2016 +0200 Committer: Matt Burgess <mattyb...@apache.org> Committed: Mon Aug 1 12:46:51 2016 -0400 ---------------------------------------------------------------------- .../hadoop/inotify/TestGetHDFSEvents.java | 23 +++++++++----------- .../hadoop/inotify/util/EventTestUtils.java | 12 ---------- 2 files changed, 10 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/8c011d91/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/inotify/TestGetHDFSEvents.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/inotify/TestGetHDFSEvents.java b/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/inotify/TestGetHDFSEvents.java index 3cd0cb3..f8c1cce 100644 --- a/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/inotify/TestGetHDFSEvents.java +++ b/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/inotify/TestGetHDFSEvents.java @@ -133,7 +133,7 @@ public class TestGetHDFSEvents { runner.run(); List<MockFlowFile> successfulFlowFiles = runner.getFlowFilesForRelationship(GetHDFSEvents.REL_SUCCESS); - assertEquals(6, successfulFlowFiles.size()); + assertEquals(3, successfulFlowFiles.size()); verify(eventBatch).getTxid(); assertEquals("100", runner.getProcessContext().getStateManager().getState(Scope.CLUSTER).get("last.tx.id")); } @@ -176,13 +176,13 @@ public class TestGetHDFSEvents { TestRunner runner = TestRunners.newTestRunner(processor); runner.setProperty(GetHDFSEvents.HDFS_PATH_TO_WATCH, "/some/path(/.*)?"); - runner.setProperty(GetHDFSEvents.EVENT_TYPES, "create, metadata, rename"); + runner.setProperty(GetHDFSEvents.EVENT_TYPES, "create, metadata"); runner.run(); List<MockFlowFile> successfulFlowFiles = runner.getFlowFilesForRelationship(GetHDFSEvents.REL_SUCCESS); - assertEquals(3, successfulFlowFiles.size()); + assertEquals(2, successfulFlowFiles.size()); - List<String> expectedEventTypes = Arrays.asList("CREATE", "METADATA", "RENAME"); + List<String> expectedEventTypes = Arrays.asList("CREATE", "METADATA"); for (MockFlowFile f : successfulFlowFiles) { String eventType = f.getAttribute(EventAttributes.EVENT_TYPE); assertTrue(expectedEventTypes.contains(eventType)); @@ -195,9 +195,9 @@ public class TestGetHDFSEvents { @Test public void makeSureExpressionLanguageIsWorkingProperlyWithinTheHdfsPathToWatch() throws Exception { Event[] events = new Event[] { - new Event.AppendEvent("/some/path/1/2/3/t.txt"), - new Event.AppendEvent("/some/path/1/2/4/t.txt"), - new Event.AppendEvent("/some/path/1/2/3/.t.txt") + new Event.CreateEvent.Builder().path("/some/path/1/2/3/t.txt").build(), + new Event.CreateEvent.Builder().path("/some/path/1/2/4/t.txt").build(), + new Event.CreateEvent.Builder().path("/some/path/1/2/3/.t.txt").build() }; EventBatch eventBatch = mock(EventBatch.class); @@ -211,7 +211,7 @@ public class TestGetHDFSEvents { TestRunner runner = TestRunners.newTestRunner(processor); runner.setProperty(GetHDFSEvents.HDFS_PATH_TO_WATCH, "/some/path/${literal(1)}/${literal(2)}/${literal(3)}/.*.txt"); - runner.setProperty(GetHDFSEvents.EVENT_TYPES, "append"); + runner.setProperty(GetHDFSEvents.EVENT_TYPES, "create"); runner.setProperty(GetHDFSEvents.IGNORE_HIDDEN_FILES, "true"); runner.run(); @@ -220,7 +220,7 @@ public class TestGetHDFSEvents { for (MockFlowFile f : successfulFlowFiles) { String eventType = f.getAttribute(EventAttributes.EVENT_TYPE); - assertTrue(eventType.equals("APPEND")); + assertTrue(eventType.equals("CREATE")); } verify(eventBatch).getTxid(); @@ -231,10 +231,7 @@ public class TestGetHDFSEvents { return new Event[]{ EventTestUtils.createCreateEvent(), EventTestUtils.createCloseEvent(), - EventTestUtils.createAppendEvent(), - EventTestUtils.createRenameEvent(), - EventTestUtils.createMetadataUpdateEvent(), - EventTestUtils.createUnlinkEvent() + EventTestUtils.createMetadataUpdateEvent() }; } http://git-wip-us.apache.org/repos/asf/nifi/blob/8c011d91/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/inotify/util/EventTestUtils.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/inotify/util/EventTestUtils.java b/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/inotify/util/EventTestUtils.java index 890b4de..83f4454 100644 --- a/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/inotify/util/EventTestUtils.java +++ b/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/inotify/util/EventTestUtils.java @@ -47,14 +47,6 @@ public class EventTestUtils { return new Event.CloseEvent("/some/path/close", 1L, 2L); } - public static Event.AppendEvent createAppendEvent() { - return new Event.AppendEvent("/some/path/append"); - } - - public static Event.RenameEvent createRenameEvent() { - return new Event.RenameEvent("/some/path/rename/src", "/some/path/rename/dest", 200L); - } - public static Event.MetadataUpdateEvent createMetadataUpdateEvent() { return new Event.MetadataUpdateEvent.Builder() .replication(0) @@ -70,8 +62,4 @@ public class EventTestUtils { .xAttrsRemoved(false) .build(); } - - public static Event.UnlinkEvent createUnlinkEvent() { - return new Event.UnlinkEvent("/some/path/unlink", 300L); - } }