harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r557492 - 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 Thu, 19 Jul 2007 05:22:14 GMT
Author: tonywu
Date: Wed Jul 18 22:22:13 2007
New Revision: 557492

URL: http://svn.apache.org/viewvc?view=rev&rev=557492
Log:
write testcase for default property index and event index

Added:
    harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox03.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox031.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox031BeanInfo.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox03BeanInfo.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=557492&r1=557491&r2=557492
==============================================================================
--- 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
Wed Jul 18 22:22:13 2007
@@ -53,6 +53,7 @@
 import org.apache.harmony.beans.tests.support.mock.FakeFox011;
 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.MockButton;
 import org.apache.harmony.beans.tests.support.mock.MockFoo;
 import org.apache.harmony.beans.tests.support.mock.MockFooButton;
@@ -2047,6 +2048,15 @@
             assertFalse(event.isHidden());
             assertFalse(event.isPreferred());
         }
+    }
+
+    public void testDefaultIndex() throws IntrospectionException {
+        Introspector
+                .setBeanInfoSearchPath(new String[] { "org.apache.harmony.beans.tests.support"
});
+
+        BeanInfo dummyInfo = Introspector.getBeanInfo(FakeFox031.class);
+        assertEquals(-1, dummyInfo.getDefaultPropertyIndex());
+        assertEquals(-1, dummyInfo.getDefaultEventIndex());
     }
 
     static class MockBaseClassForPorpertiesStandard {

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox03.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox03.java?view=auto&rev=557492
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox03.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox03.java
Wed Jul 18 22:22:13 2007
@@ -0,0 +1,11 @@
+package org.apache.harmony.beans.tests.support.mock;
+
+public class FakeFox03 {
+    public int getOther() {
+
+        return 0;
+
+    }
+
+    public void setOther(int other) {}
+}

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

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox031.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox031.java?view=auto&rev=557492
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox031.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox031.java
Wed Jul 18 22:22:13 2007
@@ -0,0 +1,14 @@
+package org.apache.harmony.beans.tests.support.mock;
+
+public class FakeFox031 {
+    public int[] getDefault() {
+        return null;
+    }
+    public void setDefault( int[] i ) {}
+
+        
+    public int indexedGetDefault( int i) {
+        return 0;
+    }
+    public void indexedSetDefault( int i, int b ) {}
+}

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

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox031BeanInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox031BeanInfo.java?view=auto&rev=557492
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox031BeanInfo.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox031BeanInfo.java
Wed Jul 18 22:22:13 2007
@@ -0,0 +1,37 @@
+package org.apache.harmony.beans.tests.support.mock;
+
+import java.beans.BeanDescriptor;
+import java.beans.BeanInfo;
+import java.beans.EventSetDescriptor;
+import java.beans.PropertyDescriptor;
+import java.beans.SimpleBeanInfo;
+
+public class FakeFox031BeanInfo extends SimpleBeanInfo{
+    public FakeFox031BeanInfo() {
+        super();
+    }
+
+    public BeanDescriptor getBeanDescriptor() {
+        BeanDescriptor descriptor = new BeanDescriptor(FakeFox031.class);
+        descriptor.setName("DummyBean Descriptor");
+        return descriptor;
+    }
+
+    public BeanInfo[] getAdditionalBeanInfo() {
+
+        return new BeanInfo[] { new FakeFox03BeanInfo() };
+
+    }
+
+    public PropertyDescriptor[] getPropertyDescriptors() {
+        return new PropertyDescriptor[] {};
+    }
+
+    public EventSetDescriptor[] getEventSetDescriptors() {
+        return new EventSetDescriptor[] {};
+    }
+
+    PropertyDescriptor propdescr[];
+
+    EventSetDescriptor eventdescr[];
+}

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

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox03BeanInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox03BeanInfo.java?view=auto&rev=557492
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox03BeanInfo.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/mock/FakeFox03BeanInfo.java
Wed Jul 18 22:22:13 2007
@@ -0,0 +1,77 @@
+package org.apache.harmony.beans.tests.support.mock;
+
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.beans.BeanDescriptor;
+import java.beans.EventSetDescriptor;
+import java.beans.PropertyDescriptor;
+import java.beans.SimpleBeanInfo;
+
+public class FakeFox03BeanInfo extends SimpleBeanInfo {
+
+    PropertyDescriptor propdescr[];
+
+    EventSetDescriptor eventdescr[];
+
+    public FakeFox03BeanInfo() {
+        super();
+        try {
+            propdescr = new PropertyDescriptor[] { new PropertyDescriptor(
+                    "Other", FakeFox03.class) };
+            eventdescr = new EventSetDescriptor[] { new EventSetDescriptor(
+                    SomeOtherObject.class, "SomeOther",
+                    SomeOtherListener.class, "aMethod") };
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public BeanDescriptor getBeanDescriptor() {
+        BeanDescriptor descriptor = new BeanDescriptor(FakeFox03.class);
+        descriptor.setName("SomeOtherBean Descriptor");
+        return descriptor;
+    }
+
+    public static final Image someOtherImage = new BufferedImage(1, 1,
+            BufferedImage.TYPE_3BYTE_BGR);
+
+    public Image getIcon(int iconKind) {
+        return someOtherImage;
+
+    }
+
+    public int getDefaultPropertyIndex() {
+        System.out
+                .println("SomeOtherBeanBeanInfo.getDefaultPropertyIndex() called...");
+        return propdescr.length - 1;
+    }
+
+    public PropertyDescriptor[] getPropertyDescriptors() {
+        return propdescr;
+    }
+
+    public int getDefaultEventIndex() {
+        return eventdescr.length - 1;
+    }
+
+    public EventSetDescriptor[] getEventSetDescriptors() {
+        return eventdescr;
+    }
+
+    private interface SomeOtherListener {
+        public void aMethod(SomeOtherEvent s);
+    }
+
+    private class SomeOtherObject {
+        public void addFakeFox03BeanInfo$SomeOtherListener(
+                SomeOtherListener l) {
+        }
+
+        public void removeFakeFox03BeanInfo$SomeOtherListener(
+                SomeOtherListener l) {
+        }
+    }
+
+    private class SomeOtherEvent {
+    }
+}

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



Mime
View raw message