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:09 UTC

[03/33] git commit: CAMEL-7354: rest-binding DSL in java and xml.

CAMEL-7354: rest-binding DSL in java and xml.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/71eaf52b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/71eaf52b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/71eaf52b

Branch: refs/heads/master
Commit: 71eaf52b8d591b7f733fb911bef54973e52be719
Parents: 2f19857
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Jul 1 14:27:36 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Jul 19 09:38:47 2014 +0200

----------------------------------------------------------------------
 .../resources/org/apache/camel/model/jaxb.index |  2 +-
 .../DummyRestBindingCapableComponent.java       |  4 ++
 .../restbinding/SpringFromRestGetTest.java      | 29 +++++++++++++++
 .../restbinding/SpringFromRestGetTest.xml       | 39 ++++++++++++++++++++
 .../issues/AdviceWithTransactionIssueTest.xml   |  8 ++--
 5 files changed, 77 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/71eaf52b/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 4afe1f1..61991d5 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,7 +30,7 @@ ExpressionSubElementDefinition
 FilterDefinition
 FinallyDefinition
 FromDefinition
-RestFromDefinition
+FromRestDefinition
 IdempotentConsumerDefinition
 InOnlyDefinition
 InOutDefinition

http://git-wip-us.apache.org/repos/asf/camel/blob/71eaf52b/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
index 6374b70..cf3a4ae 100644
--- 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
@@ -28,6 +28,10 @@ import org.apache.camel.spi.RestBindingCapable;
 
 public class DummyRestBindingCapableComponent extends DefaultComponent implements RestBindingCapable {
 
+    public void enlist() {
+        getCamelContext().addComponent("dummy-rest", this);
+    }
+
     @Override
     protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
         return null;

http://git-wip-us.apache.org/repos/asf/camel/blob/71eaf52b/components/camel-spring/src/test/java/org/apache/camel/component/restbinding/SpringFromRestGetTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/component/restbinding/SpringFromRestGetTest.java b/components/camel-spring/src/test/java/org/apache/camel/component/restbinding/SpringFromRestGetTest.java
new file mode 100644
index 0000000..371721c
--- /dev/null
+++ b/components/camel-spring/src/test/java/org/apache/camel/component/restbinding/SpringFromRestGetTest.java
@@ -0,0 +1,29 @@
+/**
+ * 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 static org.apache.camel.spring.processor.SpringTestHelper.createSpringCamelContext;
+
+public class SpringFromRestGetTest extends FromRestGetTest {
+
+    protected CamelContext createCamelContext() throws Exception {
+        return createSpringCamelContext(this, "org/apache/camel/component/restbinding/SpringFromRestGetTest.xml");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/71eaf52b/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
new file mode 100644
index 0000000..0626079
--- /dev/null
+++ b/components/camel-spring/src/test/resources/org/apache/camel/component/restbinding/SpringFromRestGetTest.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+  <!-- use a dummy rest component and enlist it in the CamelContext -->
+  <bean id="dummy-rest" class="org.apache.camel.component.restbinding.DummyRestBindingCapableComponent"
+        init-method="enlist"/>
+
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route id="foo">
+      <fromRest verb="get" path="/hello"/>
+      <to uri="mock:foo"/>
+      <transform>
+        <constant>Bye World</constant>
+      </transform>
+    </route>
+  </camelContext>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/71eaf52b/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 ebab224..1d4bcb2 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">
-      <get path="/customer/:name"/>
-      <to uri="bean:customerService?method=findCustomer($header.name})"/>
+      <from uri="seda:start"/>
+      <transacted/>
+      <to id="mock-a" uri="mock:a"/>
+      <to id="mock-b" uri="mock:b"/>
     </route>
-
   </camelContext>
 </beans>