You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/08/12 14:25:14 UTC
[camel] branch file-fast created (now 77e20578f90)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch file-fast
in repository https://gitbox.apache.org/repos/asf/camel.git
at 77e20578f90 camel-core - Make test go faster and reformat
This branch includes the following new commits:
new 77e20578f90 camel-core - Make test go faster and reformat
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[camel] 01/01: camel-core - Make test go faster and reformat
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch file-fast
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 77e20578f9028c66b7210cadd3f22b3aecb84312
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Aug 12 16:25:02 2023 +0200
camel-core - Make test go faster and reformat
---
.../strategy/FileChangedReadLockZeroTimeoutTest.java | 16 ++++------------
.../org/apache/camel/impl/ScheduledPollConsumerTest.java | 5 ++---
2 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/file/strategy/FileChangedReadLockZeroTimeoutTest.java b/core/camel-core/src/test/java/org/apache/camel/component/file/strategy/FileChangedReadLockZeroTimeoutTest.java
index 9a5e8759156..d44d8b048a0 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/file/strategy/FileChangedReadLockZeroTimeoutTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/file/strategy/FileChangedReadLockZeroTimeoutTest.java
@@ -16,37 +16,29 @@
*/
package org.apache.camel.component.file.strategy;
-import java.nio.file.Files;
-import java.time.Duration;
-
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
public class FileChangedReadLockZeroTimeoutTest extends ContextTestSupport {
@Test
+ @Timeout(10)
public void testChangedReadLockZeroTimeout() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
mock.expectedFileExists(testFile("out/hello1.txt"));
-
template.sendBodyAndHeader(fileUri("in"), "Hello World", Exchange.FILE_NAME, "hello1.txt");
-
- Awaitility.await().atMost(Duration.ofSeconds(30)).until(() -> Files.exists(testFile("in/hello1.txt")));
-
- Files.delete(testFile("in/hello1.txt"));
+ assertMockEndpointsSatisfied();
mock.reset();
oneExchangeDone.reset();
mock.expectedMessageCount(1);
mock.expectedFileExists(testFile("out/hello2.txt"));
-
template.sendBodyAndHeader(fileUri("in"), "Hello Again World", Exchange.FILE_NAME, "hello2.txt");
-
assertMockEndpointsSatisfied();
oneExchangeDone.matchesWaitTime();
}
@@ -56,7 +48,7 @@ public class FileChangedReadLockZeroTimeoutTest extends ContextTestSupport {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from(fileUri("in?initialDelay=0&delay=10&readLock=changed&readLockCheckInterval=5000&readLockTimeout=0"))
+ from(fileUri("in?initialDelay=0&delay=10&readLock=changed&readLockCheckInterval=50&readLockTimeout=0"))
.to(fileUri("out"), "mock:result");
}
};
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/ScheduledPollConsumerTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/ScheduledPollConsumerTest.java
index 84c4ec97d98..716b448dac9 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/ScheduledPollConsumerTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/ScheduledPollConsumerTest.java
@@ -16,15 +16,14 @@
*/
package org.apache.camel.impl;
+import java.util.concurrent.atomic.AtomicInteger;
+
import org.apache.camel.Consumer;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Endpoint;
import org.apache.camel.spi.PollingConsumerPollStrategy;
-import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
-import java.util.concurrent.atomic.AtomicInteger;
-
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;