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 15:36:18 UTC
[camel] branch main updated: camel-core - Make test go faster and reformat (#11094)
This is an automated email from the ASF dual-hosted git repository.
davsclaus 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 f5a1042db7f camel-core - Make test go faster and reformat (#11094)
f5a1042db7f is described below
commit f5a1042db7f48c18125874513642bb153c2f6a7c
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Aug 12 17:36:11 2023 +0200
camel-core - Make test go faster and reformat (#11094)
---
.../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;