You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2008/11/06 08:48:15 UTC
svn commit: r711784 - in /activemq/camel/trunk: ./
camel-core/src/main/java/org/apache/camel/builder/
camel-core/src/main/java/org/apache/camel/model/dataformat/
camel-core/src/main/java/org/apache/camel/processor/
components/camel-ftp/src/test/java/or...
Author: ningjiang
Date: Wed Nov 5 23:48:14 2008
New Revision: 711784
URL: http://svn.apache.org/viewvc?rev=711784&view=rev
Log:
CAMEL-822 added JSON data format support
Added:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java (with props)
activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java (with props)
activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java (with props)
activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectJSONTest.java (with props)
activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/UnmarshalThenMarshalJSONTest.java (with props)
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPassiveModeTest.java
activemq/camel/trunk/components/camel-xstream/pom.xml
activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectTest.java
activemq/camel/trunk/pom.xml
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java?rev=711784&r1=711783&r2=711784&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java Wed Nov 5 23:48:14 2008
@@ -23,6 +23,7 @@
import org.apache.camel.model.dataformat.DataFormatType;
import org.apache.camel.model.dataformat.HL7DataFormat;
import org.apache.camel.model.dataformat.JaxbDataFormat;
+import org.apache.camel.model.dataformat.JsonDataFormat;
import org.apache.camel.model.dataformat.SerializationDataFormat;
import org.apache.camel.model.dataformat.StringDataFormat;
import org.apache.camel.model.dataformat.XMLBeansDataFormat;
@@ -155,6 +156,13 @@
public T xstream() {
return dataFormat(new XStreamDataFormat());
}
+
+ /**
+ * Uses the JSON data format
+ */
+ public T json() {
+ return dataFormat(new JsonDataFormat());
+ }
private T dataFormat(DataFormatType dataFormatType) {
switch (operation) {
Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java?rev=711784&view=auto
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java Wed Nov 5 23:48:14 2008
@@ -0,0 +1,43 @@
+/**
+ * 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.dataformat;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "json")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class JsonDataFormat extends DataFormatType {
+
+ @XmlAttribute(required = false)
+ private Boolean prettyPrint;
+
+ public JsonDataFormat() {
+ super("org.apache.camel.dataformat.xstream.JsonDataFormat");
+ }
+
+ public Boolean getPrettyPrint() {
+ return prettyPrint;
+ }
+
+ public void setPrettyPrint(Boolean prettyPrint) {
+ this.prettyPrint = prettyPrint;
+ }
+
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java?rev=711784&r1=711783&r2=711784&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TransformProcessor.java Wed Nov 5 23:48:14 2008
@@ -50,6 +50,6 @@
@Override
public String toString() {
- return "transform(" + expression + "," +processor + ")";
+ return "transform(" + expression + "," + processor + ")";
}
}
Modified: activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPassiveModeTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPassiveModeTest.java?rev=711784&r1=711783&r2=711784&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPassiveModeTest.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpPassiveModeTest.java Wed Nov 5 23:48:14 2008
@@ -16,12 +16,12 @@
*/
package org.apache.camel.component.file.remote;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.component.file.FileComponent;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Producer;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.file.FileComponent;
+import org.apache.camel.component.mock.MockEndpoint;
/**
* @version $Revision$
Modified: activemq/camel/trunk/components/camel-xstream/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-xstream/pom.xml?rev=711784&r1=711783&r2=711784&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-xstream/pom.xml (original)
+++ activemq/camel/trunk/components/camel-xstream/pom.xml Wed Nov 5 23:48:14 2008
@@ -45,13 +45,16 @@
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
- <artifactId>xstream</artifactId>
- <version>1.3</version>
- </dependency>
+ <artifactId>xstream</artifactId>
+ </dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ </dependency>
<!-- testing -->
<dependency>
Added: activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java?rev=711784&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java (added)
+++ activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java Wed Nov 5 23:48:14 2008
@@ -0,0 +1,92 @@
+/**
+ * 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.dataformat.xstream;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.stream.XMLStreamException;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.HierarchicalStreamReader;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.converter.jaxp.StaxConverter;
+import org.apache.camel.spi.DataFormat;
+
+public abstract class AbstractXStreamWrapper implements DataFormat {
+
+ private XStream xstream;
+ private StaxConverter staxConverter;
+
+ public AbstractXStreamWrapper() {
+
+ }
+
+ public AbstractXStreamWrapper(XStream xstream) {
+ this.xstream = xstream;
+ }
+
+ public XStream getXStream() {
+ if (xstream == null) {
+ xstream = createXStream();
+ }
+ return xstream;
+ }
+
+ public void setXStream(XStream xstream) {
+ this.xstream = xstream;
+ }
+
+ protected XStream createXStream() {
+ return new XStream();
+ }
+
+ public StaxConverter getStaxConverter() {
+ if (staxConverter == null) {
+ staxConverter = new StaxConverter();
+ }
+ return staxConverter;
+ }
+
+ public void setStaxConverter(StaxConverter staxConverter) {
+ this.staxConverter = staxConverter;
+ }
+
+ public void marshal(Exchange exchange, Object body, OutputStream stream) throws Exception {
+ HierarchicalStreamWriter writer = createHierarchicalStreamWriter(exchange, body, stream);
+ try {
+ getXStream().marshal(body, writer);
+ } finally {
+ writer.close();
+ }
+ }
+
+ public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
+ HierarchicalStreamReader reader = createHierarchicalStreamReader(exchange, stream);
+ try {
+ return getXStream().unmarshal(reader);
+ } finally {
+ reader.close();
+ }
+ }
+
+ protected abstract HierarchicalStreamWriter createHierarchicalStreamWriter(Exchange exchange, Object body, OutputStream stream) throws XMLStreamException;
+
+ protected abstract HierarchicalStreamReader createHierarchicalStreamReader(Exchange exchange, InputStream stream) throws XMLStreamException;
+}
Propchange: activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/AbstractXStreamWrapper.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java?rev=711784&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java (added)
+++ activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java Wed Nov 5 23:48:14 2008
@@ -0,0 +1,64 @@
+/**
+ * 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.dataformat.xstream;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashMap;
+
+import javax.xml.stream.XMLStreamException;
+
+import com.thoughtworks.xstream.io.HierarchicalStreamReader;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import com.thoughtworks.xstream.io.xml.QNameMap;
+import com.thoughtworks.xstream.io.xml.StaxReader;
+import com.thoughtworks.xstream.io.xml.StaxWriter;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.spi.DataFormat;
+import org.codehaus.jettison.mapped.MappedXMLInputFactory;
+import org.codehaus.jettison.mapped.MappedXMLOutputFactory;
+
+/**
+ * A <a href="http://activemq.apache.org/camel/data-format.html">data format</a>
+ * ({@link DataFormat}) using XmlBeans to marshal to and from XML
+ *
+ * @version $Revision$
+ */
+
+public class JsonDataFormat extends AbstractXStreamWrapper {
+ private final MappedXMLOutputFactory mof;
+ private final MappedXMLInputFactory mif;
+
+ public JsonDataFormat() {
+ final HashMap nstjsons = new HashMap();
+ mof = new MappedXMLOutputFactory(nstjsons);
+ mif = new MappedXMLInputFactory(nstjsons);
+ }
+
+
+
+ protected HierarchicalStreamWriter createHierarchicalStreamWriter(Exchange exchange, Object body, OutputStream stream) throws XMLStreamException {
+ return new StaxWriter(new QNameMap(), mof.createXMLStreamWriter(stream));
+ }
+
+ protected HierarchicalStreamReader createHierarchicalStreamReader(Exchange exchange, InputStream stream) throws XMLStreamException {
+ return new StaxReader(new QNameMap(), mif.createXMLStreamReader(stream));
+ }
+
+}
Propchange: activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/JsonDataFormat.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java?rev=711784&r1=711783&r2=711784&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java (original)
+++ activemq/camel/trunk/components/camel-xstream/src/main/java/org/apache/camel/dataformat/xstream/XStreamDataFormat.java Wed Nov 5 23:48:14 2008
@@ -41,16 +41,14 @@
*
* @version $Revision$
*/
-public class XStreamDataFormat implements DataFormat {
-
- private XStream xstream;
- private StaxConverter staxConverter;
+public class XStreamDataFormat extends AbstractXStreamWrapper {
public XStreamDataFormat() {
+ super();
}
public XStreamDataFormat(XStream xstream) {
- setXStream(xstream);
+ super(xstream);
}
/**
@@ -75,51 +73,7 @@
xstream.processAnnotations(type);
}
return answer;
- }
-
- public void marshal(Exchange exchange, Object body, OutputStream stream) throws Exception {
- HierarchicalStreamWriter writer = createHierarchicalStreamWriter(exchange, body, stream);
- try {
- getXStream().marshal(body, writer);
- } finally {
- writer.close();
- }
- }
-
- public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
- HierarchicalStreamReader reader = createHierarchicalStreamReader(exchange, stream);
- try {
- return getXStream().unmarshal(reader);
- } finally {
- reader.close();
- }
- }
-
- public XStream getXStream() {
- if (xstream == null) {
- xstream = createXStream();
- }
- return xstream;
- }
-
- public void setXStream(XStream xstream) {
- this.xstream = xstream;
- }
-
- public StaxConverter getStaxConverter() {
- if (staxConverter == null) {
- staxConverter = new StaxConverter();
- }
- return staxConverter;
- }
-
- public void setStaxConverter(StaxConverter staxConverter) {
- this.staxConverter = staxConverter;
- }
-
- protected XStream createXStream() {
- return new XStream();
- }
+ }
protected HierarchicalStreamWriter createHierarchicalStreamWriter(Exchange exchange, Object body, OutputStream stream) throws XMLStreamException {
XMLStreamWriter xmlWriter = getStaxConverter().createXMLStreamWriter(stream);
Added: activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectJSONTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectJSONTest.java?rev=711784&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectJSONTest.java (added)
+++ activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectJSONTest.java Wed Nov 5 23:48:14 2008
@@ -0,0 +1,36 @@
+/**
+ * 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.dataformat.xstream;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class MarshalDomainObjectJSONTest extends MarshalDomainObjectTest {
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("direct:in").marshal().json().to("mock:result");
+
+ // just used for helping to marhsal
+ from("direct:marshal").marshal().json();
+
+ from("direct:reverse").unmarshal().json().to("mock:reverse");
+ }
+ };
+ }
+
+}
Propchange: activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectJSONTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectJSONTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectTest.java?rev=711784&r1=711783&r2=711784&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectTest.java (original)
+++ activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectTest.java Wed Nov 5 23:48:14 2008
@@ -71,7 +71,7 @@
// we get it back as byte array so type convert it to string
Object result = (Object)template.sendBody("direct:marshal", order);
- String body = context.getTypeConverter().convertTo(String.class, result);
+ String body = context.getTypeConverter().convertTo(String.class, result);
template.sendBody("direct:reverse", body);
mock.assertIsSatisfied();
Added: activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/UnmarshalThenMarshalJSONTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/UnmarshalThenMarshalJSONTest.java?rev=711784&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/UnmarshalThenMarshalJSONTest.java (added)
+++ activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/UnmarshalThenMarshalJSONTest.java Wed Nov 5 23:48:14 2008
@@ -0,0 +1,40 @@
+/**
+ * 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.dataformat.xstream;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+public class UnmarshalThenMarshalJSONTest extends UnmarshalThenMarshalTest {
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:start").
+ marshal().json().
+ process(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ log.debug("marshalled: " + exchange.getIn().getBody(String.class));
+ }
+ }).
+ unmarshal().json().
+ to("mock:result");
+ }
+ };
+ }
+
+}
Propchange: activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/UnmarshalThenMarshalJSONTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/UnmarshalThenMarshalJSONTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: activemq/camel/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/pom.xml?rev=711784&r1=711783&r2=711784&view=diff
==============================================================================
--- activemq/camel/trunk/pom.xml (original)
+++ activemq/camel/trunk/pom.xml Wed Nov 5 23:48:14 2008
@@ -909,6 +909,19 @@
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
+
+ <!-- optional XStream -->
+ <dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <version>1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <version>1.0.1</version>
+ </dependency>
</dependencies>
</dependencyManagement>