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/12/09 20:19:57 UTC
[1/6] camel git commit: CAMEL-8316: rest-dsl - Added unit test.
Repository: camel
Updated Branches:
refs/heads/camel-2.14.x f97cd5caf -> ca69cc52e
refs/heads/master 9d2f9d73f -> a42a65d90
CAMEL-8316: rest-dsl - Added unit test.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f5426f41
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f5426f41
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f5426f41
Branch: refs/heads/master
Commit: f5426f41a44ee7bfdf2dc7d01081dc97c0860fd1
Parents: 9d2f9d7
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Dec 9 19:56:14 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Dec 9 20:09:55 2014 +0100
----------------------------------------------------------------------
...estletBindingInJaxbOutStringWithXmlTest.java | 66 ++++++++++++++++++++
1 file changed, 66 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f5426f41/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
new file mode 100644
index 0000000..10f1c7f
--- /dev/null
+++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
@@ -0,0 +1,66 @@
+/**
+ * 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.restlet;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.junit.Test;
+
+/**
+ * @version
+ */
+public class RestRestletBindingInJaxbOutStringWithXmlTest extends RestletTestSupport {
+
+ @Test
+ public void testBindingMode() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:input");
+ mock.expectedMessageCount(1);
+ mock.message(0).body().isInstanceOf(UserJaxbPojo.class);
+
+ String body = "<user name=\"Donald Duck\" id=\"123\"></user>";
+ String reply = template.requestBody("http://localhost:" + portNum + "/users/new", body, String.class);
+
+ assertEquals("<message>Thanks for calling us</message>", reply);
+
+ assertMockEndpointsSatisfied();
+
+ UserJaxbPojo user = mock.getReceivedExchanges().get(0).getIn().getBody(UserJaxbPojo.class);
+ assertNotNull(user);
+ assertEquals(123, user.getId());
+ assertEquals("Donald Duck", user.getName());
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.auto)
+ // turn off must be JAXB as we create the output type ourselves as xml in a String type
+ .dataFormatProperty("mustBeJAXBElement", "false");
+
+ // use the rest DSL to define the rest services
+ rest("/users/")
+ .post("new").consumes("application/xml").produces("application/xml").type(UserJaxbPojo.class)
+ .route()
+ .to("mock:input")
+ .transform().constant("<message>Thanks for calling us</message>");
+ }
+ };
+ }
+}
[4/6] camel git commit: CAMEL-8316: rest-dsl - Added unit test.
Posted by da...@apache.org.
CAMEL-8316: rest-dsl - Added unit test.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0802f8da
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0802f8da
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0802f8da
Branch: refs/heads/camel-2.14.x
Commit: 0802f8daa2f081af63705c683a2bb9f416d196dd
Parents: f97cd5c
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Dec 9 19:56:14 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Dec 9 20:19:34 2014 +0100
----------------------------------------------------------------------
...estletBindingInJaxbOutStringWithXmlTest.java | 66 ++++++++++++++++++++
1 file changed, 66 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/0802f8da/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
new file mode 100644
index 0000000..10f1c7f
--- /dev/null
+++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletBindingInJaxbOutStringWithXmlTest.java
@@ -0,0 +1,66 @@
+/**
+ * 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.restlet;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.junit.Test;
+
+/**
+ * @version
+ */
+public class RestRestletBindingInJaxbOutStringWithXmlTest extends RestletTestSupport {
+
+ @Test
+ public void testBindingMode() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:input");
+ mock.expectedMessageCount(1);
+ mock.message(0).body().isInstanceOf(UserJaxbPojo.class);
+
+ String body = "<user name=\"Donald Duck\" id=\"123\"></user>";
+ String reply = template.requestBody("http://localhost:" + portNum + "/users/new", body, String.class);
+
+ assertEquals("<message>Thanks for calling us</message>", reply);
+
+ assertMockEndpointsSatisfied();
+
+ UserJaxbPojo user = mock.getReceivedExchanges().get(0).getIn().getBody(UserJaxbPojo.class);
+ assertNotNull(user);
+ assertEquals(123, user.getId());
+ assertEquals("Donald Duck", user.getName());
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.auto)
+ // turn off must be JAXB as we create the output type ourselves as xml in a String type
+ .dataFormatProperty("mustBeJAXBElement", "false");
+
+ // use the rest DSL to define the rest services
+ rest("/users/")
+ .post("new").consumes("application/xml").produces("application/xml").type(UserJaxbPojo.class)
+ .route()
+ .to("mock:input")
+ .transform().constant("<message>Thanks for calling us</message>");
+ }
+ };
+ }
+}
[2/6] camel git commit: CAMEL-8316: Should be true by default as
before
Posted by da...@apache.org.
CAMEL-8316: Should be true by default as before
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/79db2b6a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/79db2b6a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/79db2b6a
Branch: refs/heads/master
Commit: 79db2b6aa4de8824674140e26af264d9934afc53
Parents: f5426f4
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Dec 9 20:10:30 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Dec 9 20:10:30 2014 +0100
----------------------------------------------------------------------
.../main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/79db2b6a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
index 7e1281a..2993db5 100644
--- a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
+++ b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
@@ -83,7 +83,7 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelC
private boolean prettyPrint = true;
private boolean ignoreJAXBElement = true;
- private boolean mustBeJAXBElement;
+ private boolean mustBeJAXBElement = true;
private boolean filterNonXmlChars;
private String encoding;
private boolean fragment;
[3/6] camel git commit: CAMEL-8316: Fixed setting custom data format
properties in rest-dsl
Posted by da...@apache.org.
CAMEL-8316: Fixed setting custom data format properties in rest-dsl
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a42a65d9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a42a65d9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a42a65d9
Branch: refs/heads/master
Commit: a42a65d90dca68dadff7db3e170ea411febad0e0
Parents: 79db2b6
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Dec 9 20:17:39 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Dec 9 20:17:39 2014 +0100
----------------------------------------------------------------------
.../java/org/apache/camel/model/rest/RestBindingDefinition.java | 3 ---
1 file changed, 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/a42a65d9/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
index abe2a06..eac4829 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
@@ -170,9 +170,6 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit
JAXBContext jc = JAXBContext.newInstance(clazz);
IntrospectionSupport.setProperty(context.getTypeConverter(), jaxb, "context", jc);
}
- if (context.getRestConfiguration().getDataFormatProperties() != null) {
- IntrospectionSupport.setProperties(context.getTypeConverter(), jaxb, context.getRestConfiguration().getDataFormatProperties());
- }
setAdditionalConfiguration(context, jaxb);
context.addService(jaxb);
[6/6] camel git commit: CAMEL-8316: Fixed setting custom data format
properties in rest-dsl
Posted by da...@apache.org.
CAMEL-8316: Fixed setting custom data format properties in rest-dsl
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ca69cc52
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ca69cc52
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ca69cc52
Branch: refs/heads/camel-2.14.x
Commit: ca69cc52edfdcf70ff1c449b0e797bd1d7e44457
Parents: 408fef6
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Dec 9 20:17:39 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Dec 9 20:19:43 2014 +0100
----------------------------------------------------------------------
.../java/org/apache/camel/model/rest/RestBindingDefinition.java | 3 ---
1 file changed, 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ca69cc52/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
index abe2a06..eac4829 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
@@ -170,9 +170,6 @@ public class RestBindingDefinition extends NoOutputDefinition<RestBindingDefinit
JAXBContext jc = JAXBContext.newInstance(clazz);
IntrospectionSupport.setProperty(context.getTypeConverter(), jaxb, "context", jc);
}
- if (context.getRestConfiguration().getDataFormatProperties() != null) {
- IntrospectionSupport.setProperties(context.getTypeConverter(), jaxb, context.getRestConfiguration().getDataFormatProperties());
- }
setAdditionalConfiguration(context, jaxb);
context.addService(jaxb);
[5/6] camel git commit: CAMEL-8316: Should be true by default as
before
Posted by da...@apache.org.
CAMEL-8316: Should be true by default as before
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/408fef6a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/408fef6a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/408fef6a
Branch: refs/heads/camel-2.14.x
Commit: 408fef6a84a18323c3b4c84d57a082c11f18fb41
Parents: 0802f8d
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Dec 9 20:10:30 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Dec 9 20:19:39 2014 +0100
----------------------------------------------------------------------
.../main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/408fef6a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
index 7e1281a..2993db5 100644
--- a/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
+++ b/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java
@@ -83,7 +83,7 @@ public class JaxbDataFormat extends ServiceSupport implements DataFormat, CamelC
private boolean prettyPrint = true;
private boolean ignoreJAXBElement = true;
- private boolean mustBeJAXBElement;
+ private boolean mustBeJAXBElement = true;
private boolean filterNonXmlChars;
private String encoding;
private boolean fragment;