dan-s1 commented on code in PR #10720:
URL: https://github.com/apache/nifi/pull/10720#discussion_r2691140695


##########
nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/test/java/org/apache/nifi/nar/AbstractTestNarLoader.java:
##########
@@ -53,15 +54,25 @@ public abstract class AbstractTestNarLoader {
 
     @BeforeEach
     public void setup() throws IOException, ClassNotFoundException {
-        deleteDir(getWorkDir());
-        deleteDir(getNarAutoloadDir());
-
-        final File extensionsDir = new File(getNarAutoloadDir());
-        assertTrue(extensionsDir.mkdirs());
+        Files.createDirectories(tempDir.resolve(getWorkDir()));
+        Files.createDirectories(tempDir.resolve(getNarAutoloadDir()));
 
         // Create NiFiProperties
-        final String propertiesFile = getPropertiesFile();
-        properties = NiFiProperties.createBasicNiFiProperties(propertiesFile, 
Collections.emptyMap());
+        final Path originalPropertiesFile = Paths.get(getPropertiesFile());
+        String modifiedPropertiesFileContent;
+        try (Stream<String> lines = Files.lines(originalPropertiesFile)) {
+            modifiedPropertiesFileContent = lines.filter(line -> 
line.startsWith(NiFiProperties.NAR_LIBRARY_AUTOLOAD_DIRECTORY)
+                            ||
+                            
line.startsWith(NiFiProperties.NAR_WORKING_DIRECTORY)
+                            ||
+                            
line.startsWith(NiFiProperties.NAR_LIBRARY_DIRECTORY))
+                    .map(line -> line.replaceFirst("\\./target", 
tempDir.toString()))
+                    .collect(Collectors.joining("\n"));
+        }
+
+        final Path newPropertiesFile = 
tempDir.resolve(originalPropertiesFile.getFileName());

Review Comment:
   I just made a change. Please let me know if this is what you had in mind. 
Thanks!



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to