@Test public void testCopyExchange() throws Exception { Processor processor = mock(Processor.class); OsgiDefaultEndpoint endpoint = mock(OsgiDefaultEndpoint.class); OsgiDefaultConsumer consumer = new OsgiDefaultConsumer(endpoint, processor, Collections.<String, Object>emptyMap()); Exchange exchange = mock(Exchange.class, RETURNS_MOCKS); when(exchange.getPattern()).thenReturn(ExchangePattern.OutOptionalIn); Exchange copy = consumer.copyExchange(exchange); verify(exchange, atLeastOnce()).getPattern(); verify(exchange, atLeastOnce()).getIn(); verify(exchange, atLeastOnce()).getException(); assertThat(copy.getPattern(), sameInstance(ExchangePattern.OutOptionalIn)); }
protected Exchange copyExchange(Exchange exchange) { OsgiDefaultEndpoint endpoint = getEndpoint(); Exchange copy = ExchangeHelper.copyExchangeAndSetCamelContext(exchange, endpoint.getCamelContext(), false); copy.setFromEndpoint(endpoint); return copy; }
OsgiDefaultConsumer extends ServiceSupport implements Consumer, SuspendableService, Processor { protected Exchange copyExchange(Exchange exchange) { OsgiDefaultEndpoint endpoint = getEndpoint(); Exchange copy = ExchangeHelper.copyExchangeAndSetCamelContext(exchange, endpoint.getCamelContext(), false); copy.setFromEndpoint(endpoint); return copy; } }
OsgiDefaultConsumer extends ServiceSupport implements Consumer, SuspendableService, Processor { protected Exchange copyExchange(Exchange exchange) { OsgiDefaultEndpoint endpoint = getEndpoint(); Exchange copy = ExchangeHelper.copyExchangeAndSetCamelContext(exchange, endpoint.getCamelContext(), false); copy.setFromEndpoint(endpoint); return copy; } OsgiDefaultConsumer(OsgiDefaultEndpoint endpoint, Processor processor, Map<String, Object> props); }
OsgiDefaultConsumer extends ServiceSupport implements Consumer, SuspendableService, Processor { protected Exchange copyExchange(Exchange exchange) { OsgiDefaultEndpoint endpoint = getEndpoint(); Exchange copy = ExchangeHelper.copyExchangeAndSetCamelContext(exchange, endpoint.getCamelContext(), false); copy.setFromEndpoint(endpoint); return copy; } OsgiDefaultConsumer(OsgiDefaultEndpoint endpoint, Processor processor, Map<String, Object> props); @Override OsgiDefaultEndpoint getEndpoint(); @Override void process(final Exchange exchange); }
OsgiDefaultConsumer extends ServiceSupport implements Consumer, SuspendableService, Processor { protected Exchange copyExchange(Exchange exchange) { OsgiDefaultEndpoint endpoint = getEndpoint(); Exchange copy = ExchangeHelper.copyExchangeAndSetCamelContext(exchange, endpoint.getCamelContext(), false); copy.setFromEndpoint(endpoint); return copy; } OsgiDefaultConsumer(OsgiDefaultEndpoint endpoint, Processor processor, Map<String, Object> props); @Override OsgiDefaultEndpoint getEndpoint(); @Override void process(final Exchange exchange);  }