harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r557847 - in /harmony/enhanced/classlib/trunk/modules/beans/src/test: java/org/apache/harmony/beans/tests/java/beans/ support/java/org/apache/harmony/beans/tests/support/mock/
Date Fri, 20 Jul 2007 02:44:53 GMT
Author: tonywu
Date: Thu Jul 19 19:44:52 2007
New Revision: 557847

URL: http://svn.apache.org/viewvc?view=rev&rev=557847
Log:
enrich tests for Introspector

Added:
    harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox04.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox041.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox0411.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSubClass.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSubClassBeanInfo.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSuperClass.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSuperClassBeanInfo.java
  (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java?view=diff&rev=557847&r1=557846&r2=557847
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
Thu Jul 19 19:44:52 2007
@@ -54,6 +54,8 @@
 import org.apache.harmony.beans.tests.support.mock.FakeFox01BeanInfo;
 import org.apache.harmony.beans.tests.support.mock.FakeFox02;
 import org.apache.harmony.beans.tests.support.mock.FakeFox031;
+import org.apache.harmony.beans.tests.support.mock.FakeFox041;
+import org.apache.harmony.beans.tests.support.mock.FakeFox0411;
 import org.apache.harmony.beans.tests.support.mock.MockButton;
 import org.apache.harmony.beans.tests.support.mock.MockFoo;
 import org.apache.harmony.beans.tests.support.mock.MockFooButton;
@@ -62,6 +64,7 @@
 import org.apache.harmony.beans.tests.support.mock.MockFooSub;
 import org.apache.harmony.beans.tests.support.mock.MockFooSubSub;
 import org.apache.harmony.beans.tests.support.mock.MockJavaBean;
+import org.apache.harmony.beans.tests.support.mock.MockNullSubClass;
 import org.apache.harmony.beans.tests.support.mock.MockSubClass;
 
 /**
@@ -1317,6 +1320,17 @@
         }
         assertTrue(eventFound);
     }
+
+    public void testGetBeanInfoExplicitNull() throws Exception {
+        Introspector.flushCaches();
+        BeanInfo subinfo = Introspector.getBeanInfo(MockNullSubClass.class);
+        assertNotNull(subinfo.getPropertyDescriptors());
+        assertNotNull(subinfo.getEventSetDescriptors());
+        assertNotNull(subinfo.getMethodDescriptors());
+        assertEquals(-1, subinfo.getDefaultEventIndex());
+        assertEquals(-1, subinfo.getDefaultPropertyIndex());
+    }
+
     static class FakeFoxInfo {
 
         public int getProp6(boolean i) {
@@ -2068,6 +2082,31 @@
             assertFalse(pd.isPreferred());
         }
         assertEquals(2, info.getPropertyDescriptors().length);
+        
+        BeanInfo dummyInfo = Introspector.getBeanInfo(FakeFox041.class);
+        PropertyDescriptor[] p = dummyInfo.getPropertyDescriptors();
+        assertFalse(p[0].isBound());
+        assertFalse(p[0].isConstrained());
+        assertFalse(p[1].isBound());
+        assertFalse(p[1].isConstrained());
+        assertTrue(p[2].isBound());
+        assertTrue(p[2].isConstrained());
+        
+        dummyInfo = Introspector.getBeanInfo(FakeFox0411.class);
+        p = dummyInfo.getPropertyDescriptors();
+        assertFalse(p[0].isBound());
+        assertFalse(p[0].isConstrained());
+        assertFalse(p[1].isBound());
+        assertFalse(p[1].isConstrained());
+        assertTrue(p[2].isBound());
+        assertFalse(p[2].isConstrained());
+        assertTrue(p[3].isBound());
+        assertTrue(p[3].isConstrained());
+        
+        dummyInfo = Introspector.getBeanInfo(FakeFox0411.class, FakeFox041.class);
+        p = dummyInfo.getPropertyDescriptors();
+        assertFalse(p[0].isBound());
+        assertFalse(p[0].isConstrained());
     }
 
     public void testDefaultEvent() throws IntrospectionException {
@@ -2114,6 +2153,7 @@
             a = i;
         }
     }
+    
     static class MockClassForDefaultEvent {
         public void addPropertyChangeListener(PropertyChangeListener a) {
         }

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox04.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox04.java?view=auto&rev=557847
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox04.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox04.java
Thu Jul 19 19:44:52 2007
@@ -0,0 +1,13 @@
+package org.apache.harmony.beans.tests.support.mock;
+
+
+public class FakeFox04 extends Object {
+
+    public int[] getOneProp() {
+        return null;
+    }
+
+    public void setOneProp(int[] i) {
+    }
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox04.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox041.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox041.java?view=auto&rev=557847
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox041.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox041.java
Thu Jul 19 19:44:52 2007
@@ -0,0 +1,25 @@
+package org.apache.harmony.beans.tests.support.mock;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyVetoException;
+
+public class FakeFox041 extends FakeFox04 {
+
+    public int[] getTwoProp() {
+        return null;
+    }
+
+    // throwing PropertyVetoException makes this property constrained.
+    public void setTwoProp(int[] i) throws PropertyVetoException {
+    }
+
+    // being able to add/remove listeners makes this classes properties bound.
+    // but it does not bind properties in any superclasses.
+    // both add and remove methods are required.
+    public void addPropertyChangeListener(PropertyChangeListener l) {
+    }
+
+    public void removePropertyChangeListener(PropertyChangeListener l) {
+    }
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox041.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox0411.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox0411.java?view=auto&rev=557847
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox0411.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox0411.java
Thu Jul 19 19:44:52 2007
@@ -0,0 +1,15 @@
+package org.apache.harmony.beans.tests.support.mock;
+
+import java.beans.PropertyVetoException;
+
+public class FakeFox0411 extends FakeFox041 {
+
+    public int[] getThreeProp() {
+        return null;
+    }
+
+    // throwing PropertyVetoException makes this property constrained.
+    public void setThreeProp(int[] i) {
+    }
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox0411.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSubClass.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSubClass.java?view=auto&rev=557847
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSubClass.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSubClass.java
Thu Jul 19 19:44:52 2007
@@ -0,0 +1,5 @@
+package org.apache.harmony.beans.tests.support.mock;
+
+public class MockNullSubClass extends MockNullSuperClass{
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSubClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSubClassBeanInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSubClassBeanInfo.java?view=auto&rev=557847
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSubClassBeanInfo.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSubClassBeanInfo.java
Thu Jul 19 19:44:52 2007
@@ -0,0 +1,28 @@
+package org.apache.harmony.beans.tests.support.mock;
+
+import java.beans.EventSetDescriptor;
+import java.beans.MethodDescriptor;
+import java.beans.PropertyDescriptor;
+import java.beans.SimpleBeanInfo;
+
+public class MockNullSubClassBeanInfo extends SimpleBeanInfo{
+    public PropertyDescriptor[] getPropertyDescriptors(){
+        return null;
+    }
+    
+    public MethodDescriptor[] getMethodDescriptors(){
+        return null;
+    }
+    
+    public EventSetDescriptor[] getEventSetDescriptors(){
+        return null;
+    }
+    
+    public int getDefaultEventIndex(){
+        return Integer.MIN_VALUE;
+    }
+    
+    public int  getDefaultPropertyIndex(){
+        return Integer.MIN_VALUE;
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSubClassBeanInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSuperClass.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSuperClass.java?view=auto&rev=557847
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSuperClass.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSuperClass.java
Thu Jul 19 19:44:52 2007
@@ -0,0 +1,5 @@
+package org.apache.harmony.beans.tests.support.mock;
+
+public class MockNullSuperClass {
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSuperClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSuperClassBeanInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSuperClassBeanInfo.java?view=auto&rev=557847
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSuperClassBeanInfo.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSuperClassBeanInfo.java
Thu Jul 19 19:44:52 2007
@@ -0,0 +1,20 @@
+package org.apache.harmony.beans.tests.support.mock;
+
+import java.beans.EventSetDescriptor;
+import java.beans.MethodDescriptor;
+import java.beans.PropertyDescriptor;
+import java.beans.SimpleBeanInfo;
+
+public class MockNullSuperClassBeanInfo extends SimpleBeanInfo{
+    public PropertyDescriptor[] getPropertyDescriptors(){
+        return null;
+    }
+    
+    public MethodDescriptor[] getMethodDescriptors(){
+        return null;
+    }
+    
+    public EventSetDescriptor[] getEventSetDescriptors(){
+        return null;
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/MockNullSuperClassBeanInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message