You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dm...@apache.org on 2018/11/16 09:06:13 UTC
[camel] branch master updated (f3a1cb5 -> 1a9b479)
This is an automated email from the ASF dual-hosted git repository.
dmvolod pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.
from f3a1cb5 CAMEL-12869: ReplyTo destination must match endpoint type (topic or queue) that the message is sent on
new 9ee4dae CAMEL-12908: Add reproducer code
new fb9df2d CAMEL-12908: Cannot start route using rest dsl due to a mysterious duplicate route id
new 1a9b479 CAMEL-12908: Fix CS
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/camel/model/RouteDefinitionHelper.java | 33 +++++++++++++++++++++-
.../apache/camel/model/rest/RestDefinition.java | 17 -----------
.../apache/camel/model/rest/VerbDefinition.java | 2 +-
.../apache/camel/component/rest/RestRefTest.xml | 2 +-
4 files changed, 34 insertions(+), 20 deletions(-)
[camel] 01/03: CAMEL-12908: Add reproducer code
Posted by dm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dmvolod pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9ee4dae67419b242b44f0fda190f935ba3352715
Author: Dmitry Volodin <dm...@gmail.com>
AuthorDate: Thu Nov 1 20:25:04 2018 +0300
CAMEL-12908: Add reproducer code
---
.../src/test/resources/org/apache/camel/component/rest/RestRefTest.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/RestRefTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/RestRefTest.xml
index c53d943..246c2a9 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/RestRefTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/RestRefTest.xml
@@ -54,7 +54,7 @@
<constant>Hello World</constant>
</transform>
</route>
- <route>
+ <route id="route1">
<from uri="direct:bye"/>
<transform>
<constant>Bye World</constant>
[camel] 03/03: CAMEL-12908: Fix CS
Posted by dm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dmvolod pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1a9b479047eddc475be7de39b6e78633a821f266
Author: Dmitry Volodin <dm...@gmail.com>
AuthorDate: Tue Nov 13 16:53:26 2018 +0300
CAMEL-12908: Fix CS
---
.../org/apache/camel/model/rest/RestDefinition.java | 21 ---------------------
1 file changed, 21 deletions(-)
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
index a960827..5fcce05 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
@@ -902,27 +902,7 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
if (outType != null) {
options.put("outType", outType);
}
- // if no route id has been set, then use the verb id as route id
- /*
- if (!route.hasCustomIdAssigned()) {
- // use id of verb as route id
- String id = verb.getId();
- if (id != null) {
- route.setId(id);
- }
- }
- */
-
- /*
- String routeId = verb.idOrCreate(camelContext.getNodeIdFactory());
-
- if (!verb.getUsedForGeneratingNodeId()) {
- routeId = route.idOrCreate(camelContext.getNodeIdFactory());
- }
- verb.setRouteId(routeId);
- options.put("routeId", routeId);
- */
if (component != null && !component.isEmpty()) {
options.put("componentName", component);
}
@@ -1016,7 +996,6 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
// the route should be from this rest endpoint
route.fromRest(from);
- //route.routeId(routeId);
route.setRestDefinition(this);
answer.add(route);
}
[camel] 02/03: CAMEL-12908: Cannot start route using rest dsl due
to a mysterious duplicate route id
Posted by dm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dmvolod pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit fb9df2dbed717517ca50994d15b74f34aa9e7e37
Author: Dmitry Volodin <dm...@gmail.com>
AuthorDate: Tue Nov 13 16:43:59 2018 +0300
CAMEL-12908: Cannot start route using rest dsl due to a mysterious
duplicate route id
---
.../apache/camel/model/RouteDefinitionHelper.java | 33 +++++++++++++++++++++-
.../apache/camel/model/rest/RestDefinition.java | 6 +++-
.../apache/camel/model/rest/VerbDefinition.java | 2 +-
3 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java b/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
index 041bdc2..b005955 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
@@ -19,14 +19,18 @@ package org.apache.camel.model;
import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.ErrorHandlerBuilder;
+import org.apache.camel.model.rest.RestDefinition;
+import org.apache.camel.model.rest.VerbDefinition;
import org.apache.camel.util.CamelContextHelper;
import org.apache.camel.util.EndpointHelper;
import org.apache.camel.util.ObjectHelper;
@@ -145,10 +149,11 @@ public final class RouteDefinitionHelper {
for (final RouteDefinition route : routes) {
if (route.getId() == null) {
// keep assigning id's until we find a free name
+
boolean done = false;
String id = null;
while (!done) {
- id = context.getNodeIdFactory().createId(route);
+ id = route.idOrCreate(context.getNodeIdFactory());
done = !customIds.contains(id);
}
route.setId(id);
@@ -162,6 +167,32 @@ public final class RouteDefinitionHelper {
route.setCustomId(false);
customIds.add(route.getId());
}
+ RestDefinition rest = route.getRestDefinition();
+ if (rest != null && route.isRest()) {
+ for (VerbDefinition verb : rest.getVerbs()) {
+ String id = verb.idOrCreate(context.getNodeIdFactory());
+ if (!verb.getUsedForGeneratingNodeId()) {
+ id = route.getId();
+ }
+ verb.setRouteId(id);
+ }
+ List<FromDefinition> fromDefinitions = route.getInputs();
+
+ if (ObjectHelper.isNotEmpty(fromDefinitions)) {
+ FromDefinition fromDefinition = fromDefinitions.get(0);
+ String endpointUri = fromDefinition.getEndpointUri();
+ if (ObjectHelper.isNotEmpty(endpointUri)) {
+ Map<String, Object> options = new HashMap<String, Object>();
+ options.put("routeId", route.getId());
+ endpointUri = URISupport.appendParametersToURI(endpointUri, options);
+
+ // replace uri with new routeId
+ fromDefinition.setUri(endpointUri);
+ fromDefinitions.set(0, fromDefinition);
+ route.setInputs(fromDefinitions);
+ }
+ }
+ }
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
index 946fb76..a960827 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
@@ -903,6 +903,7 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
options.put("outType", outType);
}
// if no route id has been set, then use the verb id as route id
+ /*
if (!route.hasCustomIdAssigned()) {
// use id of verb as route id
String id = verb.getId();
@@ -910,7 +911,9 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
route.setId(id);
}
}
+ */
+ /*
String routeId = verb.idOrCreate(camelContext.getNodeIdFactory());
if (!verb.getUsedForGeneratingNodeId()) {
@@ -919,6 +922,7 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
verb.setRouteId(routeId);
options.put("routeId", routeId);
+ */
if (component != null && !component.isEmpty()) {
options.put("componentName", component);
}
@@ -1012,7 +1016,7 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
// the route should be from this rest endpoint
route.fromRest(from);
- route.routeId(routeId);
+ //route.routeId(routeId);
route.setRestDefinition(this);
answer.add(route);
}
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
index bf56005..acbe38a 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
@@ -141,7 +141,7 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition>
/**
* Sets swagger operation response messages.
*/
- public void setResponseMsgs(List<RestOperationResponseMsgDefinition> params) {
+ public void setResponseMsgs(List<RestOperationResponseMsgDefinition> responseMsgs) {
this.responseMsgs = responseMsgs;
}