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 b011982  CAMEL-15815: endpoint-dsl pollEnrich/enrich to support simple 
expressions in context-path
b011982 is described below

commit b011982691307f68b63ac4d9704ef1e0707ccce3
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Fri Dec 4 13:33:04 2020 +0100

    CAMEL-15815: endpoint-dsl pollEnrich/enrich to support simple expressions 
in context-path
---
 .../apache/camel/model/ProcessorDefinition.java    | 19 ++++-----
 .../endpoint/SedaEnrichSimpleExpressionTest.java   | 48 ++++++++++++++++++++++
 .../SedaPollEnrichSimpleExpressionTest.java        | 46 +++++++++++++++++++++
 3 files changed, 101 insertions(+), 12 deletions(-)

diff --git 
a/core/camel-core-model/src/main/java/org/apache/camel/model/ProcessorDefinition.java
 
b/core/camel-core-model/src/main/java/org/apache/camel/model/ProcessorDefinition.java
index 2bb5f2c..73413f8 100644
--- 
a/core/camel-core-model/src/main/java/org/apache/camel/model/ProcessorDefinition.java
+++ 
b/core/camel-core-model/src/main/java/org/apache/camel/model/ProcessorDefinition.java
@@ -1305,7 +1305,7 @@ public abstract class ProcessorDefinition<Type extends 
ProcessorDefinition<Type>
     /**
      * Creates a log message to be logged at INFO level.
      *
-     * @param  message the log message, (you can use {@link 
org.apache.camel.language.simple.SimpleLanguage} syntax)
+     * @param  message the log message (you can use simple language syntax)
      * @return         the builder
      */
     public Type log(String message) {
@@ -1318,8 +1318,7 @@ public abstract class ProcessorDefinition<Type extends 
ProcessorDefinition<Type>
      * Creates a log message to be logged at the given level.
      *
      * @param  loggingLevel the logging level to use
-     * @param  message      the log message, (you can use {@link 
org.apache.camel.language.simple.SimpleLanguage}
-     *                      syntax)
+     * @param  message      the log message (you can use simple language 
syntax)
      * @return              the builder
      */
     public Type log(LoggingLevel loggingLevel, String message) {
@@ -1334,8 +1333,7 @@ public abstract class ProcessorDefinition<Type extends 
ProcessorDefinition<Type>
      *
      * @param  loggingLevel the logging level to use
      * @param  logName      the log name to use
-     * @param  message      the log message, (you can use {@link 
org.apache.camel.language.simple.SimpleLanguage}
-     *                      syntax)
+     * @param  message      the log message (you can use simple language 
syntax)
      * @return              the builder
      */
     public Type log(LoggingLevel loggingLevel, String logName, String message) 
{
@@ -1351,8 +1349,7 @@ public abstract class ProcessorDefinition<Type extends 
ProcessorDefinition<Type>
      *
      * @param  loggingLevel the logging level to use
      * @param  logger       the logger to use
-     * @param  message      the log message, (you can use {@link 
org.apache.camel.language.simple.SimpleLanguage}
-     *                      syntax)
+     * @param  message      the log message (you can use simple language 
syntax)
      * @return              the builder
      */
     public Type log(LoggingLevel loggingLevel, Logger logger, String message) {
@@ -1369,8 +1366,7 @@ public abstract class ProcessorDefinition<Type extends 
ProcessorDefinition<Type>
      * @param  loggingLevel the logging level to use
      * @param  logName      the log name to use
      * @param  marker       log marker name
-     * @param  message      the log message, (you can use {@link 
org.apache.camel.language.simple.SimpleLanguage}
-     *                      syntax)
+     * @param  message      the log message (you can use simple language 
syntax)
      * @return              the builder
      */
     public Type log(LoggingLevel loggingLevel, String logName, String marker, 
String message) {
@@ -1388,8 +1384,7 @@ public abstract class ProcessorDefinition<Type extends 
ProcessorDefinition<Type>
      * @param  loggingLevel the logging level to use
      * @param  logger       the logger to use
      * @param  marker       log marker name
-     * @param  message      the log message, (you can use {@link 
org.apache.camel.language.simple.SimpleLanguage}
-     *                      syntax)
+     * @param  message      the log message (you can use simple language 
syntax)
      * @return              the builder
      */
     public Type log(LoggingLevel loggingLevel, Logger logger, String marker, 
String message) {
@@ -3182,7 +3177,7 @@ public abstract class ProcessorDefinition<Type extends 
ProcessorDefinition<Type>
      * @see                org.apache.camel.processor.PollEnricher
      */
     public Type pollEnrich(EndpointProducerBuilder resourceUri) {
-        return pollEnrich(resourceUri.getUri());
+        return pollEnrich(resourceUri.expr(), -1, (String) null, false);
     }
 
     /**
diff --git 
a/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/SedaEnrichSimpleExpressionTest.java
 
b/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/SedaEnrichSimpleExpressionTest.java
new file mode 100644
index 0000000..cc67510
--- /dev/null
+++ 
b/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/SedaEnrichSimpleExpressionTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.endpoint;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+public class SedaEnrichSimpleExpressionTest extends CamelTestSupport {
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new EndpointRouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                
from(direct("start")).enrich(seda("${exchangeProperty.whereTo}").offerTimeout(1000)).to("mock:result");
+
+                from("seda:cheese")
+                    .transform().constant("Hello World");
+            }
+        };
+    }
+
+    @Test
+    public void test() throws Exception {
+        MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
+        resultEndpoint.expectedBodiesReceived("Hello World");
+
+        template.sendBodyAndProperty("direct:start", "Empty", "whereTo", 
"cheese");
+
+        assertMockEndpointsSatisfied();
+    }
+}
diff --git 
a/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/SedaPollEnrichSimpleExpressionTest.java
 
b/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/SedaPollEnrichSimpleExpressionTest.java
new file mode 100644
index 0000000..942986b
--- /dev/null
+++ 
b/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/SedaPollEnrichSimpleExpressionTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.endpoint;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+public class SedaPollEnrichSimpleExpressionTest extends CamelTestSupport {
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new EndpointRouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                
from(direct("start")).pollEnrich(seda("${exchangeProperty.whereFrom}").timeout(1000)).to("mock:result");
+            }
+        };
+    }
+
+    @Test
+    public void test() throws Exception {
+        MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
+        resultEndpoint.expectedBodiesReceived("Hello World");
+
+        template.sendBody("seda:cheese", "Hello World");
+        template.sendBodyAndProperty("direct:start", "Empty", "whereFrom", 
"cheese");
+
+        assertMockEndpointsSatisfied();
+    }
+}

Reply via email to