harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r598643 - /harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java
Date Tue, 27 Nov 2007 13:50:55 GMT
Author: tellison
Date: Tue Nov 27 05:50:50 2007
New Revision: 598643

URL: http://svn.apache.org/viewvc?rev=598643&view=rev
Log:
Apply regression test for HARMONY-2506 ([classlib][beans] BeanContextServiceRevokedEvent.getSourceAsBeanContextServices()
throws unexpected ClassCastException)

Modified:
    harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java?rev=598643&r1=598642&r2=598643&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java
Tue Nov 27 05:50:50 2007
@@ -17,13 +17,25 @@
 
 package org.apache.harmony.beans.tests.java.beans.beancontext;
 
+import java.beans.PropertyChangeListener;
+import java.beans.VetoableChangeListener;
 import java.beans.beancontext.BeanContext;
+import java.beans.beancontext.BeanContextChild;
+import java.beans.beancontext.BeanContextMembershipListener;
+import java.beans.beancontext.BeanContextServiceAvailableEvent;
+import java.beans.beancontext.BeanContextServiceProvider;
 import java.beans.beancontext.BeanContextServiceRevokedEvent;
+import java.beans.beancontext.BeanContextServiceRevokedListener;
 import java.beans.beancontext.BeanContextServices;
+import java.beans.beancontext.BeanContextServicesListener;
 import java.beans.beancontext.BeanContextServicesSupport;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.Serializable;
+import java.net.URL;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
 import java.util.Locale;
 
 import junit.framework.TestCase;
@@ -86,14 +98,14 @@
         } catch (NullPointerException e) {
             // expected
         }
-        
+
         try {
             event.isServiceClass(null);
             fail("NPE expected");
         } catch (NullPointerException e) {
             // expected
         }
-        
+
         event = new MockBeanContextServiceRevokedEvent(services, services
                 .getClass(), true);
         assertFalse(event.isServiceClass(null));
@@ -123,6 +135,333 @@
         event = new BeanContextServiceRevokedEvent(sup,
                 MockBeanContextServices.class, false);
         assertNotNull(event.getSourceAsBeanContextServices());
+
+        // Regression for HARMONY-2506
+        BeanContextServiceRevokedEvent obj = new BeanContextServiceRevokedEvent(
+                new testBeanContextServices(), Integer.class, true);
+
+        obj.setPropagatedFrom(new testBeanContext());
+        assertNotNull(obj.getSourceAsBeanContextServices());
+    }
+
+    class testBeanContext implements BeanContext {
+        public void removeBeanContextMembershipListener(
+                BeanContextMembershipListener p0) {
+            return;
+        }
+
+        public void addBeanContextMembershipListener(
+                BeanContextMembershipListener p0) {
+            return;
+        }
+
+        public URL getResource(String p0, BeanContextChild p1) {
+            return null;
+        }
+
+        public InputStream getResourceAsStream(String p0, BeanContextChild p1) {
+            return null;
+        }
+
+        public Object instantiateChild(String p0) {
+            return null;
+        }
+
+        public void removeVetoableChangeListener(String p0,
+                VetoableChangeListener p1) {
+            return;
+        }
+
+        public void addVetoableChangeListener(String p0,
+                VetoableChangeListener p1) {
+            return;
+        }
+
+        public void removePropertyChangeListener(String p0,
+                PropertyChangeListener p1) {
+            return;
+        }
+
+        public void addPropertyChangeListener(String p0,
+                PropertyChangeListener p1) {
+            return;
+        }
+
+        public BeanContext getBeanContext() {
+            return null;
+        }
+
+        public void setBeanContext(BeanContext p0) {
+            return;
+        }
+
+        public int hashCode() {
+            return 0;
+        }
+
+        public boolean equals(Object p0) {
+            return false;
+        }
+
+        public void clear() {
+            return;
+        }
+
+        public boolean retainAll(Collection p0) {
+            return false;
+        }
+
+        public boolean removeAll(Collection p0) {
+            return false;
+        }
+
+        public boolean addAll(Collection p0) {
+            return false;
+        }
+
+        public boolean containsAll(Collection p0) {
+            return false;
+        }
+
+        public boolean remove(Object p0) {
+            return false;
+        }
+
+        public boolean add(Object p0) {
+            return false;
+        }
+
+        public Object[] toArray(Object[] p0) {
+            return null;
+        }
+
+        public Object[] toArray() {
+            return null;
+        }
+
+        public Iterator iterator() {
+            return null;
+        }
+
+        public boolean contains(Object p0) {
+            return false;
+        }
+
+        public boolean isEmpty() {
+            return false;
+        }
+
+        public int size() {
+            return 0;
+        }
+
+        public boolean isDesignTime() {
+            return false;
+        }
+
+        public void setDesignTime(boolean p0) {
+            return;
+        }
+
+        public boolean avoidingGui() {
+            return false;
+        }
+
+        public void okToUseGui() {
+            return;
+        }
+
+        public void dontUseGui() {
+            return;
+        }
+
+        public boolean needsGui() {
+            return false;
+        }
+    }
+
+    class testBeanContextServices implements BeanContextServices {
+        public void removeBeanContextServicesListener(
+                BeanContextServicesListener p0) {
+            return;
+        }
+
+        public void addBeanContextServicesListener(
+                BeanContextServicesListener p0) {
+            return;
+        }
+
+        public Iterator getCurrentServiceSelectors(Class p0) {
+            return null;
+        }
+
+        public Iterator getCurrentServiceClasses() {
+            return null;
+        }
+
+        public void releaseService(BeanContextChild p0, Object p1, Object p2) {
+            return;
+        }
+
+        public Object getService(BeanContextChild p0, Object p1, Class p2,
+                Object p3, BeanContextServiceRevokedListener p4) {
+            return null;
+        }
+
+        public boolean hasService(Class p0) {
+            return false;
+        }
+
+        public void revokeService(Class p0, BeanContextServiceProvider p1,
+                boolean p2) {
+            return;
+        }
+
+        public boolean addService(Class p0, BeanContextServiceProvider p1) {
+            return false;
+        }
+
+        public void removeBeanContextMembershipListener(
+                BeanContextMembershipListener p0) {
+            return;
+        }
+
+        public void addBeanContextMembershipListener(
+                BeanContextMembershipListener p0) {
+            return;
+        }
+
+        public URL getResource(String p0, BeanContextChild p1) {
+            return null;
+        }
+
+        public InputStream getResourceAsStream(String p0, BeanContextChild p1) {
+            return null;
+        }
+
+        public Object instantiateChild(String p0) {
+            return null;
+        }
+
+        public void removeVetoableChangeListener(String p0,
+                VetoableChangeListener p1) {
+            return;
+        }
+
+        public void addVetoableChangeListener(String p0,
+                VetoableChangeListener p1) {
+            return;
+        }
+
+        public void removePropertyChangeListener(String p0,
+                PropertyChangeListener p1) {
+            return;
+        }
+
+        public void addPropertyChangeListener(String p0,
+                PropertyChangeListener p1) {
+            return;
+        }
+
+        public BeanContext getBeanContext() {
+            return null;
+        }
+
+        public void setBeanContext(BeanContext p0) {
+            return;
+        }
+
+        public int hashCode() {
+            return 0;
+        }
+
+        public boolean equals(Object p0) {
+            return false;
+        }
+
+        public void clear() {
+            return;
+        }
+
+        public boolean retainAll(Collection p0) {
+            return false;
+        }
+
+        public boolean removeAll(Collection p0) {
+            return false;
+        }
+
+        public boolean addAll(Collection p0) {
+            return false;
+        }
+
+        public boolean containsAll(Collection p0) {
+            return false;
+        }
+
+        public boolean remove(Object p0) {
+            return false;
+        }
+
+        public boolean add(Object p0) {
+            return false;
+        }
+
+        public Object[] toArray(Object[] p0) {
+            return null;
+        }
+
+        public Object[] toArray() {
+            return null;
+        }
+
+        public Iterator iterator() {
+            return null;
+        }
+
+        public boolean contains(Object p0) {
+            return false;
+        }
+
+        public boolean isEmpty() {
+            return false;
+        }
+
+        public int size() {
+            return 0;
+        }
+
+        public boolean isDesignTime() {
+            return false;
+        }
+
+        public void setDesignTime(boolean p0) {
+            return;
+        }
+
+        public boolean avoidingGui() {
+            return false;
+        }
+
+        public void okToUseGui() {
+            return;
+        }
+
+        public void dontUseGui() {
+            return;
+        }
+
+        public boolean needsGui() {
+            return false;
+        }
+
+        public void serviceAvailable(BeanContextServiceAvailableEvent p0) {
+            return;
+        }
+
+        public void serviceRevoked(BeanContextServiceRevokedEvent p0) {
+            return;
+        }
     }
 
     public void testGetServiceClass() {
@@ -164,19 +503,19 @@
 
     }
 
-     public void testSerialization_Compatibility() throws Exception {
-         BeanContextServiceRevokedEvent event = new BeanContextServiceRevokedEvent(
-                 new MockBeanContextServices(), ArrayList.class, true);
-         event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
-         SerializationTest.verifyGolden(this, event, new SerializableAssert(){
-             public void assertDeserialized(Serializable orig, Serializable ser) {
-                 assertEqualsSerially((BeanContextServiceRevokedEvent) orig,
-                         (BeanContextServiceRevokedEvent) ser);
-             }
-         });
-     }
-     
-     public void testConstructor() throws Exception {
+    public void testSerialization_Compatibility() throws Exception {
+        BeanContextServiceRevokedEvent event = new BeanContextServiceRevokedEvent(
+                new MockBeanContextServices(), ArrayList.class, true);
+        event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
+        SerializationTest.verifyGolden(this, event, new SerializableAssert() {
+            public void assertDeserialized(Serializable orig, Serializable ser) {
+                assertEqualsSerially((BeanContextServiceRevokedEvent) orig,
+                        (BeanContextServiceRevokedEvent) ser);
+            }
+        });
+    }
+
+    public void testConstructor() throws Exception {
         BeanContextServices bcs = new MockBeanContextServices();
         BeanContextServiceRevokedEvent event = new BeanContextServiceRevokedEvent(
                 bcs, ArrayList.class, true);
@@ -187,7 +526,7 @@
         assertSame(bcs, event.getSourceAsBeanContextServices());
         assertFalse(event.isPropagated());
     }
-     
+
     private void assertEqualsSerially(BeanContextServiceRevokedEvent orig,
             BeanContextServiceRevokedEvent ser) {
         assertNull(ser.getSource());



Mime
View raw message