Browse Source

camel-CXF-rest cleaned and installed successfully

pranavE
pranavekapure 4 years ago
parent
commit
3aae685e94
47 changed files with 1265 additions and 0 deletions
  1. 33
      camel-cxf-rest/.classpath
  2. 23
      camel-cxf-rest/.project
  3. 5
      camel-cxf-rest/.settings/org.eclipse.core.resources.prefs
  4. 8
      camel-cxf-rest/.settings/org.eclipse.jdt.core.prefs
  5. 4
      camel-cxf-rest/.settings/org.eclipse.m2e.core.prefs
  6. 12
      camel-cxf-rest/ReadMe.md
  7. 92
      camel-cxf-rest/pom.xml
  8. 52
      camel-cxf-rest/src/main/java/camelinaction/Order.java
  9. 28
      camel-cxf-rest/src/main/java/camelinaction/OrderRoute.java
  10. 13
      camel-cxf-rest/src/main/java/camelinaction/OrderService.java
  11. 51
      camel-cxf-rest/src/main/java/camelinaction/RestOrderService.java
  12. 55
      camel-cxf-rest/src/test/java/camelinaction/DummyOrderService.java
  13. 84
      camel-cxf-rest/src/test/java/camelinaction/RestOrderServiceTest.java
  14. 72
      camel-cxf-rest/src/test/java/camelinaction/SpringRestBeanOrderServiceJSonTest.java
  15. 76
      camel-cxf-rest/src/test/java/camelinaction/SpringRestBeanOrderServiceTest.java
  16. 76
      camel-cxf-rest/src/test/java/camelinaction/SpringRestOrderServiceTest.java
  17. 47
      camel-cxf-rest/src/test/resources/camelinaction/SpringRestBeanOrderServiceTest.xml
  18. 53
      camel-cxf-rest/src/test/resources/camelinaction/SpringRestBeanOrderServiceTestJSon.xml
  19. 42
      camel-cxf-rest/src/test/resources/camelinaction/SpringRestOrderServiceTest.xml
  20. 7
      camel-cxf-rest/src/test/resources/log4j.properties
  21. BIN
      camel-cxf-rest/target/chapter10-camel-cxf-rest-2.0.0.jar
  22. BIN
      camel-cxf-rest/target/classes/camelinaction/Order.class
  23. BIN
      camel-cxf-rest/target/classes/camelinaction/OrderRoute.class
  24. BIN
      camel-cxf-rest/target/classes/camelinaction/OrderService.class
  25. BIN
      camel-cxf-rest/target/classes/camelinaction/RestOrderService.class
  26. 5
      camel-cxf-rest/target/maven-archiver/pom.properties
  27. 4
      camel-cxf-rest/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
  28. 4
      camel-cxf-rest/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  29. 5
      camel-cxf-rest/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
  30. 5
      camel-cxf-rest/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
  31. 61
      camel-cxf-rest/target/surefire-reports/TEST-camelinaction.RestOrderServiceTest.xml
  32. 61
      camel-cxf-rest/target/surefire-reports/TEST-camelinaction.SpringRestBeanOrderServiceJSonTest.xml
  33. 61
      camel-cxf-rest/target/surefire-reports/TEST-camelinaction.SpringRestBeanOrderServiceTest.xml
  34. 61
      camel-cxf-rest/target/surefire-reports/TEST-camelinaction.SpringRestOrderServiceTest.xml
  35. 4
      camel-cxf-rest/target/surefire-reports/camelinaction.RestOrderServiceTest.txt
  36. 4
      camel-cxf-rest/target/surefire-reports/camelinaction.SpringRestBeanOrderServiceJSonTest.txt
  37. 4
      camel-cxf-rest/target/surefire-reports/camelinaction.SpringRestBeanOrderServiceTest.txt
  38. 4
      camel-cxf-rest/target/surefire-reports/camelinaction.SpringRestOrderServiceTest.txt
  39. BIN
      camel-cxf-rest/target/test-classes/camelinaction/DummyOrderService.class
  40. BIN
      camel-cxf-rest/target/test-classes/camelinaction/RestOrderServiceTest.class
  41. BIN
      camel-cxf-rest/target/test-classes/camelinaction/SpringRestBeanOrderServiceJSonTest.class
  42. BIN
      camel-cxf-rest/target/test-classes/camelinaction/SpringRestBeanOrderServiceTest.class
  43. 47
      camel-cxf-rest/target/test-classes/camelinaction/SpringRestBeanOrderServiceTest.xml
  44. 53
      camel-cxf-rest/target/test-classes/camelinaction/SpringRestBeanOrderServiceTestJSon.xml
  45. BIN
      camel-cxf-rest/target/test-classes/camelinaction/SpringRestOrderServiceTest.class
  46. 42
      camel-cxf-rest/target/test-classes/camelinaction/SpringRestOrderServiceTest.xml
  47. 7
      camel-cxf-rest/target/test-classes/log4j.properties

33
camel-cxf-rest/.classpath

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

23
camel-cxf-rest/.project

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>chapter10-camel-cxf-rest</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

5
camel-cxf-rest/.settings/org.eclipse.core.resources.prefs

@ -0,0 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

8
camel-cxf-rest/.settings/org.eclipse.jdt.core.prefs

@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

4
camel-cxf-rest/.settings/org.eclipse.m2e.core.prefs

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

12
camel-cxf-rest/ReadMe.md

@ -0,0 +1,12 @@
Chapter 10 - camel-cxf-rest
---------------------------
This directory holds examples how to use the camel-cxf component for REST services
### 10.1.5 - Using camel-cxfrs with REST services
This example can be run using:
mvn test -Dtest=RestOrderServiceTest
mvn test -Dtest=SpringRestOrderServiceTest

92
camel-cxf-rest/pom.xml

@ -0,0 +1,92 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.camelinaction</groupId>
<artifactId>chapter10</artifactId>
<version>2.0.0</version>
<relativePath>..</relativePath>
</parent>
<artifactId>chapter10-camel-cxf-rest</artifactId>
<name>Camel in Action 2 :: Chapter 10 :: Camel CXF-RS</name>
<dependencies>
<!-- camel -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jaxb</artifactId>
<version>${camel-version}</version>
</dependency>
<!-- cxf http/jetty server -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf-version}</version>
</dependency>
<!-- to enable json support -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-extension-providers</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.7.1</version>
</dependency>
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-spring</artifactId>
<version>${camel-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-restlet</artifactId>
<version>${camel-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

52
camel-cxf-rest/src/main/java/camelinaction/Order.java

@ -0,0 +1,52 @@
package camelinaction;
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 = "order")
@XmlAccessorType(XmlAccessType.FIELD)
public class Order {
@XmlAttribute
private int id;
@XmlAttribute
private String partName;
@XmlAttribute
private int amount;
@XmlAttribute
private String customerName;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPartName() {
return partName;
}
public void setPartName(String partName) {
this.partName = partName;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
}

28
camel-cxf-rest/src/main/java/camelinaction/OrderRoute.java

@ -0,0 +1,28 @@
package camelinaction;
import org.apache.camel.builder.RouteBuilder;
public class OrderRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
// use CXF-RS to setup the REST web service using the resource class
// and use the simple binding style which is recommended to use
from("cxfrs:http://localhost:8080?resourceClasses=camelinaction.RestOrderService&bindingStyle=SimpleConsumer")
// call the route based on the operation invoked on the REST web service
.toD("direct:${header.operationName}");
// routes that implement the REST services
from("direct:createOrder")
.bean("orderService", "createOrder");
from("direct:getOrder")
.bean("orderService", "getOrder(${header.id})");
from("direct:updateOrder")
.bean("orderService", "updateOrder");
from("direct:cancelOrder")
.bean("orderService", "cancelOrder(${header.id})");
}
}

13
camel-cxf-rest/src/main/java/camelinaction/OrderService.java

@ -0,0 +1,13 @@
package camelinaction;
public interface OrderService {
Order getOrder(int orderId);
void updateOrder(Order order);
String createOrder(Order order);
void cancelOrder(int orderId);
}

51
camel-cxf-rest/src/main/java/camelinaction/RestOrderService.java

@ -0,0 +1,51 @@
package camelinaction;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
/**
* A JAX-RS Resource interface where we define the RESTful web service, using the JAX-RS annotations.
* <p/>
* When using cxfrs with Camel then this resource class can be an interface, as its just a contract/facade
* to describe the REST web service. When a client calls the REST services then its a Camel route that routes
* the incoming request, see {@link OrderRoute}
* <br/>
* This REST service supports both xml and json as data format.
*/
@Path("/orders/")
@Consumes(value = "application/xml,application/json")
@Produces(value = "application/xml,application/json")
public interface RestOrderService {
/**
* The GET order by id operation
*/
@GET
@Path("/{id}")
Order getOrder(@PathParam("id") int orderId);
/**
* The PUT update order operation
*/
@PUT
void updateOrder(Order order);
/**
* The POST create order operation
*/
@POST
String createOrder(Order order);
/**
* The DELETE cancel order operation
*/
@DELETE
@Path("/{id}")
void cancelOrder(@PathParam("id") int orderId);
}

55
camel-cxf-rest/src/test/java/camelinaction/DummyOrderService.java

@ -0,0 +1,55 @@
package camelinaction;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
/**
* A dummy implementation of {@link OrderService} to use for testing and running this example.
*/
public class DummyOrderService implements OrderService {
// in memory dummy order system
private Map<Integer, Order> orders = new HashMap<>();
private final AtomicInteger idGen = new AtomicInteger();
@Override
public Order getOrder(int orderId) {
return orders.get(orderId);
}
@Override
public void updateOrder(Order order) {
int id = order.getId();
orders.remove(id);
orders.put(id, order);
}
@Override
public String createOrder(Order order) {
int id = idGen.incrementAndGet();
order.setId(id);
orders.put(id, order);
return "" + id;
}
@Override
public void cancelOrder(int orderId) {
orders.remove(orderId);
}
public void setupDummyOrders() {
Order order = new Order();
order.setAmount(1);
order.setPartName("motor");
order.setCustomerName("honda");
createOrder(order);
order = new Order();
order.setAmount(3);
order.setPartName("brake");
order.setCustomerName("toyota");
createOrder(order);
}
}

84
camel-cxf-rest/src/test/java/camelinaction/RestOrderServiceTest.java

@ -0,0 +1,84 @@
package camelinaction;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.JndiRegistry;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class RestOrderServiceTest extends CamelTestSupport {
// use dummy service for testing purpose
private DummyOrderService orderService = new DummyOrderService();
@Override
protected JndiRegistry createRegistry() throws Exception {
JndiRegistry jndi = super.createRegistry();
jndi.bind("orderService", orderService);
return jndi;
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new OrderRoute();
}
@Test
public void testGetOrder() throws Exception {
// setup some pre-existing orders
orderService.setupDummyOrders();
// use restlet component to get the order
String response = template.requestBodyAndHeader("restlet:http://localhost:8080/orders/{id}?restletMethod=GET", null, "id", "1", String.class);
log.info("Response: {}", response);
}
@Test
public void testCreateOrder() throws Exception {
Order order = new Order();
order.setAmount(1);
order.setPartName("motor");
order.setCustomerName("honda");
// convert to XML which we support
String xml = context.getTypeConverter().convertTo(String.class, order);
log.info("Sending order using xml payload: {}", xml);
// use restlet component to send the order
String id = template.requestBodyAndHeader("restlet:http://localhost:8080/orders?restletMethod=POST", xml, Exchange.CONTENT_TYPE, "application/xml", String.class);
assertNotNull(id);
log.info("Created new order with id " + id);
// should create a new order with id 1
assertEquals("1", id);
}
@Test
public void testCreateAndGetOrder() throws Exception {
Order order = new Order();
order.setAmount(1);
order.setPartName("motor");
order.setCustomerName("honda");
// convert to XML which we support
String xml = context.getTypeConverter().convertTo(String.class, order);
log.info("Sending order using xml payload: {}", xml);
// use restlet component to send the order
String id = template.requestBodyAndHeader("restlet:http://localhost:8080/orders?restletMethod=POST", xml, Exchange.CONTENT_TYPE, "application/xml", String.class);
assertNotNull(id);
log.info("Created new order with id " + id);
// should create a new order with id 1
assertEquals("1", id);
// use restlet component to get the order
String response = template.requestBodyAndHeader("restlet:http://localhost:8080/orders/{id}?restletMethod=GET", null, "id", "1", String.class);
log.info("Response: {}", response);
}
}

72
camel-cxf-rest/src/test/java/camelinaction/SpringRestBeanOrderServiceJSonTest.java

@ -0,0 +1,72 @@
package camelinaction;
import java.util.HashMap;
import java.util.Map;
import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class SpringRestBeanOrderServiceJSonTest extends CamelSpringTestSupport {
@Override
protected AbstractApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("camelinaction/SpringRestBeanOrderServiceTestJSon.xml");
}
@Test
public void testGetOrder() throws Exception {
DummyOrderService orderService = context().getRegistry().lookupByNameAndType("orderService", DummyOrderService.class);
// setup some pre-existing orders
orderService.setupDummyOrders();
// use restlet component to get the order
String response = template.requestBodyAndHeader("restlet:http://localhost:8080/orders/1?restletMethod=GET", null, "Accept", "application/json", String.class);
log.info("Response: {}", response);
}
@Test
public void testCreateOrder() throws Exception {
String json = "{\"partName\":\"motor\",\"amount\":1,\"customerName\":\"honda\"}";
log.info("Sending order using json payload: {}", json);
// use restlet component to send the order
Map headers = new HashMap();
headers.put("Accept", "application/json");
headers.put("Content-Type", "application/json");
String id = template.requestBodyAndHeaders("restlet:http://localhost:8080/orders?restletMethod=POST", json, headers, String.class);
assertNotNull(id);
log.info("Created new order with id " + id);
// should create a new order with id 1
assertEquals("1", id);
}
@Test
public void testCreateAndGetOrder() throws Exception {
String json = "{\"partName\":\"motor\",\"amount\":1,\"customerName\":\"honda\"}";
log.info("Sending order using json payload: {}", json);
// use restlet component to send the order
Map headers = new HashMap();
headers.put("Accept", "application/json");
headers.put("Content-Type", "application/json");
String id = template.requestBodyAndHeaders("restlet:http://localhost:8080/orders?restletMethod=POST", json, headers, String.class);
assertNotNull(id);
log.info("Created new order with id " + id);
// should create a new order with id 1
assertEquals("1", id);
// use restlet component to get the order
String response = template.requestBodyAndHeader("restlet:http://localhost:8080/orders/1?restletMethod=GET", null, "Accept", "application/json", String.class);
log.info("Response: {}", response);
}
}

76
camel-cxf-rest/src/test/java/camelinaction/SpringRestBeanOrderServiceTest.java

@ -0,0 +1,76 @@
package camelinaction;
import org.apache.camel.Exchange;
import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class SpringRestBeanOrderServiceTest extends CamelSpringTestSupport {
@Override
protected AbstractApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("camelinaction/SpringRestBeanOrderServiceTest.xml");
}
@Test
public void testGetOrder() throws Exception {
DummyOrderService orderService = context().getRegistry().lookupByNameAndType("orderService", DummyOrderService.class);
// setup some pre-existing orders
orderService.setupDummyOrders();
// use restlet component to get the order
String response = template.requestBodyAndHeader("restlet:http://localhost:8080/orders/{id}?restletMethod=GET", null, "id", "1", String.class);
log.info("Response: {}", response);
}
@Test
public void testCreateOrder() throws Exception {
Order order = new Order();
order.setAmount(1);
order.setPartName("motor");
order.setCustomerName("honda");
// convert to XML which we support
String xml = context.getTypeConverter().convertTo(String.class, order);
log.info("Sending order using xml payload: {}", xml);
// use restlet component to send the order
String id = template.requestBodyAndHeader("restlet:http://localhost:8080/orders?restletMethod=POST", xml, Exchange.CONTENT_TYPE, "application/xml", String.class);
assertNotNull(id);
log.info("Created new order with id " + id);
// should create a new order with id 1
assertEquals("1", id);
}
@Test
public void testCreateAndGetOrder() throws Exception {
Order order = new Order();
order.setAmount(1);
order.setPartName("motor");
order.setCustomerName("honda");
// convert to XML which we support
String xml = context.getTypeConverter().convertTo(String.class, order);
log.info("Sending order using xml payload: {}", xml);
// use restlet component to send the order
String id = template.requestBodyAndHeader("restlet:http://localhost:8080/orders?restletMethod=POST", xml, Exchange.CONTENT_TYPE, "application/xml", String.class);
assertNotNull(id);
log.info("Created new order with id " + id);
// should create a new order with id 1
assertEquals("1", id);
// use restlet component to get the order
String response = template.requestBodyAndHeader("restlet:http://localhost:8080/orders/{id}?restletMethod=GET", null, "id", "1", String.class);
log.info("Response: {}", response);
}
}

76
camel-cxf-rest/src/test/java/camelinaction/SpringRestOrderServiceTest.java

@ -0,0 +1,76 @@
package camelinaction;
import org.apache.camel.Exchange;
import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class SpringRestOrderServiceTest extends CamelSpringTestSupport {
@Override
protected AbstractApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("camelinaction/SpringRestOrderServiceTest.xml");
}
@Test
public void testGetOrder() throws Exception {
DummyOrderService orderService = context().getRegistry().lookupByNameAndType("orderService", DummyOrderService.class);
// setup some pre-existing orders
orderService.setupDummyOrders();
// use restlet component to get the order
String response = template.requestBodyAndHeader("restlet:http://localhost:8080/orders/{id}?restletMethod=GET", null, "id", "1", String.class);
log.info("Response: {}", response);
}
@Test
public void testCreateOrder() throws Exception {
Order order = new Order();
order.setAmount(1);
order.setPartName("motor");
order.setCustomerName("honda");
// convert to XML which we support
String xml = context.getTypeConverter().convertTo(String.class, order);
log.info("Sending order using xml payload: {}", xml);
// use restlet component to send the order
String id = template.requestBodyAndHeader("restlet:http://localhost:8080/orders?restletMethod=POST", xml, Exchange.CONTENT_TYPE, "application/xml", String.class);
assertNotNull(id);
log.info("Created new order with id " + id);
// should create a new order with id 1
assertEquals("1", id);
}
@Test
public void testCreateAndGetOrder() throws Exception {
Order order = new Order();
order.setAmount(1);
order.setPartName("motor");
order.setCustomerName("honda");
// convert to XML which we support
String xml = context.getTypeConverter().convertTo(String.class, order);
log.info("Sending order using xml payload: {}", xml);
// use restlet component to send the order
String id = template.requestBodyAndHeader("restlet:http://localhost:8080/orders?restletMethod=POST", xml, Exchange.CONTENT_TYPE, "application/xml", String.class);
assertNotNull(id);
log.info("Created new order with id " + id);
// should create a new order with id 1
assertEquals("1", id);
// use restlet component to get the order
String response = template.requestBodyAndHeader("restlet:http://localhost:8080/orders/{id}?restletMethod=GET", null, "id", "1", String.class);
log.info("Response: {}", response);
}
}

47
camel-cxf-rest/src/test/resources/camelinaction/SpringRestBeanOrderServiceTest.xml

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- the order service -->
<bean id="orderService" class="camelinaction.DummyOrderService"/>
<!-- CXF-RS server as a bean where we setup the REST web service using the resource class
and can do additional configurations -->
<cxf:rsServer id="restOrderServer" address="http://localhost:8080"
serviceClass="camelinaction.RestOrderService">
</cxf:rsServer>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<!-- use cxfrs:bean and enable the simple binding style -->
<from uri="cxfrs:bean:restOrderServer?bindingStyle=SimpleConsumer"/>
<!-- call the route based on the operation invoked on the REST web service -->
<toD uri="direct:${header.operationName}"/>
</route>
<!-- routes that implement the REST services -->
<route>
<from uri="direct:createOrder"/>
<bean ref="orderService" method="createOrder"/>
</route>
<route>
<from uri="direct:getOrder"/>
<bean ref="orderService" method="getOrder(${header.id})"/>
</route>
<route>
<from uri="direct:updateOrder"/>
<bean ref="orderService" method="updateOrder"/>
</route>
<route>
<from uri="direct:cancelOrder"/>
<bean ref="orderService" method="cancelOrder(${header.id})"/>
</route>
</camelContext>
</beans>

53
camel-cxf-rest/src/test/resources/camelinaction/SpringRestBeanOrderServiceTestJSon.xml

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- the order service -->
<bean id="orderService" class="camelinaction.DummyOrderService"/>
<!-- enable json support -->
<bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
<!-- CXF-RS server as a bean where we setup the REST web service using the resource class
and can do additional configurations -->
<cxf:rsServer id="restOrderServer" address="http://localhost:8080"
serviceClass="camelinaction.RestOrderService">
<cxf:providers>
<ref bean="jsonProvider"/>
</cxf:providers>
</cxf:rsServer>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<!-- use cxfrs:bean and enable the simple binding style -->
<from uri="cxfrs:bean:restOrderServer?bindingStyle=SimpleConsumer"/>
<!-- call the route based on the operation invoked on the REST web service -->
<toD uri="direct:${header.operationName}"/>
</route>
<!-- routes that implement the REST services -->
<route>
<from uri="direct:createOrder"/>
<bean ref="orderService" method="createOrder"/>
</route>
<route>
<from uri="direct:getOrder"/>
<bean ref="orderService" method="getOrder(${header.id})"/>
</route>
<route>
<from uri="direct:updateOrder"/>
<bean ref="orderService" method="updateOrder"/>
</route>
<route>
<from uri="direct:cancelOrder"/>
<bean ref="orderService" method="cancelOrder(${header.id})"/>
</route>
</camelContext>
</beans>

42
camel-cxf-rest/src/test/resources/camelinaction/SpringRestOrderServiceTest.xml

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
<!-- the order service -->
<bean id="orderService" class="camelinaction.DummyOrderService"/>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<!-- use CXF-RS to setup the REST web service using the resource class
and use the simple binding style which is recommended to use -->
<from uri="cxfrs:http://localhost:8080?resourceClasses=camelinaction.RestOrderService&amp;bindingStyle=SimpleConsumer"/>
<!-- call the route based on the operation invoked on the REST web service -->
<toD uri="direct:${header.operationName}"/>
</route>
<!-- routes that implement the REST services -->
<route>
<from uri="direct:createOrder"/>
<bean ref="orderService" method="createOrder"/>
</route>
<route>
<from uri="direct:getOrder"/>
<bean ref="orderService" method="getOrder(${header.id})"/>
</route>
<route>
<from uri="direct:updateOrder"/>
<bean ref="orderService" method="updateOrder"/>
</route>
<route>
<from uri="direct:cancelOrder"/>
<bean ref="orderService" method="cancelOrder(${header.id})"/>
</route>
</camelContext>
</beans>

7
camel-cxf-rest/src/test/resources/log4j.properties

@ -0,0 +1,7 @@
log4j.rootLogger=INFO, out
# CONSOLE appender not used by default
log4j.appender.out=org.apache.log4j.ConsoleAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n

BIN
camel-cxf-rest/target/chapter10-camel-cxf-rest-2.0.0.jar

BIN
camel-cxf-rest/target/classes/camelinaction/Order.class

BIN
camel-cxf-rest/target/classes/camelinaction/OrderRoute.class

BIN
camel-cxf-rest/target/classes/camelinaction/OrderService.class

BIN
camel-cxf-rest/target/classes/camelinaction/RestOrderService.class

5
camel-cxf-rest/target/maven-archiver/pom.properties

@ -0,0 +1,5 @@
#Generated by Apache Maven
#Sat Mar 27 12:21:29 IST 2021
groupId=com.camelinaction
artifactId=chapter10-camel-cxf-rest
version=2.0.0

4
camel-cxf-rest/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

@ -0,0 +1,4 @@
camelinaction\OrderService.class
camelinaction\OrderRoute.class
camelinaction\RestOrderService.class
camelinaction\Order.class

4
camel-cxf-rest/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@ -0,0 +1,4 @@
G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest\src\main\java\camelinaction\Order.java
G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest\src\main\java\camelinaction\OrderRoute.java
G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest\src\main\java\camelinaction\RestOrderService.java
G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest\src\main\java\camelinaction\OrderService.java

5
camel-cxf-rest/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst

@ -0,0 +1,5 @@
camelinaction\DummyOrderService.class
camelinaction\SpringRestOrderServiceTest.class
camelinaction\RestOrderServiceTest.class
camelinaction\SpringRestBeanOrderServiceJSonTest.class
camelinaction\SpringRestBeanOrderServiceTest.class

5
camel-cxf-rest/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

@ -0,0 +1,5 @@
G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest\src\test\java\camelinaction\SpringRestBeanOrderServiceTest.java
G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest\src\test\java\camelinaction\RestOrderServiceTest.java
G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest\src\test\java\camelinaction\SpringRestOrderServiceTest.java
G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest\src\test\java\camelinaction\DummyOrderService.java
G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest\src\test\java\camelinaction\SpringRestBeanOrderServiceJSonTest.java

61
camel-cxf-rest/target/surefire-reports/TEST-camelinaction.RestOrderServiceTest.xml

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="camelinaction.RestOrderServiceTest" time="4.573" tests="3" errors="0" skipped="0" failures="0">
<properties>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="java.vm.version" value="15.0.1+9-18"/>
<property name="sun.boot.library.path" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre\bin"/>
<property name="maven.multiModuleProjectDirectory" value="G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master"/>
<property name="java.vm.vendor" value="Oracle Corporation"/>
<property name="java.vendor.url" value="https://java.oracle.com/"/>
<property name="guice.disable.misplaced.annotation.check" value="true"/>
<property name="path.separator" value=";"/>
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
<property name="sun.os.patch.level" value=""/>
<property name="user.script" value=""/>
<property name="user.country" value="US"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="user.dir" value="G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest"/>
<property name="java.vm.compressedOopsMode" value="Zero based"/>
<property name="java.runtime.version" value="15.0.1+9-18"/>
<property name="os.arch" value="amd64"/>
<property name="java.io.tmpdir" value="C:\Users\PRANAV\AppData\Local\Temp\"/>
<property name="line.separator" value="&#10;"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="user.variant" value=""/>
<property name="os.name" value="Windows 10"/>
<property name="classworlds.conf" value="G:\Project\FuseTraining\Projects\FusePOC\workspace1\.metadata\.plugins\org.eclipse.m2e.launching\launches\m2conf10599293208081275901.tmp"/>
<property name="sun.jnu.encoding" value="Cp1252"/>
<property name="java.library.path" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Users/PRANAV/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507/jre/bin/server;C:/Users/PRANAV/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507/jre/bin;C:\AdoptOpenJDK\jdk-8.0.282.8-openj9\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\AdoptOpenJDK\java\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\PRANAV\AppData\Local\Microsoft\WindowsApps;C:\Users\PRANAV\AppData\Local\Programs\Microsoft VS Code\bin;C:\adb;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Azure Data Studio\bin;C:\Program Files\TortoiseGit\bin;C:\kafka_2.13-2.7.0\bin\windows;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Python27;C:\Python27\Scripts;C:\AdoptOpenJDK\jdk-8.0.282.8-openj9\bin;C:\Program Files\Azure Data Studio\bin;C:\kafka_2.13-2.7.0\bin\windows;G:\Project\FuseTraining\apache-maven-3.6.3\bin;C:\Python27;C:\Python27\Scripts;C:\apache-cassandra-3.11.10\bin;;C:\WINDOWS\System32;;."/>
<property name="jdk.debug" value="release"/>
<property name="java.class.version" value="59.0"/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="os.version" value="10.0"/>
<property name="user.home" value="C:\Users\PRANAV"/>
<property name="user.timezone" value="Asia/Calcutta"/>
<property name="file.encoding" value="Cp1252"/>
<property name="java.specification.version" value="15"/>
<property name="user.name" value="PRANAV"/>
<property name="java.class.path" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.m2e.maven.runtime_1.16.0.20200610-1735\jars\plexus-classworlds-2.6.0.jar"/>
<property name="java.vm.specification.version" value="15"/>
<property name="sun.arch.data.model" value="64"/>
<property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher -B clean install"/>
<property name="java.home" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre"/>
<property name="user.language" value="en"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="java.vm.info" value="mixed mode"/>
<property name="java.version" value="15.0.1"/>
<property name="java.vendor" value="Oracle Corporation"/>
<property name="maven.home" value="G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest\EMBEDDED"/>
<property name="file.separator" value="\"/>
<property name="java.version.date" value="2020-10-20"/>
<property name="java.vendor.url.bug" value="https://bugreport.java.com/bugreport/"/>
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
<property name="sun.cpu.endian" value="little"/>
<property name="sun.cpu.isalist" value="amd64"/>
</properties>
<testcase name="testGetOrder" classname="camelinaction.RestOrderServiceTest" time="3.924"/>
<testcase name="testCreateOrder" classname="camelinaction.RestOrderServiceTest" time="0.526"/>
<testcase name="testCreateAndGetOrder" classname="camelinaction.RestOrderServiceTest" time="0.123"/>
</testsuite>

61
camel-cxf-rest/target/surefire-reports/TEST-camelinaction.SpringRestBeanOrderServiceJSonTest.xml

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="camelinaction.SpringRestBeanOrderServiceJSonTest" time="5.85" tests="3" errors="0" skipped="0" failures="0">
<properties>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="java.vm.version" value="15.0.1+9-18"/>
<property name="sun.boot.library.path" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre\bin"/>
<property name="maven.multiModuleProjectDirectory" value="G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master"/>
<property name="java.vm.vendor" value="Oracle Corporation"/>
<property name="java.vendor.url" value="https://java.oracle.com/"/>
<property name="guice.disable.misplaced.annotation.check" value="true"/>
<property name="path.separator" value=";"/>
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
<property name="sun.os.patch.level" value=""/>
<property name="user.script" value=""/>
<property name="user.country" value="US"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="user.dir" value="G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest"/>
<property name="java.vm.compressedOopsMode" value="Zero based"/>
<property name="java.runtime.version" value="15.0.1+9-18"/>
<property name="os.arch" value="amd64"/>
<property name="java.io.tmpdir" value="C:\Users\PRANAV\AppData\Local\Temp\"/>
<property name="line.separator" value="&#10;"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="user.variant" value=""/>
<property name="os.name" value="Windows 10"/>
<property name="classworlds.conf" value="G:\Project\FuseTraining\Projects\FusePOC\workspace1\.metadata\.plugins\org.eclipse.m2e.launching\launches\m2conf10599293208081275901.tmp"/>
<property name="sun.jnu.encoding" value="Cp1252"/>
<property name="java.library.path" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Users/PRANAV/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507/jre/bin/server;C:/Users/PRANAV/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507/jre/bin;C:\AdoptOpenJDK\jdk-8.0.282.8-openj9\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\AdoptOpenJDK\java\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\PRANAV\AppData\Local\Microsoft\WindowsApps;C:\Users\PRANAV\AppData\Local\Programs\Microsoft VS Code\bin;C:\adb;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Azure Data Studio\bin;C:\Program Files\TortoiseGit\bin;C:\kafka_2.13-2.7.0\bin\windows;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Python27;C:\Python27\Scripts;C:\AdoptOpenJDK\jdk-8.0.282.8-openj9\bin;C:\Program Files\Azure Data Studio\bin;C:\kafka_2.13-2.7.0\bin\windows;G:\Project\FuseTraining\apache-maven-3.6.3\bin;C:\Python27;C:\Python27\Scripts;C:\apache-cassandra-3.11.10\bin;;C:\WINDOWS\System32;;."/>
<property name="jdk.debug" value="release"/>
<property name="java.class.version" value="59.0"/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="os.version" value="10.0"/>
<property name="user.home" value="C:\Users\PRANAV"/>
<property name="user.timezone" value="Asia/Calcutta"/>
<property name="file.encoding" value="Cp1252"/>
<property name="java.specification.version" value="15"/>
<property name="user.name" value="PRANAV"/>
<property name="java.class.path" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.m2e.maven.runtime_1.16.0.20200610-1735\jars\plexus-classworlds-2.6.0.jar"/>
<property name="java.vm.specification.version" value="15"/>
<property name="sun.arch.data.model" value="64"/>
<property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher -B clean install"/>
<property name="java.home" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre"/>
<property name="user.language" value="en"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="java.vm.info" value="mixed mode"/>
<property name="java.version" value="15.0.1"/>
<property name="java.vendor" value="Oracle Corporation"/>
<property name="maven.home" value="G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest\EMBEDDED"/>
<property name="file.separator" value="\"/>
<property name="java.version.date" value="2020-10-20"/>
<property name="java.vendor.url.bug" value="https://bugreport.java.com/bugreport/"/>
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
<property name="sun.cpu.endian" value="little"/>
<property name="sun.cpu.isalist" value="amd64"/>
</properties>
<testcase name="testGetOrder" classname="camelinaction.SpringRestBeanOrderServiceJSonTest" time="3.108"/>
<testcase name="testCreateOrder" classname="camelinaction.SpringRestBeanOrderServiceJSonTest" time="1.795"/>
<testcase name="testCreateAndGetOrder" classname="camelinaction.SpringRestBeanOrderServiceJSonTest" time="0.947"/>
</testsuite>

61
camel-cxf-rest/target/surefire-reports/TEST-camelinaction.SpringRestBeanOrderServiceTest.xml

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="camelinaction.SpringRestBeanOrderServiceTest" time="2.448" tests="3" errors="0" skipped="0" failures="0">
<properties>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="java.vm.version" value="15.0.1+9-18"/>
<property name="sun.boot.library.path" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre\bin"/>
<property name="maven.multiModuleProjectDirectory" value="G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master"/>
<property name="java.vm.vendor" value="Oracle Corporation"/>
<property name="java.vendor.url" value="https://java.oracle.com/"/>
<property name="guice.disable.misplaced.annotation.check" value="true"/>
<property name="path.separator" value=";"/>
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
<property name="sun.os.patch.level" value=""/>
<property name="user.script" value=""/>
<property name="user.country" value="US"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="user.dir" value="G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest"/>
<property name="java.vm.compressedOopsMode" value="Zero based"/>
<property name="java.runtime.version" value="15.0.1+9-18"/>
<property name="os.arch" value="amd64"/>
<property name="java.io.tmpdir" value="C:\Users\PRANAV\AppData\Local\Temp\"/>
<property name="line.separator" value="&#10;"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="user.variant" value=""/>
<property name="os.name" value="Windows 10"/>
<property name="classworlds.conf" value="G:\Project\FuseTraining\Projects\FusePOC\workspace1\.metadata\.plugins\org.eclipse.m2e.launching\launches\m2conf10599293208081275901.tmp"/>
<property name="sun.jnu.encoding" value="Cp1252"/>
<property name="java.library.path" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Users/PRANAV/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507/jre/bin/server;C:/Users/PRANAV/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507/jre/bin;C:\AdoptOpenJDK\jdk-8.0.282.8-openj9\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\AdoptOpenJDK\java\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\PRANAV\AppData\Local\Microsoft\WindowsApps;C:\Users\PRANAV\AppData\Local\Programs\Microsoft VS Code\bin;C:\adb;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Azure Data Studio\bin;C:\Program Files\TortoiseGit\bin;C:\kafka_2.13-2.7.0\bin\windows;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Python27;C:\Python27\Scripts;C:\AdoptOpenJDK\jdk-8.0.282.8-openj9\bin;C:\Program Files\Azure Data Studio\bin;C:\kafka_2.13-2.7.0\bin\windows;G:\Project\FuseTraining\apache-maven-3.6.3\bin;C:\Python27;C:\Python27\Scripts;C:\apache-cassandra-3.11.10\bin;;C:\WINDOWS\System32;;."/>
<property name="jdk.debug" value="release"/>
<property name="java.class.version" value="59.0"/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="os.version" value="10.0"/>
<property name="user.home" value="C:\Users\PRANAV"/>
<property name="user.timezone" value="Asia/Calcutta"/>
<property name="file.encoding" value="Cp1252"/>
<property name="java.specification.version" value="15"/>
<property name="user.name" value="PRANAV"/>
<property name="java.class.path" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.m2e.maven.runtime_1.16.0.20200610-1735\jars\plexus-classworlds-2.6.0.jar"/>
<property name="java.vm.specification.version" value="15"/>
<property name="sun.arch.data.model" value="64"/>
<property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher -B clean install"/>
<property name="java.home" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre"/>
<property name="user.language" value="en"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="java.vm.info" value="mixed mode"/>
<property name="java.version" value="15.0.1"/>
<property name="java.vendor" value="Oracle Corporation"/>
<property name="maven.home" value="G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest\EMBEDDED"/>
<property name="file.separator" value="\"/>
<property name="java.version.date" value="2020-10-20"/>
<property name="java.vendor.url.bug" value="https://bugreport.java.com/bugreport/"/>
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
<property name="sun.cpu.endian" value="little"/>
<property name="sun.cpu.isalist" value="amd64"/>
</properties>
<testcase name="testGetOrder" classname="camelinaction.SpringRestBeanOrderServiceTest" time="1.134"/>
<testcase name="testCreateOrder" classname="camelinaction.SpringRestBeanOrderServiceTest" time="0.784"/>
<testcase name="testCreateAndGetOrder" classname="camelinaction.SpringRestBeanOrderServiceTest" time="0.53"/>
</testsuite>

61
camel-cxf-rest/target/surefire-reports/TEST-camelinaction.SpringRestOrderServiceTest.xml

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="camelinaction.SpringRestOrderServiceTest" time="1.807" tests="3" errors="0" skipped="0" failures="0">
<properties>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="java.vm.version" value="15.0.1+9-18"/>
<property name="sun.boot.library.path" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre\bin"/>
<property name="maven.multiModuleProjectDirectory" value="G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master"/>
<property name="java.vm.vendor" value="Oracle Corporation"/>
<property name="java.vendor.url" value="https://java.oracle.com/"/>
<property name="guice.disable.misplaced.annotation.check" value="true"/>
<property name="path.separator" value=";"/>
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
<property name="sun.os.patch.level" value=""/>
<property name="user.script" value=""/>
<property name="user.country" value="US"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="user.dir" value="G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest"/>
<property name="java.vm.compressedOopsMode" value="Zero based"/>
<property name="java.runtime.version" value="15.0.1+9-18"/>
<property name="os.arch" value="amd64"/>
<property name="java.io.tmpdir" value="C:\Users\PRANAV\AppData\Local\Temp\"/>
<property name="line.separator" value="&#10;"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="user.variant" value=""/>
<property name="os.name" value="Windows 10"/>
<property name="classworlds.conf" value="G:\Project\FuseTraining\Projects\FusePOC\workspace1\.metadata\.plugins\org.eclipse.m2e.launching\launches\m2conf10599293208081275901.tmp"/>
<property name="sun.jnu.encoding" value="Cp1252"/>
<property name="java.library.path" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Users/PRANAV/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507/jre/bin/server;C:/Users/PRANAV/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507/jre/bin;C:\AdoptOpenJDK\jdk-8.0.282.8-openj9\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\AdoptOpenJDK\java\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\PRANAV\AppData\Local\Microsoft\WindowsApps;C:\Users\PRANAV\AppData\Local\Programs\Microsoft VS Code\bin;C:\adb;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Azure Data Studio\bin;C:\Program Files\TortoiseGit\bin;C:\kafka_2.13-2.7.0\bin\windows;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Python27;C:\Python27\Scripts;C:\AdoptOpenJDK\jdk-8.0.282.8-openj9\bin;C:\Program Files\Azure Data Studio\bin;C:\kafka_2.13-2.7.0\bin\windows;G:\Project\FuseTraining\apache-maven-3.6.3\bin;C:\Python27;C:\Python27\Scripts;C:\apache-cassandra-3.11.10\bin;;C:\WINDOWS\System32;;."/>
<property name="jdk.debug" value="release"/>
<property name="java.class.version" value="59.0"/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="os.version" value="10.0"/>
<property name="user.home" value="C:\Users\PRANAV"/>
<property name="user.timezone" value="Asia/Calcutta"/>
<property name="file.encoding" value="Cp1252"/>
<property name="java.specification.version" value="15"/>
<property name="user.name" value="PRANAV"/>
<property name="java.class.path" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.m2e.maven.runtime_1.16.0.20200610-1735\jars\plexus-classworlds-2.6.0.jar"/>
<property name="java.vm.specification.version" value="15"/>
<property name="sun.arch.data.model" value="64"/>
<property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher -B clean install"/>
<property name="java.home" value="C:\Users\PRANAV\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.1.v20201027-0507\jre"/>
<property name="user.language" value="en"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="java.vm.info" value="mixed mode"/>
<property name="java.version" value="15.0.1"/>
<property name="java.vendor" value="Oracle Corporation"/>
<property name="maven.home" value="G:\Project\FuseTraining\Projects\FusePOC\camelinaction2-master\chapter10\camel-cxf-rest\EMBEDDED"/>
<property name="file.separator" value="\"/>
<property name="java.version.date" value="2020-10-20"/>
<property name="java.vendor.url.bug" value="https://bugreport.java.com/bugreport/"/>
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
<property name="sun.cpu.endian" value="little"/>
<property name="sun.cpu.isalist" value="amd64"/>
</properties>
<testcase name="testGetOrder" classname="camelinaction.SpringRestOrderServiceTest" time="0.655"/>
<testcase name="testCreateOrder" classname="camelinaction.SpringRestOrderServiceTest" time="0.669"/>
<testcase name="testCreateAndGetOrder" classname="camelinaction.SpringRestOrderServiceTest" time="0.483"/>
</testsuite>

4
camel-cxf-rest/target/surefire-reports/camelinaction.RestOrderServiceTest.txt

@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: camelinaction.RestOrderServiceTest
-------------------------------------------------------------------------------
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.802 sec - in camelinaction.RestOrderServiceTest

4
camel-cxf-rest/target/surefire-reports/camelinaction.SpringRestBeanOrderServiceJSonTest.txt

@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: camelinaction.SpringRestBeanOrderServiceJSonTest
-------------------------------------------------------------------------------
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.851 sec - in camelinaction.SpringRestBeanOrderServiceJSonTest

4
camel-cxf-rest/target/surefire-reports/camelinaction.SpringRestBeanOrderServiceTest.txt

@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: camelinaction.SpringRestBeanOrderServiceTest
-------------------------------------------------------------------------------
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.456 sec - in camelinaction.SpringRestBeanOrderServiceTest

4
camel-cxf-rest/target/surefire-reports/camelinaction.SpringRestOrderServiceTest.txt

@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: camelinaction.SpringRestOrderServiceTest
-------------------------------------------------------------------------------
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.81 sec - in camelinaction.SpringRestOrderServiceTest

BIN
camel-cxf-rest/target/test-classes/camelinaction/DummyOrderService.class

BIN
camel-cxf-rest/target/test-classes/camelinaction/RestOrderServiceTest.class

BIN
camel-cxf-rest/target/test-classes/camelinaction/SpringRestBeanOrderServiceJSonTest.class

BIN
camel-cxf-rest/target/test-classes/camelinaction/SpringRestBeanOrderServiceTest.class

47
camel-cxf-rest/target/test-classes/camelinaction/SpringRestBeanOrderServiceTest.xml

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- the order service -->
<bean id="orderService" class="camelinaction.DummyOrderService"/>
<!-- CXF-RS server as a bean where we setup the REST web service using the resource class
and can do additional configurations -->
<cxf:rsServer id="restOrderServer" address="http://localhost:8080"
serviceClass="camelinaction.RestOrderService">
</cxf:rsServer>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<!-- use cxfrs:bean and enable the simple binding style -->
<from uri="cxfrs:bean:restOrderServer?bindingStyle=SimpleConsumer"/>
<!-- call the route based on the operation invoked on the REST web service -->
<toD uri="direct:${header.operationName}"/>
</route>
<!-- routes that implement the REST services -->
<route>
<from uri="direct:createOrder"/>
<bean ref="orderService" method="createOrder"/>
</route>
<route>
<from uri="direct:getOrder"/>
<bean ref="orderService" method="getOrder(${header.id})"/>
</route>
<route>
<from uri="direct:updateOrder"/>
<bean ref="orderService" method="updateOrder"/>
</route>
<route>
<from uri="direct:cancelOrder"/>
<bean ref="orderService" method="cancelOrder(${header.id})"/>
</route>
</camelContext>
</beans>

53
camel-cxf-rest/target/test-classes/camelinaction/SpringRestBeanOrderServiceTestJSon.xml

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- the order service -->
<bean id="orderService" class="camelinaction.DummyOrderService"/>
<!-- enable json support -->
<bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
<!-- CXF-RS server as a bean where we setup the REST web service using the resource class
and can do additional configurations -->
<cxf:rsServer id="restOrderServer" address="http://localhost:8080"
serviceClass="camelinaction.RestOrderService">
<cxf:providers>
<ref bean="jsonProvider"/>
</cxf:providers>
</cxf:rsServer>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<!-- use cxfrs:bean and enable the simple binding style -->
<from uri="cxfrs:bean:restOrderServer?bindingStyle=SimpleConsumer"/>
<!-- call the route based on the operation invoked on the REST web service -->
<toD uri="direct:${header.operationName}"/>
</route>
<!-- routes that implement the REST services -->
<route>
<from uri="direct:createOrder"/>
<bean ref="orderService" method="createOrder"/>
</route>
<route>
<from uri="direct:getOrder"/>
<bean ref="orderService" method="getOrder(${header.id})"/>
</route>
<route>
<from uri="direct:updateOrder"/>
<bean ref="orderService" method="updateOrder"/>
</route>
<route>
<from uri="direct:cancelOrder"/>
<bean ref="orderService" method="cancelOrder(${header.id})"/>
</route>
</camelContext>
</beans>

BIN
camel-cxf-rest/target/test-classes/camelinaction/SpringRestOrderServiceTest.class

42
camel-cxf-rest/target/test-classes/camelinaction/SpringRestOrderServiceTest.xml

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
<!-- the order service -->
<bean id="orderService" class="camelinaction.DummyOrderService"/>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<!-- use CXF-RS to setup the REST web service using the resource class
and use the simple binding style which is recommended to use -->
<from uri="cxfrs:http://localhost:8080?resourceClasses=camelinaction.RestOrderService&amp;bindingStyle=SimpleConsumer"/>
<!-- call the route based on the operation invoked on the REST web service -->
<toD uri="direct:${header.operationName}"/>
</route>
<!-- routes that implement the REST services -->
<route>
<from uri="direct:createOrder"/>
<bean ref="orderService" method="createOrder"/>
</route>
<route>
<from uri="direct:getOrder"/>
<bean ref="orderService" method="getOrder(${header.id})"/>
</route>
<route>
<from uri="direct:updateOrder"/>
<bean ref="orderService" method="updateOrder"/>
</route>
<route>
<from uri="direct:cancelOrder"/>
<bean ref="orderService" method="cancelOrder(${header.id})"/>
</route>
</camelContext>
</beans>

7
camel-cxf-rest/target/test-classes/log4j.properties

@ -0,0 +1,7 @@
log4j.rootLogger=INFO, out
# CONSOLE appender not used by default
log4j.appender.out=org.apache.log4j.ConsoleAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
Loading…
Cancel
Save