cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1201681 - in /cxf/branches/2.4.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
Date Mon, 14 Nov 2011 12:24:49 GMT
Author: sergeyb
Date: Mon Nov 14 12:24:48 2011
New Revision: 1201681

URL: http://svn.apache.org/viewvc?rev=1201681&view=rev
Log:
Merged revisions 1201680 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1201680 | sergeyb | 2011-11-14 12:22:27 +0000 (Mon, 14 Nov 2011) | 1 line
  
  [CXF-3900] Checking Sets when reading the beans
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 14 12:24:48 2011
@@ -1 +1 @@
-/cxf/trunk:1197048,1198584,1198875,1198884,1199905,1200850,1200876,1200920,1200934
+/cxf/trunk:1197048,1198584,1198875,1198884,1199905,1200850,1200876,1200920,1200934,1201680

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=1201681&r1=1201680&r2=1201681&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
Mon Nov 14 12:24:48 2011
@@ -1014,10 +1014,11 @@ public final class InjectionUtils {
                 if (isPrimitive(value.getClass())) {
                     values.putSingle(propertyName, value);
                 } else if (isSupportedCollectionOrArray(value.getClass())) {
-                    // ignoring arrrays for a moment
                     List<Object> theValues = null;
                     if (value.getClass().isArray()) {
                         theValues = Arrays.asList(value);
+                    } else if (value instanceof Set) {
+                        theValues = new ArrayList<Object>((Set<?>)value);
                     } else {
                         theValues = CastUtils.cast((List<?>)value);
                     }

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java?rev=1201681&r1=1201680&r2=1201681&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
Mon Nov 14 12:24:48 2011
@@ -73,10 +73,16 @@ public class InjectionUtilsTest extends 
         values.add("lv11");
         values.add("lv22");
         bean2.setC(values);
+        Set<String> set = new HashSet<String>();
+        set.add("set1");
+        set.add("set2");
+        bean2.setS(set);
+        
         bean1.setD(bean2);
         
+        
         MultivaluedMap<String, Object> map = InjectionUtils.extractValuesFromBean(bean1,
"");
-        assertEquals("Size is wrong", 6, map.size());
+        assertEquals("Size is wrong", 7, map.size());
         assertEquals(1, map.get("a").size());
         assertEquals("aValue", map.getFirst("a"));
         assertEquals(1, map.get("b").size());
@@ -93,6 +99,10 @@ public class InjectionUtilsTest extends 
         assertEquals("lv11", map.get("d.c").get(0));
         assertEquals("lv22", map.get("d.c").get(1));
         
+        assertEquals(2, map.get("d.s").size());
+        assertEquals("set1", map.get("d.s").get(0));
+        assertEquals("set2", map.get("d.s").get(1));
+        
     }
 
     static class CustomerBean1 {
@@ -140,6 +150,8 @@ public class InjectionUtilsTest extends 
         private String a;
         private Long b;
         private List<String> c;
+        private Set<String> s;
+        
         public void setA(String aString) {
             this.a = aString;
         }
@@ -159,7 +171,13 @@ public class InjectionUtilsTest extends 
             return c;
         }
         
+        public void setS(Set<String> set) {
+            this.s = set;
+        }
         
+        public Set<String> getS() {
+            return this.s;
+        }
     }
     
 }



Mime
View raw message