This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 5b5d97b80d7 (chores) camel-zipfile: speed up test
ZipFileSplitAndDeleteTest (#10940)
5b5d97b80d7 is described below
commit 5b5d97b80d72c26faf1a9685f44fc3a74fa73ce6
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Tue Aug 1 10:33:13 2023 +0200
(chores) camel-zipfile: speed up test ZipFileSplitAndDeleteTest (#10940)
---
.../camel/dataformat/zipfile/ZipFileSplitAndDeleteTest.java | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git
a/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileSplitAndDeleteTest.java
b/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileSplitAndDeleteTest.java
index 032611179fe..678cd9d1680 100644
---
a/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileSplitAndDeleteTest.java
+++
b/components/camel-zipfile/src/test/java/org/apache/camel/dataformat/zipfile/ZipFileSplitAndDeleteTest.java
@@ -22,6 +22,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
+import java.time.Duration;
import java.util.Iterator;
import org.apache.camel.RoutesBuilder;
@@ -29,6 +30,7 @@ import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit5.CamelTestSupport;
+import org.awaitility.Awaitility;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -47,8 +49,7 @@ public class ZipFileSplitAndDeleteTest extends
CamelTestSupport {
@Test
public void testDeleteZipFileWhenUnmarshalWithDataFormat() throws
Exception {
- NotifyBuilder notify = new NotifyBuilder(context)
- .from("file://target/" +
"testDeleteZipFileWhenUnmarshalWithDataFormat").whenDone(1).create();
+ NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
getMockEndpoint("mock:end").expectedMessageCount(2);
String zipFile =
createZipFile("testDeleteZipFileWhenUnmarshalWithDataFormat");
@@ -57,12 +58,12 @@ public class ZipFileSplitAndDeleteTest extends
CamelTestSupport {
notify.matchesWaitTime();
// the original file should have been deleted
- assertFalse(new File(zipFile).exists(), "File should been deleted");
+ Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() ->
assertFalse(new File(zipFile).exists(), "File should been deleted"));
}
@Test
public void testDeleteZipFileWhenUnmarshalWithSplitter() throws Exception {
- NotifyBuilder notify = new
NotifyBuilder(context).from("file://target/" +
"testDeleteZipFileWhenUnmarshalWithSplitter")
+ NotifyBuilder notify = new NotifyBuilder(context)
.whenDone(1).create();
getMockEndpoint("mock:end").expectedMessageCount(2);
String zipFile =
createZipFile("testDeleteZipFileWhenUnmarshalWithSplitter");
@@ -71,8 +72,8 @@ public class ZipFileSplitAndDeleteTest extends
CamelTestSupport {
notify.matchesWaitTime();
- // the original file should have been deleted,
- assertFalse(new File(zipFile).exists(), "File should been deleted");
+ // the original file should have been deleted
+ Awaitility.await().atMost(Duration.ofSeconds(10)).untilAsserted(() ->
assertFalse(new File(zipFile).exists(), "File should been deleted"));
}
@Override