This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch mock in repository https://gitbox.apache.org/repos/asf/camel.git
commit fcc5c4e1e3f1c0120bc63b984d1b94c82bafc21f Author: Claus Ibsen <[email protected]> AuthorDate: Mon Apr 15 16:56:46 2019 +0200 Move mock component out of camel-core. Work in progress. --- .../org/apache/camel/impl/InterceptSendToMockEndpointStrategy.java | 7 +++---- .../camel/impl/InterceptSendToMockEndpointStrategyCustomTest.java | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToMockEndpointStrategy.java b/core/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToMockEndpointStrategy.java index 030b3d4..f608085 100644 --- a/core/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToMockEndpointStrategy.java +++ b/core/camel-core/src/main/java/org/apache/camel/impl/InterceptSendToMockEndpointStrategy.java @@ -18,7 +18,6 @@ package org.apache.camel.impl; import org.apache.camel.Endpoint; import org.apache.camel.Producer; -import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.spi.EndpointStrategy; import org.apache.camel.support.EndpointHelper; import org.apache.camel.util.StringHelper; @@ -72,7 +71,7 @@ public class InterceptSendToMockEndpointStrategy implements EndpointStrategy { if (endpoint instanceof DefaultInterceptSendToEndpoint) { // endpoint already decorated return endpoint; - } else if (endpoint instanceof MockEndpoint) { + } else if (endpoint.getEndpointUri().startsWith("mock:")) { // we should not intercept mock endpoints return endpoint; } else if (matchPattern(uri, endpoint, pattern)) { @@ -91,7 +90,7 @@ public class InterceptSendToMockEndpointStrategy implements EndpointStrategy { } LOG.info("Adviced endpoint [{}] with mock endpoint [{}]", uri, key); - MockEndpoint mock = endpoint.getCamelContext().getEndpoint(key, MockEndpoint.class); + Endpoint mock = endpoint.getCamelContext().getEndpoint(key, Endpoint.class); Producer producer; try { producer = mock.createProducer(); @@ -131,7 +130,7 @@ public class InterceptSendToMockEndpointStrategy implements EndpointStrategy { * @param mockProducer the mock producer * @return the mock producer */ - protected Producer onInterceptEndpoint(String uri, Endpoint endpoint, MockEndpoint mockEndpoint, Producer mockProducer) { + protected Producer onInterceptEndpoint(String uri, Endpoint endpoint, Endpoint mockEndpoint, Producer mockProducer) { return mockProducer; } diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/InterceptSendToMockEndpointStrategyCustomTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/InterceptSendToMockEndpointStrategyCustomTest.java index 6693988..b1f8ac8 100644 --- a/core/camel-core/src/test/java/org/apache/camel/impl/InterceptSendToMockEndpointStrategyCustomTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/impl/InterceptSendToMockEndpointStrategyCustomTest.java @@ -20,7 +20,6 @@ import org.apache.camel.ContextTestSupport; import org.apache.camel.Endpoint; import org.apache.camel.Producer; import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; import org.junit.Test; public class InterceptSendToMockEndpointStrategyCustomTest extends ContextTestSupport { @@ -30,7 +29,7 @@ public class InterceptSendToMockEndpointStrategyCustomTest extends ContextTestSu private class MyStrategy extends InterceptSendToMockEndpointStrategy { @Override - protected Producer onInterceptEndpoint(String uri, Endpoint endpoint, MockEndpoint mockEndpoint, Producer mockProducer) { + protected Producer onInterceptEndpoint(String uri, Endpoint endpoint, Endpoint mockEndpoint, Producer mockProducer) { called = true; return mockProducer; }
