Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
0.1.0
-
None
-
None
Description
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:
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())); }