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 2014/12/10 13:09:52 UTC

[3/3] incubator-nifi git commit: NIFI-151 Fixed test issue which resulted from needing to cleanup after previous runs

NIFI-151 Fixed test issue which resulted from needing to cleanup after previous runs


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

Branch: refs/heads/develop
Commit: 51d177b2426e4940134069c28d8d7f70c473a353
Parents: c55e851
Author: joewitt <jo...@apache.org>
Authored: Wed Dec 10 07:09:18 2014 -0500
Committer: joewitt <jo...@apache.org>
Committed: Wed Dec 10 07:09:18 2014 -0500

----------------------------------------------------------------------
 .../accesscontrol/DfmAccessControlTest.java     | 26 +++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/51d177b2/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/DfmAccessControlTest.java
----------------------------------------------------------------------
diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/DfmAccessControlTest.java b/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/DfmAccessControlTest.java
index 2946177..03b26ca 100644
--- a/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/DfmAccessControlTest.java
+++ b/nar-bundles/framework-bundle/framework/web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/DfmAccessControlTest.java
@@ -21,6 +21,10 @@ import com.sun.jersey.multipart.BodyPart;
 import com.sun.jersey.multipart.FormDataBodyPart;
 import com.sun.jersey.multipart.FormDataMultiPart;
 import java.io.File;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -81,6 +85,7 @@ public class DfmAccessControlTest {
     private static final String CLIENT_ID = "dfm-client-id";
     private static final String CONTEXT_PATH = "/nifi-api";
     private static final String FLOW_XML_PATH = "target/test-classes/access-control/flow-dfm.xml";
+    private static final String FLOW_TEMPLATES_PATH = "target/test-classes/access-control/templates";
 
     private static NiFiTestServer SERVER;
     private static NiFiTestUser DFM_USER;
@@ -88,6 +93,20 @@ public class DfmAccessControlTest {
 
     @BeforeClass
     public static void setup() throws Exception {
+        // look for the flow.xml and toss it
+        File flow = new File(FLOW_XML_PATH);
+        if (flow.exists()) {
+            flow.delete();
+        }
+        // look for templates and toss them
+        final Path templatePath = Paths.get(FLOW_TEMPLATES_PATH);
+        if (Files.exists(templatePath)) {
+            final DirectoryStream<Path> dirStream = Files.newDirectoryStream(Paths.get(FLOW_TEMPLATES_PATH), "*.template");
+            for (final Path path : dirStream) {
+                Files.delete(path);
+            }
+        }
+
         // configure the location of the nifi properties
         File nifiPropertiesFile = new File("src/test/resources/access-control/nifi.properties");
         System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, nifiPropertiesFile.getAbsolutePath());
@@ -1377,10 +1396,15 @@ public class DfmAccessControlTest {
         SERVER.shutdownServer();
         SERVER = null;
 
-        // look for the flow.xml
+        // look for the flow.xml and toss it
         File flow = new File(FLOW_XML_PATH);
         if (flow.exists()) {
             flow.delete();
         }
+        // look for templates and toss them
+        final DirectoryStream<Path> dirStream = Files.newDirectoryStream(Paths.get(FLOW_TEMPLATES_PATH), "*.template");
+        for (final Path path : dirStream) {
+            Files.delete(path);
+        }
     }
 }