harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r475304 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test: java/org/apache/harmony/beans/tests/java/beans/ support/java/org/apache/harmony/beans/infos/ support/java/org/apache/harmony/beans/tests/support/
Date Wed, 15 Nov 2006 16:39:32 GMT
Author: ayza
Date: Wed Nov 15 08:39:31 2006
New Revision: 475304

URL: http://svn.apache.org/viewvc?view=rev&rev=475304
Log:
[classlib][beans] another three tests were corrected in IntrospectorTest

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/infos/
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/infos/MockFooButtonBeanInfo.java
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/OtherBean.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java?view=diff&rev=475304&r1=475303&r2=475304
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
Wed Nov 15 08:39:31 2006
@@ -170,10 +170,13 @@
     public void testEventSetDescriptorWithoutAddListenerMethod()
             throws IntrospectionException {
         BeanInfo info = Introspector.getBeanInfo(OtherBean.class);
+        EventSetDescriptor[] descriptors;
+
         assertNotNull(info);
-        EventSetDescriptor[] descriptors = info.getEventSetDescriptors();
+        descriptors = info.getEventSetDescriptors();
         assertNotNull(descriptors);
-        assertEquals(0, descriptors.length);
+        assertEquals(1, descriptors.length);
+        assertTrue(contains("sample", descriptors));
     }
 
     /**
@@ -673,12 +676,13 @@
     public void testGetBeanInfoSearchPath_Default()
             throws IntrospectionException, ClassNotFoundException {
         BeanInfo info = Introspector.getBeanInfo(MockFooButton.class);
-
         PropertyDescriptor[] pds = info.getPropertyDescriptors();
+        BeanDescriptor beanDesc;
+
         assertEquals(1, pds.length);
         assertEquals("text.MockFooButtonBeanInfo", pds[0].getName());
 
-        BeanDescriptor beanDesc = info.getBeanDescriptor();
+        beanDesc = info.getBeanDescriptor();
         assertEquals("MockFooButton.MockFooButtonBeanInfo", beanDesc.getName());
     }
 
@@ -818,18 +822,22 @@
     public void testIntrospection_5() throws IntrospectionException {
         Class<FakeFox401> beanClass = FakeFox401.class;
         BeanInfo info = Introspector.getBeanInfo(beanClass);
+        PropertyDescriptor[] pds;
+
         assertEquals(0, info.getEventSetDescriptors().length);
         assertEquals(13, info.getMethodDescriptors().length);
 
-        PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
-        assertEquals(2, propertyDesc.length);
+        pds = info.getPropertyDescriptors();
+        assertEquals(2, pds.length);
 
-        for (PropertyDescriptor element : propertyDesc) {
+        for (PropertyDescriptor element : pds) {
             if (element.getName().equals("class")) {
                 assertNull(element.getWriteMethod());
                 assertNotNull(element.getReadMethod());
             } else {
-                IndexedPropertyDescriptor indexedDesc = (IndexedPropertyDescriptor) element;
+                IndexedPropertyDescriptor indexedDesc =
+                        (IndexedPropertyDescriptor) element;
+                
                 assertEquals("fox401", element.getName());
                 assertEquals(String[].class.getName(), element
                         .getPropertyType().getName());
@@ -1374,9 +1382,6 @@
         PropertyDescriptor[] propertyDescriptors = Introspector.getBeanInfo(
                 Bean.class).getPropertyDescriptors();
 
-        for (PropertyDescriptor elem : propertyDescriptors) {
-            System.out.println("UUU " + elem.getName());
-        }
         assertEquals("class", propertyDescriptors[0].getName());
         assertEquals("prop1", propertyDescriptors[1].getName());
         assertEquals("prop2", propertyDescriptors[2].getName());
@@ -1529,11 +1534,11 @@
         return false;
     }
 
-    private static boolean contains(String methodName,
+    private static boolean contains(String eventSetName,
             EventSetDescriptor[] esds)
     {
         for (EventSetDescriptor esd : esds) {
-            if (methodName.equals(esd.getName())) {
+            if (eventSetName.equals(esd.getName())) {
                 return true;
             }
         }

Added: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/infos/MockFooButtonBeanInfo.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/infos/MockFooButtonBeanInfo.java?view=auto&rev=475304
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/infos/MockFooButtonBeanInfo.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/infos/MockFooButtonBeanInfo.java
Wed Nov 15 08:39:31 2006
@@ -0,0 +1,53 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.beans.infos;
+
+import java.beans.BeanDescriptor;
+import java.beans.IntrospectionException;
+import java.beans.PropertyDescriptor;
+import java.beans.SimpleBeanInfo;
+
+import org.apache.harmony.beans.tests.support.mock.MockFooButton;
+
+/**
+ * BeanInfo for the MockFooButton class 
+ */
+public class MockFooButtonBeanInfo extends SimpleBeanInfo {
+    private final Class<MockFooButton> clazz = MockFooButton.class;
+    private final String suffix = ".MockFooButtonBeanInfo";
+
+    @Override
+    public BeanDescriptor getBeanDescriptor() {
+        BeanDescriptor beanDesc = new BeanDescriptor(clazz);
+
+        beanDesc.setName(beanDesc.getName() + suffix);
+        return beanDesc;
+    }
+
+    @Override
+    public PropertyDescriptor[] getPropertyDescriptors() {
+        PropertyDescriptor pd = null;
+
+        try {
+            pd = new PropertyDescriptor("text", clazz);
+            pd.setName(pd.getName() + suffix);
+        } catch (IntrospectionException e) {}
+        
+        return new PropertyDescriptor[] { pd };
+    }
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/OtherBean.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/OtherBean.java?view=diff&rev=475304&r1=475303&r2=475304
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/OtherBean.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/OtherBean.java
Wed Nov 15 08:39:31 2006
@@ -15,16 +15,9 @@
  *  limitations under the License.
  */
 
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.2.6.3 $
- */
 package org.apache.harmony.beans.tests.support;
 
-/**
- * @author Maxim V. Berkultsev
- * @version $Revision: 1.2.6.3 $
- */
+import java.beans.PropertyChangeListener;
 
 public class OtherBean {
 
@@ -34,6 +27,10 @@
     public void removeSampleListener(SampleListener listener) {
     }
 
+    // no corresponding add method
+    public void removePropertyChangeListener(PropertyChangeListener listener) {
+    }
+   
     public void setNumber(int a) {
     }
 



Mime
View raw message