CAMEL-6913 - Add dynamic unmarshalling capability to JiBX data format
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8a6c87a4 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8a6c87a4 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8a6c87a4 Branch: refs/heads/master Commit: 8a6c87a44ef5a67a1d1f382b0d4a39f33881b060 Parents: 5af2c60 Author: lburgazzoli <lburgazz...@gmail.com> Authored: Wed Jan 27 12:24:37 2016 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Wed Jan 27 16:39:06 2016 +0100 ---------------------------------------------------------------------- .../camel/dataformat/jibx/JibxDataFormat.java | 13 +++- .../jibx/JibxDataFormatMarshallTest.java | 1 + ...bxDataFormatMarshallWithBindingNameTest.java | 1 + .../jibx/JibxDataFormatSpringDslTest.java | 1 + .../jibx/JibxDataFormatUnmarshallFail.java | 67 ++++++++++++++++++ .../jibx/JibxDataFormatUnmarshallTest.java | 1 + ...DataFormatUnmarshallWithBindingNameTest.java | 4 +- ...ibxDataFormatUnmarshallWithDynamicClass.java | 65 +++++++++++++++++ .../camel/dataformat/jibx/PurchaseOrder.java | 72 ------------------- .../dataformat/jibx/model/PurchaseOrder.java | 72 +++++++++++++++++++ .../dataformat/jibx/model/PurchaseOrder2.java | 73 ++++++++++++++++++++ .../jibx/SpringJibxConfigurationTest.xml | 2 +- .../dataformat/jibx/purchaseOrder-jibx.xml | 7 +- 13 files changed, 301 insertions(+), 78 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/8a6c87a4/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java b/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java index 6d9d519..e48daa5 100644 --- a/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java +++ b/components/camel-jibx/src/main/java/org/apache/camel/dataformat/jibx/JibxDataFormat.java @@ -31,6 +31,8 @@ import org.jibx.runtime.IUnmarshallingContext; import org.jibx.runtime.JiBXException; public class JibxDataFormat extends ServiceSupport implements DataFormat, DataFormatName { + public static final String UNMARSHALL_CLASS = "CamelJibxUnmarshallClass"; + private Class<?> unmarshallClass; private String bindingName; @@ -58,8 +60,14 @@ public class JibxDataFormat extends ServiceSupport implements DataFormat, DataFo } public Object unmarshal(Exchange exchange, InputStream stream) throws Exception { - ObjectHelper.notNull(getUnmarshallClass(), "unmarshallClass"); - IBindingFactory bindingFactory = createBindingFactory(getUnmarshallClass(), bindingName); + Class<?> unmarshallType = exchange.getIn().getHeader(UNMARSHALL_CLASS, Class.class); + if (unmarshallType == null) { + unmarshallType = getUnmarshallClass(); + } + + ObjectHelper.notNull(unmarshallType, "unmarshallClass or CamelJibxUnmarshallClass header"); + + IBindingFactory bindingFactory = createBindingFactory(unmarshallType, bindingName); IUnmarshallingContext unmarshallingContext = bindingFactory.createUnmarshallingContext(); return unmarshallingContext.unmarshalDocument(stream, null); } @@ -74,6 +82,7 @@ public class JibxDataFormat extends ServiceSupport implements DataFormat, DataFo protected void doStop() throws Exception { // noop } + public Class<?> getUnmarshallClass() { return unmarshallClass; } http://git-wip-us.apache.org/repos/asf/camel/blob/8a6c87a4/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatMarshallTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatMarshallTest.java b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatMarshallTest.java index 115a637..17aaea6 100644 --- a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatMarshallTest.java +++ b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatMarshallTest.java @@ -22,6 +22,7 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import org.apache.camel.dataformat.jibx.model.PurchaseOrder; import org.w3c.dom.Element; import org.xml.sax.InputSource; import org.xml.sax.SAXException; http://git-wip-us.apache.org/repos/asf/camel/blob/8a6c87a4/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatMarshallWithBindingNameTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatMarshallWithBindingNameTest.java b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatMarshallWithBindingNameTest.java index 2dd7bcb..6c5b03d 100644 --- a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatMarshallWithBindingNameTest.java +++ b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatMarshallWithBindingNameTest.java @@ -23,6 +23,7 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import org.apache.camel.dataformat.jibx.model.PurchaseOrder; import org.w3c.dom.Element; import org.xml.sax.InputSource; http://git-wip-us.apache.org/repos/asf/camel/blob/8a6c87a4/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatSpringDslTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatSpringDslTest.java b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatSpringDslTest.java index 72eb332..c175099 100644 --- a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatSpringDslTest.java +++ b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatSpringDslTest.java @@ -22,6 +22,7 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import org.apache.camel.dataformat.jibx.model.PurchaseOrder; import org.w3c.dom.Element; import org.xml.sax.InputSource; import org.xml.sax.SAXException; http://git-wip-us.apache.org/repos/asf/camel/blob/8a6c87a4/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallFail.java ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallFail.java b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallFail.java new file mode 100644 index 0000000..6111112 --- /dev/null +++ b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallFail.java @@ -0,0 +1,67 @@ +/* + * 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.jibx; + +import java.io.IOException; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.camel.CamelExecutionException; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.dataformat.jibx.model.PurchaseOrder; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; +import org.xml.sax.SAXException; + + +public class JibxDataFormatUnmarshallFail extends CamelTestSupport { + + @Test(expected = CamelExecutionException.class) + public void testUnmarshallFail() throws InterruptedException, ParserConfigurationException, IOException, + SAXException { + MockEndpoint mock = getMockEndpoint("mock:result"); + mock.expectedMessageCount(1); + + String name = "foo"; + double price = 1; + double amount = 2; + String purchaseOrderXml = String.format("<order name='%s' price='%s' amount='%s' />", name, price + "", amount + + ""); + + template.sendBody("direct:start", purchaseOrderXml); + + assertMockEndpointsSatisfied(); + + PurchaseOrder body = mock.getReceivedExchanges().get(0).getIn().getBody(PurchaseOrder.class); + assertEquals(name, body.getName()); + assertEquals(price, body.getPrice(), 1); + assertEquals(amount, body.getAmount(), 1); + } + + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + public void configure() { + from("direct:start") + .unmarshal(new JibxDataFormat()) + .convertBodyTo(PurchaseOrder.class) + .to("mock:result"); + } + }; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/8a6c87a4/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallTest.java b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallTest.java index 45ad32c..1d24b3b 100644 --- a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallTest.java +++ b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallTest.java @@ -19,6 +19,7 @@ package org.apache.camel.dataformat.jibx; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; +import org.apache.camel.dataformat.jibx.model.PurchaseOrder; import org.xml.sax.SAXException; import org.apache.camel.builder.RouteBuilder; http://git-wip-us.apache.org/repos/asf/camel/blob/8a6c87a4/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallWithBindingNameTest.java ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallWithBindingNameTest.java b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallWithBindingNameTest.java index 6709fa8..c086666 100644 --- a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallWithBindingNameTest.java +++ b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallWithBindingNameTest.java @@ -20,6 +20,7 @@ import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; +import org.apache.camel.dataformat.jibx.model.PurchaseOrder; import org.xml.sax.SAXException; import org.apache.camel.builder.RouteBuilder; @@ -32,8 +33,7 @@ public class JibxDataFormatUnmarshallWithBindingNameTest extends CamelTestSuppor private static final String BINDING_NAME = "purchaseOrder-jibx"; @Test - public void testUnmarshallWithBindingName() throws InterruptedException, ParserConfigurationException, IOException, - SAXException { + public void testUnmarshallWithBindingName() throws InterruptedException, ParserConfigurationException, IOException, SAXException { MockEndpoint mock = getMockEndpoint("mock:result"); mock.expectedMessageCount(1); http://git-wip-us.apache.org/repos/asf/camel/blob/8a6c87a4/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallWithDynamicClass.java ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallWithDynamicClass.java b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallWithDynamicClass.java new file mode 100644 index 0000000..e64b3df --- /dev/null +++ b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatUnmarshallWithDynamicClass.java @@ -0,0 +1,65 @@ +/* + * 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.jibx; + +import java.io.IOException; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.dataformat.jibx.model.PurchaseOrder; +import org.apache.camel.dataformat.jibx.model.PurchaseOrder2; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; +import org.xml.sax.SAXException; + + +public class JibxDataFormatUnmarshallWithDynamicClass extends CamelTestSupport { + @Test + public void testUnmarshallWithDynamicClass() throws InterruptedException, ParserConfigurationException, IOException, + SAXException { + MockEndpoint mock = getMockEndpoint("mock:result"); + mock.expectedMessageCount(1); + + String name = "foo"; + double price = 1; + double amount = 2; + String purchaseOrderXml = String.format("<order2 name='%s' price='%s' amount='%s' />", name, price + "", amount + ""); + + template.sendBody("direct:start", purchaseOrderXml); + + assertMockEndpointsSatisfied(); + + PurchaseOrder2 body = mock.getReceivedExchanges().get(0).getIn().getBody(PurchaseOrder2.class); + assertEquals(name, body.getName()); + assertEquals(price, body.getPrice(), 1); + assertEquals(amount, body.getAmount(), 1); + } + + protected RouteBuilder createRouteBuilder() { + return new RouteBuilder() { + public void configure() { + from("direct:start") + .setHeader(JibxDataFormat.UNMARSHALL_CLASS, constant(PurchaseOrder2.class)) + .unmarshal(new JibxDataFormat(PurchaseOrder.class)) + .convertBodyTo(PurchaseOrder2.class) + .to("mock:result"); + } + }; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/8a6c87a4/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/PurchaseOrder.java ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/PurchaseOrder.java b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/PurchaseOrder.java deleted file mode 100644 index bea8286..0000000 --- a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/PurchaseOrder.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * 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.jibx; - -import org.apache.camel.util.ObjectHelper; - -/** - * @version - */ -public class PurchaseOrder { - private String name; - private double price; - private double amount; - - @Override - public String toString() { - return "PurchaseOrder[name: " + name + " amount: " + amount + " price: " + price + "]"; - } - - @Override - public boolean equals(Object o) { - if (o instanceof PurchaseOrder) { - PurchaseOrder that = (PurchaseOrder) o; - return ObjectHelper.equal(this.name, that.name) - && ObjectHelper.equal(this.amount, that.amount) - && ObjectHelper.equal(this.price, that.price); - } - return false; - } - - public int hashCode() { - return (int) (name.hashCode() + (price * 100) + (amount * 100)); - } - - public double getAmount() { - return amount; - } - - public void setAmount(double amount) { - this.amount = amount; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public double getPrice() { - return price; - } - - public void setPrice(double price) { - this.price = price; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/8a6c87a4/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/model/PurchaseOrder.java ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/model/PurchaseOrder.java b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/model/PurchaseOrder.java new file mode 100644 index 0000000..a0722dc --- /dev/null +++ b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/model/PurchaseOrder.java @@ -0,0 +1,72 @@ +/* + * 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.jibx.model; + +import org.apache.camel.util.ObjectHelper; + +/** + * @version + */ +public class PurchaseOrder { + private String name; + private double price; + private double amount; + + @Override + public String toString() { + return "PurchaseOrder[name: " + name + " amount: " + amount + " price: " + price + "]"; + } + + @Override + public boolean equals(Object o) { + if (o instanceof PurchaseOrder) { + PurchaseOrder that = (PurchaseOrder) o; + return ObjectHelper.equal(this.name, that.name) + && ObjectHelper.equal(this.amount, that.amount) + && ObjectHelper.equal(this.price, that.price); + } + return false; + } + + public int hashCode() { + return (int) (name.hashCode() + (price * 100) + (amount * 100)); + } + + public double getAmount() { + return amount; + } + + public void setAmount(double amount) { + this.amount = amount; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/8a6c87a4/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/model/PurchaseOrder2.java ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/model/PurchaseOrder2.java b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/model/PurchaseOrder2.java new file mode 100644 index 0000000..afd2a97 --- /dev/null +++ b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/model/PurchaseOrder2.java @@ -0,0 +1,73 @@ +/* + * 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.jibx.model; + +import org.apache.camel.util.ObjectHelper; + +/** + * @version + */ +public class PurchaseOrder2 { + private String name; + private double price; + private double amount; + + @Override + public String toString() { + return "PurchaseOrder[name: " + name + " amount: " + amount + " price: " + price + "]"; + } + + @Override + public boolean equals(Object o) { + if (o instanceof PurchaseOrder2) { + PurchaseOrder2 that = (PurchaseOrder2) o; + return ObjectHelper.equal(this.name, that.name) + && ObjectHelper.equal(this.amount, that.amount) + && ObjectHelper.equal(this.price, that.price); + } + return false; + } + + public int hashCode() { + return (int) (name.hashCode() + (price * 100) + (amount * 100)); + } + + public double getAmount() { + return amount; + } + + public void setAmount(double amount) { + this.amount = amount; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/8a6c87a4/components/camel-jibx/src/test/resources/org/apache/camel/dataformat/jibx/SpringJibxConfigurationTest.xml ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/test/resources/org/apache/camel/dataformat/jibx/SpringJibxConfigurationTest.xml b/components/camel-jibx/src/test/resources/org/apache/camel/dataformat/jibx/SpringJibxConfigurationTest.xml index 81aabc4..6588f59 100644 --- a/components/camel-jibx/src/test/resources/org/apache/camel/dataformat/jibx/SpringJibxConfigurationTest.xml +++ b/components/camel-jibx/src/test/resources/org/apache/camel/dataformat/jibx/SpringJibxConfigurationTest.xml @@ -25,7 +25,7 @@ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <dataFormats> - <jibx id="jibx" unmarshallClass="org.apache.camel.dataformat.jibx.PurchaseOrder"/> + <jibx id="jibx" unmarshallClass="org.apache.camel.dataformat.jibx.model.PurchaseOrder"/> </dataFormats> <route> http://git-wip-us.apache.org/repos/asf/camel/blob/8a6c87a4/components/camel-jibx/src/test/resources/org/apache/camel/dataformat/jibx/purchaseOrder-jibx.xml ---------------------------------------------------------------------- diff --git a/components/camel-jibx/src/test/resources/org/apache/camel/dataformat/jibx/purchaseOrder-jibx.xml b/components/camel-jibx/src/test/resources/org/apache/camel/dataformat/jibx/purchaseOrder-jibx.xml index 80681f1..020a6f5 100644 --- a/components/camel-jibx/src/test/resources/org/apache/camel/dataformat/jibx/purchaseOrder-jibx.xml +++ b/components/camel-jibx/src/test/resources/org/apache/camel/dataformat/jibx/purchaseOrder-jibx.xml @@ -16,7 +16,12 @@ limitations under the License. --> <binding> - <mapping name="order" class="org.apache.camel.dataformat.jibx.PurchaseOrder"> + <mapping name="order" class="org.apache.camel.dataformat.jibx.model.PurchaseOrder"> + <value name="name" field="name" style="attribute"/> + <value name="price" field="price" style="attribute"/> + <value name="amount" field="amount" style="attribute"/> + </mapping> + <mapping name="order2" class="org.apache.camel.dataformat.jibx.model.PurchaseOrder2"> <value name="name" field="name" style="attribute"/> <value name="price" field="price" style="attribute"/> <value name="amount" field="amount" style="attribute"/>