You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2015/04/29 21:48:13 UTC
incubator-nifi git commit: NIFI-533: Fixed buggy unit test more
Repository: incubator-nifi
Updated Branches:
refs/heads/ListHDFS 946fd7ce0 -> e0d4484ee
NIFI-533: Fixed buggy unit test more
Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/e0d4484e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/e0d4484e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/e0d4484e
Branch: refs/heads/ListHDFS
Commit: e0d4484ee8e7b80fe3b47d5bb132d95019253a46
Parents: 946fd7c
Author: Mark Payne <ma...@hotmail.com>
Authored: Wed Apr 29 15:48:08 2015 -0400
Committer: Mark Payne <ma...@hotmail.com>
Committed: Wed Apr 29 15:48:08 2015 -0400
----------------------------------------------------------------------
.../nifi/processors/hadoop/TestListHDFS.java | 26 +++++++++++++-------
1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e0d4484e/nifi/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/TestListHDFS.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/TestListHDFS.java b/nifi/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/TestListHDFS.java
index c0b7c1e..0492ccf 100644
--- a/nifi/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/TestListHDFS.java
+++ b/nifi/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/TestListHDFS.java
@@ -25,7 +25,8 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URI;
import java.util.HashMap;
-import java.util.LinkedHashSet;
+import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -48,6 +49,7 @@ import org.apache.nifi.reporting.InitializationException;
import org.apache.nifi.util.MockFlowFile;
import org.apache.nifi.util.TestRunner;
import org.apache.nifi.util.TestRunners;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -95,13 +97,19 @@ public class TestListHDFS {
runner.assertAllFlowFilesTransferred(ListHDFS.REL_SUCCESS, 2);
- final MockFlowFile mff1 = runner.getFlowFilesForRelationship(ListHDFS.REL_SUCCESS).get(0);
- mff1.assertAttributeEquals("path", "/test");
- mff1.assertAttributeEquals("filename", "testFile.txt");
-
- final MockFlowFile mff2 = runner.getFlowFilesForRelationship(ListHDFS.REL_SUCCESS).get(1);
- mff2.assertAttributeEquals("path", "/test/testDir");
- mff2.assertAttributeEquals("filename", "1.txt");
+ final List<MockFlowFile> flowFiles = runner.getFlowFilesForRelationship(ListHDFS.REL_SUCCESS);
+ for (int i=0; i < 2; i++) {
+ final MockFlowFile ff = flowFiles.get(i);
+ final String filename = ff.getAttribute("filename");
+
+ if (filename.equals("testFile.txt")) {
+ ff.assertAttributeEquals("path", "/test");
+ } else if ( filename.equals("1.txt")) {
+ ff.assertAttributeEquals("path", "/test/testDir");
+ } else {
+ Assert.fail("filename was " + filename);
+ }
+ }
}
@Test
@@ -209,7 +217,7 @@ public class TestListHDFS {
public void addFileStatus(final Path parent, final FileStatus child) {
Set<FileStatus> children = fileStatuses.get(parent);
if ( children == null ) {
- children = new LinkedHashSet<>();
+ children = new HashSet<>();
fileStatuses.put(parent, children);
}