You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/10/25 15:43:56 UTC
[camel] 02/02: CAMEL-15753: camel-core - Modularize model should
not use base
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
commit ae392e46337a52ca8dcf63e8744c7b2157611347
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Oct 25 16:36:03 2020 +0100
CAMEL-15753: camel-core - Modularize model should not use base
---
components/camel-hystrix/pom.xml | 2 +-
.../hystrix/processor/HystrixProcessorFactory.java | 2 +-
.../camel-microprofile-fault-tolerance/pom.xml | 2 +-
.../FaultToleranceProcessorFactory.java | 2 +-
.../camel/mock-send-to-endpoint-strategy-factory | 2 ++
.../DefaultMockSendToEndpointStrategyFactory.java} | 24 +++++---------
.../mock}/InterceptSendToMockEndpointStrategy.java | 8 +++--
components/camel-resilience4j/pom.xml | 2 +-
.../resilience4j/ResilienceProcessorFactory.java | 2 +-
.../InterceptSendToMockEndpointStrategyTest.xml | 2 +-
.../apache/camel/spi/InterceptSendToEndpoint.java | 10 ++++++
.../spi/MockSendToEndpointStrategyFactory.java} | 22 +++----------
.../engine/DefaultInterceptEndpointFactory.java | 1 +
.../impl/cloud/ServiceCallProcessorFactory.java | 2 +-
.../impl/cloud/ServiceCallConfigurationTest.java | 2 +-
core/camel-cluster/pom.xml | 4 +++
core/camel-core-model/pom.xml | 11 ++++---
.../camel/builder/AdviceWithRouteBuilder.java | 37 ++++++++++------------
core/camel-core-processor/pom.xml | 1 -
.../InterceptSendToEndpointProcessor.java | 2 +-
core/camel-core-reifier/pom.xml | 6 ----
...erceptSendToMockEndpointStrategyCustomTest.java | 2 +-
.../InterceptSendToMockEndpointStrategyTest.java | 2 +-
...ryCatchInterceptSendToAllEndpointIssueTest.java | 2 +-
.../support}/DefaultInterceptSendToEndpoint.java | 2 +-
.../camel/support}/TypedProcessorFactory.java | 2 +-
.../ROOT/pages/camel-3x-upgrade-guide-3_7.adoc | 8 +++++
27 files changed, 81 insertions(+), 83 deletions(-)
diff --git a/components/camel-hystrix/pom.xml b/components/camel-hystrix/pom.xml
index 95a84bd..63da386 100644
--- a/components/camel-hystrix/pom.xml
+++ b/components/camel-hystrix/pom.xml
@@ -42,7 +42,7 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core-engine</artifactId>
+ <artifactId>camel-core-reifier</artifactId>
</dependency>
<dependency>
diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorFactory.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorFactory.java
index 0d848a7..5674f7b 100644
--- a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorFactory.java
+++ b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixProcessorFactory.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.hystrix.processor;
import org.apache.camel.Processor;
import org.apache.camel.Route;
-import org.apache.camel.impl.engine.TypedProcessorFactory;
import org.apache.camel.model.CircuitBreakerDefinition;
+import org.apache.camel.support.TypedProcessorFactory;
/**
* To integrate camel-hystrix with the Camel routes using the Hystrix EIP.
diff --git a/components/camel-microprofile-fault-tolerance/pom.xml b/components/camel-microprofile-fault-tolerance/pom.xml
index dba4f98..4b8d502 100644
--- a/components/camel-microprofile-fault-tolerance/pom.xml
+++ b/components/camel-microprofile-fault-tolerance/pom.xml
@@ -41,7 +41,7 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core-engine</artifactId>
+ <artifactId>camel-core-reifier</artifactId>
</dependency>
<dependency>
diff --git a/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessorFactory.java b/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessorFactory.java
index 75d5858..2b70ca9 100644
--- a/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessorFactory.java
+++ b/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessorFactory.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.microprofile.faulttolerance;
import org.apache.camel.Processor;
import org.apache.camel.Route;
-import org.apache.camel.impl.engine.TypedProcessorFactory;
import org.apache.camel.model.CircuitBreakerDefinition;
+import org.apache.camel.support.TypedProcessorFactory;
/**
* To integrate camel-microprofile-faulttolerance with the Camel routes using the Circuit Breaker EIP.
diff --git a/components/camel-mock/src/generated/resources/META-INF/services/org/apache/camel/mock-send-to-endpoint-strategy-factory b/components/camel-mock/src/generated/resources/META-INF/services/org/apache/camel/mock-send-to-endpoint-strategy-factory
new file mode 100644
index 0000000..bfa7339
--- /dev/null
+++ b/components/camel-mock/src/generated/resources/META-INF/services/org/apache/camel/mock-send-to-endpoint-strategy-factory
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.mock.DefaultMockSendToEndpointStrategyFactory
diff --git a/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessorFactory.java b/components/camel-mock/src/main/java/org/apache/camel/component/mock/DefaultMockSendToEndpointStrategyFactory.java
similarity index 55%
copy from components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessorFactory.java
copy to components/camel-mock/src/main/java/org/apache/camel/component/mock/DefaultMockSendToEndpointStrategyFactory.java
index 75d5858..f66b19e 100644
--- a/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceProcessorFactory.java
+++ b/components/camel-mock/src/main/java/org/apache/camel/component/mock/DefaultMockSendToEndpointStrategyFactory.java
@@ -14,25 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.component.microprofile.faulttolerance;
+package org.apache.camel.component.mock;
-import org.apache.camel.Processor;
-import org.apache.camel.Route;
-import org.apache.camel.impl.engine.TypedProcessorFactory;
-import org.apache.camel.model.CircuitBreakerDefinition;
+import org.apache.camel.spi.EndpointStrategy;
+import org.apache.camel.spi.MockSendToEndpointStrategyFactory;
+import org.apache.camel.spi.annotations.JdkService;
-/**
- * To integrate camel-microprofile-faulttolerance with the Camel routes using the Circuit Breaker EIP.
- */
-public class FaultToleranceProcessorFactory extends TypedProcessorFactory<CircuitBreakerDefinition> {
-
- public FaultToleranceProcessorFactory() {
- super(CircuitBreakerDefinition.class);
- }
+@JdkService(MockSendToEndpointStrategyFactory.FACTORY)
+public class DefaultMockSendToEndpointStrategyFactory implements MockSendToEndpointStrategyFactory {
@Override
- public Processor doCreateProcessor(Route route, CircuitBreakerDefinition definition) throws Exception {
- return new FaultToleranceReifier(route, definition).createProcessor();
+ public EndpointStrategy mock(String pattern, boolean skip) {
+ return new InterceptSendToMockEndpointStrategy(pattern, skip);
}
-
}
diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/InterceptSendToMockEndpointStrategy.java b/components/camel-mock/src/main/java/org/apache/camel/component/mock/InterceptSendToMockEndpointStrategy.java
similarity index 94%
rename from core/camel-base/src/main/java/org/apache/camel/impl/engine/InterceptSendToMockEndpointStrategy.java
rename to components/camel-mock/src/main/java/org/apache/camel/component/mock/InterceptSendToMockEndpointStrategy.java
index a08e268..c9fa98c 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/InterceptSendToMockEndpointStrategy.java
+++ b/components/camel-mock/src/main/java/org/apache/camel/component/mock/InterceptSendToMockEndpointStrategy.java
@@ -14,11 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.impl.engine;
+package org.apache.camel.component.mock;
import org.apache.camel.Endpoint;
import org.apache.camel.Producer;
import org.apache.camel.spi.EndpointStrategy;
+import org.apache.camel.spi.InterceptSendToEndpoint;
+import org.apache.camel.support.DefaultInterceptSendToEndpoint;
import org.apache.camel.support.EndpointHelper;
import org.apache.camel.util.StringHelper;
import org.slf4j.Logger;
@@ -69,7 +71,7 @@ public class InterceptSendToMockEndpointStrategy implements EndpointStrategy {
@Override
public Endpoint registerEndpoint(String uri, Endpoint endpoint) {
- if (endpoint instanceof DefaultInterceptSendToEndpoint) {
+ if (endpoint instanceof InterceptSendToEndpoint) {
// endpoint already decorated
return endpoint;
} else if (endpoint.getEndpointUri().startsWith("mock:")) {
@@ -80,7 +82,7 @@ public class InterceptSendToMockEndpointStrategy implements EndpointStrategy {
// only proxy if the uri is matched decorate endpoint with our proxy
// should be false by default
- DefaultInterceptSendToEndpoint proxy = new DefaultInterceptSendToEndpoint(endpoint, skip);
+ InterceptSendToEndpoint proxy = new DefaultInterceptSendToEndpoint(endpoint, skip);
// create mock endpoint which we will use as interceptor
// replace :// from scheme to make it easy to lookup the mock endpoint without having double :// in uri
diff --git a/components/camel-resilience4j/pom.xml b/components/camel-resilience4j/pom.xml
index 532f6c0..c0d5d05 100644
--- a/components/camel-resilience4j/pom.xml
+++ b/components/camel-resilience4j/pom.xml
@@ -41,7 +41,7 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core-engine</artifactId>
+ <artifactId>camel-core-reifier</artifactId>
</dependency>
<dependency>
diff --git a/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessorFactory.java b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessorFactory.java
index e2613cf..dd4d346 100644
--- a/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessorFactory.java
+++ b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceProcessorFactory.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.resilience4j;
import org.apache.camel.Processor;
import org.apache.camel.Route;
-import org.apache.camel.impl.engine.TypedProcessorFactory;
import org.apache.camel.model.CircuitBreakerDefinition;
+import org.apache.camel.support.TypedProcessorFactory;
/**
* To integrate camel-resilience4j with the Camel routes using the Circuit Breaker EIP.
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/mock/InterceptSendToMockEndpointStrategyTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/mock/InterceptSendToMockEndpointStrategyTest.xml
index 881797a..c6b81f7 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/mock/InterceptSendToMockEndpointStrategyTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/mock/InterceptSendToMockEndpointStrategyTest.xml
@@ -28,7 +28,7 @@
<import resource="camel-route.xml"/>
<!-- bean which enables mocking all endpoints -->
- <bean id="mockAllEndpoints" class="org.apache.camel.impl.engine.InterceptSendToMockEndpointStrategy"/>
+ <bean id="mockAllEndpoints" class="org.apache.camel.component.mock.InterceptSendToMockEndpointStrategy"/>
<!-- end::e1[] -->
<!-- END SNIPPET: e1 -->
diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/InterceptSendToEndpoint.java b/core/camel-api/src/main/java/org/apache/camel/spi/InterceptSendToEndpoint.java
index fdd170a..7b26b9a 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/InterceptSendToEndpoint.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/InterceptSendToEndpoint.java
@@ -36,11 +36,21 @@ public interface InterceptSendToEndpoint extends Endpoint {
Processor getBefore();
/**
+ * Sets the processor for routing in a detour before sending to the original endpoint.
+ */
+ void setBefore(Processor before);
+
+ /**
* The processor (optional) for routing after sending to the original endpoint.
*/
Processor getAfter();
/**
+ * Sets the processor (optional) for routing after sending to the original endpoint.
+ */
+ void setAfter(Processor after);
+
+ /**
* Whether to skip sending to the original endpoint.
*/
boolean isSkip();
diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInterceptEndpointFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/MockSendToEndpointStrategyFactory.java
similarity index 53%
copy from core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInterceptEndpointFactory.java
copy to core/camel-api/src/main/java/org/apache/camel/spi/MockSendToEndpointStrategyFactory.java
index 9710df7..b41cfd1 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInterceptEndpointFactory.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/MockSendToEndpointStrategyFactory.java
@@ -14,24 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.impl.engine;
+package org.apache.camel.spi;
-import org.apache.camel.CamelContext;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
-import org.apache.camel.spi.InterceptEndpointFactory;
+public interface MockSendToEndpointStrategyFactory {
-/**
- * Default {@link InterceptEndpointFactory}.
- */
-public class DefaultInterceptEndpointFactory implements InterceptEndpointFactory {
+ String FACTORY = "mock-send-to-endpoint-strategy-factory";
+
+ EndpointStrategy mock(String pattern, boolean skip);
- @Override
- public Endpoint createInterceptSendToEndpoint(
- CamelContext camelContext, Endpoint endpoint, boolean skip, Processor before, Processor after) {
- DefaultInterceptSendToEndpoint answer = new DefaultInterceptSendToEndpoint(endpoint, skip);
- answer.setBefore(before);
- answer.setAfter(after);
- return answer;
- }
}
diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInterceptEndpointFactory.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInterceptEndpointFactory.java
index 9710df7..9d9492f 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInterceptEndpointFactory.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInterceptEndpointFactory.java
@@ -20,6 +20,7 @@ import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.Processor;
import org.apache.camel.spi.InterceptEndpointFactory;
+import org.apache.camel.support.DefaultInterceptSendToEndpoint;
/**
* Default {@link InterceptEndpointFactory}.
diff --git a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
index 8431c6e..95cedde 100644
--- a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
+++ b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceCallProcessorFactory.java
@@ -36,12 +36,12 @@ import org.apache.camel.cloud.ServiceExpressionFactory;
import org.apache.camel.cloud.ServiceFilter;
import org.apache.camel.cloud.ServiceFilterAware;
import org.apache.camel.cloud.ServiceLoadBalancer;
-import org.apache.camel.impl.engine.TypedProcessorFactory;
import org.apache.camel.model.Model;
import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
import org.apache.camel.model.cloud.ServiceCallDefinition;
import org.apache.camel.model.cloud.ServiceCallDefinitionConstants;
import org.apache.camel.support.CamelContextHelper;
+import org.apache.camel.support.TypedProcessorFactory;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.function.Suppliers;
import org.apache.camel.util.function.ThrowingHelper;
diff --git a/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
index 7fac92a..d8283d4 100644
--- a/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
+++ b/core/camel-cloud/src/test/java/org/apache/camel/impl/cloud/ServiceCallConfigurationTest.java
@@ -26,11 +26,11 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.cloud.ServiceDefinition;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.engine.DefaultChannel;
import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
import org.apache.camel.model.cloud.ServiceCallDefinitionConstants;
import org.apache.camel.model.cloud.ServiceCallExpressionConfiguration;
import org.apache.camel.model.language.SimpleExpression;
-import org.apache.camel.impl.engine.DefaultChannel;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
diff --git a/core/camel-cluster/pom.xml b/core/camel-cluster/pom.xml
index 929071f..b1384e2 100644
--- a/core/camel-cluster/pom.xml
+++ b/core/camel-cluster/pom.xml
@@ -43,6 +43,10 @@
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-base</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-core-model</artifactId>
</dependency>
diff --git a/core/camel-core-model/pom.xml b/core/camel-core-model/pom.xml
index cf5c4f1..bec7163 100644
--- a/core/camel-core-model/pom.xml
+++ b/core/camel-core-model/pom.xml
@@ -45,14 +45,15 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-api</artifactId>
</dependency>
- <!-- TODO: Remove this dependency -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-base</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-processor</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-base</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/builder/AdviceWithRouteBuilder.java b/core/camel-core-model/src/main/java/org/apache/camel/builder/AdviceWithRouteBuilder.java
index c3f7327b..f73d319 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/builder/AdviceWithRouteBuilder.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/builder/AdviceWithRouteBuilder.java
@@ -1,19 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
package org.apache.camel.builder;
import java.util.ArrayList;
@@ -22,14 +6,17 @@ import java.util.List;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.ExtendedCamelContext;
-import org.apache.camel.impl.engine.InterceptSendToMockEndpointStrategy;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.spi.EndpointStrategy;
+import org.apache.camel.spi.MockSendToEndpointStrategyFactory;
import org.apache.camel.support.EndpointHelper;
import org.apache.camel.support.PatternHelper;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.function.ThrowingConsumer;
+import static org.apache.camel.spi.FactoryFinder.DEFAULT_PATH;
+
/**
* A {@link RouteBuilder} which has extended capabilities when using the
* <a href="http://camel.apache.org/advicewith.html">advice with</a> feature.
@@ -175,7 +162,7 @@ public abstract class AdviceWithRouteBuilder extends RouteBuilder {
* @throws Exception can be thrown if error occurred
*/
public void mockEndpoints() throws Exception {
- getContext().adapt(ExtendedCamelContext.class).registerEndpointCallback(new InterceptSendToMockEndpointStrategy(null));
+ getContext().adapt(ExtendedCamelContext.class).registerEndpointCallback(createMockEndpointStrategy(null, false));
}
/**
@@ -187,7 +174,7 @@ public abstract class AdviceWithRouteBuilder extends RouteBuilder {
*/
public void mockEndpoints(String... pattern) throws Exception {
for (String s : pattern) {
- getContext().adapt(ExtendedCamelContext.class).registerEndpointCallback(new InterceptSendToMockEndpointStrategy(s));
+ getContext().adapt(ExtendedCamelContext.class).registerEndpointCallback(createMockEndpointStrategy(s, false));
}
}
@@ -202,7 +189,7 @@ public abstract class AdviceWithRouteBuilder extends RouteBuilder {
public void mockEndpointsAndSkip(String... pattern) throws Exception {
for (String s : pattern) {
getContext().adapt(ExtendedCamelContext.class)
- .registerEndpointCallback(new InterceptSendToMockEndpointStrategy(s, true));
+ .registerEndpointCallback(createMockEndpointStrategy(s, true));
}
}
@@ -299,4 +286,14 @@ public abstract class AdviceWithRouteBuilder extends RouteBuilder {
return new AdviceWithBuilder<T>(this, "*", null, null, null).maxDeep(1).selectLast().after();
}
+ private EndpointStrategy createMockEndpointStrategy(String pattern, boolean skip) {
+ MockSendToEndpointStrategyFactory factory = getContext().adapt(ExtendedCamelContext.class)
+ .getFactoryFinder(DEFAULT_PATH)
+ .newInstance(MockSendToEndpointStrategyFactory.FACTORY, MockSendToEndpointStrategyFactory.class)
+ .orElseThrow(() -> new IllegalArgumentException(
+ "Cannot find MockSendToEndpointStrategyFactory on classpath. "
+ + "Add camel-mock to classpath."));
+ return factory.mock(pattern, skip);
+ }
+
}
diff --git a/core/camel-core-processor/pom.xml b/core/camel-core-processor/pom.xml
index f982de3..f452120 100644
--- a/core/camel-core-processor/pom.xml
+++ b/core/camel-core-processor/pom.xml
@@ -46,7 +46,6 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-api</artifactId>
</dependency>
- <!-- TODO: Remove this dependency -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-base</artifactId>
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/InterceptSendToEndpointProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/InterceptSendToEndpointProcessor.java
index ac5a335..595a497 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/InterceptSendToEndpointProcessor.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/InterceptSendToEndpointProcessor.java
@@ -23,11 +23,11 @@ import org.apache.camel.AsyncProcessor;
import org.apache.camel.AsyncProducer;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
-import org.apache.camel.impl.engine.DefaultInterceptSendToEndpoint;
import org.apache.camel.spi.InterceptSendToEndpoint;
import org.apache.camel.support.AsyncProcessorConverterHelper;
import org.apache.camel.support.AsyncProcessorSupport;
import org.apache.camel.support.DefaultAsyncProducer;
+import org.apache.camel.support.DefaultInterceptSendToEndpoint;
import org.apache.camel.support.service.ServiceHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/core/camel-core-reifier/pom.xml b/core/camel-core-reifier/pom.xml
index 6483577..a048fcb 100644
--- a/core/camel-core-reifier/pom.xml
+++ b/core/camel-core-reifier/pom.xml
@@ -53,12 +53,6 @@
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-model</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-base</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
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 7f61f04..8b5a5a2 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
@@ -21,7 +21,7 @@ import org.apache.camel.Endpoint;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.Producer;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.engine.InterceptSendToMockEndpointStrategy;
+import org.apache.camel.component.mock.InterceptSendToMockEndpointStrategy;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/InterceptSendToMockEndpointStrategyTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/InterceptSendToMockEndpointStrategyTest.java
index cf297c4..83e7378 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/InterceptSendToMockEndpointStrategyTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/InterceptSendToMockEndpointStrategyTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.impl;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.engine.InterceptSendToMockEndpointStrategy;
+import org.apache.camel.component.mock.InterceptSendToMockEndpointStrategy;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;
diff --git a/core/camel-core/src/test/java/org/apache/camel/issues/ThreadsDoTryCatchInterceptSendToAllEndpointIssueTest.java b/core/camel-core/src/test/java/org/apache/camel/issues/ThreadsDoTryCatchInterceptSendToAllEndpointIssueTest.java
index a79e64f..cc82686 100644
--- a/core/camel-core/src/test/java/org/apache/camel/issues/ThreadsDoTryCatchInterceptSendToAllEndpointIssueTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/issues/ThreadsDoTryCatchInterceptSendToAllEndpointIssueTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.issues;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.engine.InterceptSendToMockEndpointStrategy;
+import org.apache.camel.component.mock.InterceptSendToMockEndpointStrategy;
import org.junit.jupiter.api.Test;
/**
diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInterceptSendToEndpoint.java b/core/camel-support/src/generated/java/org/apache/camel/support/DefaultInterceptSendToEndpoint.java
similarity index 99%
rename from core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInterceptSendToEndpoint.java
rename to core/camel-support/src/generated/java/org/apache/camel/support/DefaultInterceptSendToEndpoint.java
index dc4b09e..454a0e6 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultInterceptSendToEndpoint.java
+++ b/core/camel-support/src/generated/java/org/apache/camel/support/DefaultInterceptSendToEndpoint.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.impl.engine;
+package org.apache.camel.support;
import java.util.HashMap;
import java.util.Map;
diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/TypedProcessorFactory.java b/core/camel-support/src/main/java/org/apache/camel/support/TypedProcessorFactory.java
similarity index 98%
rename from core/camel-base/src/main/java/org/apache/camel/impl/engine/TypedProcessorFactory.java
rename to core/camel-support/src/main/java/org/apache/camel/support/TypedProcessorFactory.java
index 7412be7..55b4b3b 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/TypedProcessorFactory.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/TypedProcessorFactory.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.impl.engine;
+package org.apache.camel.support;
import java.util.Map;
diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_7.adoc b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_7.adoc
index bb3a924..9e071d5 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_7.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_7.adoc
@@ -37,6 +37,9 @@ If a custom `org.apache.camel.spi.ProcessorFactory` is in use, then the factory
`org.apache.camel.processor.DefaultProcessorFactory` and in the overridden methods, super should be called to let
the default implementation create the processor when custom processors is not created.
+The class `org.apache.camel.impl.engine.TypedProcessorFactor` moved from `camel-base` JAR
+to `org.apache.camel.support.TypedProcessorFactor` in the `camel-support` JAR.
+
=== AdviceWith
Advice routes moved the `adviceWith` method from `org.apache.camel.reifier.RouteReifier` to `org.apache.camel.builder.AdviceWith`.
@@ -61,3 +64,8 @@ The event type header is no more an enum, but it is now the explicit event as a
Component uses different serialization mechanism, which is not backwards compatible with the original one.
For full compatibility use camel-leveldb-legacy component. (legacy component will be removed in the future)
+=== camel-mock
+
+The class `InterceptSendToMockEndpointStrategy` in `camel-base` JAR is moved from `org.apache.camel.impl.engine.InterceptSendToMockEndpointStrategy`
+to `org.apache.camel.component.mock.InterceptSendToMockEndpointStrategy` in the `camel-mock` JAR.
+