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 77520b1 route template builder: add option to set properties as a map (#4310) 77520b1 is described below commit 77520b14212908079542b4e1c7e93478b9955a8a Author: Luca Burgazzoli <lburgazz...@users.noreply.github.com> AuthorDate: Mon Sep 28 19:03:16 2020 +0200 route template builder: add option to set properties as a map (#4310) --- .../java/org/apache/camel/builder/TemplatedRouteBuilder.java | 10 ++++++++++ .../camel/builder/RouteTemplateBeforeContextStartingTest.java | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/builder/TemplatedRouteBuilder.java b/core/camel-core-engine/src/main/java/org/apache/camel/builder/TemplatedRouteBuilder.java index a7eda70d..8ec7dd2 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/builder/TemplatedRouteBuilder.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/builder/TemplatedRouteBuilder.java @@ -75,6 +75,16 @@ public final class TemplatedRouteBuilder { } /** + * Adds parameters the route template will use when creating the route. + * + * @param parameters the template parameters to add + */ + public TemplatedRouteBuilder parameters(Map<String, Object> parameters) { + this.parameters.putAll(parameters); + return this; + } + + /** * Sets a handler which gives access to the route template model that will be used for creating the route. This can * be used to do validation. Any changes to the model happens before the route is created and added, however these * changes affect future usage of the same template. diff --git a/core/camel-core/src/test/java/org/apache/camel/builder/RouteTemplateBeforeContextStartingTest.java b/core/camel-core/src/test/java/org/apache/camel/builder/RouteTemplateBeforeContextStartingTest.java index 3137284..a7fd69e 100644 --- a/core/camel-core/src/test/java/org/apache/camel/builder/RouteTemplateBeforeContextStartingTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/builder/RouteTemplateBeforeContextStartingTest.java @@ -21,6 +21,7 @@ import org.apache.camel.Route; import org.apache.camel.model.RouteTemplateDefinition; import org.junit.jupiter.api.Test; +import static org.apache.camel.util.CollectionHelper.mapOf; import static org.junit.jupiter.api.Assertions.assertEquals; public class RouteTemplateBeforeContextStartingTest extends ContextTestSupport { @@ -58,8 +59,7 @@ public class RouteTemplateBeforeContextStartingTest extends ContextTestSupport { TemplatedRouteBuilder.builder(context, "myTemplate") .routeId("second") - .parameter("foo", "two") - .parameter("bar", "cake") + .parameters(mapOf("foo", "two", "bar", "cake")) .add(); // now start camel