Github user MikeThomsen commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2892#discussion_r217718166
  
    --- Diff: 
nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/test/java/org/apache/nifi/processors/hadoop/PutHDFSTest.java
 ---
    @@ -362,32 +342,139 @@ public void 
testPutFileWhenDirectoryUsesUnrecognizedEL() throws IOException {
         @Test
         public void testPutFileWhenDirectoryUsesInvalidEL() throws IOException 
{
             // Refer to comment in the BeforeClass method for an explanation
    -        assumeTrue(isNotWindows());
     
    -        PutHDFS proc = new TestablePutHDFS(kerberosProperties);
    +        PutHDFS proc = new TestablePutHDFS(kerberosProperties, 
mockFileSystem);
             TestRunner runner = TestRunners.newTestRunner(proc);
             // the validator should pick up the invalid EL
             runner.setProperty(PutHDFS.DIRECTORY, 
"target/data_${literal('testing'):foo()}");
             runner.setProperty(PutHDFS.CONFLICT_RESOLUTION, "replace");
             runner.assertNotValid();
         }
     
    -    private boolean isNotWindows() {
    -        return !System.getProperty("os.name").startsWith("Windows");
    -    }
    -
    -    private static class TestablePutHDFS extends PutHDFS {
    +    private class TestablePutHDFS extends PutHDFS {
     
             private KerberosProperties testKerberosProperties;
    +        private FileSystem fileSystem;
     
    -        public TestablePutHDFS(KerberosProperties testKerberosProperties) {
    +        public TestablePutHDFS(KerberosProperties testKerberosProperties, 
FileSystem fileSystem) {
                 this.testKerberosProperties = testKerberosProperties;
    +            this.fileSystem = fileSystem;
             }
     
             @Override
             protected KerberosProperties getKerberosProperties(File 
kerberosConfigFile) {
                 return testKerberosProperties;
             }
    +
    +        @Override
    +        protected FileSystem getFileSystem(Configuration config) throws 
IOException {
    +            return fileSystem;
    +        }
    +
    +        @Override
    +        protected FileSystem getFileSystem() {
    +            return fileSystem;
    +        }
    +    }
    +
    +    private class MockFileSystem extends FileSystem {
    --- End diff --
    
    Probably should be a static class.


---

Reply via email to