This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch itest-jms in repository https://gitbox.apache.org/repos/asf/camel.git
commit ecc8eea789ffd930779aa7bfada8193a021f6d07 Author: Claus Ibsen <[email protected]> AuthorDate: Fri Aug 11 15:43:34 2023 +0200 camel-test - Make jms test faster --- .../apache/camel/itest/jms/JmsConsumerShutdownTest.java | 15 ++++++++++++--- .../org/apache/camel/itest/jms/JmsJettyAsyncTest.java | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsConsumerShutdownTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsConsumerShutdownTest.java index 18258486f42..d7fd0125ddf 100644 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsConsumerShutdownTest.java +++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsConsumerShutdownTest.java @@ -16,6 +16,7 @@ */ package org.apache.camel.itest.jms; +import org.apache.camel.CamelContext; import org.apache.camel.EndpointInject; import org.apache.camel.Exchange; import org.apache.camel.Processor; @@ -27,6 +28,7 @@ import org.apache.camel.itest.utils.extensions.JmsServiceExtension; import org.apache.camel.test.spring.junit5.CamelSpringTest; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; @@ -36,6 +38,9 @@ public class JmsConsumerShutdownTest { @RegisterExtension public static JmsServiceExtension jmsServiceExtension = JmsServiceExtension.createExtension(); + @Autowired + CamelContext camelContext; + @Produce("jms:start") protected ProducerTemplate activemq; @@ -51,8 +56,10 @@ public class JmsConsumerShutdownTest { @Test @DirtiesContext void testJmsConsumerShutdownWithMessageInFlight() throws InterruptedException { + camelContext.getShutdownStrategy().setTimeout(3); + end.expectedMessageCount(0); - end.setResultWaitTime(2000); + end.setResultWaitTime(1000); // direct:dir route always fails exception.whenAnyExchangeReceived(new Processor() { @@ -71,8 +78,10 @@ public class JmsConsumerShutdownTest { @Test @DirtiesContext void testSedaConsumerShutdownWithMessageInFlight() throws InterruptedException { + camelContext.getShutdownStrategy().setTimeout(3); + end.expectedMessageCount(0); - end.setResultWaitTime(2000); + end.setResultWaitTime(1000); // direct:dir route always fails exception.whenAnyExchangeReceived(new Processor() { @@ -100,7 +109,7 @@ public class JmsConsumerShutdownTest { from("direct:dir") .onException(Exception.class) - .redeliveryDelay(1000) + .redeliveryDelay(500) .maximumRedeliveries(-1) // forever .end() .to("mock:exception"); diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsJettyAsyncTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsJettyAsyncTest.java index 01e170fd71d..15d958c8f3a 100644 --- a/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsJettyAsyncTest.java +++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsJettyAsyncTest.java @@ -62,7 +62,7 @@ public class JmsJettyAsyncTest extends CamelTestSupport { .to("log:result?groupSize=10", "mock:result"); from("jetty:http://0.0.0.0:" + port + "/myapp") - .delay(100) + .delay(10) .transform(body().prepend("Bye ")); } };
