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 fa2fc251d8 file: migrate quartz scheduled file polling to new test
harness #3584
fa2fc251d8 is described below
commit fa2fc251d8a1a8d6d0d4eb652ee135e256ddee54
Author: aldettinger <[email protected]>
AuthorDate: Fri Sep 8 19:01:05 2023 +0200
file: migrate quartz scheduled file polling to new test harness #3584
---
.../camel/quarkus/component/file/it/FileRoutes.java | 5 +++--
.../apache/camel/quarkus/component/file/it/FileTest.java | 16 ----------------
.../quarkus/component/file/it/NonFlakyFileTest.java | 11 +++++++++++
.../component/file/it/NonFlakyFileTestResource.java | 4 ++++
4 files changed, 18 insertions(+), 18 deletions(-)
diff --git
a/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileRoutes.java
b/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileRoutes.java
index 48f0de44b3..fb21e60d9e 100644
---
a/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileRoutes.java
+++
b/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileRoutes.java
@@ -50,8 +50,9 @@ public class FileRoutes extends RouteBuilder {
+ "readLockTimeout=5000")
.to("file://target/" + READ_LOCK_OUT);
-
from("file://target/quartz?scheduler=quartz&scheduler.cron=0/1+*+*+*+*+?&repeatCount=0")
- .to("file://target/quartz/out");
+
from("file://target/test-files/quartz-scheduled?scheduler=quartz&scheduler.cron=0/1+*+*+*+*+?&repeatCount=0")
+ .convertBodyTo(String.class)
+ .to("mock:quartzScheduledFilePolling");
from("file://target/" + CONSUME_BATCH + "?"
+ "initialDelay=0&delay=100")
diff --git
a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
index caeec3e14c..e40969faaf 100644
---
a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
+++
b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
@@ -184,22 +184,6 @@ class FileTest {
.statusCode(200);
}
- @Test
- public void quartzSchedulerFilePollingConsumer() throws
InterruptedException, UnsupportedEncodingException {
- String fileName = createFile(FILE_BODY, "/file/create/quartz");
-
- String targetFileName = Paths.get(fileName).toFile().getName();
- await().atMost(10, TimeUnit.SECONDS).until(() -> {
- return Files.exists(Paths.get("target/quartz/out",
targetFileName));
- });
-
- RestAssured
- .get("/file/get/{folder}/{name}", "quartz/out", targetFileName)
- .then()
- .statusCode(200)
- .body(equalTo(FILE_BODY));
- }
-
private static String createFile(String content, String path) throws
UnsupportedEncodingException {
return createFile(content, path, "UTF-8", null);
}
diff --git
a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/NonFlakyFileTest.java
b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/NonFlakyFileTest.java
index b42ca887d6..c71a7a3cfb 100644
---
a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/NonFlakyFileTest.java
+++
b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/NonFlakyFileTest.java
@@ -34,6 +34,7 @@ import static
org.apache.camel.quarkus.component.file.it.NonFlakyFileTestResourc
import static
org.apache.camel.quarkus.component.file.it.NonFlakyFileTestResource.IDEMPOTENT_FILE_CONTENT;
import static
org.apache.camel.quarkus.component.file.it.NonFlakyFileTestResource.IDEMPOTENT_FILE_NAME;
import static
org.apache.camel.quarkus.component.file.it.NonFlakyFileTestResource.POLL_ENRICH_FILE_CONTENT;
+import static
org.apache.camel.quarkus.component.file.it.NonFlakyFileTestResource.QUARTZ_SCHEDULED_FILE_CONTENT;
import static
org.apache.camel.quarkus.component.file.it.NonFlakyFileTestResource.TEST_FILES_FOLDER;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.core.IsEqual.equalTo;
@@ -95,4 +96,14 @@ class NonFlakyFileTest {
.body(Matchers.is(POLL_ENRICH_FILE_CONTENT));
}
+ @Test
+ public void quartzScheduledFilePollingShouldSucceed() {
+ await().atMost(10, TimeUnit.SECONDS).until(
+ () -> RestAssured
+ .get("/file/getFromMock/quartzScheduledFilePolling")
+ .then()
+ .extract().asString(),
+ equalTo(QUARTZ_SCHEDULED_FILE_CONTENT));
+ }
+
}
diff --git
a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/NonFlakyFileTestResource.java
b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/NonFlakyFileTestResource.java
index fecf1404dd..0cfa91beb0 100644
---
a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/NonFlakyFileTestResource.java
+++
b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/NonFlakyFileTestResource.java
@@ -40,6 +40,8 @@ public class NonFlakyFileTestResource implements
QuarkusTestResourceLifecycleMan
static final String IDEMPOTENT_FILE_CONTENT = IDEMPOTENT_FILE_NAME +
"-CONTENT";
static final String POLL_ENRICH_FILE_NAME = "poll-enrich-file";
static final String POLL_ENRICH_FILE_CONTENT = POLL_ENRICH_FILE_NAME +
"-CONTENT";
+ static final String QUARTZ_SCHEDULED_FILE_NAME = "quartz-schedule-file";
+ static final String QUARTZ_SCHEDULED_FILE_CONTENT =
QUARTZ_SCHEDULED_FILE_NAME + "-CONTENT";
private final List<Path> createdTestFiles = new ArrayList<Path>();
@@ -55,6 +57,8 @@ public class NonFlakyFileTestResource implements
QuarkusTestResourceLifecycleMan
createTestFile("poll-enrich", POLL_ENRICH_FILE_NAME);
+ createTestFile("quartz-scheduled", QUARTZ_SCHEDULED_FILE_NAME);
+
ensureAllTestFilesCreatedWithExpectedContent();
} catch (Exception ex) {
throw new RuntimeException("Problem while initializing test
files", ex);