You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2014/07/20 08:53:11 UTC
[05/33] git commit: CAMEL-7354: rest-binding in camel-core
CAMEL-7354: rest-binding in camel-core
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2f19857a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2f19857a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2f19857a
Branch: refs/heads/master
Commit: 2f19857a392df2735ec49d442390fa26956b844b
Parents: 08d68bc
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jul 1 14:07:20 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Jul 19 09:38:47 2014 +0200
----------------------------------------------------------------------
.../org/apache/camel/builder/RouteBuilder.java | 10 +++
.../restbinding/RestBindingComponent.java | 23 +++++
.../restbinding/RestBindingConsumer.java | 29 ------
.../restbinding/RestBindingEndpoint.java | 38 ++++++--
.../apache/camel/model/FromRestDefinition.java | 93 ++++++++++++++++++++
.../org/apache/camel/model/RouteDefinition.java | 10 +++
.../apache/camel/model/RoutesDefinition.java | 11 +++
.../apache/camel/spi/RestBindingCapable.java | 37 ++++++++
.../org/apache/camel/component/rest-binding | 18 ++++
.../resources/org/apache/camel/model/jaxb.index | 1 +
.../DummyRestBindingCapableComponent.java | 47 ++++++++++
.../component/restbinding/FromRestGetTest.java | 70 +++++++++++++++
.../issues/AdviceWithTransactionIssueTest.xml | 8 +-
13 files changed, 356 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2f19857a/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java b/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
index e17dace..4392d1b 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/RouteBuilder.java
@@ -69,6 +69,16 @@ public abstract class RouteBuilder extends BuilderSupport implements RoutesBuild
public abstract void configure() throws Exception;
/**
+ * Creates a new REST route
+ */
+ public RouteDefinition fromRest(String verb, String path) {
+ getRouteCollection().setCamelContext(getContext());
+ RouteDefinition answer = getRouteCollection().fromRest(verb, path);
+ configureRoute(answer);
+ return answer;
+ }
+
+ /**
* Creates a new route from the given URI input
*
* @param uri the from uri
http://git-wip-us.apache.org/repos/asf/camel/blob/2f19857a/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingComponent.java b/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingComponent.java
index 62a5f84..d24b72e 100644
--- a/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingComponent.java
@@ -18,8 +18,10 @@ package org.apache.camel.component.restbinding;
import java.util.Map;
+import org.apache.camel.Component;
import org.apache.camel.Endpoint;
import org.apache.camel.impl.UriEndpointComponent;
+import org.apache.camel.spi.RestBindingCapable;
import org.apache.camel.util.ObjectHelper;
public class RestBindingComponent extends UriEndpointComponent {
@@ -30,8 +32,11 @@ public class RestBindingComponent extends UriEndpointComponent {
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+ preCheckConditions();
+
RestBindingEndpoint answer = new RestBindingEndpoint(uri, this);
setProperties(answer, parameters);
+ answer.setParameters(parameters);
if (!remaining.contains(":")) {
throw new IllegalArgumentException("Invalid syntax. Must be rest-binding:verb:path");
@@ -45,4 +50,22 @@ public class RestBindingComponent extends UriEndpointComponent {
return answer;
}
+
+
+ protected void preCheckConditions() throws Exception {
+ if (lookupRestBindingCapableComponent() == null) {
+ throw new IllegalStateException("There are no registered components in CamelContext that is RestBindingCapable");
+ }
+ }
+
+ public RestBindingCapable lookupRestBindingCapableComponent() {
+ for (String id : getCamelContext().getComponentNames()) {
+ Component component = getCamelContext().getComponent(id);
+ if (component instanceof RestBindingCapable) {
+ return (RestBindingCapable) component;
+ }
+ }
+ return null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/2f19857a/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingConsumer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingConsumer.java b/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingConsumer.java
deleted file mode 100644
index 4480bf4..0000000
--- a/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingConsumer.java
+++ /dev/null
@@ -1,29 +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.component.restbinding;
-
-import org.apache.camel.Processor;
-import org.apache.camel.impl.DefaultConsumer;
-
-public class RestBindingConsumer extends DefaultConsumer {
-
- public RestBindingConsumer(RestBindingEndpoint endpoint, Processor processor) {
- super(endpoint, processor);
- }
-
- // TODO: lookup which components support rest binding and create an endpoint and create the delegate consumer
-}
http://git-wip-us.apache.org/repos/asf/camel/blob/2f19857a/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingEndpoint.java
index df7c62f..da6ce09 100644
--- a/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/restbinding/RestBindingEndpoint.java
@@ -16,15 +16,17 @@
*/
package org.apache.camel.component.restbinding;
-import org.apache.camel.Component;
+import java.util.Map;
+
import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.RestBindingCapable;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
-@UriEndpoint(scheme = "rest", consumerClass = RestBindingConsumer.class)
+@UriEndpoint(scheme = "rest-binding")
public class RestBindingEndpoint extends DefaultEndpoint {
@UriParam
@@ -34,10 +36,17 @@ public class RestBindingEndpoint extends DefaultEndpoint {
@UriParam
private String accept;
- public RestBindingEndpoint(String endpointUri, Component component) {
+ private Map<String, Object> parameters;
+
+ public RestBindingEndpoint(String endpointUri, RestBindingComponent component) {
super(endpointUri, component);
}
+ @Override
+ public RestBindingComponent getComponent() {
+ return (RestBindingComponent) super.getComponent();
+ }
+
public String getVerb() {
return verb;
}
@@ -62,6 +71,14 @@ public class RestBindingEndpoint extends DefaultEndpoint {
this.accept = accept;
}
+ public Map<String, Object> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Map<String, Object> parameters) {
+ this.parameters = parameters;
+ }
+
@Override
public Producer createProducer() throws Exception {
throw new UnsupportedOperationException("Producer not supported");
@@ -69,13 +86,22 @@ public class RestBindingEndpoint extends DefaultEndpoint {
@Override
public Consumer createConsumer(Processor processor) throws Exception {
- Consumer consumer = new RestBindingConsumer(this, processor);
- configureConsumer(consumer);
- return consumer;
+ // create the consumer directly from the component that supports rest binding
+ // TODO: should we have a RestBindingConsumer class that delegates to the actual consumer?
+ // TODO: what if there is 2+ RestBindingCapable components in the registry?
+ RestBindingCapable component = getComponent().lookupRestBindingCapableComponent();
+ if (component != null) {
+ Consumer consumer = component.createConsumer(this, processor);
+ configureConsumer(consumer);
+ return consumer;
+ } else {
+ throw new IllegalStateException("There are no registered components in CamelContext that is RestBindingCapable");
+ }
}
@Override
public boolean isSingleton() {
return true;
}
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/2f19857a/camel-core/src/main/java/org/apache/camel/model/FromRestDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/FromRestDefinition.java b/camel-core/src/main/java/org/apache/camel/model/FromRestDefinition.java
new file mode 100644
index 0000000..dca9ce4
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/model/FromRestDefinition.java
@@ -0,0 +1,93 @@
+/**
+ * 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 javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.spi.RouteContext;
+
+@XmlRootElement(name = "fromRest")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class FromRestDefinition extends FromDefinition {
+
+ // TODO: verb should be an enum
+
+ @XmlAttribute
+ private String verb;
+ @XmlAttribute
+ private String path;
+ @XmlAttribute
+ private String accept;
+ @XmlTransient
+ private Endpoint endpoint;
+
+ public FromRestDefinition() {
+ }
+
+ public FromRestDefinition(String verb, String path) {
+ this(verb, path, null);
+ }
+
+ public FromRestDefinition(String verb, String path, String accept) {
+ this.verb = verb;
+ this.path = path;
+ this.accept = accept;
+ }
+
+ public Endpoint resolveEndpoint(RouteContext context) {
+ if (endpoint == null) {
+ if (accept != null) {
+ return context.resolveEndpoint("rest-binding:" + verb + ":" + path + "?accept=" + accept);
+ } else {
+ return context.resolveEndpoint("rest-binding:" + verb + ":" + path);
+ }
+ } else {
+ return endpoint;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "fromRest[" + getLabel() + "]";
+ }
+
+ @Override
+ public String getShortName() {
+ return "fromRest";
+ }
+
+ public String getLabel() {
+ return verb + "(" + "/" + path + ")";
+ }
+
+ public String getVerb() {
+ return verb;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getAccept() {
+ return accept;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/2f19857a/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java b/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java
index 05a5b5f..3caade6 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RouteDefinition.java
@@ -284,6 +284,16 @@ public class RouteDefinition extends ProcessorDefinition<RouteDefinition> {
// -----------------------------------------------------------------------
/**
+ * Creates an REST input to the route
+ *
+ * @return the builder
+ */
+ public RouteDefinition fromRest(String verb, String path) {
+ getInputs().add(new FromRestDefinition(verb, path));
+ return this;
+ }
+
+ /**
* Creates an input to the route
*
* @param uri the from uri
http://git-wip-us.apache.org/repos/asf/camel/blob/2f19857a/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java b/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java
index ab99fe0..b5929ec 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java
@@ -149,6 +149,17 @@ public class RoutesDefinition extends OptionalIdentifiedDefinition<RoutesDefinit
}
/**
+ * Creates a new REST route
+ *
+ * @return the builder
+ */
+ public RouteDefinition fromRest(String verb, String path) {
+ RouteDefinition route = createRoute();
+ route.fromRest(verb, path);
+ return route(route);
+ }
+
+ /**
* Creates a new route from the given URI input
*
* @param uri the from uri
http://git-wip-us.apache.org/repos/asf/camel/blob/2f19857a/camel-core/src/main/java/org/apache/camel/spi/RestBindingCapable.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/spi/RestBindingCapable.java b/camel-core/src/main/java/org/apache/camel/spi/RestBindingCapable.java
new file mode 100644
index 0000000..645f1bc
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/spi/RestBindingCapable.java
@@ -0,0 +1,37 @@
+/**
+ * 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.spi;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.component.restbinding.RestBindingEndpoint;
+
+public interface RestBindingCapable {
+
+ /**
+ * Creates a new REST <a
+ * href="http://camel.apache.org/event-driven-consumer.html">Event
+ * Driven Consumer</a>, using the details from the {@link org.apache.camel.component.restbinding.RestBindingEndpoint},
+ * which consumes messages from the endpoint using the given processor
+ *
+ * @param endpoint the binding endpoint
+ * @param processor the processor
+ * @return a newly created REST consumer
+ * @throws Exception can be thrown
+ */
+ Consumer createConsumer(RestBindingEndpoint endpoint, Processor processor) throws Exception;
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/2f19857a/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/rest-binding
----------------------------------------------------------------------
diff --git a/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/rest-binding b/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/rest-binding
new file mode 100644
index 0000000..3bf1949
--- /dev/null
+++ b/camel-core/src/main/resources/META-INF/services/org/apache/camel/component/rest-binding
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.component.restbinding.RestBindingComponent
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/2f19857a/camel-core/src/main/resources/org/apache/camel/model/jaxb.index
----------------------------------------------------------------------
diff --git a/camel-core/src/main/resources/org/apache/camel/model/jaxb.index b/camel-core/src/main/resources/org/apache/camel/model/jaxb.index
index 1e32f42..4afe1f1 100644
--- a/camel-core/src/main/resources/org/apache/camel/model/jaxb.index
+++ b/camel-core/src/main/resources/org/apache/camel/model/jaxb.index
@@ -30,6 +30,7 @@ ExpressionSubElementDefinition
FilterDefinition
FinallyDefinition
FromDefinition
+RestFromDefinition
IdempotentConsumerDefinition
InOnlyDefinition
InOutDefinition
http://git-wip-us.apache.org/repos/asf/camel/blob/2f19857a/camel-core/src/test/java/org/apache/camel/component/restbinding/DummyRestBindingCapableComponent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/restbinding/DummyRestBindingCapableComponent.java b/camel-core/src/test/java/org/apache/camel/component/restbinding/DummyRestBindingCapableComponent.java
new file mode 100644
index 0000000..6374b70
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/restbinding/DummyRestBindingCapableComponent.java
@@ -0,0 +1,47 @@
+/**
+ * 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.component.restbinding;
+
+import java.util.Map;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Processor;
+import org.apache.camel.component.seda.SedaEndpoint;
+import org.apache.camel.impl.ActiveMQUuidGenerator;
+import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.spi.RestBindingCapable;
+
+public class DummyRestBindingCapableComponent extends DefaultComponent implements RestBindingCapable {
+
+ @Override
+ protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Consumer createConsumer(RestBindingEndpoint endpoint, Processor processor) throws Exception {
+ // just use a seda endpoint for testing purpose
+ String id = ActiveMQUuidGenerator.generateSanitizedId(endpoint.getPath());
+ // remove leading dash as we add that ourselves
+ if (id.startsWith("-")) {
+ id = id.substring(1);
+ }
+ SedaEndpoint seda = getCamelContext().getEndpoint("seda:" + endpoint.getVerb() + "-" + id, SedaEndpoint.class);
+ return seda.createConsumer(processor);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/2f19857a/camel-core/src/test/java/org/apache/camel/component/restbinding/FromRestGetTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/restbinding/FromRestGetTest.java b/camel-core/src/test/java/org/apache/camel/component/restbinding/FromRestGetTest.java
new file mode 100644
index 0000000..69141c4
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/restbinding/FromRestGetTest.java
@@ -0,0 +1,70 @@
+/**
+ * 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.component.restbinding;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.FromRestDefinition;
+import org.apache.camel.model.RouteDefinition;
+
+public class FromRestGetTest extends ContextTestSupport {
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ CamelContext context = super.createCamelContext();
+
+ // register our dummy rest capable component
+ context.addComponent("dummy-rest", new DummyRestBindingCapableComponent());
+
+ return context;
+ }
+
+ public void testFromRestModel() {
+ assertEquals(1, context.getRoutes().size());
+
+ RouteDefinition route = context.getRouteDefinition("foo");
+ assertNotNull(route);
+
+ FromRestDefinition from = (FromRestDefinition) route.getInputs().get(0);
+ assertNotNull(from);
+ assertEquals("get", from.getVerb());
+ assertEquals("/hello", from.getPath());
+ assertNull(from.getAccept());
+ }
+
+ public void testFromRest() throws Exception {
+ getMockEndpoint("mock:foo").expectedMessageCount(1);
+
+ template.sendBody("seda:get-hello", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ // fromRest().get("/hello")
+ fromRest("get", "/hello").routeId("foo")
+ .to("mock:foo")
+ .transform().constant("Bye World");
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/2f19857a/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/AdviceWithTransactionIssueTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/AdviceWithTransactionIssueTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/AdviceWithTransactionIssueTest.xml
index 1d4bcb2..ebab224 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/AdviceWithTransactionIssueTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/AdviceWithTransactionIssueTest.xml
@@ -25,11 +25,11 @@
<import resource="../interceptor/transactionalClientDataSource.xml"/>
<camelContext id="myCamelContext" xmlns="http://camel.apache.org/schema/spring">
+
<route id="route1">
- <from uri="seda:start"/>
- <transacted/>
- <to id="mock-a" uri="mock:a"/>
- <to id="mock-b" uri="mock:b"/>
+ <get path="/customer/:name"/>
+ <to uri="bean:customerService?method=findCustomer($header.name})"/>
</route>
+
</camelContext>
</beans>