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
commit 9d77df417d16c8c88c5707277d486ad431c1ded0 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu Jun 12 07:39:03 2025 +0200 camel-google-pubsub: Fix test --- .../pubsub/integration/AcknowledgementIT.java | 4 --- .../integration/ManualAcknowledgementIT.java | 38 ---------------------- 2 files changed, 42 deletions(-) diff --git a/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/AcknowledgementIT.java b/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/AcknowledgementIT.java index 4f00d6b2862..c87d2b8ed74 100644 --- a/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/AcknowledgementIT.java +++ b/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/AcknowledgementIT.java @@ -67,7 +67,6 @@ public class AcknowledgementIT extends PubsubTestSupport { @Override public void process(Exchange exchange) throws Exception { if (AcknowledgementIT.fail) { - Thread.sleep(750); throw new Exception("fail"); } } @@ -82,10 +81,7 @@ public class AcknowledgementIT extends PubsubTestSupport { * body comparison will fail. Check 2 : Failure. As the route throws and exception and the message is NACK'ed. The * message should remain in the PubSub Subscription for the third check. Check 3 : Success for the second message. * The message received should match the second message sent. - * - * @throws Exception */ - @Test public void singleMessage() throws Exception { diff --git a/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/ManualAcknowledgementIT.java b/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/ManualAcknowledgementIT.java index 86b0b29f031..4ba5e8a467d 100644 --- a/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/ManualAcknowledgementIT.java +++ b/components/camel-google/camel-google-pubsub/src/test/java/org/apache/camel/component/google/pubsub/integration/ManualAcknowledgementIT.java @@ -34,12 +34,8 @@ public class ManualAcknowledgementIT extends PubsubTestSupport { private static final String TOPIC_NAME = "manualAcknowledgeTopic"; private static final String SUBSCRIPTION_NAME = "manualAcknowledgeSubscription"; private static final String SYNC_ROUTE_ID = "receive-from-subscription-sync"; - private static final String ASYNC_ROUTE_ID = "receive-from-subscription-async"; private static Boolean ack = true; - @EndpointInject("mock:receiveResultAsync") - private MockEndpoint receiveResultAsync; - @EndpointInject("mock:receiveResultSync") private MockEndpoint receiveResultSync; @@ -60,23 +56,6 @@ public class ManualAcknowledgementIT extends PubsubTestSupport { .routeId("send-to-topic") .to("google-pubsub:{{project.id}}:" + TOPIC_NAME); - from("google-pubsub:{{project.id}}:" + SUBSCRIPTION_NAME + "?ackMode=NONE") - .autoStartup(false) - .routeId(ASYNC_ROUTE_ID) - .to("mock:receiveResultAsync") - .process(exchange -> { - GooglePubsubAcknowledge acknowledge - = exchange.getIn().getHeader(GooglePubsubConstants.GOOGLE_PUBSUB_ACKNOWLEDGE, - GooglePubsubAcknowledge.class); - - if (ManualAcknowledgementIT.ack) { - acknowledge.ack(exchange); - } else { - LOG.debug("Nack!"); - acknowledge.nack(exchange); - } - }); - from("google-pubsub:{{project.id}}:" + SUBSCRIPTION_NAME + "?synchronousPull=true&ackMode=NONE") .autoStartup(false) .routeId(SYNC_ROUTE_ID) @@ -99,14 +78,6 @@ public class ManualAcknowledgementIT extends PubsubTestSupport { @Test public void testManualAcknowledgement() throws Exception { - // 1. Asynchronous consumer with manual acknowledgement. - // Message should only be received once. - producer.sendBody("Testing!"); - receiveResultAsync.expectedMessageCount(1); - context.getRouteController().startRoute(ASYNC_ROUTE_ID); - receiveResultAsync.assertIsSatisfied(3000); - context.getRouteController().stopRoute(ASYNC_ROUTE_ID); - // 2. Synchronous consumer with manual acknowledgement. // Message should only be received once. producer.sendBody("Testing!"); @@ -116,17 +87,8 @@ public class ManualAcknowledgementIT extends PubsubTestSupport { context.getRouteController().stopRoute(SYNC_ROUTE_ID); receiveResultSync.reset(); - receiveResultAsync.reset(); ack = false; - // 3. Asynchronous consumer with manual negative-acknowledgement. - // Message should be continuously redelivered after being nacked. - producer.sendBody("Testing!"); - receiveResultAsync.expectedMinimumMessageCount(3); - context.getRouteController().startRoute(ASYNC_ROUTE_ID); - receiveResultAsync.assertIsSatisfied(3000); - context.getRouteController().stopRoute(ASYNC_ROUTE_ID); - // 4. Synchronous consumer with manual negative-acknowledgement. // Message should be continuously redelivered after being nacked. producer.sendBody("Testing!");