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:22 UTC
[16/33] git commit: CAMEL-7354: Migrating rest DSL to be separated
from regular Camel routes.
CAMEL-7354: Migrating rest DSL to be separated from regular Camel routes.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/31269fd9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/31269fd9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/31269fd9
Branch: refs/heads/master
Commit: 31269fd9da5477e8d1bd109fa46979bcdb3c40de
Parents: aff5987
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jul 2 19:53:56 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Jul 19 09:38:50 2014 +0200
----------------------------------------------------------------------
.../camel/component/restbinding/FromRestGetTest.java | 15 +++++++++++++--
.../camel/management/ManagedFromRestGetTest.java | 14 ++++++++------
.../component/restbinding/SpringFromRestGetTest.xml | 2 +-
.../component/restbinding/FromRestGetTest.xml | 2 +-
4 files changed, 23 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/31269fd9/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
index 72798fc..da8a765 100644
--- 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
@@ -32,7 +32,7 @@ public class FromRestGetTest extends ContextTestSupport {
return jndi;
}
- public void testFromRestModel() {
+ public void testFromRestModel() throws Exception {
assertEquals(2 + 3, context.getRoutes().size());
RestDefinition rest = context.getRestDefinitions().get(0);
@@ -51,6 +51,17 @@ public class FromRestGetTest extends ContextTestSupport {
assertEquals("direct:bye", to.getUri());
assertEquals(null, path.getVerbs().get(2).getUri());
+
+ // the rest becomes routes and the input is a seda endpoint created by the DummyRestConsumerFactory
+
+ getMockEndpoint("mock:update").expectedMessageCount(1);
+ template.sendBody("seda:post-say", "I was here");
+ assertMockEndpointsSatisfied();
+
+ String out = template.requestBody("seda:get-say-hello", "Me", String.class);
+ assertEquals("Hello World", out);
+ String out2 = template.requestBody("seda:get-say-bye", "Me", String.class);
+ assertEquals("Bye World", out2);
}
@Override
@@ -62,7 +73,7 @@ public class FromRestGetTest extends ContextTestSupport {
.path("/say")
.get("/hello").to("direct:hello")
.get("/bye").to("direct:bye")
- .post().to("seda:update");
+ .post().to("mock:update");
from("direct:hello")
.transform().constant("Hello World");
http://git-wip-us.apache.org/repos/asf/camel/blob/31269fd9/camel-core/src/test/java/org/apache/camel/management/ManagedFromRestGetTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/management/ManagedFromRestGetTest.java b/camel-core/src/test/java/org/apache/camel/management/ManagedFromRestGetTest.java
index 17060bf..43c9d37 100644
--- a/camel-core/src/test/java/org/apache/camel/management/ManagedFromRestGetTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/ManagedFromRestGetTest.java
@@ -19,17 +19,19 @@ package org.apache.camel.management;
import javax.management.MBeanServer;
import javax.management.ObjectName;
+import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.restbinding.DummyRestConsumerFactory;
-import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.SimpleRegistry;
public class ManagedFromRestGetTest extends ManagementTestSupport {
@Override
- protected JndiRegistry createRegistry() throws Exception {
- JndiRegistry jndi = super.createRegistry();
- jndi.bind("dummy-test", new DummyRestConsumerFactory());
- return jndi;
+ protected CamelContext createCamelContext() throws Exception {
+ SimpleRegistry registry = new SimpleRegistry();
+ registry.put("dummy-test", new DummyRestConsumerFactory());
+ return new DefaultCamelContext(registry);
}
public void testFromRestModel() throws Exception {
@@ -69,7 +71,7 @@ public class ManagedFromRestGetTest extends ManagementTestSupport {
.path("/say")
.get("/hello").to("direct:hello")
.get("/bye").to("direct:bye")
- .post().to("seda:update");
+ .post().to("mock:update");
from("direct:hello")
.transform().constant("Hello World");
http://git-wip-us.apache.org/repos/asf/camel/blob/31269fd9/components/camel-spring/src/test/resources/org/apache/camel/component/restbinding/SpringFromRestGetTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/component/restbinding/SpringFromRestGetTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/component/restbinding/SpringFromRestGetTest.xml
index 156a2c1..8929e75 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/component/restbinding/SpringFromRestGetTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/component/restbinding/SpringFromRestGetTest.xml
@@ -36,7 +36,7 @@
<to uri="direct:bye"/>
</get>
<post>
- <to uri="seda:update"/>
+ <to uri="mock:update"/>
</post>
</path>
</rest>
http://git-wip-us.apache.org/repos/asf/camel/blob/31269fd9/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/restbinding/FromRestGetTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/restbinding/FromRestGetTest.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/restbinding/FromRestGetTest.xml
index 2ba7b41..f5e83f5 100644
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/restbinding/FromRestGetTest.xml
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/restbinding/FromRestGetTest.xml
@@ -34,7 +34,7 @@
<to uri="direct:bye"/>
</get>
<post>
- <to uri="seda:update"/>
+ <to uri="mock:update"/>
</post>
</path>
</rest>