Author: ningjiang
Date: Fri Jul 22 05:07:24 2011
New Revision: 1149468
URL: http://svn.apache.org/viewvc?rev=1149468&view=rev
Log:
CAMEL-4258 Add integration test of CXFRS blueprint
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouterTest.java
(with props)
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Customer.java
(with props)
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerService.java
(with props)
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerServiceResource.java
(with props)
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Order.java
(with props)
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Product.java
(with props)
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/blueprint/
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouter.xml
(with props)
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouterTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouterTest.java?rev=1149468&view=auto
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouterTest.java
(added)
+++
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouterTest.java
Fri Jul 22 05:07:24 2011
@@ -0,0 +1,210 @@
+/**
+ * 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.itest.osgi.cxf.blueprint;
+
+
+import org.apache.camel.CamelContext;
+import
org.apache.camel.itest.osgi.cxf.blueprint.jaxrs.testbean.CustomerService;
+import org.apache.camel.itest.osgi.blueprint.OSGiBlueprintTestSupport;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.EntityUtils;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.osgi.framework.Constants;
+
+import static org.ops4j.pax.exam.OptionUtils.combine;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.newBundle;
+
+@RunWith(JUnit4TestRunner.class)
+@Ignore("This test will be failed with CXF 2.4.1, we need to use CXF 2.4.2")
+public class CxfRsBlueprintRouterTest extends OSGiBlueprintTestSupport {
+ private static final String PUT_REQUEST =
"<Customer><name>Mary</name><id>123</id></Customer>";
+ private static final String POST_REQUEST =
"<Customer><name>Jack</name></Customer>";
+ private static Server server;
+
+ @BeforeClass
+ public static void startServer() {
+ JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
+ sf.setAddress("http://localhost:9002/rest");
+ sf.setServiceBean(new CustomerService());
+ sf.setStaticSubresourceResolution(true);
+ server = sf.create();
+ }
+
+ @AfterClass
+ public static void stopServer() {
+ if (server != null) {
+ server.stop();
+ }
+ }
+
+ protected void doPostSetup() throws Exception {
+ getInstalledBundle("CxfRsBlueprintRouterTest").start();
+ getOsgiService(CamelContext.class,
"(camel.context.symbolicname=CxfRsBlueprintRouterTest)", 10000);
+ }
+
+ @Test
+ public void testGetCustomer() throws Exception {
+ HttpGet get = new
HttpGet("http://localhost:9000/route/customerservice/customers/123");
+ get.addHeader("Accept" , "application/json");
+ HttpClient httpclient = new DefaultHttpClient();
+
+ try {
+ HttpResponse response = httpclient.execute(get);
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ assertEquals("{\"Customer\":{\"id\":123,\"name\":\"John\"}}",
+ EntityUtils.toString(response.getEntity()));
+ } finally {
+ httpclient.getConnectionManager().shutdown();
+ }
+ }
+
+
+ @Test
+ public void testGetCustomerWithQuery() throws Exception {
+ HttpGet get = new
HttpGet("http://localhost:9000/route/customerservice/customers?id=123");
+ get.addHeader("Accept" , "application/json");
+ HttpClient httpclient = new DefaultHttpClient();
+
+ try {
+ HttpResponse response = httpclient.execute(get);
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ assertEquals("{\"Customer\":{\"id\":123,\"name\":\"John\"}}",
+ EntityUtils.toString(response.getEntity()));
+ } finally {
+ httpclient.getConnectionManager().shutdown();
+ }
+ }
+
+ @Test
+ public void testGetCustomers() throws Exception {
+ HttpGet get = new
HttpGet("http://localhost:9000/route/customerservice/customers/");
+ get.addHeader("Accept" , "application/xml");
+ HttpClient httpclient = new DefaultHttpClient();
+
+ try {
+ HttpResponse response = httpclient.execute(get);
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ // order returned can differ on OS so match for both orders
+ String s = EntityUtils.toString(response.getEntity());
+ boolean m1 =
"<Customers><Customer><id>123</id><name>John</name></Customer><Customer><id>113</id><name>Dan</name></Customer></Customers>".equals(s);
+ boolean m2 =
"<Customers><Customer><id>113</id><name>Dan</name></Customer><Customer><id>123</id><name>John</name></Customer></Customers>".equals(s);
+
+ if (!m1 && !m2) {
+ fail("Not expected body returned: " + s);
+ }
+ } finally {
+ httpclient.getConnectionManager().shutdown();
+ }
+ }
+
+ @Test
+ public void testGetSubResource() throws Exception {
+ HttpGet get = new
HttpGet("http://localhost:9000/route/customerservice/orders/223/products/323");
+ get.addHeader("Accept" , "application/json");
+ HttpClient httpclient = new DefaultHttpClient();
+
+ try {
+ HttpResponse response = httpclient.execute(get);
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ assertEquals("{\"Product\":{\"description\":\"product
323\",\"id\":323}}",
+ EntityUtils.toString(response.getEntity()));
+ } finally {
+ httpclient.getConnectionManager().shutdown();
+ }
+ }
+
+ @Test
+ public void testPutConsumer() throws Exception {
+ HttpPut put = new
HttpPut("http://localhost:9000/route/customerservice/customers");
+ StringEntity entity = new StringEntity(PUT_REQUEST, "ISO-8859-1");
+ entity.setContentType("text/xml; charset=ISO-8859-1");
+ put.setEntity(entity);
+ HttpClient httpclient = new DefaultHttpClient();
+
+ try {
+ HttpResponse response = httpclient.execute(put);
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ assertEquals("", EntityUtils.toString(response.getEntity()));
+ } finally {
+ httpclient.getConnectionManager().shutdown();
+ }
+ }
+
+ @Test
+ public void testPostConsumer() throws Exception {
+ HttpPost post = new
HttpPost("http://localhost:9000/route/customerservice/customers");
+ post.addHeader("Accept" , "text/xml");
+ StringEntity entity = new StringEntity(POST_REQUEST, "ISO-8859-1");
+ entity.setContentType("text/xml; charset=ISO-8859-1");
+ post.setEntity(entity);
+ HttpClient httpclient = new DefaultHttpClient();
+
+ try {
+ HttpResponse response = httpclient.execute(post);
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"
standalone=\"yes\"?><Customer><id>124</id><name>Jack</name></Customer>",
+ EntityUtils.toString(response.getEntity()));
+ } finally {
+ httpclient.getConnectionManager().shutdown();
+ }
+
+ }
+
+ @Configuration
+ public static Option[] configure() throws Exception {
+ Option[] options = combine(
+ getDefaultCamelKarafOptions(),
+
+ // using the features to install the camel components
+ scanFeatures(getCamelKarafFeatureUrl(),
+ "camel-blueprint","camel-http4", "camel-cxf"),
+
+ bundle(newBundle()
+ .add("OSGI-INF/blueprint/test.xml",
CxfRsBlueprintRouterTest.class.getResource("CxfRsBlueprintRouter.xml"))
+
.add(org.apache.camel.itest.osgi.cxf.blueprint.jaxrs.testbean.Customer.class)
+
.add(org.apache.camel.itest.osgi.cxf.blueprint.jaxrs.testbean.CustomerService.class)
+
.add(org.apache.camel.itest.osgi.cxf.blueprint.jaxrs.testbean.CustomerServiceResource.class)
+
.add(org.apache.camel.itest.osgi.cxf.blueprint.jaxrs.testbean.Order.class)
+
.add(org.apache.camel.itest.osgi.cxf.blueprint.jaxrs.testbean.Product.class)
+ .set(Constants.BUNDLE_SYMBOLICNAME, "CxfRsBlueprintRouterTest")
+ .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
+ .build()).noStart(),
+ vmOption( "-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006" )
+
+ );
+
+ return options;
+ }
+
+}
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouterTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Customer.java
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Customer.java?rev=1149468&view=auto
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Customer.java
(added)
+++
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Customer.java
Fri Jul 22 05:07:24 2011
@@ -0,0 +1,45 @@
+/**
+ * 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.itest.osgi.cxf.blueprint.jaxrs.testbean;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ *
+ * @version
+ */
+@XmlRootElement(name = "Customer")
+public class Customer {
+ private long id;
+ private String name;
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Customer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Customer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerService.java
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerService.java?rev=1149468&view=auto
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerService.java
(added)
+++
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerService.java
Fri Jul 22 05:07:24 2011
@@ -0,0 +1,151 @@
+/**
+ * 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.itest.osgi.cxf.blueprint.jaxrs.testbean;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
+
+
+
+/**
+ *
+ * @version
+ */
+@Path("/customerservice/")
+public class CustomerService {
+ long currentId = 123;
+ Map<Long, Customer> customers = new HashMap<Long, Customer>();
+ Map<Long, Order> orders = new HashMap<Long, Order>();
+
+ public CustomerService() {
+ init();
+ }
+
+ @GET
+ @Path("/customers/{id}/")
+ public Customer getCustomer(@PathParam("id") String id) {
+ long idNumber = Long.parseLong(id);
+ Customer c = customers.get(idNumber);
+ return c;
+ }
+
+ @GET
+ @Path("/customers")
+ public Customer getCustomerByQueryParam(@QueryParam("id") String id) {
+ long idNumber = Long.parseLong(id);
+ Customer c = customers.get(idNumber);
+ return c;
+ }
+
+ @GET
+ @Path("/customers/")
+ @Produces("application/xml")
+ public List<Customer> getCustomers() {
+ List<Customer> l = new ArrayList<Customer>(customers.values());
+ return l;
+ }
+
+
+ @PUT
+ @Path("/customers/")
+ public Response updateCustomer(Customer customer) {
+ Customer c = customers.get(customer.getId());
+ Response r;
+ if (c != null) {
+ customers.put(customer.getId(), customer);
+ r = Response.ok().build();
+ } else {
+ r = Response.notModified().build();
+ }
+
+ return r;
+ }
+
+ @POST
+ @Path("/customers/")
+ public Response addCustomer(Customer customer) {
+ customer.setId(++currentId);
+
+ customers.put(customer.getId(), customer);
+
+ return Response.ok(customer).build();
+ }
+
+ @POST
+ @Path("/customersUniqueResponseCode/")
+ public Response addCustomerUniqueResponseCode(Customer customer) {
+ customer.setId(++currentId);
+
+ customers.put(customer.getId(), customer);
+
+ return Response.status(201).entity(customer).build();
+ }
+
+ @DELETE
+ @Path("/customers/{id}/")
+ public Response deleteCustomer(@PathParam("id") String id) {
+ long idNumber = Long.parseLong(id);
+ Customer c = customers.get(idNumber);
+
+ Response r;
+ if (c != null) {
+ r = Response.ok().build();
+ customers.remove(idNumber);
+ } else {
+ r = Response.notModified().build();
+ }
+
+ return r;
+ }
+
+ @Path("/orders/{orderId}/")
+ public Order getOrder(@PathParam("orderId") String orderId) {
+ long idNumber = Long.parseLong(orderId);
+ Order c = orders.get(idNumber);
+ return c;
+ }
+
+ final void init() {
+ Customer c = new Customer();
+ c.setName("John");
+ c.setId(123);
+ customers.put(c.getId(), c);
+
+ c = new Customer();
+ c.setName("Dan");
+ c.setId(113);
+ customers.put(c.getId(), c);
+
+ Order o = new Order();
+ o.setDescription("order 223");
+ o.setId(223);
+ orders.put(o.getId(), o);
+ }
+
+}
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerServiceResource.java
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerServiceResource.java?rev=1149468&view=auto
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerServiceResource.java
(added)
+++
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerServiceResource.java
Fri Jul 22 05:07:24 2011
@@ -0,0 +1,48 @@
+/**
+ * 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.itest.osgi.cxf.blueprint.jaxrs.testbean;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Response;
+
+/**
+ *
+ * @version
+ */
+// START SNIPPET: example
+@Path("/customerservice/")
+public class CustomerServiceResource {
+
+ public CustomerServiceResource() {
+ }
+
+ @GET
+ @Path("/customers/{id}/")
+ public Customer getCustomer(@PathParam("id") String id) {
+ return null;
+ }
+
+ @PUT
+ @Path("/customers/")
+ public Response updateCustomer(Customer customer) {
+ return null;
+ }
+}
+// END SNIPPET: example
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerServiceResource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/CustomerServiceResource.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Order.java
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Order.java?rev=1149468&view=auto
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Order.java
(added)
+++
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Order.java
Fri Jul 22 05:07:24 2011
@@ -0,0 +1,71 @@
+/**
+ * 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.itest.osgi.cxf.blueprint.jaxrs.testbean;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ *
+ * @version
+ */
+@XmlRootElement(name = "Order")
+public class Order {
+ private long id;
+ private String description;
+ private Map<Long, Product> products = new HashMap<Long, Product>();
+
+ public Order() {
+ init();
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String d) {
+ this.description = d;
+ }
+
+ @GET
+ @Path("products/{productId}/")
+ public Product getProduct(@PathParam("productId")int productId) {
+ Product p = products.get(new Long(productId));
+ return p;
+ }
+
+ final void init() {
+ Product p = new Product();
+ p.setId(323);
+ p.setDescription("product 323");
+ products.put(p.getId(), p);
+ }
+
+}
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Order.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Order.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Product.java
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Product.java?rev=1149468&view=auto
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Product.java
(added)
+++
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Product.java
Fri Jul 22 05:07:24 2011
@@ -0,0 +1,45 @@
+/**
+ * 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.itest.osgi.cxf.blueprint.jaxrs.testbean;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ *
+ * @version
+ */
+@XmlRootElement(name = "Product")
+public class Product {
+ private long id;
+ private String description;
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String d) {
+ this.description = d;
+ }
+}
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Product.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/jaxrs/testbean/Product.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouter.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouter.xml?rev=1149468&view=auto
==============================================================================
---
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouter.xml
(added)
+++
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouter.xml
Fri Jul 22 05:07:24 2011
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/blueprint"
+ xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf">
+
+ <bean id="customerService"
class="org.apache.camel.itest.osgi.cxf.blueprint.jaxrs.testbean.CustomerService"
/>
+
+ <!-- Defined the server endpoint to create the cxf-rs consumer -->
+ <camelcxf:rsServer id="rsServer" address="http://localhost:9000/route"
+
serviceClass="org.apache.camel.itest.osgi.cxf.blueprint.jaxrs.testbean.CustomerService"
/>
+
+ <!-- Defined the client endpoint to create the cxf-rs consumer -->
+ <camelcxf:rsClient id="rsClient" address="http://localhost:9002/rest"
+
serviceClass="org.apache.camel.itest.osgi.cxf.blueprint.jaxrs.testbean.CustomerService"/>
+
+ <!-- The camel route context -->
+ <camel:camelContext>
+ <camel:route>
+ <camel:from uri="cxfrs://bean://rsServer"/>
+ <!-- We can remove this configure as the CXFRS producer is using the
HttpAPI by default -->
+ <camel:setHeader headerName="CamelCxfRsUsingHttpAPI">
+ <camel:constant>True</camel:constant>
+ </camel:setHeader>
+ <camel:to uri="cxfrs://bean://rsClient"/>
+ </camel:route>
+ </camel:camelContext>
+
+</blueprint>
+
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouter.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouter.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/cxf/blueprint/CxfRsBlueprintRouter.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml