harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r446483 [4/8] - in /incubator/harmony/enhanced/classlib/trunk/modules/beans: .settings/ META-INF/ make/ src/main/java/java/beans/ src/main/java/java/beans/beancontext/ src/main/java/org/apache/harmony/beans/ src/main/java/org/apache/harmony...
Date Fri, 15 Sep 2006 02:53:28 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextMembershipEventTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextMembershipEventTest.java?view=diff&rev=446483&r1=446482&r2=446483
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextMembershipEventTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextMembershipEventTest.java Thu Sep 14 19:53:17 2006
@@ -1,284 +1,284 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.tests.java.beans.beancontext;
-
-import java.beans.beancontext.BeanContext;
-import java.beans.beancontext.BeanContextMembershipEvent;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import junit.framework.TestCase;
-
-import org.apache.harmony.beans.tests.support.beancontext.Utils;
-import org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContext;
-import org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextDelegateS;
-
-import tests.util.SerializationTester;
-
-/**
- * Test BeanContextMembershipEvent
- */
-public class BeanContextMembershipEventTest extends TestCase {
-
-    private static class MockBeanContextMembershipEvent extends
-            BeanContextMembershipEvent {
-
-        static final long serialVersionUID = -4761911723636245515L;
-        
-        /**
-         * @param bc
-         * @param changes
-         */
-        public MockBeanContextMembershipEvent(BeanContext bc, Object[] changes) {
-            super(bc, changes);
-        }
-
-        /**
-         * @param bc
-         * @param changes
-         */
-        public MockBeanContextMembershipEvent(BeanContext bc, Collection changes) {
-            super(bc, changes);
-        }
-
-        public Collection collection() {
-            return this.children;
-        }
-    }
-
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(BeanContextMembershipEventTest.class);
-    }
-
-    public void testBeanContextMembershipEvent_NullParam() {
-        BeanContext ctx = new MockBeanContext();
-        Collection<String> c = new ArrayList<String>();
-        c.add("1");
-        c.add("2");
-        c.add("3");
-        String array[] = new String[] { "1", "2", "3" };
-
-        try {
-            new MockBeanContextMembershipEvent(null, c);
-            fail("IAE expected");
-        } catch (IllegalArgumentException e) {
-            // expected
-        }
-
-        try {
-            new MockBeanContextMembershipEvent(null, array);
-            fail("IAE expected");
-        } catch (IllegalArgumentException e) {
-            // expected
-        }
-
-        try {
-            new MockBeanContextMembershipEvent(ctx, (Collection) null);
-            fail("NPE expected");
-        } catch (NullPointerException e) {
-            // expected
-        }
-
-        try {
-            new MockBeanContextMembershipEvent(ctx, (Object[]) null);
-            fail("NPE expected");
-        } catch (NullPointerException e) {
-            // expected
-        }
-    }
-
-    /*
-     * Class under test for void
-     * BeanContextMembershipEvent(java.beans.beancontext.BeanContext,
-     * java.util.Collection)
-     */
-    public void testBeanContextMembershipEventBeanContextCollection() {
-        BeanContext ctx = new MockBeanContext();
-        Collection<String> c = new ArrayList<String>();
-        c.add("1");
-        c.add("2");
-        c.add("3");
-        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-                ctx, c);
-        assertSame(c, event.collection());
-    }
-
-    /*
-     * Class under test for void
-     * BeanContextMembershipEvent(java.beans.beancontext.BeanContext,
-     * java.lang.Object[])
-     */
-    public void testBeanContextMembershipEventBeanContextObjectArray() {
-        BeanContext ctx = new MockBeanContext();
-        String array[] = new String[] { "1", "2", "3" };
-        new MockBeanContextMembershipEvent(ctx, array);
-    }
-
-    public void testSize_Collection() {
-        BeanContext ctx = new MockBeanContext();
-        Collection<String> c = new ArrayList<String>();
-        c.add("1");
-        c.add("2");
-        c.add("3");
-        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-                ctx, c);
-        assertEquals(3, event.size());
-    }
-
-    public void testSize_Array() {
-        BeanContext ctx = new MockBeanContext();
-        String array[] = new String[] { "1", "2", "3" };
-        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-                ctx, array);
-        assertEquals(3, event.size());
-    }
-
-    public void testContains_Collection() {
-        BeanContext ctx = new MockBeanContext();
-        Collection<String> c = new ArrayList<String>();
-        c.add("1");
-        c.add("2");
-        c.add("3");
-        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-                ctx, c);
-        assertTrue(event.contains("1"));
-        assertTrue(event.contains("2"));
-        assertTrue(event.contains("3"));
-        assertFalse(event.contains(null));
-        assertFalse(event.contains("4"));
-    }
-
-    public void testContains_Array() {
-        BeanContext ctx = new MockBeanContext();
-        String array[] = new String[] { "1", "2", "3" };
-        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-                ctx, array);
-        assertTrue(event.contains("1"));
-        assertTrue(event.contains("2"));
-        assertTrue(event.contains("3"));
-        assertFalse(event.contains(null));
-        assertFalse(event.contains("4"));
-    }
-
-    public void testToArray_Collection() {
-        BeanContext ctx = new MockBeanContext();
-        Collection<String> c = new ArrayList<String>();
-        c.add("1");
-        c.add("2");
-        c.add("3");
-        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-                ctx, c);
-        Object resultArray[] = event.toArray();
-        assertEquals(3, resultArray.length);
-        assertEquals("1", resultArray[0]);
-        assertEquals("2", resultArray[1]);
-        assertEquals("3", resultArray[2]);
-    }
-
-    public void testToArray_Array() {
-        BeanContext ctx = new MockBeanContext();
-        String array[] = new String[] { "1", "2", "3" };
-        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-                ctx, array);
-        Object resultArray[] = event.toArray();
-        assertEquals(3, resultArray.length);
-        assertEquals("1", resultArray[0]);
-        assertEquals("2", resultArray[1]);
-        assertEquals("3", resultArray[2]);
-    }
-
-    public void testIterator_Collection() {
-        BeanContext ctx = new MockBeanContext();
-        Collection<String> c = new ArrayList<String>();
-        c.add("1");
-        c.add("2");
-        c.add("3");
-        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-                ctx, c);
-        Iterator it = event.iterator();
-        assertEquals("1", it.next());
-        assertEquals("2", it.next());
-        assertEquals("3", it.next());
-        assertFalse(it.hasNext());
-    }
-
-    public void testIterator_Array() {
-        BeanContext ctx = new MockBeanContext();
-        String array[] = new String[] { "1", "2", "3" };
-        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-                ctx, array);
-        Iterator it = event.iterator();
-        assertEquals("1", it.next());
-        assertEquals("2", it.next());
-        assertEquals("3", it.next());
-        assertFalse(it.hasNext());
-    }
-
-    public void testSerialization() throws IOException, ClassNotFoundException {
-        ArrayList<String> things = new ArrayList<String>();
-        things.add("1");
-        things.add("2");
-        things.add("3");
-        BeanContextMembershipEvent event = new BeanContextMembershipEvent(
-                new MockBeanContext(), things);
-        event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
-
-        assertEqualsSerially(event,
-                (BeanContextMembershipEvent) SerializationTester
-                        .getDeserilizedObject(event));
-    }
-
-    public void testSerialization_Compatibility() throws Exception {
-        ArrayList<String> things = new ArrayList<String>();
-        things.add("1");
-        things.add("2");
-        things.add("3");
-        BeanContextMembershipEvent event = new BeanContextMembershipEvent(
-                new MockBeanContext(), things);
-        event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
-
-        assertEqualsSerially(
-                event,
-                (BeanContextMembershipEvent) SerializationTester
-                        .readObject(event,
-                                "serialization/java/beans/beancontext/BeanContextMembershipEvent.ser"));
-    }
-
-    private void assertEqualsSerially(BeanContextMembershipEvent orig,
-            BeanContextMembershipEvent ser) {
-        assertNull(ser.getSource());
-
-        // check propagatedFrom
-        if (orig.getPropagatedFrom() instanceof Serializable) {
-            BeanContext origFrom = orig.getPropagatedFrom();
-            BeanContext serFrom = ser.getPropagatedFrom();
-            assertEquals(origFrom.getClass(), serFrom.getClass());
-            if (origFrom instanceof MockBeanContextDelegateS) {
-                assertEquals(((MockBeanContextDelegateS) origFrom).id,
-                        ((MockBeanContextDelegateS) serFrom).id);
-            }
-        }
-
-        // check children
-        Collection origChildren = (Collection) Utils.getField(orig, "children");
-        Collection serChildren = (Collection) Utils.getField(ser, "children");
-        assertEquals(origChildren, serChildren);
-    }
-
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.tests.java.beans.beancontext;
+
+import java.beans.beancontext.BeanContext;
+import java.beans.beancontext.BeanContextMembershipEvent;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.apache.harmony.beans.tests.support.beancontext.Utils;
+import org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContext;
+import org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextDelegateS;
+
+import tests.util.SerializationTester;
+
+/**
+ * Test BeanContextMembershipEvent
+ */
+public class BeanContextMembershipEventTest extends TestCase {
+
+    private static class MockBeanContextMembershipEvent extends
+            BeanContextMembershipEvent {
+
+        static final long serialVersionUID = -4761911723636245515L;
+        
+        /**
+         * @param bc
+         * @param changes
+         */
+        public MockBeanContextMembershipEvent(BeanContext bc, Object[] changes) {
+            super(bc, changes);
+        }
+
+        /**
+         * @param bc
+         * @param changes
+         */
+        public MockBeanContextMembershipEvent(BeanContext bc, Collection changes) {
+            super(bc, changes);
+        }
+
+        public Collection collection() {
+            return this.children;
+        }
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(BeanContextMembershipEventTest.class);
+    }
+
+    public void testBeanContextMembershipEvent_NullParam() {
+        BeanContext ctx = new MockBeanContext();
+        Collection<String> c = new ArrayList<String>();
+        c.add("1");
+        c.add("2");
+        c.add("3");
+        String array[] = new String[] { "1", "2", "3" };
+
+        try {
+            new MockBeanContextMembershipEvent(null, c);
+            fail("IAE expected");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+
+        try {
+            new MockBeanContextMembershipEvent(null, array);
+            fail("IAE expected");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+
+        try {
+            new MockBeanContextMembershipEvent(ctx, (Collection) null);
+            fail("NPE expected");
+        } catch (NullPointerException e) {
+            // expected
+        }
+
+        try {
+            new MockBeanContextMembershipEvent(ctx, (Object[]) null);
+            fail("NPE expected");
+        } catch (NullPointerException e) {
+            // expected
+        }
+    }
+
+    /*
+     * Class under test for void
+     * BeanContextMembershipEvent(java.beans.beancontext.BeanContext,
+     * java.util.Collection)
+     */
+    public void testBeanContextMembershipEventBeanContextCollection() {
+        BeanContext ctx = new MockBeanContext();
+        Collection<String> c = new ArrayList<String>();
+        c.add("1");
+        c.add("2");
+        c.add("3");
+        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+                ctx, c);
+        assertSame(c, event.collection());
+    }
+
+    /*
+     * Class under test for void
+     * BeanContextMembershipEvent(java.beans.beancontext.BeanContext,
+     * java.lang.Object[])
+     */
+    public void testBeanContextMembershipEventBeanContextObjectArray() {
+        BeanContext ctx = new MockBeanContext();
+        String array[] = new String[] { "1", "2", "3" };
+        new MockBeanContextMembershipEvent(ctx, array);
+    }
+
+    public void testSize_Collection() {
+        BeanContext ctx = new MockBeanContext();
+        Collection<String> c = new ArrayList<String>();
+        c.add("1");
+        c.add("2");
+        c.add("3");
+        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+                ctx, c);
+        assertEquals(3, event.size());
+    }
+
+    public void testSize_Array() {
+        BeanContext ctx = new MockBeanContext();
+        String array[] = new String[] { "1", "2", "3" };
+        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+                ctx, array);
+        assertEquals(3, event.size());
+    }
+
+    public void testContains_Collection() {
+        BeanContext ctx = new MockBeanContext();
+        Collection<String> c = new ArrayList<String>();
+        c.add("1");
+        c.add("2");
+        c.add("3");
+        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+                ctx, c);
+        assertTrue(event.contains("1"));
+        assertTrue(event.contains("2"));
+        assertTrue(event.contains("3"));
+        assertFalse(event.contains(null));
+        assertFalse(event.contains("4"));
+    }
+
+    public void testContains_Array() {
+        BeanContext ctx = new MockBeanContext();
+        String array[] = new String[] { "1", "2", "3" };
+        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+                ctx, array);
+        assertTrue(event.contains("1"));
+        assertTrue(event.contains("2"));
+        assertTrue(event.contains("3"));
+        assertFalse(event.contains(null));
+        assertFalse(event.contains("4"));
+    }
+
+    public void testToArray_Collection() {
+        BeanContext ctx = new MockBeanContext();
+        Collection<String> c = new ArrayList<String>();
+        c.add("1");
+        c.add("2");
+        c.add("3");
+        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+                ctx, c);
+        Object resultArray[] = event.toArray();
+        assertEquals(3, resultArray.length);
+        assertEquals("1", resultArray[0]);
+        assertEquals("2", resultArray[1]);
+        assertEquals("3", resultArray[2]);
+    }
+
+    public void testToArray_Array() {
+        BeanContext ctx = new MockBeanContext();
+        String array[] = new String[] { "1", "2", "3" };
+        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+                ctx, array);
+        Object resultArray[] = event.toArray();
+        assertEquals(3, resultArray.length);
+        assertEquals("1", resultArray[0]);
+        assertEquals("2", resultArray[1]);
+        assertEquals("3", resultArray[2]);
+    }
+
+    public void testIterator_Collection() {
+        BeanContext ctx = new MockBeanContext();
+        Collection<String> c = new ArrayList<String>();
+        c.add("1");
+        c.add("2");
+        c.add("3");
+        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+                ctx, c);
+        Iterator it = event.iterator();
+        assertEquals("1", it.next());
+        assertEquals("2", it.next());
+        assertEquals("3", it.next());
+        assertFalse(it.hasNext());
+    }
+
+    public void testIterator_Array() {
+        BeanContext ctx = new MockBeanContext();
+        String array[] = new String[] { "1", "2", "3" };
+        MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+                ctx, array);
+        Iterator it = event.iterator();
+        assertEquals("1", it.next());
+        assertEquals("2", it.next());
+        assertEquals("3", it.next());
+        assertFalse(it.hasNext());
+    }
+
+    public void testSerialization() throws IOException, ClassNotFoundException {
+        ArrayList<String> things = new ArrayList<String>();
+        things.add("1");
+        things.add("2");
+        things.add("3");
+        BeanContextMembershipEvent event = new BeanContextMembershipEvent(
+                new MockBeanContext(), things);
+        event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
+
+        assertEqualsSerially(event,
+                (BeanContextMembershipEvent) SerializationTester
+                        .getDeserilizedObject(event));
+    }
+
+    public void testSerialization_Compatibility() throws Exception {
+        ArrayList<String> things = new ArrayList<String>();
+        things.add("1");
+        things.add("2");
+        things.add("3");
+        BeanContextMembershipEvent event = new BeanContextMembershipEvent(
+                new MockBeanContext(), things);
+        event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
+
+        assertEqualsSerially(
+                event,
+                (BeanContextMembershipEvent) SerializationTester
+                        .readObject(event,
+                                "serialization/java/beans/beancontext/BeanContextMembershipEvent.ser"));
+    }
+
+    private void assertEqualsSerially(BeanContextMembershipEvent orig,
+            BeanContextMembershipEvent ser) {
+        assertNull(ser.getSource());
+
+        // check propagatedFrom
+        if (orig.getPropagatedFrom() instanceof Serializable) {
+            BeanContext origFrom = orig.getPropagatedFrom();
+            BeanContext serFrom = ser.getPropagatedFrom();
+            assertEquals(origFrom.getClass(), serFrom.getClass());
+            if (origFrom instanceof MockBeanContextDelegateS) {
+                assertEquals(((MockBeanContextDelegateS) origFrom).id,
+                        ((MockBeanContextDelegateS) serFrom).id);
+            }
+        }
+
+        // check children
+        Collection origChildren = (Collection) Utils.getField(orig, "children");
+        Collection serChildren = (Collection) Utils.getField(ser, "children");
+        assertEquals(origChildren, serChildren);
+    }
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextMembershipEventTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceAvailableEventTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceAvailableEventTest.java?view=diff&rev=446483&r1=446482&r2=446483
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceAvailableEventTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceAvailableEventTest.java Thu Sep 14 19:53:17 2006
@@ -1,154 +1,154 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.tests.java.beans.beancontext;
-
-import java.beans.beancontext.BeanContext;
-import java.beans.beancontext.BeanContextServiceAvailableEvent;
-import java.beans.beancontext.BeanContextServices;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import junit.framework.TestCase;
-
-import org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextDelegateS;
-import org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextServices;
-
-import tests.util.SerializationTester;
-
-/**
- * Test BeanContextServiceAvailableEvent
- */
-public class BeanContextServiceAvailableEventTest extends TestCase {
-
-    private static class MockBeanContextServiceAvailableEvent extends
-            BeanContextServiceAvailableEvent {
-        
-        static final long serialVersionUID = 796722290390289532L;
-
-        /**
-         * @param bcs
-         * @param sc
-         */
-        public MockBeanContextServiceAvailableEvent(BeanContextServices bcs,
-                Class sc) {
-            super(bcs, sc);
-            assertSame(sc, this.serviceClass);
-        }
-    }
-
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(BeanContextServiceAvailableEventTest.class);
-    }
-
-    public void testBeanContextServiceAvailableEvent_NullParam() {
-        BeanContextServices services = new MockBeanContextServices();
-
-        try {
-            new MockBeanContextServiceAvailableEvent(null, BeanContext.class);
-            fail("IAE expected");
-        } catch (IllegalArgumentException e) {
-            // expected
-        }
-
-        BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
-                services, null);
-        assertNull(event.getServiceClass());
-        assertSame(services, event.getSource());
-        assertSame(services, event.getSourceAsBeanContextServices());
-    }
-
-    public void testBeanContextServiceAvailableEvent() {
-        BeanContextServices services = new MockBeanContextServices();
-        BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
-                services, BeanContext.class);
-        assertSame(BeanContext.class, event.getServiceClass());
-        assertSame(services, event.getSource());
-        assertSame(services, event.getSourceAsBeanContextServices());
-    }
-
-    public void testGetSourceAsBeanContextServices() {
-        BeanContextServices services = new MockBeanContextServices();
-        BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
-                services, BeanContext.class);
-        assertSame(services, event.getSource());
-        assertSame(services, event.getSourceAsBeanContextServices());
-    }
-
-    public void testGetServiceClass() {
-        BeanContextServices services = new MockBeanContextServices();
-        BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
-                services, BeanContext.class);
-        assertSame(BeanContext.class, event.getServiceClass());
-    }
-
-    public void testGetCurrentServiceSelectors() {
-        BeanContextServices services = new MockBeanContextServices();
-        BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
-                services, BeanContext.class);
-
-        Iterator expectedIt = services
-                .getCurrentServiceSelectors(BeanContext.class);
-        Iterator it = event.getCurrentServiceSelectors();
-        while (expectedIt.hasNext()) {
-            assertSame(expectedIt.next(), it.next());
-        }
-        assertFalse(expectedIt.hasNext());
-        assertFalse(it.hasNext());
-    }
-
-    public void testSerialization() throws IOException, ClassNotFoundException {
-        BeanContextServiceAvailableEvent event = new BeanContextServiceAvailableEvent(
-                new MockBeanContextServices(), ArrayList.class);
-        event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
-
-        assertEqualsSerially(event,
-                (BeanContextServiceAvailableEvent) SerializationTester
-                        .getDeserilizedObject(event));
-    }
-
-    public void testSerialization_Compatibility() throws Exception {
-        BeanContextServiceAvailableEvent event = new BeanContextServiceAvailableEvent(
-                new MockBeanContextServices(), ArrayList.class);
-        event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
-
-        assertEqualsSerially(
-                event,
-                (BeanContextServiceAvailableEvent) SerializationTester
-                        .readObject(event,
-                                "serialization/java/beans/beancontext/BeanContextServiceAvailableEvent.ser"));
-    }
-
-    private void assertEqualsSerially(BeanContextServiceAvailableEvent orig,
-            BeanContextServiceAvailableEvent ser) {
-        assertNull(ser.getSource());
-
-        // check propagatedFrom
-        if (orig.getPropagatedFrom() instanceof Serializable) {
-            BeanContext origFrom = orig.getPropagatedFrom();
-            BeanContext serFrom = ser.getPropagatedFrom();
-            assertEquals(origFrom.getClass(), serFrom.getClass());
-            if (origFrom instanceof MockBeanContextDelegateS) {
-                assertEquals(((MockBeanContextDelegateS) origFrom).id,
-                        ((MockBeanContextDelegateS) serFrom).id);
-            }
-        }
-
-        // check serviceClass
-        assertEquals(orig.getServiceClass(), ser.getServiceClass());
-    }
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.tests.java.beans.beancontext;
+
+import java.beans.beancontext.BeanContext;
+import java.beans.beancontext.BeanContextServiceAvailableEvent;
+import java.beans.beancontext.BeanContextServices;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextDelegateS;
+import org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextServices;
+
+import tests.util.SerializationTester;
+
+/**
+ * Test BeanContextServiceAvailableEvent
+ */
+public class BeanContextServiceAvailableEventTest extends TestCase {
+
+    private static class MockBeanContextServiceAvailableEvent extends
+            BeanContextServiceAvailableEvent {
+        
+        static final long serialVersionUID = 796722290390289532L;
+
+        /**
+         * @param bcs
+         * @param sc
+         */
+        public MockBeanContextServiceAvailableEvent(BeanContextServices bcs,
+                Class sc) {
+            super(bcs, sc);
+            assertSame(sc, this.serviceClass);
+        }
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(BeanContextServiceAvailableEventTest.class);
+    }
+
+    public void testBeanContextServiceAvailableEvent_NullParam() {
+        BeanContextServices services = new MockBeanContextServices();
+
+        try {
+            new MockBeanContextServiceAvailableEvent(null, BeanContext.class);
+            fail("IAE expected");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+
+        BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
+                services, null);
+        assertNull(event.getServiceClass());
+        assertSame(services, event.getSource());
+        assertSame(services, event.getSourceAsBeanContextServices());
+    }
+
+    public void testBeanContextServiceAvailableEvent() {
+        BeanContextServices services = new MockBeanContextServices();
+        BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
+                services, BeanContext.class);
+        assertSame(BeanContext.class, event.getServiceClass());
+        assertSame(services, event.getSource());
+        assertSame(services, event.getSourceAsBeanContextServices());
+    }
+
+    public void testGetSourceAsBeanContextServices() {
+        BeanContextServices services = new MockBeanContextServices();
+        BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
+                services, BeanContext.class);
+        assertSame(services, event.getSource());
+        assertSame(services, event.getSourceAsBeanContextServices());
+    }
+
+    public void testGetServiceClass() {
+        BeanContextServices services = new MockBeanContextServices();
+        BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
+                services, BeanContext.class);
+        assertSame(BeanContext.class, event.getServiceClass());
+    }
+
+    public void testGetCurrentServiceSelectors() {
+        BeanContextServices services = new MockBeanContextServices();
+        BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
+                services, BeanContext.class);
+
+        Iterator expectedIt = services
+                .getCurrentServiceSelectors(BeanContext.class);
+        Iterator it = event.getCurrentServiceSelectors();
+        while (expectedIt.hasNext()) {
+            assertSame(expectedIt.next(), it.next());
+        }
+        assertFalse(expectedIt.hasNext());
+        assertFalse(it.hasNext());
+    }
+
+    public void testSerialization() throws IOException, ClassNotFoundException {
+        BeanContextServiceAvailableEvent event = new BeanContextServiceAvailableEvent(
+                new MockBeanContextServices(), ArrayList.class);
+        event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
+
+        assertEqualsSerially(event,
+                (BeanContextServiceAvailableEvent) SerializationTester
+                        .getDeserilizedObject(event));
+    }
+
+    public void testSerialization_Compatibility() throws Exception {
+        BeanContextServiceAvailableEvent event = new BeanContextServiceAvailableEvent(
+                new MockBeanContextServices(), ArrayList.class);
+        event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
+
+        assertEqualsSerially(
+                event,
+                (BeanContextServiceAvailableEvent) SerializationTester
+                        .readObject(event,
+                                "serialization/java/beans/beancontext/BeanContextServiceAvailableEvent.ser"));
+    }
+
+    private void assertEqualsSerially(BeanContextServiceAvailableEvent orig,
+            BeanContextServiceAvailableEvent ser) {
+        assertNull(ser.getSource());
+
+        // check propagatedFrom
+        if (orig.getPropagatedFrom() instanceof Serializable) {
+            BeanContext origFrom = orig.getPropagatedFrom();
+            BeanContext serFrom = ser.getPropagatedFrom();
+            assertEquals(origFrom.getClass(), serFrom.getClass());
+            if (origFrom instanceof MockBeanContextDelegateS) {
+                assertEquals(((MockBeanContextDelegateS) origFrom).id,
+                        ((MockBeanContextDelegateS) serFrom).id);
+            }
+        }
+
+        // check serviceClass
+        assertEquals(orig.getServiceClass(), ser.getServiceClass());
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceAvailableEventTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/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/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java?view=diff&rev=446483&r1=446482&r2=446483
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java Thu Sep 14 19:53:17 2006
@@ -1,171 +1,171 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.tests.java.beans.beancontext;
-
-import java.beans.beancontext.BeanContext;
-import java.beans.beancontext.BeanContextServiceRevokedEvent;
-import java.beans.beancontext.BeanContextServices;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-
-import junit.framework.TestCase;
-
-import org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextDelegateS;
-import org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextServices;
-
-import tests.util.SerializationTester;
-
-/**
- * Test BeanContextServiceRevokedEvent
- */
-public class BeanContextServiceRevokedEventTest extends TestCase {
-
-    private static class MockBeanContextServiceRevokedEvent extends
-            BeanContextServiceRevokedEvent {
-        
-        static final long serialVersionUID = -705194281645674622L;
-
-        /**
-         * @param bcs
-         * @param sc
-         * @param invalidate
-         */
-        public MockBeanContextServiceRevokedEvent(BeanContextServices bcs,
-                Class sc, boolean invalidate) {
-            super(bcs, sc, invalidate);
-            assertSame(sc, this.serviceClass);
-        }
-
-    }
-
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(BeanContextServiceRevokedEventTest.class);
-    }
-
-    public void testBeanContextServiceRevokedEvent_NullParam() {
-        BeanContextServices services = new MockBeanContextServices();
-
-        try {
-            new MockBeanContextServiceRevokedEvent(null, BeanContext.class,
-                    true);
-            fail("IAE expected");
-        } catch (IllegalArgumentException e) {
-            // expected
-        }
-
-        BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
-                services, null, true);
-        assertNull(event.getServiceClass());
-        assertSame(services, event.getSource());
-        assertSame(services, event.getSourceAsBeanContextServices());
-        assertEquals(true, event.isCurrentServiceInvalidNow());
-        try {
-            event.isServiceClass(Integer.class);
-            fail("NPE expected");
-        } catch (NullPointerException e) {
-            // expected
-        }
-    }
-
-    public void testBeanContextServiceRevokedEvent() {
-        BeanContextServices services = new MockBeanContextServices();
-        BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
-                services, BeanContext.class, true);
-        assertSame(BeanContext.class, event.getServiceClass());
-        assertSame(services, event.getSource());
-        assertSame(services, event.getSourceAsBeanContextServices());
-        assertEquals(true, event.isCurrentServiceInvalidNow());
-    }
-
-    public void testGetSourceAsBeanContextServices() {
-        BeanContextServices services = new MockBeanContextServices();
-        BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
-                services, BeanContext.class, true);
-        assertSame(services, event.getSource());
-        assertSame(services, event.getSourceAsBeanContextServices());
-    }
-
-    public void testGetServiceClass() {
-        BeanContextServices services = new MockBeanContextServices();
-        BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
-                services, BeanContext.class, true);
-        assertSame(BeanContext.class, event.getServiceClass());
-    }
-
-    public void testIsServiceClass() {
-        BeanContextServices services = new MockBeanContextServices();
-        BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
-                services, BeanContext.class, true);
-        assertTrue(event.isServiceClass(BeanContext.class));
-        assertFalse(event.isServiceClass(Integer.class));
-    }
-
-    public void testIsCurrentServiceInvalidNow() {
-        BeanContextServices services = new MockBeanContextServices();
-        BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
-                services, BeanContext.class, true);
-        assertEquals(true, event.isCurrentServiceInvalidNow());
-        event = new MockBeanContextServiceRevokedEvent(services,
-                BeanContext.class, false);
-        assertEquals(false, event.isCurrentServiceInvalidNow());
-    }
-
-    public void testSerialization() throws IOException, ClassNotFoundException {
-        BeanContextServiceRevokedEvent event = new BeanContextServiceRevokedEvent(
-                new MockBeanContextServices(), ArrayList.class, true);
-        event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
-
-        assertEqualsSerially(event,
-                (BeanContextServiceRevokedEvent) SerializationTester
-                        .getDeserilizedObject(event));
-    }
-
-    public void testSerialization_Compatibility() throws Exception {
-        BeanContextServiceRevokedEvent event = new BeanContextServiceRevokedEvent(
-                new MockBeanContextServices(), ArrayList.class, true);
-        event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
-
-        assertEqualsSerially(
-                event,
-                (BeanContextServiceRevokedEvent) SerializationTester
-                        .readObject(event,
-                                "serialization/java/beans/beancontext/BeanContextServiceRevokedEvent.ser"));
-    }
-
-    private void assertEqualsSerially(BeanContextServiceRevokedEvent orig,
-            BeanContextServiceRevokedEvent ser) {
-        assertNull(ser.getSource());
-
-        // check propagatedFrom
-        if (orig.getPropagatedFrom() instanceof Serializable) {
-            BeanContext origFrom = orig.getPropagatedFrom();
-            BeanContext serFrom = ser.getPropagatedFrom();
-            assertEquals(origFrom.getClass(), serFrom.getClass());
-            if (origFrom instanceof MockBeanContextDelegateS) {
-                assertEquals(((MockBeanContextDelegateS) origFrom).id,
-                        ((MockBeanContextDelegateS) serFrom).id);
-            }
-        }
-
-        // check serviceClass
-        assertEquals(orig.getServiceClass(), ser.getServiceClass());
-
-        // check invalidateRefs
-        assertEquals(orig.isCurrentServiceInvalidNow(), ser
-                .isCurrentServiceInvalidNow());
-    }
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.tests.java.beans.beancontext;
+
+import java.beans.beancontext.BeanContext;
+import java.beans.beancontext.BeanContextServiceRevokedEvent;
+import java.beans.beancontext.BeanContextServices;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+
+import junit.framework.TestCase;
+
+import org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextDelegateS;
+import org.apache.harmony.beans.tests.support.beancontext.mock.MockBeanContextServices;
+
+import tests.util.SerializationTester;
+
+/**
+ * Test BeanContextServiceRevokedEvent
+ */
+public class BeanContextServiceRevokedEventTest extends TestCase {
+
+    private static class MockBeanContextServiceRevokedEvent extends
+            BeanContextServiceRevokedEvent {
+        
+        static final long serialVersionUID = -705194281645674622L;
+
+        /**
+         * @param bcs
+         * @param sc
+         * @param invalidate
+         */
+        public MockBeanContextServiceRevokedEvent(BeanContextServices bcs,
+                Class sc, boolean invalidate) {
+            super(bcs, sc, invalidate);
+            assertSame(sc, this.serviceClass);
+        }
+
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(BeanContextServiceRevokedEventTest.class);
+    }
+
+    public void testBeanContextServiceRevokedEvent_NullParam() {
+        BeanContextServices services = new MockBeanContextServices();
+
+        try {
+            new MockBeanContextServiceRevokedEvent(null, BeanContext.class,
+                    true);
+            fail("IAE expected");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+
+        BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
+                services, null, true);
+        assertNull(event.getServiceClass());
+        assertSame(services, event.getSource());
+        assertSame(services, event.getSourceAsBeanContextServices());
+        assertEquals(true, event.isCurrentServiceInvalidNow());
+        try {
+            event.isServiceClass(Integer.class);
+            fail("NPE expected");
+        } catch (NullPointerException e) {
+            // expected
+        }
+    }
+
+    public void testBeanContextServiceRevokedEvent() {
+        BeanContextServices services = new MockBeanContextServices();
+        BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
+                services, BeanContext.class, true);
+        assertSame(BeanContext.class, event.getServiceClass());
+        assertSame(services, event.getSource());
+        assertSame(services, event.getSourceAsBeanContextServices());
+        assertEquals(true, event.isCurrentServiceInvalidNow());
+    }
+
+    public void testGetSourceAsBeanContextServices() {
+        BeanContextServices services = new MockBeanContextServices();
+        BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
+                services, BeanContext.class, true);
+        assertSame(services, event.getSource());
+        assertSame(services, event.getSourceAsBeanContextServices());
+    }
+
+    public void testGetServiceClass() {
+        BeanContextServices services = new MockBeanContextServices();
+        BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
+                services, BeanContext.class, true);
+        assertSame(BeanContext.class, event.getServiceClass());
+    }
+
+    public void testIsServiceClass() {
+        BeanContextServices services = new MockBeanContextServices();
+        BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
+                services, BeanContext.class, true);
+        assertTrue(event.isServiceClass(BeanContext.class));
+        assertFalse(event.isServiceClass(Integer.class));
+    }
+
+    public void testIsCurrentServiceInvalidNow() {
+        BeanContextServices services = new MockBeanContextServices();
+        BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
+                services, BeanContext.class, true);
+        assertEquals(true, event.isCurrentServiceInvalidNow());
+        event = new MockBeanContextServiceRevokedEvent(services,
+                BeanContext.class, false);
+        assertEquals(false, event.isCurrentServiceInvalidNow());
+    }
+
+    public void testSerialization() throws IOException, ClassNotFoundException {
+        BeanContextServiceRevokedEvent event = new BeanContextServiceRevokedEvent(
+                new MockBeanContextServices(), ArrayList.class, true);
+        event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
+
+        assertEqualsSerially(event,
+                (BeanContextServiceRevokedEvent) SerializationTester
+                        .getDeserilizedObject(event));
+    }
+
+    public void testSerialization_Compatibility() throws Exception {
+        BeanContextServiceRevokedEvent event = new BeanContextServiceRevokedEvent(
+                new MockBeanContextServices(), ArrayList.class, true);
+        event.setPropagatedFrom(new MockBeanContextDelegateS("from ID"));
+
+        assertEqualsSerially(
+                event,
+                (BeanContextServiceRevokedEvent) SerializationTester
+                        .readObject(event,
+                                "serialization/java/beans/beancontext/BeanContextServiceRevokedEvent.ser"));
+    }
+
+    private void assertEqualsSerially(BeanContextServiceRevokedEvent orig,
+            BeanContextServiceRevokedEvent ser) {
+        assertNull(ser.getSource());
+
+        // check propagatedFrom
+        if (orig.getPropagatedFrom() instanceof Serializable) {
+            BeanContext origFrom = orig.getPropagatedFrom();
+            BeanContext serFrom = ser.getPropagatedFrom();
+            assertEquals(origFrom.getClass(), serFrom.getClass());
+            if (origFrom instanceof MockBeanContextDelegateS) {
+                assertEquals(((MockBeanContextDelegateS) origFrom).id,
+                        ((MockBeanContextDelegateS) serFrom).id);
+            }
+        }
+
+        // check serviceClass
+        assertEquals(orig.getServiceClass(), ser.getServiceClass());
+
+        // check invalidateRefs
+        assertEquals(orig.isCurrentServiceInvalidNow(), ser
+                .isCurrentServiceInvalidNow());
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/beancontext/BeanContextServiceRevokedEventTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message