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 329b44b CAMEL-14923: Deprecated inOnly and inOut EIPs as you should
use to EIP instead and specify the pattern.
329b44b is described below
commit 329b44bfabf2fdd850ed00684b8ac308c6739b7c
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Apr 25 12:17:56 2020 +0200
CAMEL-14923: Deprecated inOnly and inOut EIPs as you should use to EIP
instead and specify the pattern.
---
.../resources/org/apache/camel/model/inOnly.json | 2 +-
.../resources/org/apache/camel/model/inOut.json | 2 +-
.../org/apache/camel/model/InOnlyDefinition.java | 1 +
.../org/apache/camel/model/InOutDefinition.java | 1 +
.../apache/camel/model/ProcessorDefinition.java | 25 +++++++++-
.../camel/processor/FromToInOutUsingToTest.java | 55 ++++++++++++++++++++++
6 files changed, 83 insertions(+), 3 deletions(-)
diff --git
a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/inOnly.json
b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/inOnly.json
index ebc50a8..fbf5926 100644
---
a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/inOnly.json
+++
b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/inOnly.json
@@ -4,7 +4,7 @@
"name": "inOnly",
"title": "In Only",
"description": "Marks the exchange pattern for the route to one way",
- "deprecated": false,
+ "deprecated": true,
"label": "eip,endpoint,routing",
"javaType": "org.apache.camel.model.InOnlyDefinition",
"input": true,
diff --git
a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/inOut.json
b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/inOut.json
index 7133977..0282841 100644
---
a/core/camel-core-engine/src/generated/resources/org/apache/camel/model/inOut.json
+++
b/core/camel-core-engine/src/generated/resources/org/apache/camel/model/inOut.json
@@ -4,7 +4,7 @@
"name": "inOut",
"title": "In Out",
"description": "Marks the exchange pattern for the route to
request\/reply",
- "deprecated": false,
+ "deprecated": true,
"label": "eip,endpoint,routing",
"javaType": "org.apache.camel.model.InOutDefinition",
"input": true,
diff --git
a/core/camel-core-engine/src/main/java/org/apache/camel/model/InOnlyDefinition.java
b/core/camel-core-engine/src/main/java/org/apache/camel/model/InOnlyDefinition.java
index b7313a1..486be6c 100644
---
a/core/camel-core-engine/src/main/java/org/apache/camel/model/InOnlyDefinition.java
+++
b/core/camel-core-engine/src/main/java/org/apache/camel/model/InOnlyDefinition.java
@@ -30,6 +30,7 @@ import org.apache.camel.spi.Metadata;
@Metadata(label = "eip,endpoint,routing")
@XmlRootElement(name = "inOnly")
@XmlAccessorType(XmlAccessType.FIELD)
+@Deprecated
public class InOnlyDefinition extends SendDefinition<InOnlyDefinition> {
public InOnlyDefinition() {
diff --git
a/core/camel-core-engine/src/main/java/org/apache/camel/model/InOutDefinition.java
b/core/camel-core-engine/src/main/java/org/apache/camel/model/InOutDefinition.java
index 65e9e45..fad827a 100644
---
a/core/camel-core-engine/src/main/java/org/apache/camel/model/InOutDefinition.java
+++
b/core/camel-core-engine/src/main/java/org/apache/camel/model/InOutDefinition.java
@@ -30,6 +30,7 @@ import org.apache.camel.spi.Metadata;
@Metadata(label = "eip,endpoint,routing")
@XmlRootElement(name = "inOut")
@XmlAccessorType(XmlAccessType.FIELD)
+@Deprecated
public class InOutDefinition extends SendDefinition<InOutDefinition> {
public InOutDefinition() {
diff --git
a/core/camel-core-engine/src/main/java/org/apache/camel/model/ProcessorDefinition.java
b/core/camel-core-engine/src/main/java/org/apache/camel/model/ProcessorDefinition.java
index d4b9db3..5e90a10 100644
---
a/core/camel-core-engine/src/main/java/org/apache/camel/model/ProcessorDefinition.java
+++
b/core/camel-core-engine/src/main/java/org/apache/camel/model/ProcessorDefinition.java
@@ -477,6 +477,7 @@ public abstract class ProcessorDefinition<Type extends
ProcessorDefinition<Type>
* @param endpoints list of endpoints to send to
* @return the builder
*/
+ @Deprecated
public Type to(Iterable<Endpoint> endpoints) {
for (Endpoint endpoint : endpoints) {
addOutput(new ToDefinition(endpoint));
@@ -586,7 +587,9 @@ public abstract class ProcessorDefinition<Type extends
ProcessorDefinition<Type>
*
* @param uri The endpoint uri which is used for sending the exchange
* @return the builder
+ * @deprecated use to where you can specify the exchange pattern as well
*/
+ @Deprecated
public Type inOnly(@AsEndpointUri String uri) {
return to(ExchangePattern.InOnly, uri);
}
@@ -602,7 +605,9 @@ public abstract class ProcessorDefinition<Type extends
ProcessorDefinition<Type>
*
* @param endpoint The endpoint which is used for sending the exchange
* @return the builder
+ * @deprecated use to where you can specify the exchange pattern as well
*/
+ @Deprecated
public Type inOnly(Endpoint endpoint) {
return to(ExchangePattern.InOnly, endpoint);
}
@@ -618,7 +623,9 @@ public abstract class ProcessorDefinition<Type extends
ProcessorDefinition<Type>
*
* @param uris list of endpoints to send to
* @return the builder
+ * @deprecated use to where you can specify the exchange pattern as well
*/
+ @Deprecated
public Type inOnly(@AsEndpointUri String... uris) {
return to(ExchangePattern.InOnly, uris);
}
@@ -634,7 +641,9 @@ public abstract class ProcessorDefinition<Type extends
ProcessorDefinition<Type>
*
* @param endpoints list of endpoints to send to
* @return the builder
+ * @deprecated use to where you can specify the exchange pattern as well
*/
+ @Deprecated
public Type inOnly(@AsEndpointUri Endpoint... endpoints) {
return to(ExchangePattern.InOnly, endpoints);
}
@@ -650,7 +659,9 @@ public abstract class ProcessorDefinition<Type extends
ProcessorDefinition<Type>
*
* @param endpoints list of endpoints to send to
* @return the builder
+ * @deprecated use to where you can specify the exchange pattern as well
*/
+ @Deprecated
public Type inOnly(Iterable<Endpoint> endpoints) {
return to(ExchangePattern.InOnly, endpoints);
}
@@ -666,7 +677,9 @@ public abstract class ProcessorDefinition<Type extends
ProcessorDefinition<Type>
*
* @param uri The endpoint uri which is used for sending the exchange
* @return the builder
+ * @deprecated use to where you can specify the exchange pattern as well
*/
+ @Deprecated
public Type inOut(@AsEndpointUri String uri) {
return to(ExchangePattern.InOut, uri);
}
@@ -682,7 +695,9 @@ public abstract class ProcessorDefinition<Type extends
ProcessorDefinition<Type>
*
* @param endpoint The endpoint which is used for sending the exchange
* @return the builder
+ * @deprecated use to where you can specify the exchange pattern as well
*/
+ @Deprecated
public Type inOut(Endpoint endpoint) {
return to(ExchangePattern.InOut, endpoint);
}
@@ -698,7 +713,9 @@ public abstract class ProcessorDefinition<Type extends
ProcessorDefinition<Type>
*
* @param uris list of endpoints to send to
* @return the builder
+ * @deprecated use to where you can specify the exchange pattern as well
*/
+ @Deprecated
public Type inOut(@AsEndpointUri String... uris) {
return to(ExchangePattern.InOut, uris);
}
@@ -714,7 +731,9 @@ public abstract class ProcessorDefinition<Type extends
ProcessorDefinition<Type>
*
* @param endpoints list of endpoints to send to
* @return the builder
+ * @deprecated use to where you can specify the exchange pattern as well
*/
+ @Deprecated
public Type inOut(Endpoint... endpoints) {
return to(ExchangePattern.InOut, endpoints);
}
@@ -730,7 +749,9 @@ public abstract class ProcessorDefinition<Type extends
ProcessorDefinition<Type>
*
* @param endpoints list of endpoints to send to
* @return the builder
+ * @deprecated use to where you can specify the exchange pattern as well
*/
+ @Deprecated
public Type inOut(Iterable<Endpoint> endpoints) {
return to(ExchangePattern.InOut, endpoints);
}
@@ -975,8 +996,10 @@ public abstract class ProcessorDefinition<Type extends
ProcessorDefinition<Type>
*/
public Type pipeline(Collection<Endpoint> endpoints) {
PipelineDefinition answer = new PipelineDefinition();
+ for (Endpoint endpoint : endpoints) {
+ answer.addOutput(new ToDefinition(endpoint));
+ }
addOutput(answer);
- answer.to(endpoints);
return asType();
}
diff --git
a/core/camel-core/src/test/java/org/apache/camel/processor/FromToInOutUsingToTest.java
b/core/camel-core/src/test/java/org/apache/camel/processor/FromToInOutUsingToTest.java
new file mode 100644
index 0000000..3b7ec47
--- /dev/null
+++
b/core/camel-core/src/test/java/org/apache/camel/processor/FromToInOutUsingToTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class FromToInOutUsingToTest extends ContextTestSupport {
+
+ @Test
+ public void testInOut() throws Exception {
+ getMockEndpoint("mock:foo").expectedMessageCount(1);
+ getMockEndpoint("mock:result").expectedMessageCount(1);
+
+ // start with InOnly
+ template.sendBody("direct:start", ExchangePattern.InOnly, "Hello
World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").to(ExchangePattern.InOut,
"direct:foo").to("mock:result");
+
+ from("direct:foo").process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ // but it should have been changed to InOut
+ assertEquals(ExchangePattern.InOut,
exchange.getPattern());
+ }
+ }).to("mock:foo");
+ }
+ };
+ }
+}