You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2012/09/20 18:19:01 UTC
svn commit: r1388096 - in /cxf/trunk:
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/
systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/
Author: sergeyb
Date: Thu Sep 20 16:19:00 2012
New Revision: 1388096
URL: http://svn.apache.org/viewvc?rev=1388096&view=rev
Log:
[CXF-4514] Updating JAX-RS client code to recognize bean enum properties
Modified:
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/OrderBean.java
Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=1388096&r1=1388095&r2=1388096&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java Thu Sep 20 16:19:00 2012
@@ -1023,6 +1023,8 @@ public final class InjectionUtils {
}
if (isPrimitive(value.getClass())) {
values.putSingle(propertyName, value);
+ } else if (value.getClass().isEnum()) {
+ values.putSingle(propertyName, value.toString());
} else if (isSupportedCollectionOrArray(value.getClass())) {
List<Object> theValues = null;
if (value.getClass().isArray()) {
Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java?rev=1388096&r1=1388095&r2=1388096&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java Thu Sep 20 16:19:00 2012
@@ -54,6 +54,8 @@ import org.apache.cxf.interceptor.FIStax
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.interceptor.InterceptorProvider;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.interceptor.transform.TransformInInterceptor;
import org.apache.cxf.interceptor.transform.TransformOutInterceptor;
import org.apache.cxf.io.CachedOutputStream;
@@ -532,12 +534,18 @@ public class JAXRSSoapBookTest extends A
String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
BookStoreJaxrsJaxws.class);
+
+ WebClient.getConfig(proxy).getOutInterceptors().add(new LoggingOutInterceptor());
+ WebClient.getConfig(proxy).getInInterceptors().add(new LoggingInInterceptor());
+
BookSubresource bs = proxy.getBookSubresource("139");
OrderBean order = new OrderBean();
order.setId(123L);
order.setWeight(100);
+ order.setCustomerTitle(OrderBean.Title.MS);
OrderBean order2 = bs.addOrder(order);
assertEquals(Long.valueOf(123L), Long.valueOf(order2.getId()));
+ assertEquals(OrderBean.Title.MS, order2.getCustomerTitle());
}
@Test
Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/OrderBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/OrderBean.java?rev=1388096&r1=1388095&r2=1388096&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/OrderBean.java (original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/OrderBean.java Thu Sep 20 16:19:00 2012
@@ -25,6 +25,7 @@ public class OrderBean {
private Long id;
private int weight;
+ private Title customerTitle;
public void setId(Long id) {
this.id = id;
@@ -38,4 +39,16 @@ public class OrderBean {
public int getWeight() {
return weight;
}
+
+ public Title getCustomerTitle() {
+ return customerTitle;
+ }
+ public void setCustomerTitle(Title customerTitle) {
+ this.customerTitle = customerTitle;
+ }
+
+ public static enum Title {
+ MR,
+ MS;
+ }
}