From 913ae91614b25dfd3fd668c475acd712d00de5a2 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Tue, 22 Nov 2016 16:31:52 -0500 Subject: [PATCH] Added posix guard to ignore tests on windows This closes #1259 Signed-off-by: jpercivall --- .../nifi/processors/standard/TestGetFile.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetFile.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetFile.java index daf807a077..baa89197b3 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetFile.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetFile.java @@ -22,6 +22,7 @@ import static org.junit.Assert.fail; import java.io.File; import java.io.IOException; +import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.attribute.PosixFilePermission; @@ -34,6 +35,7 @@ import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Set; + import org.apache.nifi.flowfile.attributes.CoreAttributes; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; @@ -44,6 +46,10 @@ public class TestGetFile { @Test public void testWithInaccessibleDir() throws IOException { + // Some systems don't support POSIX (Windows) and will fail if run. Should ignore the test in that event + if (!FileSystems.getDefault().supportedFileAttributeViews().contains("posix")) { + return; + } File inaccessibleDir = new File("target/inaccessible"); inaccessibleDir.deleteOnExit(); inaccessibleDir.mkdir(); @@ -62,6 +68,10 @@ public class TestGetFile { @Test public void testWithUnreadableDir() throws IOException { + // Some systems don't support POSIX (Windows) and will fail if run. Should ignore the test in that event + if (!FileSystems.getDefault().supportedFileAttributeViews().contains("posix")) { + return; + } File unreadableDir = new File("target/unreadable"); unreadableDir.deleteOnExit(); unreadableDir.mkdir(); @@ -86,6 +96,10 @@ public class TestGetFile { @Test public void testWithUnwritableDir() throws IOException { + // Some systems don't support POSIX (Windows) and will fail if run. Should ignore the test in that event + if (!FileSystems.getDefault().supportedFileAttributeViews().contains("posix")) { + return; + } File unwritableDir = new File("target/unwritable"); unwritableDir.deleteOnExit(); unwritableDir.mkdir();