You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/02/22 19:24:16 UTC

[GitHub] [nifi] markap14 opened a new pull request #5788: NIFI-9716, NIFI-9577: Addressed issue in the PathFilter for GetFile /…

markap14 opened a new pull request #5788:
URL: https://github.com/apache/nifi/pull/5788


   … ListFile. For any file that is found in the Input Directory directly, it was previously being listed/fetched even if it didn't match the PathFilter. Additionally, updated the code to create a new File FIlter for every invocation of onTrigger. This was necessary for NIFI-9577 because the directory to monitor supports Expression Language and as a result may change from invocation to invocation, if using a function such as now() but the PathFilter would always relativize the path based on the value that was obtained when the processor was scheduled.
   
   <!--
     Licensed to the Apache Software Foundation (ASF) under one or more
     contributor license agreements.  See the NOTICE file distributed with
     this work for additional information regarding copyright ownership.
     The ASF licenses this file to You under the Apache License, Version 2.0
     (the "License"); you may not use this file except in compliance with
     the License.  You may obtain a copy of the License at
         http://www.apache.org/licenses/LICENSE-2.0
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
   -->
   Thank you for submitting a contribution to Apache NiFi.
   
   Please provide a short description of the PR here:
   
   #### Description of PR
   
   _Enables X functionality; fixes bug NIFI-YYYY._
   
   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-XXXX** where XXXX 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 `main`)?
   
   - [ ] Is your initial contribution a single, squashed commit? _Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not `squash` or use `--force` when pushing to allow for clean monitoring of changes._
   
   ### 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?
   - [ ] Have you verified that the full build is successful on JDK 8?
   - [ ] Have you verified that the full build is successful on JDK 11?
   - [ ] 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 GitHub Actions CI for build issues and submit an update to your PR as soon as possible.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] gresockj commented on pull request #5788: NIFI-9716, NIFI-9577: Addressed issue in the PathFilter for GetFile /…

Posted by GitBox <gi...@apache.org>.
gresockj commented on pull request #5788:
URL: https://github.com/apache/nifi/pull/5788#issuecomment-1049898263


   Based on @greyp9 's review, and since the code changes look good to me, I'll merge this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] greyp9 commented on pull request #5788: NIFI-9716, NIFI-9577: Addressed issue in the PathFilter for GetFile /…

Posted by GitBox <gi...@apache.org>.
greyp9 commented on pull request #5788:
URL: https://github.com/apache/nifi/pull/5788#issuecomment-1048317969


   > This looks to address the issue surfaced in NIFI-9577. What do you think of a unit test that verifies the dynamic behavior of the input directory property?
   
   A quick and dirty completion of this thought...
   
   ```
       @Test
       public void testExpressionLanguageOnProperty() throws IOException, InterruptedException {
           final Calendar calendar = Calendar.getInstance();
           final int seconds = calendar.get(Calendar.SECOND);
           final int seconds1 = seconds + 1;
           final int seconds2 = seconds + 2;
           final int millis = calendar.get(Calendar.MILLISECOND);
           final File folder1 = new File(TESTDIR, String.format("%02d", seconds1));
           assertTrue(folder1.mkdirs() || folder1.exists());
           final File folder2 = new File(TESTDIR, String.format("%02d", seconds2));
           assertTrue(folder2.mkdirs() || folder2.exists());
           // create one new file in folder "n + 1"
           final File file1 = new File(folder1, "1.txt");
           // create two new files in folder "n + 2"
           final File file2 = new File(folder2, "2.txt");
           final File file2A = new File(folder2, "2A.txt");
           for (final File file : Arrays.asList(file1, file2, file2A)) {
               assertTrue(file.createNewFile() || file.exists());
           }
           runner.setProperty(ListFile.DIRECTORY, TESTDIR + "/${now():format('ss')}");
           // wait until second "n + 1", then test
           Thread.sleep((1000 - millis) + 10);
           runner.run();
           runner.assertAllFlowFilesTransferred(ListFile.REL_SUCCESS, 1);
           runner.clearTransferState();
   
           // wait until second "n + 2", then test
           Thread.sleep(1000);
           runner.run();
           runner.assertAllFlowFilesTransferred(ListFile.REL_SUCCESS, 2);
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] asfgit closed pull request #5788: NIFI-9716, NIFI-9577: Addressed issue in the PathFilter for GetFile /…

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #5788:
URL: https://github.com/apache/nifi/pull/5788


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] greyp9 commented on pull request #5788: NIFI-9716, NIFI-9577: Addressed issue in the PathFilter for GetFile /…

Posted by GitBox <gi...@apache.org>.
greyp9 commented on pull request #5788:
URL: https://github.com/apache/nifi/pull/5788#issuecomment-1049124810


   > @greyp9 I considered it. But I think we should avoid any tests that require `sleep`s and timing in order to be correct. Such tests are notoriously problematic.
   
   I hear you about `sleep`.  I was hoping the concrete example would help you think of another way to do the same thing (I'm not very familiar with the capabilities of EL, so I took a hint from the problem description). 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] thenatog commented on pull request #5788: NIFI-9716, NIFI-9577: Addressed issue in the PathFilter for GetFile /…

Posted by GitBox <gi...@apache.org>.
thenatog commented on pull request #5788:
URL: https://github.com/apache/nifi/pull/5788#issuecomment-1048273099


   Will review


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] markap14 commented on pull request #5788: NIFI-9716, NIFI-9577: Addressed issue in the PathFilter for GetFile /…

Posted by GitBox <gi...@apache.org>.
markap14 commented on pull request #5788:
URL: https://github.com/apache/nifi/pull/5788#issuecomment-1048847457


   @greyp9 I considered it. But I think we should avoid any tests that require `sleep`s and timing in order to be correct. Such tests are notoriously problematic. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org