[ 
https://issues.apache.org/jira/browse/NIFI-1184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16615118#comment-16615118
 ] 

ASF GitHub Bot commented on NIFI-1184:
--------------------------------------

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.


> Mock File System for PutHDFS Tests
> ----------------------------------
>
>                 Key: NIFI-1184
>                 URL: https://issues.apache.org/jira/browse/NIFI-1184
>             Project: Apache NiFi
>          Issue Type: Test
>            Reporter: Joseph Percivall
>            Assignee: Uday Kale
>            Priority: Minor
>             Fix For: 1.8.0
>
>
> Currently 2 of the PutHDFSTest unit test fail when run on Windows. For the 
> 0.4.0 released we decided to ignore those tests when running on Windows on 
> the grounds that they were failing due to issues unrelated to what was 
> attempting to be unit tested.
> What needs to be done is to mock the File System being used for validation in 
> the PutHDFSTest instead of relying on Hadoop (which fails on Windows without 
> the "winutil.exe" binary).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to