This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new a5a70ba  CAMEL-16331: Workaround in unit test
a5a70ba is described below

commit a5a70ba8087de7b7177225339b8b8e12f150de21
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed Mar 10 19:25:01 2021 +0100

    CAMEL-16331: Workaround in unit test
---
 .../component/paho/mqtt5/PahoMqtt5ToDSendDynamicTest.java     | 11 +++++++++++
 .../apache/camel/component/paho/PahoToDSendDynamicTest.java   | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git 
a/components/camel-paho-mqtt5/src/test/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5ToDSendDynamicTest.java
 
b/components/camel-paho-mqtt5/src/test/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5ToDSendDynamicTest.java
index 1c13670..cea8d54 100644
--- 
a/components/camel-paho-mqtt5/src/test/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5ToDSendDynamicTest.java
+++ 
b/components/camel-paho-mqtt5/src/test/java/org/apache/camel/component/paho/mqtt5/PahoMqtt5ToDSendDynamicTest.java
@@ -16,13 +16,24 @@
  */
 package org.apache.camel.component.paho.mqtt5;
 
+import org.apache.camel.CamelContext;
+import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.engine.PrototypeExchangeFactory;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class PahoMqtt5ToDSendDynamicTest extends PahoMqtt5TestSupport {
 
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext context = super.createCamelContext();
+        // this test must use prototype scope as we use pooling consumer
+        context.adapt(ExtendedCamelContext.class).setExchangeFactory(new 
PrototypeExchangeFactory());
+        return context;
+    }
+
     @Test
     public void testToD() throws Exception {
         template.sendBodyAndHeader("direct:start", "Hello bar", "where", 
"bar");
diff --git 
a/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoToDSendDynamicTest.java
 
b/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoToDSendDynamicTest.java
index 4deb2c7..0d2d662 100644
--- 
a/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoToDSendDynamicTest.java
+++ 
b/components/camel-paho/src/test/java/org/apache/camel/component/paho/PahoToDSendDynamicTest.java
@@ -17,7 +17,10 @@
 package org.apache.camel.component.paho;
 
 import org.apache.activemq.broker.BrokerService;
+import org.apache.camel.CamelContext;
+import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.engine.PrototypeExchangeFactory;
 import org.apache.camel.test.AvailablePortFinder;
 import org.apache.camel.test.junit5.CamelTestSupport;
 import org.junit.jupiter.api.AfterEach;
@@ -32,6 +35,14 @@ public class PahoToDSendDynamicTest extends CamelTestSupport 
{
     int mqttPort = AvailablePortFinder.getNextAvailable();
 
     @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext context = super.createCamelContext();
+        // this test must use prototype scope as we use pooling consumer
+        context.adapt(ExtendedCamelContext.class).setExchangeFactory(new 
PrototypeExchangeFactory());
+        return context;
+    }
+
+    @Override
     protected boolean useJmx() {
         return false;
     }

Reply via email to