This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch exchange-factory in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/exchange-factory by this push: new f3dfff1 CAMEL-16222: PooledExchangeFactory experiment f3dfff1 is described below commit f3dfff1253d4d53b8c122f29c260ed55e0ec37be Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Feb 22 12:17:47 2021 +0100 CAMEL-16222: PooledExchangeFactory experiment --- .../apache/camel/component/cometd/CometdConsumerTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java index 545b621..51b7fcc 100644 --- a/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java +++ b/components/camel-cometd/src/test/java/org/apache/camel/component/cometd/CometdConsumerTest.java @@ -19,8 +19,10 @@ package org.apache.camel.component.cometd; import java.util.HashSet; import java.util.Set; +import org.apache.camel.ExtendedCamelContext; import org.apache.camel.Processor; import org.apache.camel.component.cometd.CometdConsumer.ConsumerService; +import org.apache.camel.spi.ExchangeFactory; import org.cometd.bayeux.MarkedReference; import org.cometd.bayeux.server.LocalSession; import org.cometd.bayeux.server.ServerChannel; @@ -35,6 +37,7 @@ import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) @@ -43,6 +46,10 @@ public class CometdConsumerTest { private static final String USER_NAME = "userName"; private CometdConsumer testObj; @Mock + private ExtendedCamelContext context; + @Mock + private ExchangeFactory exchangeFactory; + @Mock private CometdEndpoint endpoint; @Mock private Processor processor; @@ -65,6 +72,11 @@ public class CometdConsumerTest { when(bayeuxServerImpl.createChannelIfAbsent(ArgumentMatchers.isNull())).thenReturn(markedReferenceServerChannel); when(markedReferenceServerChannel.getReference()).thenReturn(serverChannel); + when(endpoint.getCamelContext()).thenReturn(context); + when(context.adapt(ExtendedCamelContext.class)).thenReturn(context); + when(context.getExchangeFactory()).thenReturn(exchangeFactory); + when(exchangeFactory.newExchangeFactory(any())).thenReturn(exchangeFactory); + testObj = new CometdConsumer(endpoint, processor); testObj.setBayeux(bayeuxServerImpl);