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 15ff17b  Polish endpoint DSL to add javadoc and to use SimpleBuilder 
to not import model in the DSL.
15ff17b is described below

commit 15ff17b9fe63e3327bce44c1264ce2db938db7eb
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Tue Jun 18 11:23:52 2019 +0200

    Polish endpoint DSL to add javadoc and to use SimpleBuilder to not import 
model in the DSL.
---
 .../camel/builder/EndpointConsumerBuilder.java     | 20 ++++++++++++++++++
 .../camel/builder/EndpointProducerBuilder.java     | 24 ++++++++++++++++++++++
 .../builder/endpoint/AbstractEndpointBuilder.java  | 15 ++++----------
 .../builder/endpoint/EndpointRouteBuilder.java     |  4 ++--
 .../builder/endpoint/FileConsumeCharsetTest.java   |  2 +-
 5 files changed, 51 insertions(+), 14 deletions(-)

diff --git 
a/core/camel-core/src/main/java/org/apache/camel/builder/EndpointConsumerBuilder.java
 
b/core/camel-core/src/main/java/org/apache/camel/builder/EndpointConsumerBuilder.java
index 7d5b9ce..83f2ac2 100644
--- 
a/core/camel-core/src/main/java/org/apache/camel/builder/EndpointConsumerBuilder.java
+++ 
b/core/camel-core/src/main/java/org/apache/camel/builder/EndpointConsumerBuilder.java
@@ -20,12 +20,32 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.NoSuchEndpointException;
 
+/**
+ * Type-safe endpoint DSL for building consumer endpoints.
+ *
+ * @see EndpointProducerBuilder
+ */
 public interface EndpointConsumerBuilder {
 
+    /**
+     * Builds and resolves this endpoint DSL as an endpoint.
+     *
+     * @param context  the camel context
+     * @return a built {@link Endpoint}
+     * @throws NoSuchEndpointException is thrown if the endpoint
+     */
     Endpoint resolve(CamelContext context) throws NoSuchEndpointException;
 
+    /**
+     * Builds the url of this endpoint.
+     * This API is only intended for Camel internally.
+     */
     String getUri();
 
+    /**
+     * Adds an option to this endpoint.
+     * This API is only intended for Camel internally.
+     */
     void setProperty(String name, Object value);
 
 }
diff --git 
a/core/camel-core/src/main/java/org/apache/camel/builder/EndpointProducerBuilder.java
 
b/core/camel-core/src/main/java/org/apache/camel/builder/EndpointProducerBuilder.java
index b08034b..08543ae 100644
--- 
a/core/camel-core/src/main/java/org/apache/camel/builder/EndpointProducerBuilder.java
+++ 
b/core/camel-core/src/main/java/org/apache/camel/builder/EndpointProducerBuilder.java
@@ -21,14 +21,38 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.Expression;
 import org.apache.camel.NoSuchEndpointException;
 
+/**
+ * Type-safe endpoint DSL for building producer endpoints.
+ *
+ * @see EndpointConsumerBuilder
+ */
 public interface EndpointProducerBuilder {
 
+    /**
+     * Builds and resolves this endpoint DSL as an endpoint.
+     *
+     * @param context  the camel context
+     * @return a built {@link Endpoint}
+     * @throws NoSuchEndpointException is thrown if the endpoint
+     */
     Endpoint resolve(CamelContext context) throws NoSuchEndpointException;
 
+    /**
+     * Builds the url of this endpoint.
+     * This API is only intended for Camel internally.
+     */
     String getUri();
 
+    /**
+     * Adds an option to this endpoint.
+     * This API is only intended for Camel internally.
+     */
     void setProperty(String name, Object value);
 
+    /**
+     * Builds an expression of this endpoint url.
+     * This API is only intended for Camel internally.
+     */
     Expression expr();
 
 }
diff --git 
a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/AbstractEndpointBuilder.java
 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/AbstractEndpointBuilder.java
index b243ac1..1d1725e 100644
--- 
a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/AbstractEndpointBuilder.java
+++ 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/AbstractEndpointBuilder.java
@@ -18,20 +18,17 @@ package org.apache.camel.builder.endpoint;
 
 import java.net.URISyntaxException;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.TreeMap;
-
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
 import org.apache.camel.Expression;
 import org.apache.camel.NoSuchEndpointException;
 import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.model.language.SimpleExpression;
-import org.apache.camel.spi.RouteContext;
-import org.apache.camel.support.ExpressionAdapter;
+import org.apache.camel.builder.SimpleBuilder;
 import org.apache.camel.util.URISupport;
 
 @XmlTransient
@@ -39,7 +36,7 @@ public class AbstractEndpointBuilder {
 
     protected final String scheme;
     protected final String path;
-    protected final Map<String, Object> properties = new HashMap<>();
+    protected final Map<String, Object> properties = new LinkedHashMap<>();
 
     public AbstractEndpointBuilder(String scheme, String path) {
         this.scheme = scheme;
@@ -94,11 +91,7 @@ public class AbstractEndpointBuilder {
         this.properties.put(key, value);
     }
 
-    /**
-     * Builds an expression that can be used
-     * @return
-     */
     public Expression expr() {
-        return new SimpleExpression(getUri());
+        return SimpleBuilder.simple(getUri());
     }
 }
diff --git 
a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/EndpointRouteBuilder.java
 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/EndpointRouteBuilder.java
index d6f30e1..9ee5fa8 100644
--- 
a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/EndpointRouteBuilder.java
+++ 
b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/EndpointRouteBuilder.java
@@ -21,7 +21,7 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.util.function.ThrowingConsumer;
 
 /**
- * A route builder which gives access to the endpoint DSL
+ * A {@link RouteBuilder} which gives access to the endpoint DSL.
  */
 public abstract class EndpointRouteBuilder extends RouteBuilder implements 
EndpointBuilderFactory {
 
@@ -41,7 +41,7 @@ public abstract class EndpointRouteBuilder extends 
RouteBuilder implements Endpo
      * </pre>
      *
      * @param context the camel context to add routes
-     * @param rbc a lambda expression receiving the {@code RouteBuilder} to 
use to create routes
+     * @param rbc a lambda expression receiving the {@code RouteBuilder} to 
use for creating routes
      * @throws Exception if an error occurs
      */
     public static void addEndpointRoutes(CamelContext context, 
ThrowingConsumer<EndpointRouteBuilder, Exception> rbc) throws Exception {
diff --git 
a/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/FileConsumeCharsetTest.java
 
b/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/FileConsumeCharsetTest.java
index 6d7aa77..ee65386 100644
--- 
a/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/FileConsumeCharsetTest.java
+++ 
b/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/FileConsumeCharsetTest.java
@@ -45,7 +45,7 @@ public class FileConsumeCharsetTest extends 
ContextTestSupport {
 
         assertMockEndpointsSatisfied();
 
-        oneExchangeDone.matchesMockWaitTime();
+        oneExchangeDone.matchesWaitTime();
 
         // file should not exists
         assertFalse("File should been deleted", new 
File("target/data/files/report.txt").exists());

Reply via email to