harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r412641 [25/32] - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/ main/java/java/beans/beancontext/ test/java-internal/java/beans/beancontext/ test/java/org/apache/harmony/beans/tests/ test/java/org/ap...
Date Thu, 08 Jun 2006 03:40:30 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?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- 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
Wed Jun  7 20:40:24 2006
@@ -1,289 +1,289 @@
-/* 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.BeanContextEvent;
-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.java.beans.beancontext.mock.MockBeanContext;
-import org.apache.harmony.beans.tests.java.beans.beancontext.mock.MockBeanContextDelegateS;
-import tests.util.SerializationTester;
-
-/**
- * Test BeanContextMembershipEvent
- */
-public class BeanContextMembershipEventTest extends TestCase {
-
-	private static class MockBeanContextMembershipEvent extends
-			BeanContextMembershipEvent {
-
-		/**
-		 * @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 c = new ArrayList();
-		c.add("1");
-		c.add("2");
-		c.add("3");
-		String array[] = new String[] { "1", "2", "3" };
-
-		try {
-			MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-					null, c);
-			fail();
-		} catch (IllegalArgumentException e) {
-			// expected
-		}
-
-		try {
-			MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-					null, array);
-			fail();
-		} catch (IllegalArgumentException e) {
-			// expected
-		}
-
-		try {
-			MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-					ctx, (Collection) null);
-			fail();
-		} catch (NullPointerException e) {
-			// expected
-		}
-
-		try {
-			MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-					ctx, (Object[]) null);
-			fail();
-		} 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 c = new ArrayList();
-		c.add("1");
-		c.add("2");
-		c.add("3");
-		MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-				ctx, c);
-		assertSame(c, event.collection());
-
-		assertTrue(event instanceof BeanContextEvent);
-	}
-
-	/*
-	 * 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" };
-		MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
-				ctx, array);
-
-		assertTrue(event instanceof BeanContextEvent);
-	}
-
-	public void testSize_Collection() {
-		BeanContext ctx = new MockBeanContext();
-		Collection c = new ArrayList();
-		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 c = new ArrayList();
-		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 c = new ArrayList();
-		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 c = new ArrayList();
-		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 things = new ArrayList();
-		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 things = new ArrayList();
-		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.BeanContextEvent;
+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.java.beans.beancontext.mock.MockBeanContext;
+import org.apache.harmony.beans.tests.java.beans.beancontext.mock.MockBeanContextDelegateS;
+import tests.util.SerializationTester;
+
+/**
+ * Test BeanContextMembershipEvent
+ */
+public class BeanContextMembershipEventTest extends TestCase {
+
+	private static class MockBeanContextMembershipEvent extends
+			BeanContextMembershipEvent {
+
+		/**
+		 * @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 c = new ArrayList();
+		c.add("1");
+		c.add("2");
+		c.add("3");
+		String array[] = new String[] { "1", "2", "3" };
+
+		try {
+			MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+					null, c);
+			fail();
+		} catch (IllegalArgumentException e) {
+			// expected
+		}
+
+		try {
+			MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+					null, array);
+			fail();
+		} catch (IllegalArgumentException e) {
+			// expected
+		}
+
+		try {
+			MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+					ctx, (Collection) null);
+			fail();
+		} catch (NullPointerException e) {
+			// expected
+		}
+
+		try {
+			MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+					ctx, (Object[]) null);
+			fail();
+		} 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 c = new ArrayList();
+		c.add("1");
+		c.add("2");
+		c.add("3");
+		MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+				ctx, c);
+		assertSame(c, event.collection());
+
+		assertTrue(event instanceof BeanContextEvent);
+	}
+
+	/*
+	 * 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" };
+		MockBeanContextMembershipEvent event = new MockBeanContextMembershipEvent(
+				ctx, array);
+
+		assertTrue(event instanceof BeanContextEvent);
+	}
+
+	public void testSize_Collection() {
+		BeanContext ctx = new MockBeanContext();
+		Collection c = new ArrayList();
+		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 c = new ArrayList();
+		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 c = new ArrayList();
+		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 c = new ArrayList();
+		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 things = new ArrayList();
+		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 things = new ArrayList();
+		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);
+	}
+
+}

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?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- 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
Wed Jun  7 20:40:24 2006
@@ -1,153 +1,153 @@
-/* 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.BeanContextEvent;
-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.java.beans.beancontext.mock.MockBeanContextDelegateS;
-import org.apache.harmony.beans.tests.java.beans.beancontext.mock.MockBeanContextServices;
-import tests.util.SerializationTester;
-
-/**
- * Test BeanContextServiceAvailableEvent
- */
-public class BeanContextServiceAvailableEventTest extends TestCase {
-
-	private static class MockBeanContextServiceAvailableEvent extends
-			BeanContextServiceAvailableEvent {
-
-		/**
-		 * @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 {
-			BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
-					null, BeanContext.class);
-			fail();
-		} 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());
-		assertTrue(event instanceof BeanContextEvent);
-	}
-
-	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.BeanContextEvent;
+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.java.beans.beancontext.mock.MockBeanContextDelegateS;
+import org.apache.harmony.beans.tests.java.beans.beancontext.mock.MockBeanContextServices;
+import tests.util.SerializationTester;
+
+/**
+ * Test BeanContextServiceAvailableEvent
+ */
+public class BeanContextServiceAvailableEventTest extends TestCase {
+
+	private static class MockBeanContextServiceAvailableEvent extends
+			BeanContextServiceAvailableEvent {
+
+		/**
+		 * @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 {
+			BeanContextServiceAvailableEvent event = new MockBeanContextServiceAvailableEvent(
+					null, BeanContext.class);
+			fail();
+		} 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());
+		assertTrue(event instanceof BeanContextEvent);
+	}
+
+	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());
+	}
+}

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?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- 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
Wed Jun  7 20:40:24 2006
@@ -1,169 +1,169 @@
-/* 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.BeanContextEvent;
-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.java.beans.beancontext.mock.MockBeanContextDelegateS;
-import org.apache.harmony.beans.tests.java.beans.beancontext.mock.MockBeanContextServices;
-import tests.util.SerializationTester;
-
-/**
- * Test BeanContextServiceRevokedEvent
- */
-public class BeanContextServiceRevokedEventTest extends TestCase {
-
-	private static class MockBeanContextServiceRevokedEvent extends
-			BeanContextServiceRevokedEvent {
-
-		/**
-		 * @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 {
-			BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
-					null, BeanContext.class, true);
-			fail();
-		} catch (IllegalArgumentException e) {
-			// expected
-		}
-
-		try {
-			BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
-					services, null, true);
-			assertNull(event.getServiceClass());
-			assertSame(services, event.getSource());
-			assertSame(services, event.getSourceAsBeanContextServices());
-			assertEquals(true, event.isCurrentServiceInvalidNow());
-			event.isServiceClass(Integer.class);
-			fail();
-		} 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());
-		assertTrue(event instanceof BeanContextEvent);
-	}
-
-	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.BeanContextEvent;
+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.java.beans.beancontext.mock.MockBeanContextDelegateS;
+import org.apache.harmony.beans.tests.java.beans.beancontext.mock.MockBeanContextServices;
+import tests.util.SerializationTester;
+
+/**
+ * Test BeanContextServiceRevokedEvent
+ */
+public class BeanContextServiceRevokedEventTest extends TestCase {
+
+	private static class MockBeanContextServiceRevokedEvent extends
+			BeanContextServiceRevokedEvent {
+
+		/**
+		 * @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 {
+			BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
+					null, BeanContext.class, true);
+			fail();
+		} catch (IllegalArgumentException e) {
+			// expected
+		}
+
+		try {
+			BeanContextServiceRevokedEvent event = new MockBeanContextServiceRevokedEvent(
+					services, null, true);
+			assertNull(event.getServiceClass());
+			assertSame(services, event.getSource());
+			assertSame(services, event.getSourceAsBeanContextServices());
+			assertEquals(true, event.isCurrentServiceInvalidNow());
+			event.isServiceClass(Integer.class);
+			fail();
+		} 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());
+		assertTrue(event instanceof BeanContextEvent);
+	}
+
+	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());
+	}
+}



Mime
View raw message