You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/11/24 13:39:08 UTC
[camel] 01/01: Revert "CAMEL-11532 Java DSL enhancement to accept
supplier and function arguments (#2098)"
This is an automated email from the ASF dual-hosted git repository.
lburgazzoli pushed a commit to branch revert-2098-CAMEL-11532
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 291c546db3fa46b8e8d1a060aed3f25666d84c03
Author: Luca Burgazzoli <lb...@users.noreply.github.com>
AuthorDate: Fri Nov 24 14:39:05 2017 +0100
Revert "CAMEL-11532 Java DSL enhancement to accept supplier and function arguments (#2098)"
This reverts commit 1a26e25343803e32aa88503831e843e6766ee8d9.
---
.../org/apache/camel/builder/ExpressionClause.java | 12 -----
.../apache/camel/model/ProcessorDefinition.java | 37 --------------
.../builder/ExpressionClauseSupplierTest.java | 48 -------------------
.../camel/model/ProcessDefinitionSetBodyTest.java | 56 ----------------------
4 files changed, 153 deletions(-)
diff --git a/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java b/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java
index 16714d4..9e3106a 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java
@@ -20,7 +20,6 @@ import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Function;
-import java.util.function.Supplier;
import org.apache.camel.Exchange;
import org.apache.camel.Expression;
import org.apache.camel.Message;
@@ -152,17 +151,6 @@ public class ExpressionClause<T> extends ExpressionDefinition {
}
/**
- * A functional expression of an inbound message body
- */
- public T body(final Supplier<Object> supplier) {
- return delegate.expression(new ExpressionAdapter() {
- public Object evaluate(Exchange exchange) {
- return supplier.get();
- }
- });
- }
-
- /**
* A functional expression of an inbound message body and headers
*/
public T body(final BiFunction<Object, Map<String, Object>, Object> function) {
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
index 594f68d..0ac2474 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
@@ -28,7 +28,6 @@ import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.function.Function;
import java.util.function.Supplier;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -3054,42 +3053,6 @@ public abstract class ProcessorDefinition<Type extends ProcessorDefinition<Type>
/**
* <a href="http://camel.apache.org/message-translator.html">Message Translator EIP:</a>
- * Adds a processor which sets the body on the IN message
- *
- * @param supplier the supplier that provides a value to the IN message body
- * @return the builder
- */
- public <Result> Type setBody(Supplier<Result> supplier) {
- SetBodyDefinition answer = new SetBodyDefinition(new ExpressionAdapter() {
- @Override
- public Result evaluate(Exchange exchange) {
- return supplier.get();
- }
- });
- addOutput(answer);
- return (Type) this;
- }
-
- /**
- * <a href="http://camel.apache.org/message-translator.html">Message Translator EIP:</a>
- * Adds a processor which sets the body on the IN message
- *
- * @param function the function that provides a value to the IN message body
- * @return the builder
- */
- public <Result> Type setBody(Function<Exchange, Result> function) {
- SetBodyDefinition answer = new SetBodyDefinition(new ExpressionAdapter() {
- @Override
- public Result evaluate(Exchange exchange) {
- return function.apply(exchange);
- }
- });
- addOutput(answer);
- return (Type) this;
- }
-
- /**
- * <a href="http://camel.apache.org/message-translator.html">Message Translator EIP:</a>
* Adds a processor which sets the body on the OUT message
*
* @param expression the expression used to set the body
diff --git a/camel-core/src/test/java/org/apache/camel/builder/ExpressionClauseSupplierTest.java b/camel-core/src/test/java/org/apache/camel/builder/ExpressionClauseSupplierTest.java
deleted file mode 100644
index f104e95..0000000
--- a/camel-core/src/test/java/org/apache/camel/builder/ExpressionClauseSupplierTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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 org.apache.camel.ContextTestSupport;
-import org.apache.camel.component.mock.MockEndpoint;
-
-public class ExpressionClauseSupplierTest extends ContextTestSupport {
-
- private static final String BODY_SUPPLIER_MSG = "I am the body supplier!";
-
- public void testBodySupplier() throws Exception {
- MockEndpoint functionMock1 = getMockEndpoint("mock:output1");
- functionMock1.expectedMessageCount(1);
- functionMock1.expectedBodyReceived().constant(BODY_SUPPLIER_MSG);
-
- template.sendBody("direct:supplier1", "are you there?");
-
- assertMockEndpointsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:supplier1")
- .transform().body(() -> BODY_SUPPLIER_MSG)
- .to("mock:output1");
- }
- };
- }
-
-}
diff --git a/camel-core/src/test/java/org/apache/camel/model/ProcessDefinitionSetBodyTest.java b/camel-core/src/test/java/org/apache/camel/model/ProcessDefinitionSetBodyTest.java
deleted file mode 100644
index b024808..0000000
--- a/camel-core/src/test/java/org/apache/camel/model/ProcessDefinitionSetBodyTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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.model;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-
-public class ProcessDefinitionSetBodyTest extends ContextTestSupport {
-
- private static final String SUPPLIER_MESSAGE = "Hello from a Supplier!";
- private static final String FUNCTION_MESSAGE = "Hello from a Function!";
-
- public void testProcessDefinitionSetBody() throws InterruptedException {
-
- MockEndpoint functionMock1 = getMockEndpoint("mock:supplierOutput");
- functionMock1.expectedMessageCount(1);
- functionMock1.expectedBodyReceived().constant(SUPPLIER_MESSAGE);
- MockEndpoint functionMock2 = getMockEndpoint("mock:functionOutput");
- functionMock2.expectedMessageCount(1);
- functionMock2.expectedBodyReceived().constant(FUNCTION_MESSAGE);
-
- template.sendBody("direct:start", "are you there?");
-
- assertMockEndpointsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start")
- .setBody(() -> SUPPLIER_MESSAGE)
- .to("mock:supplierOutput")
- .setBody(exchange -> FUNCTION_MESSAGE)
- .to("mock:functionOutput")
- .to("mock:output");
- }
- };
- }
-}
--
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.