[jira] [Commented] (NIFI-1184) Mock File System for PutHDFS Tests
[ https://issues.apache.org/jira/browse/NIFI-1184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16615123#comment-16615123 ] ASF GitHub Bot commented on NIFI-1184: -- Github user asfgit closed the pull request at: https://github.com/apache/nifi/pull/2892 > 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)
[jira] [Commented] (NIFI-1184) Mock File System for PutHDFS Tests
[ https://issues.apache.org/jira/browse/NIFI-1184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16615121#comment-16615121 ] ASF subversion and git services commented on NIFI-1184: --- Commit 57ae9b65a0fd9f9f0880331debabbd75e64e1c40 in nifi's branch refs/heads/master from uday [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=57ae9b6 ] NIFI-1184 Mock FileSystem for PutHDFSTest This closes #2892 Signed-off-by: Mike Thomsen > 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)
[jira] [Commented] (NIFI-1184) Mock File System for PutHDFS Tests
[ https://issues.apache.org/jira/browse/NIFI-1184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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)
[jira] [Commented] (NIFI-1184) Mock File System for PutHDFS Tests
[ https://issues.apache.org/jira/browse/NIFI-1184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16553379#comment-16553379 ] Uday Kale commented on NIFI-1184: - Hi, Can someone please review this? > 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)
[jira] [Commented] (NIFI-1184) Mock File System for PutHDFS Tests
[ https://issues.apache.org/jira/browse/NIFI-1184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16544546#comment-16544546 ] ASF GitHub Bot commented on NIFI-1184: -- GitHub user udaykale opened a pull request: https://github.com/apache/nifi/pull/2892 NIFI-1184 Mock FileSystem for PutHDFSTest Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [ ] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)? - [ ] Is your initial contribution a single, squashed commit? ### For code changes: - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [ ] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/udaykale/nifi NIFI-1184 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2892.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2892 commit 0640f80f7067867a2091531e2136196a7b87a4f6 Author: uday Date: 2018-07-14T20:54:58Z NIFI-1184 Mock FileSystem for PutHDFSTest > 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 >Priority: Minor > > 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)