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

Matt Gilman commented on NIFI-593:
----------------------------------

+1 Looks good.

> Possible test failures due to no guarantee of ordering for directory 
> properties
> -------------------------------------------------------------------------------
>
>                 Key: NIFI-593
>                 URL: https://issues.apache.org/jira/browse/NIFI-593
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 0.1.0
>            Reporter: Aldrin Piri
>            Assignee: Aldrin Piri
>            Priority: Blocker
>         Attachments: 
> 0001-NIFI-593-Providing-Set-semantics-for-those-compariso.patch
>
>
> org.apache.nifi.nar.NarUnpackerTest#testUnpackNars makes explicit selections 
> of listed directories by array index.  This can be problematic as those 
> listings are not guaranteed to be ordered.
> This signature is also present in NiFiPropertiesTest#testProperties where a 
> similar selection of value is provided via an element index.
> Results where order is not guaranteed and does not matter need to have their 
> semantics changed to model those of a Set in lieu of the List that is 
> typically returned.
> A scan needs to be performed for such problem cases and converted to use this.
> Something along the lines would be sufficient:
> {code}
>         final File extensionsWorkingDir = 
> properties.getExtensionsWorkingDirectory();
>         File[] extensionFiles = extensionsWorkingDir.listFiles();
>         Set<String> expectedNars = new HashSet<>();
>         expectedNars.add("dummy-one.nar-unpacked");
>         expectedNars.add("dummy-two.nar-unpacked");
>         assertEquals(expectedNars.size(), extensionFiles.length);
>         for (File extensionFile : extensionFiles) {
>             Assert.assertTrue(expectedNars.contains(extensionFile.getName()));
>         }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to