use of org.wildfly.camel.test.common.types.Customer in project wildfly-camel by wildfly-extras.
the class BoonDataFormatTest method testUnmarshal.
@Test
public void testUnmarshal() throws Exception {
CamelContext camelctx = new DefaultCamelContext();
camelctx.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").unmarshal(new BoonDataFormat(Customer.class));
}
});
String input = "{'firstName':'John','lastName':'Doe'}";
camelctx.start();
try {
ProducerTemplate producer = camelctx.createProducerTemplate();
Customer customer = producer.requestBody("direct:start", input, Customer.class);
Assert.assertEquals("John", customer.getFirstName());
Assert.assertEquals("Doe", customer.getLastName());
} finally {
camelctx.stop();
}
}
use of org.wildfly.camel.test.common.types.Customer in project wildfly-camel by wildfly-extras.
the class JacksonXMLIntegrationTest method testUnmarshal.
@Test
public void testUnmarshal() throws Exception {
CamelContext camelctx = new DefaultCamelContext();
camelctx.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").unmarshal().jacksonxml(Customer.class);
}
});
camelctx.start();
try {
ProducerTemplate producer = camelctx.createProducerTemplate();
Customer customer = producer.requestBody("direct:start", XML_STRING, Customer.class);
Assert.assertEquals("John", customer.getFirstName());
Assert.assertEquals("Doe", customer.getLastName());
} finally {
camelctx.stop();
}
}
use of org.wildfly.camel.test.common.types.Customer in project wildfly-camel by wildfly-extras.
the class JacksonXMLIntegrationTest method testMarshal.
@Test
public void testMarshal() throws Exception {
CamelContext camelctx = new DefaultCamelContext();
camelctx.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").marshal().jacksonxml();
}
});
camelctx.start();
try {
ProducerTemplate producer = camelctx.createProducerTemplate();
String result = producer.requestBody("direct:start", new Customer("John", "Doe"), String.class);
Assert.assertEquals(XML_STRING, result);
} finally {
camelctx.stop();
}
}
use of org.wildfly.camel.test.common.types.Customer in project wildfly-camel by wildfly-extras.
the class SOAPServiceInterfaceStrategyIntegrationTest method testSOAPServiceInterfaceStrategyMarshal.
@Test
public void testSOAPServiceInterfaceStrategyMarshal() throws Exception {
ServiceInterfaceStrategy strategy = new ServiceInterfaceStrategy(CustomerService.class, true);
final SoapJaxbDataFormat format = new SoapJaxbDataFormat("org.wildfly.camel.test.common.types", strategy);
CamelContext camelctx = new DefaultCamelContext();
camelctx.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").marshal(format);
}
});
camelctx.start();
try (InputStream input = getClass().getResourceAsStream("/envelope.xml")) {
Customer customer = new Customer();
customer.setFirstName("Kermit");
customer.setLastName("The Frog");
ProducerTemplate template = camelctx.createProducerTemplate();
String result = template.requestBody("direct:start", customer, String.class);
Assert.assertEquals(XMLUtils.compactXML(input), XMLUtils.compactXML(result));
} finally {
camelctx.stop();
}
}
use of org.wildfly.camel.test.common.types.Customer in project wildfly-camel by wildfly-extras.
the class SOAPServiceInterfaceStrategyIntegrationTest method createDeployment.
@Deployment
public static WebArchive createDeployment() {
return ShrinkWrap.create(WebArchive.class, "camel-soap-sis-tests.war").addClasses(XMLUtils.class, Customer.class, CustomerService.class).addAsResource(new StringAsset("Customer"), "org/wildfly/camel/test/common/types/jaxb.index").addAsResource("soap/envelope-sis.xml", "envelope.xml").setManifest(() -> {
ManifestBuilder builder = new ManifestBuilder();
builder.addManifestHeader("Dependencies", "org.jdom");
return builder.openStream();
});
}
Aggregations