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/25 12:42:17 UTC
[2/3] git commit: CAMEL-7619: Rest DSL - adding support for xml/json
binding using Camel's data formats. Work in progress.
CAMEL-7619: Rest DSL - adding support for xml/json binding using Camel's data formats. Work in progress.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ccb9836b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ccb9836b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ccb9836b
Branch: refs/heads/master
Commit: ccb9836b93b8557368ad3502feafcf9c01da6b49
Parents: 2d38cd3
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jul 25 12:06:27 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jul 25 12:06:27 2014 +0200
----------------------------------------------------------------------
.../apache/camel/impl/DefaultCamelContext.java | 2 +-
.../camel/model/rest/RestBindingDefinition.java | 137 +++++--------------
.../apache/camel/model/rest/RestDefinition.java | 78 ++---------
.../apache/camel/model/rest/VerbDefinition.java | 78 ++---------
.../processor/binding/RestBindingProcessor.java | 23 +++-
.../rest/FromRestGetEmbeddedRouteTest.java | 4 +-
.../component/rest/FromRestGetEndPathTest.java | 2 +-
.../camel/component/rest/FromRestGetTest.java | 3 +-
.../management/ManagedFromRestGetTest.java | 3 +-
.../component/rest/SpringFromRestGetTest.xml | 2 +-
.../component/rest/FromRestGetTest.java | 1 -
.../component/rest/FromRestGetTest.xml | 2 +-
12 files changed, 90 insertions(+), 245 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/ccb9836b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 3b4a4f3..15987fc 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -174,7 +174,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
private ManagementMBeanAssembler managementMBeanAssembler;
private final List<RouteDefinition> routeDefinitions = new ArrayList<RouteDefinition>();
private final List<RestDefinition> restDefinitions = new ArrayList<RestDefinition>();
- private RestConfiguration restConfiguration;
+ private RestConfiguration restConfiguration = new RestConfiguration();
private List<InterceptStrategy> interceptStrategies = new ArrayList<InterceptStrategy>();
// special flags to control the first startup which can are special
http://git-wip-us.apache.org/repos/asf/camel/blob/ccb9836b/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 5ffb068..80535f3 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
@@ -21,7 +21,6 @@ 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.CamelContext;
import org.apache.camel.Processor;
@@ -30,7 +29,6 @@ import org.apache.camel.processor.binding.RestBindingProcessor;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.RouteContext;
import org.apache.camel.util.IntrospectionSupport;
-import org.apache.camel.util.ObjectHelper;
@XmlRootElement(name = "restBinding")
@XmlAccessorType(XmlAccessType.FIELD)
@@ -55,25 +53,13 @@ public class RestBindingDefinition extends NoOutputDefinition {
private String type;
@XmlAttribute
- private String typeList;
-
- @XmlTransient
- private Class<?> classType;
-
- @XmlTransient
- private boolean useList;
-
- @XmlAttribute
private String outType;
@XmlAttribute
- private String outTypeList;
+ private Boolean list;
- @XmlTransient
- private Class<?> outClassType;
-
- @XmlTransient
- private boolean outUseList;
+ @XmlAttribute
+ private Boolean outList;
@Override
public String toString() {
@@ -89,10 +75,6 @@ public class RestBindingDefinition extends NoOutputDefinition {
@Override
public Processor createProcessor(RouteContext routeContext) throws Exception {
- // type must be set
- if (ObjectHelper.isEmpty(type) && ObjectHelper.isEmpty(classType)) {
- throw new IllegalArgumentException("Type must be configured on " + this);
- }
CamelContext context = routeContext.getCamelContext();
@@ -113,28 +95,24 @@ public class RestBindingDefinition extends NoOutputDefinition {
if (mode.contains("json") && json == null) {
throw new IllegalArgumentException("JSon DataFormat " + name + " not found.");
}
- if (classType == null && type != null) {
- classType = context.getClassResolver().resolveMandatoryClass(type);
+ Class<?> clazz = null;
+ if (type != null) {
+ clazz = context.getClassResolver().resolveMandatoryClass(type);
}
- if (classType == null && typeList != null) {
- classType = context.getClassResolver().resolveMandatoryClass(typeList);
- }
- if (classType != null) {
- IntrospectionSupport.setProperty(context.getTypeConverter(), json, "unmarshalType", classType);
- IntrospectionSupport.setProperty(context.getTypeConverter(), json, "useList", useList);
+ if (clazz != null) {
+ IntrospectionSupport.setProperty(context.getTypeConverter(), json, "unmarshalType", clazz);
+ IntrospectionSupport.setProperty(context.getTypeConverter(), json, "useList", list != null ? list : false);
}
context.addService(json);
DataFormat outJson = context.resolveDataFormat(name);
- if (outClassType == null && outType != null) {
- outClassType = context.getClassResolver().resolveMandatoryClass(outType);
- }
- if (outClassType == null && outTypeList != null) {
- outClassType = context.getClassResolver().resolveMandatoryClass(outTypeList);
+ Class<?> outClazz = null;
+ if (outType != null) {
+ outClazz = context.getClassResolver().resolveMandatoryClass(outType);
}
- if (outClassType != null) {
- IntrospectionSupport.setProperty(context.getTypeConverter(), outJson, "unmarshalType", outClassType);
- IntrospectionSupport.setProperty(context.getTypeConverter(), outJson, "useList", outUseList);
+ if (outClazz != null) {
+ IntrospectionSupport.setProperty(context.getTypeConverter(), outJson, "unmarshalType", outClazz);
+ IntrospectionSupport.setProperty(context.getTypeConverter(), outJson, "useList", outList != null ? outList : false);
}
context.addService(outJson);
@@ -148,31 +126,27 @@ public class RestBindingDefinition extends NoOutputDefinition {
if (mode.contains("xml") && jaxb == null) {
throw new IllegalArgumentException("XML DataFormat " + name + " not found.");
}
- if (classType == null && type != null) {
- classType = context.getClassResolver().resolveMandatoryClass(type);
+ clazz = null;
+ if (type != null) {
+ clazz = context.getClassResolver().resolveMandatoryClass(type);
}
- if (classType == null && typeList != null) {
- classType = context.getClassResolver().resolveMandatoryClass(type);
- }
- if (classType != null) {
- JAXBContext jc = JAXBContext.newInstance(classType);
+ if (clazz != null) {
+ JAXBContext jc = JAXBContext.newInstance(clazz);
IntrospectionSupport.setProperty(context.getTypeConverter(), jaxb, "context", jc);
}
context.addService(jaxb);
DataFormat outJaxb = context.resolveDataFormat(name);
- if (outClassType == null && outType != null) {
- outClassType = context.getClassResolver().resolveMandatoryClass(outType);
- }
- if (outClassType == null && outTypeList != null) {
- outClassType = context.getClassResolver().resolveMandatoryClass(outTypeList);
+ outClazz = null;
+ if (outType != null) {
+ outClazz = context.getClassResolver().resolveMandatoryClass(outType);
}
- if (outClassType != null) {
- JAXBContext jc = JAXBContext.newInstance(outClassType);
+ if (outClazz != null) {
+ JAXBContext jc = JAXBContext.newInstance(outClazz);
IntrospectionSupport.setProperty(context.getTypeConverter(), outJaxb, "context", jc);
- } else if (classType != null) {
+ } else if (clazz != null) {
// fallback and use the context from the input
- JAXBContext jc = JAXBContext.newInstance(classType);
+ JAXBContext jc = JAXBContext.newInstance(clazz);
IntrospectionSupport.setProperty(context.getTypeConverter(), outJaxb, "context", jc);
}
context.addService(outJaxb);
@@ -226,66 +200,29 @@ public class RestBindingDefinition extends NoOutputDefinition {
public void setType(String type) {
this.type = type;
- this.useList = false;
- }
-
- public String getTypeList() {
- return typeList;
- }
-
- public void setTypeList(String typeList) {
- this.typeList = typeList;
- this.useList = true;
- }
-
- public Class<?> getClassType() {
- return classType;
- }
-
- public void setClassType(Class<?> classType) {
- this.classType = classType;
- }
-
- public boolean isUseList() {
- return useList;
- }
-
- public void setUseList(boolean useList) {
- this.useList = useList;
}
public String getOutType() {
return outType;
}
- public void setOutType(String type) {
- this.outType = type;
- this.outUseList = false;
- }
-
- public String getOutTypeList() {
- return outTypeList;
+ public void setOutType(String outType) {
+ this.outType = outType;
}
- public void setOutTypeList(String typeList) {
- this.outTypeList = typeList;
- this.outUseList = true;
+ public Boolean getList() {
+ return list;
}
- public Class<?> getOutClassType() {
- return outClassType;
+ public void setList(Boolean list) {
+ this.list = list;
}
- public void setOutClassType(Class<?> classType) {
- this.outClassType = classType;
+ public Boolean getOutList() {
+ return outList;
}
- public boolean isOutUseList() {
- return outUseList;
+ public void setOutList(Boolean outList) {
+ this.outList = outList;
}
-
- public void setOutUseList(boolean useList) {
- this.outUseList = useList;
- }
-
}
http://git-wip-us.apache.org/repos/asf/camel/blob/ccb9836b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
----------------------------------------------------------------------
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 d81a564..2186993 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
@@ -143,17 +143,6 @@ public class RestDefinition {
return this;
}
- public RestDefinition type(String classType) {
- // add to last verb
- if (getVerbs().isEmpty()) {
- throw new IllegalArgumentException("Must add verb first, such as get/post/delete");
- }
-
- VerbDefinition verb = getVerbs().get(getVerbs().size() - 1);
- verb.setType(classType);
- return this;
- }
-
public RestDefinition type(Class<?> classType) {
// add to last verb
if (getVerbs().isEmpty()) {
@@ -161,22 +150,10 @@ public class RestDefinition {
}
VerbDefinition verb = getVerbs().get(getVerbs().size() - 1);
- verb.setClassType(classType);
verb.setType(classType.getCanonicalName());
return this;
}
- public RestDefinition typeList(String classType) {
- // add to last verb
- if (getVerbs().isEmpty()) {
- throw new IllegalArgumentException("Must add verb first, such as get/post/delete");
- }
-
- VerbDefinition verb = getVerbs().get(getVerbs().size() - 1);
- verb.setTypeList(classType);
- return this;
- }
-
public RestDefinition typeList(Class<?> classType) {
// add to last verb
if (getVerbs().isEmpty()) {
@@ -184,19 +161,8 @@ public class RestDefinition {
}
VerbDefinition verb = getVerbs().get(getVerbs().size() - 1);
- verb.setClassType(classType);
- verb.setTypeList(classType.getCanonicalName());
- return this;
- }
-
- public RestDefinition outType(String classType) {
- // add to last verb
- if (getVerbs().isEmpty()) {
- throw new IllegalArgumentException("Must add verb first, such as get/post/delete");
- }
-
- VerbDefinition verb = getVerbs().get(getVerbs().size() - 1);
- verb.setOutType(classType);
+ verb.setType(classType.getCanonicalName());
+ verb.setList(true);
return this;
}
@@ -207,22 +173,10 @@ public class RestDefinition {
}
VerbDefinition verb = getVerbs().get(getVerbs().size() - 1);
- verb.setOutClassType(classType);
verb.setOutType(classType.getCanonicalName());
return this;
}
- public RestDefinition outTypeList(String classType) {
- // add to last verb
- if (getVerbs().isEmpty()) {
- throw new IllegalArgumentException("Must add verb first, such as get/post/delete");
- }
-
- VerbDefinition verb = getVerbs().get(getVerbs().size() - 1);
- verb.setOutTypeList(classType);
- return this;
- }
-
public RestDefinition outTypeList(Class<?> classType) {
// add to last verb
if (getVerbs().isEmpty()) {
@@ -230,8 +184,8 @@ public class RestDefinition {
}
VerbDefinition verb = getVerbs().get(getVerbs().size() - 1);
- verb.setOutClassType(classType);
- verb.setOutTypeList(classType.getCanonicalName());
+ verb.setOutType(classType.getCanonicalName());
+ verb.setOutList(true);
return this;
}
@@ -338,21 +292,15 @@ public class RestDefinition {
}
// add the binding
- if (verb.getType() != null || verb.getClassType() != null) {
- RestBindingDefinition binding = new RestBindingDefinition();
- binding.setType(verb.getType());
- binding.setTypeList(verb.getTypeList());
- binding.setClassType(verb.getClassType());
- binding.setUseList(verb.isUseList());
- binding.setOutType(verb.getOutType());
- binding.setOutTypeList(verb.getOutTypeList());
- binding.setOutClassType(verb.getOutClassType());
- binding.setOutUseList(verb.isOutUseList());
- binding.setConsumes(verb.getConsumes());
- binding.setProduces(verb.getProduces());
- binding.setBindingMode(verb.getBindingMode());
- route.getOutputs().add(0, binding);
- }
+ RestBindingDefinition binding = new RestBindingDefinition();
+ binding.setType(verb.getType());
+ binding.setOutType(verb.getOutType());
+ binding.setList(verb.getList());
+ binding.setOutList(verb.getOutList());
+ binding.setConsumes(verb.getConsumes());
+ binding.setProduces(verb.getProduces());
+ binding.setBindingMode(verb.getBindingMode());
+ route.getOutputs().add(0, binding);
// the route should be from this rest endpoint
route.fromRest(from);
http://git-wip-us.apache.org/repos/asf/camel/blob/ccb9836b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
----------------------------------------------------------------------
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 1032772..48aa066 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
@@ -51,25 +51,13 @@ public class VerbDefinition {
private String type;
@XmlAttribute
- private String typeList;
-
- @XmlAttribute
private String outType;
@XmlAttribute
- private String outTypeList;
-
- @XmlTransient
- private Class<?> classType;
+ private Boolean list;
- @XmlTransient
- private Class<?> outClassType;
-
- @XmlTransient
- private boolean useList;
-
- @XmlTransient
- private boolean outUseList;
+ @XmlAttribute
+ private Boolean outList;
// used by XML DSL to either select a <to> or <route>
// so we need to use the common type OptionalIdentifiedDefinition
@@ -133,70 +121,30 @@ public class VerbDefinition {
public void setType(String type) {
this.type = type;
- this.useList = false;
- }
-
- public String getTypeList() {
- return typeList;
- }
-
- public void setTypeList(String typeList) {
- this.typeList = typeList;
- this.useList = true;
- }
-
- public Class<?> getClassType() {
- return classType;
- }
-
- public void setClassType(Class<?> classType) {
- this.classType = classType;
- this.useList = false;
- }
-
- public void setListClassType(Class<?> classType) {
- this.classType = classType;
- this.useList = true;
- }
-
- public boolean isUseList() {
- return useList;
}
public String getOutType() {
return outType;
}
- public void setOutType(String type) {
- this.outType = type;
- this.outUseList = false;
- }
-
- public String getOutTypeList() {
- return outTypeList;
- }
-
- public void setOutTypeList(String typeList) {
- this.outTypeList = typeList;
- this.outUseList = true;
+ public void setOutType(String outType) {
+ this.outType = outType;
}
- public Class<?> getOutClassType() {
- return outClassType;
+ public Boolean getList() {
+ return list;
}
- public void setOutClassType(Class<?> classType) {
- this.outClassType = classType;
- this.outUseList = false;
+ public void setList(Boolean list) {
+ this.list = list;
}
- public void setOutListClassType(Class<?> classType) {
- this.outClassType = classType;
- this.outUseList = true;
+ public Boolean getOutList() {
+ return outList;
}
- public boolean isOutUseList() {
- return outUseList;
+ public void setOutList(Boolean outList) {
+ this.outList = outList;
}
public RestDefinition getRest() {
http://git-wip-us.apache.org/repos/asf/camel/blob/ccb9836b/camel-core/src/main/java/org/apache/camel/processor/binding/RestBindingProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/binding/RestBindingProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/binding/RestBindingProcessor.java
index 7560348..f911f70 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/binding/RestBindingProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/binding/RestBindingProcessor.java
@@ -104,6 +104,12 @@ public class RestBindingProcessor extends ServiceSupport implements AsyncProcess
return true;
}
+ // is the body empty
+ if (exchange.getIn().getBody() == null) {
+ callback.done(true);
+ return true;
+ }
+
boolean isXml = false;
boolean isJson = false;
@@ -123,8 +129,10 @@ public class RestBindingProcessor extends ServiceSupport implements AsyncProcess
if (!isXml && !isJson) {
// read the content into memory so we can determine if its xml or json
String body = MessageHelper.extractBodyAsString(exchange.getIn());
- isXml = body.startsWith("<") || body.contains("xml");
- isJson = !isXml;
+ if (body != null) {
+ isXml = body.startsWith("<") || body.contains("xml");
+ isJson = !isXml;
+ }
}
// only allow xml/json if the binding mode allows that
@@ -200,6 +208,11 @@ public class RestBindingProcessor extends ServiceSupport implements AsyncProcess
return;
}
+ // is the body empty
+ if (exchange.hasOut() && exchange.getOut().getBody() == null || exchange.getIn().getBody() == null) {
+ return;
+ }
+
boolean isXml = false;
boolean isJson = false;
@@ -221,8 +234,10 @@ public class RestBindingProcessor extends ServiceSupport implements AsyncProcess
if (!isXml && !isJson) {
// read the content into memory so we can determine if its xml or json
String body = MessageHelper.extractBodyAsString(exchange.getIn());
- isXml = body.startsWith("<") || body.contains("xml");
- isJson = !isXml;
+ if (body != null) {
+ isXml = body.startsWith("<") || body.contains("xml");
+ isJson = !isXml;
+ }
}
// only allow xml/json if the binding mode allows that
http://git-wip-us.apache.org/repos/asf/camel/blob/ccb9836b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetEmbeddedRouteTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetEmbeddedRouteTest.java b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetEmbeddedRouteTest.java
index ce96957..0caf36a 100644
--- a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetEmbeddedRouteTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetEmbeddedRouteTest.java
@@ -43,7 +43,7 @@ public class FromRestGetEmbeddedRouteTest extends ContextTestSupport {
assertNotNull(rest);
assertEquals("/say/hello", rest.getUri());
assertEquals(1, rest.getVerbs().size());
- ToDefinition to = assertIsInstanceOf(ToDefinition.class, rest.getVerbs().get(0).getRoute().getOutputs().get(0));
+ ToDefinition to = assertIsInstanceOf(ToDefinition.class, rest.getVerbs().get(0).getRoute().getOutputs().get(1));
assertEquals("mock:hello", to.getUri());
rest = context.getRestDefinitions().get(1);
@@ -51,7 +51,7 @@ public class FromRestGetEmbeddedRouteTest extends ContextTestSupport {
assertEquals("/say/bye", rest.getUri());
assertEquals(2, rest.getVerbs().size());
assertEquals("application/json", rest.getVerbs().get(0).getConsumes());
- to = assertIsInstanceOf(ToDefinition.class, rest.getVerbs().get(0).getRoute().getOutputs().get(0));
+ to = assertIsInstanceOf(ToDefinition.class, rest.getVerbs().get(0).getRoute().getOutputs().get(1));
assertEquals("mock:bye", to.getUri());
// the rest becomes routes and the input is a seda endpoint created by the DummyRestConsumerFactory
http://git-wip-us.apache.org/repos/asf/camel/blob/ccb9836b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetEndPathTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetEndPathTest.java b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetEndPathTest.java
index 7f2d439..6ef4fb2 100644
--- a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetEndPathTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetEndPathTest.java
@@ -38,7 +38,7 @@ public class FromRestGetEndPathTest extends FromRestGetTest {
assertEquals("/say/bye", rest.getUri());
assertEquals(2, rest.getVerbs().size());
assertEquals("application/json", rest.getVerbs().get(0).getConsumes());
- to = assertIsInstanceOf(ToDefinition.class, rest.getVerbs().get(0).getRoute().getOutputs().get(0));
+ to = assertIsInstanceOf(ToDefinition.class, rest.getVerbs().get(0).getRoute().getOutputs().get(1));
assertEquals("direct:bye", to.getUri());
// the rest becomes routes and the input is a seda endpoint created by the DummyRestConsumerFactory
http://git-wip-us.apache.org/repos/asf/camel/blob/ccb9836b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
index 3a2e16d..02864db 100644
--- a/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/rest/FromRestGetTest.java
@@ -51,7 +51,6 @@ public class FromRestGetTest extends ContextTestSupport {
assertEquals("/say/bye", rest.getUri());
assertEquals(2, rest.getVerbs().size());
assertEquals("application/json", rest.getVerbs().get(0).getConsumes());
- assertEquals("application/xml", rest.getVerbs().get(0).getProduces());
to = assertIsInstanceOf(ToDefinition.class, rest.getVerbs().get(0).getTo());
assertEquals("direct:bye", to.getUri());
@@ -75,7 +74,7 @@ public class FromRestGetTest extends ContextTestSupport {
.get().to("direct:hello");
rest("/say/bye")
- .get().consumes("application/json").produces("application/xml").to("direct:bye")
+ .get().consumes("application/json").to("direct:bye")
.post().to("mock:update");
from("direct:hello")
http://git-wip-us.apache.org/repos/asf/camel/blob/ccb9836b/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 8de5c23..d1c627e 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
@@ -54,7 +54,6 @@ public class ManagedFromRestGetTest extends ManagementTestSupport {
assertTrue(xml.contains("</rest>"));
assertTrue(xml.contains("<get>"));
assertTrue(xml.contains("application/json"));
- assertTrue(xml.contains("application/xml"));
assertTrue(xml.contains("<post>"));
assertTrue(xml.contains("application/json"));
assertTrue(xml.contains("</rests>"));
@@ -77,7 +76,7 @@ public class ManagedFromRestGetTest extends ManagementTestSupport {
.get().to("direct:hello");
rest("/say/bye")
- .get().consumes("application/json").produces("application/xml").to("direct:bye")
+ .get().consumes("application/json").to("direct:bye")
.post().to("mock:update");
from("direct:hello")
http://git-wip-us.apache.org/repos/asf/camel/blob/ccb9836b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestGetTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestGetTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestGetTest.xml
index d176889..4fa30ec 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestGetTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/SpringFromRestGetTest.xml
@@ -33,7 +33,7 @@
</get>
</rest>
<rest uri="/say/bye">
- <get consumes="application/json" produces="application/json">
+ <get consumes="application/json">
<to uri="direct:bye"/>
</get>
<post>
http://git-wip-us.apache.org/repos/asf/camel/blob/ccb9836b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.java
index 44cdddc..68f1547 100644
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.java
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.java
@@ -49,7 +49,6 @@ public class FromRestGetTest extends CamelBlueprintTestSupport {
assertEquals("/say/bye", rest.getUri());
assertEquals(2, rest.getVerbs().size());
assertEquals("application/json", rest.getVerbs().get(0).getConsumes());
- assertEquals("application/json", rest.getVerbs().get(0).getProduces());
to = assertIsInstanceOf(ToDefinition.class, rest.getVerbs().get(0).getTo());
assertEquals("direct:bye", to.getUri());
http://git-wip-us.apache.org/repos/asf/camel/blob/ccb9836b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.xml
index 7d566b1..578ed92 100644
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.xml
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestGetTest.xml
@@ -31,7 +31,7 @@
</get>
</rest>
<rest uri="/say/bye">
- <get consumes="application/json" produces="application/json">
+ <get consumes="application/json">
<to uri="direct:bye"/>
</get>
<post>