This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new dc23ef7996 Delete potentially locked file on VM exit for Windows dev 
mode test
dc23ef7996 is described below

commit dc23ef7996ebd5243be54db9bcea430176a6f6bf
Author: James Netherton <[email protected]>
AuthorDate: Mon Jul 25 08:43:02 2022 +0100

    Delete potentially locked file on VM exit for Windows dev mode test
---
 ...nRoutesIncludePatternWithAbsoluteFilePrefixDevModeTest.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git 
a/integration-tests/main-devmode/src/test/java/org/apache/camel/quarkus/main/CamelMainRoutesIncludePatternWithAbsoluteFilePrefixDevModeTest.java
 
b/integration-tests/main-devmode/src/test/java/org/apache/camel/quarkus/main/CamelMainRoutesIncludePatternWithAbsoluteFilePrefixDevModeTest.java
index 4a03772191..23b43e9a0b 100644
--- 
a/integration-tests/main-devmode/src/test/java/org/apache/camel/quarkus/main/CamelMainRoutesIncludePatternWithAbsoluteFilePrefixDevModeTest.java
+++ 
b/integration-tests/main-devmode/src/test/java/org/apache/camel/quarkus/main/CamelMainRoutesIncludePatternWithAbsoluteFilePrefixDevModeTest.java
@@ -26,11 +26,13 @@ import java.nio.file.StandardCopyOption;
 import java.util.Comparator;
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
 
 import io.quarkus.test.QuarkusDevModeTest;
 import io.restassured.RestAssured;
 import io.restassured.response.Response;
 import org.apache.camel.quarkus.core.util.FileUtils;
+import org.apache.camel.util.FileUtil;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
 import org.jboss.shrinkwrap.api.asset.Asset;
 import org.jboss.shrinkwrap.api.asset.StringAsset;
@@ -64,10 +66,16 @@ public class 
CamelMainRoutesIncludePatternWithAbsoluteFilePrefixDevModeTest {
 
     @AfterAll
     public static void cleanUp() throws IOException {
+        Consumer<? super File> deleteFile = File::delete;
+        if (FileUtil.isWindows()) {
+            // File may be locked by the Quarkus process, so clean up on VM 
exit
+            deleteFile = File::deleteOnExit;
+        }
+
         Files.walk(BASE)
                 .sorted(Comparator.reverseOrder())
                 .map(Path::toFile)
-                .forEach(File::delete);
+                .forEach(deleteFile);
     }
 
     public static Asset applicationProperties() {

Reply via email to