cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1233488 - in /cxf/branches/2.3.x-fixes: ./ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/
Date Thu, 19 Jan 2012 17:25:37 GMT
Author: dkulp
Date: Thu Jan 19 17:25:37 2012
New Revision: 1233488

URL: http://svn.apache.org/viewvc?rev=1233488&view=rev
Log:
Merged revisions 1232519 via svnmerge from 
https://svn.us.apache.org/repos/asf/cxf/branches/2.4.x-fixes

................
  r1232519 | dkulp | 2012-01-17 13:15:53 -0500 (Tue, 17 Jan 2012) | 17 lines
  
  Merged revisions 1232501 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes
  
  ................
    r1232501 | dkulp | 2012-01-17 12:31:04 -0500 (Tue, 17 Jan 2012) | 10 lines
    
    Merged revisions 1232495 via svnmerge from 
    https://svn.apache.org/repos/asf/cxf/trunk
    
    ........
      r1232495 | dkulp | 2012-01-17 12:25:06 -0500 (Tue, 17 Jan 2012) | 2 lines
      
      [CXF-4027] Omit Enum, Clonable, Serializable from Aegis class searching
      Patch from James Phillpotts  applied
    ........
  ................
................

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
    cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypeInfo.java
    cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java

Propchange: cxf/branches/2.3.x-fixes/
            ('svn:mergeinfo' removed)

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

Modified: cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java?rev=1233488&r1=1233487&r2=1233488&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
Thu Jan 19 17:25:37 2012
@@ -19,6 +19,7 @@
 package org.apache.cxf.aegis.type.basic;
 
 import java.beans.PropertyDescriptor;
+import java.io.Serializable;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
@@ -578,7 +579,8 @@ public class BeanType extends AegisType 
         /*
          * Don't dig any deeper than Object or Exception
          */
-        if (c != null && c != Object.class && c != Exception.class &&
c != RuntimeException.class) {
+        if (c != null && c != Object.class && c != Exception.class &&
c != RuntimeException.class 
+            && c != Enum.class && c != Serializable.class && c !=
Cloneable.class) {
             TypeMapping tm = inf.getTypeMapping();
             AegisType superType = tm.getType(c);
             if (superType == null) {

Modified: cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypeInfo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypeInfo.java?rev=1233488&r1=1233487&r2=1233488&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypeInfo.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypeInfo.java
Thu Jan 19 17:25:37 2012
@@ -271,6 +271,8 @@ public class BeanTypeInfo {
         try {
             if (beanClass.isInterface() || beanClass.isPrimitive()) {
                 descriptors = getInterfacePropertyDescriptors(beanClass);
+            } else if (beanClass.isEnum()) {
+                // do nothing
             } else if (beanClass == Object.class || beanClass == Throwable.class) {
                 // do nothing
             } else if (beanClass == Throwable.class) {

Modified: cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java?rev=1233488&r1=1233487&r2=1233488&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
Thu Jan 19 17:25:37 2012
@@ -21,7 +21,9 @@ package org.apache.cxf.aegis.type.basic;
 import java.beans.PropertyDescriptor;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.Serializable;
 import java.util.Date;
+import java.util.Set;
 
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.namespace.QName;
@@ -606,6 +608,55 @@ public class BeanTest extends AbstractAe
         assertFalse(type.getTypeInfo().getElements().iterator().hasNext());
     }
 
+    @Test
+    public void testInterfaceBeans() throws Exception {
+        defaultContext();
+        BeanType type = new BeanType();
+        type.setTypeClass(SerializableBean.class);
+        type.setTypeMapping(mapping);
+        type.setSchemaType(new QName("urn:foo", "SerializableBean"));
+
+        AegisType stringType = mapping.getType(String.class);
+        assertTrue(type.getDependencies().contains(stringType));
+
+        type = new BeanType();
+        type.setTypeClass(CloneableBean.class);
+        type.setTypeMapping(mapping);
+        type.setSchemaType(new QName("urn:foo", "CloneableBean"));
+
+        assertEquals(1, type.getDependencies().size());
+        assertTrue(type.getDependencies().contains(stringType));
+
+        type = new BeanType();
+        type.setTypeClass(SimpleInterface.class);
+        type.setTypeMapping(mapping);
+        type.setSchemaType(new QName("urn:foo", "SimpleInterface"));
+
+        assertEquals(1, type.getDependencies().size());
+        assertTrue(type.getDependencies().contains(stringType));
+
+        type = new BeanType();
+        type.setTypeClass(ExtendingInterface.class);
+        type.setTypeMapping(mapping);
+        type.setSchemaType(new QName("urn:foo", "ExtendingInterface"));
+
+        Set<AegisType> dependencies = type.getDependencies();
+        assertEquals(2, dependencies.size());
+        dependencies.remove(stringType);
+        assertEquals(SimpleInterface.class, dependencies.iterator().next().getTypeClass());
+    }
+
+    @Test
+    public void testEnumBean() throws Exception {
+        defaultContext();
+        BeanType type = new BeanType();
+        type.setTypeClass(EnumBean.class);
+        type.setTypeMapping(mapping);
+        type.setSchemaType(new QName("urn:foo", "EnumBean"));
+
+        assertTrue(type.getDependencies().isEmpty());
+    }
+
     public static class DateBean {
         private Date date;
 
@@ -706,4 +757,24 @@ public class BeanTest extends AbstractAe
             this.howdy = howdy;
         }
     }
+    
+    public interface SerializableBean extends Serializable {
+        String getString();
+    }
+    
+    public interface CloneableBean extends Cloneable {
+        String getString();
+    }
+    
+    public interface SimpleInterface {
+        String getString();
+    }
+    
+    public interface ExtendingInterface extends SimpleInterface {
+        String getAnotherString();
+    }
+    
+    public enum EnumBean {
+        VALUE1, VALUE2;
+    }
 }



Mime
View raw message