harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r449555 [2/6] - in /incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java: com/sun/jndi/url/dir2/ com/sun/jndi/url/nntp/ dazzle/jndi/testing/spi/ org/apache/harmony/jndi/provider/dns/ org/apache/harmony/jndi/tests/javax/namin...
Date Mon, 25 Sep 2006 03:33:32 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/BasicAttributeTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/BasicAttributeTest.java?view=diff&rev=449555&r1=449554&r2=449555
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/BasicAttributeTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/BasicAttributeTest.java Sun Sep 24 20:33:27 2006
@@ -27,9 +27,9 @@
 import javax.naming.NamingException;
 import javax.naming.OperationNotSupportedException;
 import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.DirContext;
 
 import junit.framework.TestCase;
+
 import org.apache.harmony.jndi.tests.javax.naming.util.Person;
 
 public class BasicAttributeTest extends TestCase {
@@ -38,15 +38,12 @@
 
 	private BasicAttribute unorderedAttribute;
 
-	protected void setUp() {
+	@Override
+    protected void setUp() {
 		orderedAttribute = new BasicAttribute("Ordered_Attribute", true);
 		unorderedAttribute = new BasicAttribute("Unordered_Attribute", false);
 	}
 
-	protected void tearDown() {
-
-	}
-
 	/**
 	 * Test BasicAttribute constructor 1) use a specified ID 2) the default
 	 * order flag is set to false 3) contain zero value.
@@ -520,7 +517,7 @@
 
 	public void testGet_unordered_noValue() throws NamingException {
 		try {
-			Object obj = unorderedAttribute.get();
+			unorderedAttribute.get();
 			fail("No value, throw NoSuchElementException.");
 			// return -> throw.
 		} catch (NoSuchElementException e) {
@@ -544,7 +541,7 @@
 
 	public void testGet_ordered_noValue() throws NamingException {
 		try {
-			Object obj = orderedAttribute.get();
+			orderedAttribute.get();
 			fail("No value, throw NoSuchElementException.");
 			// return -> throw.
 		} catch (NoSuchElementException e) {
@@ -560,7 +557,7 @@
 		Person person = Person.getInstance();
 		unorderedAttribute.add(person);
 		try {
-			Object obj = unorderedAttribute.get(-1);
+			unorderedAttribute.get(-1);
 			fail("get(-1), throw IndexOutOfBoundsException.");
 		} catch (IndexOutOfBoundsException e) {
 		}
@@ -570,7 +567,7 @@
 		Person person = Person.getInstance();
 		unorderedAttribute.add(person);
 		try {
-			Object obj = unorderedAttribute.get(unorderedAttribute.size());
+			unorderedAttribute.get(unorderedAttribute.size());
 			fail("get(size()), throw IndexOutOfBoundsException.");
 		} catch (IndexOutOfBoundsException e) {
 		}
@@ -584,7 +581,7 @@
 			orderedAttribute.add(persons[i]);
 		}
 
-		NamingEnumeration enumeration = orderedAttribute.getAll();
+		NamingEnumeration<?> enumeration = orderedAttribute.getAll();
 		int i = 0;
 		while (enumeration.hasMore()) {
 			assertEquals(persons[i++], enumeration.next());
@@ -592,7 +589,7 @@
 	}
 
 	public void testGetAll_ordered_noValue() throws NamingException {
-		NamingEnumeration enumeration = orderedAttribute.getAll();
+		NamingEnumeration<?> enumeration = orderedAttribute.getAll();
 		int count = 0;
 		while (enumeration.hasMore()) {
 			count++;
@@ -608,7 +605,7 @@
 			unorderedAttribute.add(persons[i]);
 		}
 
-		NamingEnumeration enumeration = unorderedAttribute.getAll();
+		NamingEnumeration<?> enumeration = unorderedAttribute.getAll();
 		int i = 0;
 		while (enumeration.hasMore()) {
 			assertEquals(persons[i++], enumeration.next());
@@ -616,7 +613,7 @@
 	}
 
 	public void testGetAll_unordered_noValue() throws NamingException {
-		NamingEnumeration enumeration = unorderedAttribute.getAll();
+		NamingEnumeration<?> enumeration = unorderedAttribute.getAll();
 		int count = 0;
 		while (enumeration.hasMore()) {
 			count++;
@@ -626,20 +623,19 @@
 
 	public void testGetAttributeDefinition() throws NamingException {
 		try {
-			DirContext context = orderedAttribute.getAttributeDefinition();
+			orderedAttribute.getAttributeDefinition();
 			fail("Should throw OperationNotSupportedException");
 		} catch (OperationNotSupportedException e) {
 		}
 	}
 
 	public void testGetAttributeSyntaxDefinition() throws NamingException {
-		try {
-			DirContext context = orderedAttribute
-					.getAttributeSyntaxDefinition();
-			fail("Should throw OperationNotSupportedException");
-		} catch (OperationNotSupportedException e) {
-		}
-	}
+        try {
+            orderedAttribute.getAttributeSyntaxDefinition();
+            fail("Should throw OperationNotSupportedException");
+        } catch (OperationNotSupportedException e) {
+        }
+    }
 
 	public void testGetID() {
 		String ID = "attribute ID";
@@ -684,7 +680,7 @@
 
 	public void testRemove_novalue() {
 		try {
-			Object obj = orderedAttribute.remove(0);
+			orderedAttribute.remove(0);
 			fail("Should throw IndexOutOfBoundsException.");
 		} catch (IndexOutOfBoundsException e) {
 		}
@@ -693,7 +689,7 @@
 	public void testRemove_tooSmall() {
 		orderedAttribute.add("value one");
 		try {
-			Object obj = orderedAttribute.remove(-1);
+			orderedAttribute.remove(-1);
 			fail("Should throw IndexOutOfBoundsException.");
 		} catch (IndexOutOfBoundsException e) {
 		}
@@ -702,7 +698,7 @@
 	public void testRemove_tooLarge() {
 		orderedAttribute.add("value one");
 		try {
-			Object obj = orderedAttribute.remove(orderedAttribute.size());
+			orderedAttribute.remove(orderedAttribute.size());
 			fail("Should throw IndexOutOfBoundsException.");
 		} catch (IndexOutOfBoundsException e) {
 		}
@@ -770,7 +766,6 @@
 	public void testSet_ordered_NewValueNull() throws NamingException {
 		Person person = Person.getInstance();
 		orderedAttribute.add(person);
-		Person person2 = Person.getInstance();
 
 		assertEquals(person, orderedAttribute.set(0, null));
 		assertNull(orderedAttribute.get(0));
@@ -787,7 +782,7 @@
 	public void testSet_ordered_IndexTooSmall() {
 		orderedAttribute.add("value");
 		try {
-			Object obj = orderedAttribute.remove(-1);
+			orderedAttribute.remove(-1);
 			fail("Should throw IndexOutOfBoundsException.");
 		} catch (IndexOutOfBoundsException e) {
 		}
@@ -796,7 +791,7 @@
 	public void testSet_ordered_IndexTooLarge() {
 		orderedAttribute.add("value");
 		try {
-			Object obj = orderedAttribute.remove(orderedAttribute.size());
+			orderedAttribute.remove(orderedAttribute.size());
 			fail("Should throw IndexOutOfBoundsException.");
 		} catch (IndexOutOfBoundsException e) {
 		}
@@ -813,7 +808,7 @@
 		Person person = Person.getInstance();
 		unorderedAttribute.add(person);
 		try {
-			Object obj = unorderedAttribute.set(0, person);
+			unorderedAttribute.set(0, person);
 			fail("Should throw IllegalStateException.");
 		} catch (IllegalStateException e) {
 		}
@@ -830,7 +825,7 @@
 
 		unorderedAttribute.add(persons);
 		try {
-			Object obj = unorderedAttribute.set(0, newPersons);
+			unorderedAttribute.set(0, newPersons);
 			fail("Should throw IllegalStateException.");
 		} catch (IllegalStateException e) {
 		}
@@ -930,7 +925,7 @@
 		BasicAttribute attribute0 = new BasicAttribute(null, strObj);
 		BasicAttribute attribute1 = new BasicAttribute(null, strObj);
 		try {
-			boolean result = attribute0.equals(attribute1);
+			attribute0.equals(attribute1);
 			fail("Should throw NullPointerException.");
 		} catch (NullPointerException e) {
 		}
@@ -1028,9 +1023,9 @@
 		String id = "Array Attribute";
 		BasicAttribute attribute = new BasicAttribute(id, strs);
 		int hashCode = id.hashCode();
-		for (int i = 0; i < strs.length; i++) {
-			if (strs[i] != null) {
-				hashCode += strs[i].hashCode();
+		for (String element : strs) {
+			if (element != null) {
+				hashCode += element.hashCode();
 			}
 		}
 
@@ -1047,8 +1042,8 @@
 		Person person = Person.getInstance();
 		attribute.add(person);
 		int hashCode = id.hashCode() + person.hashCode();
-		for (int i = 0; i < numbers.length; i++) {
-			hashCode += numbers[i];
+		for (int element : numbers) {
+			hashCode += element;
 		}
 
 		assertEquals(hashCode, attribute.hashCode());
@@ -1063,8 +1058,8 @@
 		String id = "double-Array";
 		BasicAttribute attribute = new BasicAttribute(id, doubles);
 		int hashCode = id.hashCode();
-		for (int i = 0; i < doubles.length; i++) {
-			hashCode += new Double(doubles[i]).hashCode();
+		for (double element : doubles) {
+			hashCode += new Double(element).hashCode();
 		}
 		assertEquals(hashCode, attribute.hashCode());
 	}
@@ -1072,7 +1067,7 @@
 	public void testHashCode_IDnull() {
 		BasicAttribute attribute = new BasicAttribute(null, "ID==NULL");
 		try {
-			int hashCode = attribute.hashCode();
+			attribute.hashCode();
 			fail("Should throw NullPointerException.");
 		} catch (NullPointerException e) {
 		}
@@ -1093,9 +1088,6 @@
 		for (int i = 0; i < count; i++) {
 			orderedAttribute.add("Value: " + i);
 		}
-		String str = "Attribute ID: Ordered_Attribute\n"
-				+ "Attribute values: Value: 0,Value: 1,Value: 2,Value: 3,Value: 4\n";
-		// assertEquals(str, orderedAttribute.toString());
 		assertNotNull(orderedAttribute.toString());
 	}
 
@@ -1160,16 +1152,13 @@
 		for (int i = 0; i < 5; i++) {
 			attribute.add(null);
 		}
-		String str = "Attribute ID: nulls\nAttribute values: null,null,null,null,null\n";
-		// assertEquals(str, attribute.toString());
+
 		assertNotNull(attribute.toString());
 	}
 
 	public void testToString_IDNull() {
 		// TO DO: explore behavior
 		BasicAttribute attribute = new BasicAttribute(null, "ID==NULL");
-		String str = "Attribute ID: null\nAttribute values: ID==NULL\n";
-		// assertEquals(str, attribute.toString());
 		assertNotNull(attribute.toString());
 	}
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/BasicAttributesTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/BasicAttributesTest.java?view=diff&rev=449555&r1=449554&r2=449555
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/BasicAttributesTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/BasicAttributesTest.java Sun Sep 24 20:33:27 2006
@@ -37,7 +37,8 @@
 
 	static Log log = new Log(BasicAttributesTest.class);
 
-	protected void setUp() {
+	@Override
+    protected void setUp() {
 		ignoreCaseAttributes = new BasicAttributes(true);
 		caseSensitiveAttributes = new BasicAttributes(false);
 	}
@@ -73,7 +74,7 @@
 		String id = null;
 		Person person = Person.getInstance();
 		try {
-			BasicAttributes attributes = new BasicAttributes(id, person);
+			new BasicAttributes(id, person);
 			fail("Should throw NullPointerException.");
 		} catch (NullPointerException e) {
 		}
@@ -125,8 +126,8 @@
 
 		assertEquals(cloneAttributes, ignoreCaseAttributes);
 
-		for (int i = 0; i < attributes.length; i++) {
-			String id = attributes[i].getID();
+		for (Attribute element : attributes) {
+			element.getID();
 		}
 		cloneAttributes.put("newID", "new Obj");
 		assertEquals(ignoreCaseAttributes.size() + 1, cloneAttributes.size());
@@ -146,8 +147,8 @@
 
 		assertEquals(cloneAttributes, caseSensitiveAttributes);
 
-		for (int i = 0; i < attributes.length; i++) {
-			String id = attributes[i].getID();
+		for (Attribute element : attributes) {
+			element.getID();
 		}
 		cloneAttributes.put("newID", "new Obj");
 		assertEquals(caseSensitiveAttributes.size() + 1, cloneAttributes.size());
@@ -178,7 +179,7 @@
 
 	public void testGet_IgnoreCase_IDNull() {
 		try {
-			Attribute attribute = ignoreCaseAttributes.get(null);
+			ignoreCaseAttributes.get(null);
 			fail("Should throw NullPointerException.");
 		} catch (NullPointerException e) {
 		}
@@ -209,7 +210,7 @@
 
 	public void testGet_CaseSensitive_IDNull() {
 		try {
-			Attribute attribute = caseSensitiveAttributes.get(null);
+			caseSensitiveAttributes.get(null);
 			fail("Should throw NullPointerException.");
 		} catch (NullPointerException e) {
 		}
@@ -220,7 +221,7 @@
 		Attribute attribute = new BasicAttribute(person.getName(), person);
 		caseSensitiveAttributes.put(attribute);
 
-		NamingEnumeration enumeration = caseSensitiveAttributes.getAll();
+		NamingEnumeration<?> enumeration = caseSensitiveAttributes.getAll();
 		int count = 0;
 		while (enumeration.hasMore()) {
 			count++;
@@ -230,7 +231,7 @@
 	}
 
 	public void testGetAll_caseSensitive_NoValue() throws NamingException {
-		NamingEnumeration enumeration = caseSensitiveAttributes.getAll();
+		NamingEnumeration<?> enumeration = caseSensitiveAttributes.getAll();
 		int count = 0;
 		while (enumeration.hasMore()) {
 			count++;
@@ -244,7 +245,7 @@
 		Attribute attribute = new BasicAttribute(person.getName(), person);
 		ignoreCaseAttributes.put(attribute);
 
-		NamingEnumeration enumeration = ignoreCaseAttributes.getAll();
+		NamingEnumeration<?> enumeration = ignoreCaseAttributes.getAll();
 		int count = 0;
 		while (enumeration.hasMore()) {
 			count++;
@@ -254,7 +255,7 @@
 	}
 
 	public void testGetAll_IgnoreCase_NoValue() throws NamingException {
-		NamingEnumeration enumeration = ignoreCaseAttributes.getAll();
+		NamingEnumeration<?> enumeration = ignoreCaseAttributes.getAll();
 		int count = 0;
 		while (enumeration.hasMore()) {
 			count++;
@@ -266,7 +267,7 @@
 		String id = "Ignore case ID";
 		Attribute attribute = new BasicAttribute(id, "IgnoreCase value");
 		ignoreCaseAttributes.put(attribute);
-		NamingEnumeration enumeration = ignoreCaseAttributes.getIDs();
+		NamingEnumeration<?> enumeration = ignoreCaseAttributes.getIDs();
 		int count = 0;
 		while (enumeration.hasMore()) {
 			count++;
@@ -279,7 +280,7 @@
 		String id = "Ignore case ID";
 		Attribute attribute = new BasicAttribute(id, "IgnoreCase value");
 		caseSensitiveAttributes.put(attribute);
-		NamingEnumeration enumeration = caseSensitiveAttributes.getIDs();
+		NamingEnumeration<?> enumeration = caseSensitiveAttributes.getIDs();
 		int count = 0;
 		while (enumeration.hasMore()) {
 			count++;
@@ -450,7 +451,7 @@
 
 	public void testRemove_IgnoreCase_Null() {
 		try {
-			Object obj = ignoreCaseAttributes.remove(null);
+			ignoreCaseAttributes.remove(null);
 			fail("Should throw NullPointerException.");
 		} catch (NullPointerException e) {
 		}
@@ -472,7 +473,7 @@
 
 	public void testRemove_CaseSensitive_Null() {
 		try {
-			Object obj = caseSensitiveAttributes.remove(null);
+			caseSensitiveAttributes.remove(null);
 			fail("Should throw NullPointerException.");
 		} catch (NullPointerException e) {
 		}
@@ -549,16 +550,6 @@
 			attribute[i] = new BasicAttribute("ID:" + i, "Value: " + i);
 			ignoreCaseAttributes.put(attribute[i]);
 		}
-		String str = "{\nid:9=Attribute ID: ID:9\nAttribute values: Value: 9\n"
-				+ "; id:8=Attribute ID: ID:8\nAttribute values: Value: 8\n"
-				+ "; id:7=Attribute ID: ID:7\nAttribute values: Value: 7\n"
-				+ "; id:6=Attribute ID: ID:6\nAttribute values: Value: 6\n"
-				+ "; id:5=Attribute ID: ID:5\nAttribute values: Value: 5\n"
-				+ "; id:4=Attribute ID: ID:4\nAttribute values: Value: 4\n"
-				+ "; id:3=Attribute ID: ID:3\nAttribute values: Value: 3\n"
-				+ "; id:2=Attribute ID: ID:2\nAttribute values: Value: 2\n"
-				+ "; id:1=Attribute ID: ID:1\nAttribute values: Value: 1\n"
-				+ "; id:0=Attribute ID: ID:0\nAttribute values: Value: 0\n}\n";
 		// assertEquals(str, ignoreCaseAttributes.toString());
 		assertNotNull(ignoreCaseAttributes.toString());
 	}
@@ -585,16 +576,6 @@
 			attribute[i] = new BasicAttribute("ID:" + i, "Value: " + i);
 			caseSensitiveAttributes.put(attribute[i]);
 		}
-		String str = "{\nID:9=Attribute ID: ID:9\nAttribute values: Value: 9\n"
-				+ "; ID:8=Attribute ID: ID:8\nAttribute values: Value: 8\n"
-				+ "; ID:7=Attribute ID: ID:7\nAttribute values: Value: 7\n"
-				+ "; ID:6=Attribute ID: ID:6\nAttribute values: Value: 6\n"
-				+ "; ID:5=Attribute ID: ID:5\nAttribute values: Value: 5\n"
-				+ "; ID:4=Attribute ID: ID:4\nAttribute values: Value: 4\n"
-				+ "; ID:3=Attribute ID: ID:3\nAttribute values: Value: 3\n"
-				+ "; ID:2=Attribute ID: ID:2\nAttribute values: Value: 2\n"
-				+ "; ID:1=Attribute ID: ID:1\nAttribute values: Value: 1\n"
-				+ "; ID:0=Attribute ID: ID:0\nAttribute values: Value: 0\n}\n";
 		// assertEquals(str, caseSensitiveAttributes.toString());
 		assertNotNull(caseSensitiveAttributes.toString());
 	}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/InitialDirContextTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/InitialDirContextTest.java?view=diff&rev=449555&r1=449554&r2=449555
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/InitialDirContextTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/InitialDirContextTest.java Sun Sep 24 20:33:27 2006
@@ -92,26 +92,20 @@
 		super(arg0);
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see junit.framework.TestCase#setUp()
-	 */
-	protected void setUp() throws Exception {
+
+	@Override
+    protected void setUp() throws Exception {
 		super.setUp();
-		Hashtable env = new Hashtable();
+		Hashtable<String, String> env = new Hashtable<String, String>();
 		env.put(Context.INITIAL_CONTEXT_FACTORY,
 				"org.apache.harmony.jndi.tests.javax.naming.spi.mock.MockDirContextFactory");
 		env.put(Context.URL_PKG_PREFIXES, "org.apache.harmony.jndi.tests.javax.naming.spi.mock");
 		ctx = new InitialDirContext(env);
 	}
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see junit.framework.TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
+
+	@Override
+    protected void tearDown() throws Exception {
 		super.tearDown();
 	}
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/ModificationItemTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/ModificationItemTest.java?view=diff&rev=449555&r1=449554&r2=449555
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/ModificationItemTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/ModificationItemTest.java Sun Sep 24 20:33:27 2006
@@ -27,29 +27,6 @@
 
 	BasicAttribute attr = new BasicAttribute("id_sample", "value_sample");
 
-	/**
-	 * Constructor for ModificationItemTest.
-	 * 
-	 * @param arg0
-	 */
-	public ModificationItemTest(String arg0) {
-		super(arg0);
-	}
-
-	/*
-	 * @see TestCase#setUp()
-	 */
-	protected void setUp() throws Exception {
-		super.setUp();
-	}
-
-	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
 	public void testModificationItem() {
 		log.setMethod("testModificationItem()");
 		ModificationItem item;
@@ -61,10 +38,9 @@
 
 	public void testModificationItem_InvalidOp() {
 		log.setMethod("testModificationItem_InvalidOp()");
-		ModificationItem item;
 
 		try {
-			item = new ModificationItem(-255, attr);
+			new ModificationItem(-255, attr);
 			fail("Should throw IllegalArgumentException");
 		} catch (IllegalArgumentException e) {
 		}
@@ -72,10 +48,9 @@
 
 	public void testModificationItem_NullAttribute() {
 		log.setMethod("testModificationItem_NullAttribute()");
-		ModificationItem item;
 
 		try {
-			item = new ModificationItem(DirContext.ADD_ATTRIBUTE, null);
+			new ModificationItem(DirContext.ADD_ATTRIBUTE, null);
 			fail("Should throw IllegalArgumentException");
 		} catch (IllegalArgumentException e) {
 		}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/SearchControlsTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/SearchControlsTest.java?view=diff&rev=449555&r1=449554&r2=449555
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/SearchControlsTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/SearchControlsTest.java Sun Sep 24 20:33:27 2006
@@ -25,29 +25,6 @@
 
 	static Log log = new Log(SearchControlsTest.class);
 
-	/**
-	 * Constructor for SearchControlsTest.
-	 * 
-	 * @param arg0
-	 */
-	public SearchControlsTest(String arg0) {
-		super(arg0);
-	}
-
-	/*
-	 * @see TestCase#setUp()
-	 */
-	protected void setUp() throws Exception {
-		super.setUp();
-	}
-
-	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
 	/*
 	 * Test for void SearchControls()
 	 */
@@ -84,27 +61,21 @@
 
 	public void testSearchControls_Illegal_Scope() {
 		log.setMethod("testSearchControls_Illegal_Scope()");
-		SearchControls ctrl;
-
-		ctrl = new SearchControls(-1, 100, 200, new String[] { "id1", "id2" },
+		new SearchControls(-1, 100, 200, new String[] { "id1", "id2" },
 				true, true);
 
 	}
 
 	public void testSearchControls_Illegal_CountLimit() {
 		log.setMethod("testSearchControls_Illegal_CountLimit()");
-		SearchControls ctrl;
-
-		ctrl = new SearchControls(SearchControls.OBJECT_SCOPE, -1, 200,
+		new SearchControls(SearchControls.OBJECT_SCOPE, -1, 200,
 				new String[] { "id1", "id2" }, true, true);
 
 	}
 
 	public void testSearchControls_Illegal_TimeLimit() {
 		log.setMethod("testSearchControls_Illegal_TimeLimit()");
-		SearchControls ctrl;
-
-		ctrl = new SearchControls(SearchControls.OBJECT_SCOPE, 100, -1,
+		new SearchControls(SearchControls.OBJECT_SCOPE, 100, -1,
 				new String[] { "id1", "id2" }, true, true);
 
 	}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/SearchResultTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/SearchResultTest.java?view=diff&rev=449555&r1=449554&r2=449555
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/SearchResultTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/directory/SearchResultTest.java Sun Sep 24 20:33:27 2006
@@ -26,29 +26,6 @@
 
 	BasicAttributes attrs = new BasicAttributes("id_sample", "value_sample");
 
-	/**
-	 * Constructor for SearchResultTest.
-	 * 
-	 * @param arg0
-	 */
-	public SearchResultTest(String arg0) {
-		super(arg0);
-	}
-
-	/*
-	 * @see TestCase#setUp()
-	 */
-	protected void setUp() throws Exception {
-		super.setUp();
-	}
-
-	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
 	/*
 	 * Test for void SearchResult(String, Object, Attributes)
 	 */
@@ -111,10 +88,10 @@
 
 	public void testSearchResult_NullAttributes() {
 		log.setMethod("testSearchResult_NullAttributes()");
-		SearchResult r;
 
 		try {
-			r = new SearchResult(null, null, null);
+			 new SearchResult(null, null, null);
+             fail("no illegal argument exception");
 		} 
 		catch (IllegalArgumentException e) {
 			// Expected, name cannot be null

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/MockEventDirContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/MockEventDirContext.java?view=diff&rev=449555&r1=449554&r2=449555
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/MockEventDirContext.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/MockEventDirContext.java Sun Sep 24 20:33:27 2006
@@ -17,8 +17,10 @@
 
 import java.util.Hashtable;
 
+import javax.naming.Binding;
 import javax.naming.Context;
 import javax.naming.Name;
+import javax.naming.NameClassPair;
 import javax.naming.NameParser;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -26,687 +28,318 @@
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
 import javax.naming.event.EventDirContext;
 import javax.naming.event.NamingListener;
 
 public class MockEventDirContext implements EventDirContext {
 
-	/*
-	 * -------------------------------------------------------------------
-	 * Methods
-	 * -------------------------------------------------------------------
-	 */
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.event.EventDirContext#addNamingListener(javax.naming.Name,
-	 *      java.lang.String, java.lang.Object[],
-	 *      javax.naming.directory.SearchControls,
-	 *      javax.naming.event.NamingListener)
-	 */
-	public void addNamingListener(Name name, String s, Object[] aobj,
-			SearchControls searchcontrols, NamingListener naminglistener)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.event.EventDirContext#addNamingListener(javax.naming.Name,
-	 *      java.lang.String, javax.naming.directory.SearchControls,
-	 *      javax.naming.event.NamingListener)
-	 */
-	public void addNamingListener(Name name, String s,
-			SearchControls searchcontrols, NamingListener naminglistener)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.event.EventDirContext#addNamingListener(java.lang.String,
-	 *      java.lang.String, java.lang.Object[],
-	 *      javax.naming.directory.SearchControls,
-	 *      javax.naming.event.NamingListener)
-	 */
-	public void addNamingListener(String s, String s1, Object[] aobj,
-			SearchControls searchcontrols, NamingListener naminglistener)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.event.EventDirContext#addNamingListener(java.lang.String,
-	 *      java.lang.String, javax.naming.directory.SearchControls,
-	 *      javax.naming.event.NamingListener)
-	 */
-	public void addNamingListener(String s, String s1,
-			SearchControls searchcontrols, NamingListener naminglistener)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.event.EventContext#addNamingListener(javax.naming.Name,
-	 *      int, javax.naming.event.NamingListener)
-	 */
-	public void addNamingListener(Name name, int i,
-			NamingListener naminglistener) throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.event.EventContext#addNamingListener(java.lang.String,
-	 *      int, javax.naming.event.NamingListener)
-	 */
-	public void addNamingListener(String s, int i, NamingListener naminglistener)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.event.EventContext#removeNamingListener(javax.naming.event.NamingListener)
-	 */
-	public void removeNamingListener(NamingListener naminglistener)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.event.EventContext#targetMustExist()
-	 */
-	public boolean targetMustExist() throws NamingException {
-
-		return false;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#addToEnvironment(java.lang.String,
-	 *      java.lang.Object)
-	 */
-	public Object addToEnvironment(String s, Object o) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#bind(javax.naming.Name, java.lang.Object)
-	 */
-	public void bind(Name n, Object o) throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#bind(java.lang.String, java.lang.Object)
-	 */
-	public void bind(String s, Object o) throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#close()
-	 */
-	public void close() throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#composeName(javax.naming.Name,
-	 *      javax.naming.Name)
-	 */
-	public Name composeName(Name n, Name pfx) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#composeName(java.lang.String, java.lang.String)
-	 */
-	public String composeName(String s, String pfx) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#createSubcontext(javax.naming.Name)
-	 */
-	public Context createSubcontext(Name n) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#createSubcontext(java.lang.String)
-	 */
-	public Context createSubcontext(String s) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#destroySubcontext(javax.naming.Name)
-	 */
-	public void destroySubcontext(Name n) throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#destroySubcontext(java.lang.String)
-	 */
-	public void destroySubcontext(String s) throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#getEnvironment()
-	 */
-	public Hashtable getEnvironment() throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#getNameInNamespace()
-	 */
-	public String getNameInNamespace() throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#getNameParser(javax.naming.Name)
-	 */
-	public NameParser getNameParser(Name n) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#getNameParser(java.lang.String)
-	 */
-	public NameParser getNameParser(String s) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#list(javax.naming.Name)
-	 */
-	public NamingEnumeration list(Name n) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#list(java.lang.String)
-	 */
-	public NamingEnumeration list(String s) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#listBindings(javax.naming.Name)
-	 */
-	public NamingEnumeration listBindings(Name n) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#listBindings(java.lang.String)
-	 */
-	public NamingEnumeration listBindings(String s) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#lookup(javax.naming.Name)
-	 */
-	public Object lookup(Name n) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#lookup(java.lang.String)
-	 */
-	public Object lookup(String s) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#lookupLink(javax.naming.Name)
-	 */
-	public Object lookupLink(Name n) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#lookupLink(java.lang.String)
-	 */
-	public Object lookupLink(String s) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#rebind(javax.naming.Name, java.lang.Object)
-	 */
-	public void rebind(Name n, Object o) throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#rebind(java.lang.String, java.lang.Object)
-	 */
-	public void rebind(String s, Object o) throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#removeFromEnvironment(java.lang.String)
-	 */
-	public Object removeFromEnvironment(String s) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#rename(javax.naming.Name, javax.naming.Name)
-	 */
-	public void rename(Name nOld, Name nNew) throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#rename(java.lang.String, java.lang.String)
-	 */
-	public void rename(String sOld, String sNew) throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#unbind(javax.naming.Name)
-	 */
-	public void unbind(Name n) throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.Context#unbind(java.lang.String)
-	 */
-	public void unbind(String s) throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#bind(javax.naming.Name,
-	 *      java.lang.Object, javax.naming.directory.Attributes)
-	 */
-	public void bind(Name name, Object obj, Attributes attributes)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#bind(java.lang.String,
-	 *      java.lang.Object, javax.naming.directory.Attributes)
-	 */
-	public void bind(String s, Object obj, Attributes attributes)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#createSubcontext(javax.naming.Name,
-	 *      javax.naming.directory.Attributes)
-	 */
-	public DirContext createSubcontext(Name name, Attributes attributes)
-			throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#createSubcontext(java.lang.String,
-	 *      javax.naming.directory.Attributes)
-	 */
-	public DirContext createSubcontext(String s, Attributes attributes)
-			throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#getAttributes(javax.naming.Name)
-	 */
-	public Attributes getAttributes(Name name) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#getAttributes(javax.naming.Name,
-	 *      java.lang.String[])
-	 */
-	public Attributes getAttributes(Name name, String[] as)
-			throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#getAttributes(java.lang.String)
-	 */
-	public Attributes getAttributes(String s) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#getAttributes(java.lang.String,
-	 *      java.lang.String[])
-	 */
-	public Attributes getAttributes(String s, String[] as)
-			throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#getSchema(javax.naming.Name)
-	 */
-	public DirContext getSchema(Name name) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#getSchema(java.lang.String)
-	 */
-	public DirContext getSchema(String s) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#getSchemaClassDefinition(javax.naming.Name)
-	 */
-	public DirContext getSchemaClassDefinition(Name name)
-			throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#getSchemaClassDefinition(java.lang.String)
-	 */
-	public DirContext getSchemaClassDefinition(String s) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#modifyAttributes(javax.naming.Name,
-	 *      int, javax.naming.directory.Attributes)
-	 */
-	public void modifyAttributes(Name name, int i, Attributes attributes)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#modifyAttributes(javax.naming.Name,
-	 *      javax.naming.directory.ModificationItem[])
-	 */
-	public void modifyAttributes(Name name, ModificationItem[] amodificationitem)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#modifyAttributes(java.lang.String,
-	 *      int, javax.naming.directory.Attributes)
-	 */
-	public void modifyAttributes(String s, int i, Attributes attributes)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#modifyAttributes(java.lang.String,
-	 *      javax.naming.directory.ModificationItem[])
-	 */
-	public void modifyAttributes(String s, ModificationItem[] amodificationitem)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#rebind(javax.naming.Name,
-	 *      java.lang.Object, javax.naming.directory.Attributes)
-	 */
-	public void rebind(Name name, Object obj, Attributes attributes)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#rebind(java.lang.String,
-	 *      java.lang.Object, javax.naming.directory.Attributes)
-	 */
-	public void rebind(String s, Object obj, Attributes attributes)
-			throws NamingException {
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#search(javax.naming.Name,
-	 *      javax.naming.directory.Attributes)
-	 */
-	public NamingEnumeration search(Name name, Attributes attributes)
-			throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#search(javax.naming.Name,
-	 *      javax.naming.directory.Attributes, java.lang.String[])
-	 */
-	public NamingEnumeration search(Name name, Attributes attributes,
-			String[] as) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#search(javax.naming.Name,
-	 *      java.lang.String, java.lang.Object[],
-	 *      javax.naming.directory.SearchControls)
-	 */
-	public NamingEnumeration search(Name name, String s, Object[] aobj,
-			SearchControls searchcontrols) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#search(javax.naming.Name,
-	 *      java.lang.String, javax.naming.directory.SearchControls)
-	 */
-	public NamingEnumeration search(Name name, String s,
-			SearchControls searchcontrols) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#search(java.lang.String,
-	 *      javax.naming.directory.Attributes)
-	 */
-	public NamingEnumeration search(String s, Attributes attributes)
-			throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#search(java.lang.String,
-	 *      javax.naming.directory.Attributes, java.lang.String[])
-	 */
-	public NamingEnumeration search(String s, Attributes attributes, String[] as)
-			throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#search(java.lang.String,
-	 *      java.lang.String, java.lang.Object[],
-	 *      javax.naming.directory.SearchControls)
-	 */
-	public NamingEnumeration search(String s, String s1, Object[] aobj,
-			SearchControls searchcontrols) throws NamingException {
-
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.naming.directory.DirContext#search(java.lang.String,
-	 *      java.lang.String, javax.naming.directory.SearchControls)
-	 */
-	public NamingEnumeration search(String s, String s1,
-			SearchControls searchcontrols) throws NamingException {
+    public void addNamingListener(Name name, String s, Object[] aobj,
+            SearchControls searchcontrols, NamingListener naminglistener)
+            throws NamingException {
 
-		return null;
-	}
+    }
+
+    public void addNamingListener(Name name, String s, SearchControls searchcontrols,
+            NamingListener naminglistener) throws NamingException {
+
+    }
+
+    public void addNamingListener(String s, String s1, Object[] aobj,
+            SearchControls searchcontrols, NamingListener naminglistener)
+            throws NamingException {
+
+    }
+
+    public void addNamingListener(String s, String s1, SearchControls searchcontrols,
+            NamingListener naminglistener) throws NamingException {
+
+    }
+
+    public void addNamingListener(Name name, int i, NamingListener naminglistener)
+            throws NamingException {
+
+    }
+
+    public void addNamingListener(String s, int i, NamingListener naminglistener)
+            throws NamingException {
+
+    }
+
+    public void removeNamingListener(NamingListener naminglistener) throws NamingException {
+
+    }
+
+    public boolean targetMustExist() throws NamingException {
+
+        return false;
+    }
+
+    public Object addToEnvironment(String s, Object o) throws NamingException {
+
+        return null;
+    }
+
+    public void bind(Name n, Object o) throws NamingException {
+
+    }
+
+    public void bind(String s, Object o) throws NamingException {
+
+    }
+
+    public void close() throws NamingException {
+
+    }
+
+    public Name composeName(Name n, Name pfx) throws NamingException {
+
+        return null;
+    }
+
+    public String composeName(String s, String pfx) throws NamingException {
+
+        return null;
+    }
+
+    public Context createSubcontext(Name n) throws NamingException {
+
+        return null;
+    }
+
+    public Context createSubcontext(String s) throws NamingException {
+
+        return null;
+    }
+
+    public void destroySubcontext(Name n) throws NamingException {
+
+    }
+
+    public void destroySubcontext(String s) throws NamingException {
+
+    }
+
+    public Hashtable<?, ?> getEnvironment() throws NamingException {
+
+        return null;
+    }
+
+    public String getNameInNamespace() throws NamingException {
+
+        return null;
+    }
+
+    public NameParser getNameParser(Name n) throws NamingException {
+
+        return null;
+    }
+
+    public NameParser getNameParser(String s) throws NamingException {
+
+        return null;
+    }
+
+    public NamingEnumeration<NameClassPair> list(Name n) throws NamingException {
+
+        return null;
+    }
+
+    public NamingEnumeration<NameClassPair> list(String s) throws NamingException {
+
+        return null;
+    }
+
+    public NamingEnumeration<Binding> listBindings(Name n) throws NamingException {
+
+        return null;
+    }
+
+    public NamingEnumeration<Binding> listBindings(String s) throws NamingException {
+
+        return null;
+    }
+
+    public Object lookup(Name n) throws NamingException {
+
+        return null;
+    }
+
+    public Object lookup(String s) throws NamingException {
+
+        return null;
+    }
+
+    public Object lookupLink(Name n) throws NamingException {
+
+        return null;
+    }
+
+    public Object lookupLink(String s) throws NamingException {
+
+        return null;
+    }
+
+    public void rebind(Name n, Object o) throws NamingException {
+
+    }
+
+    public void rebind(String s, Object o) throws NamingException {
+
+    }
+
+    public Object removeFromEnvironment(String s) throws NamingException {
+
+        return null;
+    }
+
+    public void rename(Name nOld, Name nNew) throws NamingException {
+
+    }
+
+    public void rename(String sOld, String sNew) throws NamingException {
+
+    }
+
+    public void unbind(Name n) throws NamingException {
+
+    }
+
+    public void unbind(String s) throws NamingException {
+
+    }
+
+    public void bind(Name name, Object obj, Attributes attributes) throws NamingException {
+
+    }
+
+    public void bind(String s, Object obj, Attributes attributes) throws NamingException {
+
+    }
+
+    public DirContext createSubcontext(Name name, Attributes attributes) throws NamingException {
+
+        return null;
+    }
+
+    public DirContext createSubcontext(String s, Attributes attributes) throws NamingException {
+
+        return null;
+    }
+
+    public Attributes getAttributes(Name name) throws NamingException {
+
+        return null;
+    }
+
+    public Attributes getAttributes(Name name, String[] as) throws NamingException {
+
+        return null;
+    }
+
+    public Attributes getAttributes(String s) throws NamingException {
+
+        return null;
+    }
+
+    public Attributes getAttributes(String s, String[] as) throws NamingException {
+
+        return null;
+    }
+
+    public DirContext getSchema(Name name) throws NamingException {
+
+        return null;
+    }
+
+    public DirContext getSchema(String s) throws NamingException {
+
+        return null;
+    }
+
+    public DirContext getSchemaClassDefinition(Name name) throws NamingException {
+
+        return null;
+    }
+
+    public DirContext getSchemaClassDefinition(String s) throws NamingException {
+
+        return null;
+    }
+
+    public void modifyAttributes(Name name, int i, Attributes attributes)
+            throws NamingException {
+
+    }
+
+    public void modifyAttributes(Name name, ModificationItem[] amodificationitem)
+            throws NamingException {
+
+    }
+
+    public void modifyAttributes(String s, int i, Attributes attributes) throws NamingException {
+
+    }
+
+    public void modifyAttributes(String s, ModificationItem[] amodificationitem)
+            throws NamingException {
+
+    }
+
+    public void rebind(Name name, Object obj, Attributes attributes) throws NamingException {
+
+    }
+
+    public void rebind(String s, Object obj, Attributes attributes) throws NamingException {
+
+    }
+
+    public NamingEnumeration<SearchResult> search(Name name, Attributes attributes)
+            throws NamingException {
+
+        return null;
+    }
+
+    public NamingEnumeration<SearchResult> search(Name name, Attributes attributes, String[] as)
+            throws NamingException {
+
+        return null;
+    }
+
+    public NamingEnumeration<SearchResult> search(Name name, String s, Object[] aobj,
+            SearchControls searchcontrols) throws NamingException {
+
+        return null;
+    }
+
+    public NamingEnumeration<SearchResult> search(Name name, String s,
+            SearchControls searchcontrols) throws NamingException {
+
+        return null;
+    }
+
+    public NamingEnumeration<SearchResult> search(String s, Attributes attributes)
+            throws NamingException {
+
+        return null;
+    }
+
+    public NamingEnumeration<SearchResult> search(String s, Attributes attributes, String[] as)
+            throws NamingException {
+
+        return null;
+    }
+
+    public NamingEnumeration<SearchResult> search(String s, String s1, Object[] aobj,
+            SearchControls searchcontrols) throws NamingException {
+
+        return null;
+    }
+
+    public NamingEnumeration<SearchResult> search(String s, String s1,
+            SearchControls searchcontrols) throws NamingException {
+
+        return null;
+    }
 
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/NamingEventTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/NamingEventTest.java?view=diff&rev=449555&r1=449554&r2=449555
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/NamingEventTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/NamingEventTest.java Sun Sep 24 20:33:27 2006
@@ -19,6 +19,7 @@
 import javax.naming.Binding;
 import javax.naming.Context;
 import javax.naming.Name;
+import javax.naming.NameClassPair;
 import javax.naming.NameParser;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -35,573 +36,532 @@
 
 public class NamingEventTest extends TestCase {
 
-	static Log log = new Log(NamingEventTest.class);
+    static Log log = new Log(NamingEventTest.class);
 
-	static Binding binding1 = new Binding("name_sample", "value_sample");
+    static Binding binding1 = new Binding("name_sample", "value_sample");
 
-	static Binding binding2 = new Binding("name_sample2", "value_sample2");
+    static Binding binding2 = new Binding("name_sample2", "value_sample2");
 
-	static EventContext eventctx = new EventContextMockUp();
+    static EventContext eventctx = new EventContextMockUp();
 
-	/**
-	 * Constructor for NameEventTest.
-	 * 
-	 * @param arg0
-	 */
-	public NamingEventTest(String arg0) {
-		super(arg0);
-	}
-
-	/*
-	 * @see TestCase#setUp()
-	 */
-	protected void setUp() throws Exception {
-		super.setUp();
-	}
-
-	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
-	public void testConstructorAndGetters() {
-		log.setMethod("testConstructorAndGetters()");
-		NamingEvent event = null;
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_CHANGED, binding1,
-				binding2, "anything");
-
-		assertEquals(eventctx, event.getEventContext());
-		assertEquals(NamingEvent.OBJECT_CHANGED, event.getType());
-		assertEquals(binding1, event.getNewBinding());
-		assertEquals(binding2, event.getOldBinding());
-		assertEquals("anything", event.getChangeInfo());
-
-		assertEquals(eventctx, event.getSource());
-	}
-
-	public void testConstructorAndGetters_Null_EventContext() {
-		log.setMethod("testConstructorAndGetters_Null_EventContext()");
-		NamingEvent event;
-
-		try {
-			event = new NamingEvent(null, NamingEvent.OBJECT_CHANGED, binding1,
-					binding2, "anything");
-			fail("IllegalArgumentException excepted");
-		} catch (IllegalArgumentException e) {
-		}
-	}
-
-	public void testConstructorAndGetters_Null_Type() {
-		log.setMethod("testConstructorAndGetters_Null_Type()");
-		NamingEvent event;
-
-		event = new NamingEvent(eventctx, -1, binding1, binding2, "anything");
-		assertEquals(-1, event.getType());
-	}
-
-	public void testConstructor_ValidateArgs_ADDED() {
-		log.setMethod("testConstructor_ValidateArgs_ADDED()");
-		NamingEvent event;
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_ADDED, binding1,
-				null, null);
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_ADDED, null,
-				binding2, "anything");
-		assertNull(event.getNewBinding());
-	}
-
-	public void testConstructor_ValidateArgs_CHANGED() {
-		log.setMethod("testConstructor_ValidateArgs_CHANGED()");
-		NamingEvent event;
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_CHANGED, binding1,
-				binding2, null);
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_CHANGED, null,
-				binding2, "anything");
-		assertNull(event.getNewBinding());
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_CHANGED, binding1,
-				null, "anything");
-		assertNull(event.getOldBinding());
-	}
-
-	public void testConstructor_ValidateArgs_REMOVED() {
-		log.setMethod("testConstructor_ValidateArgs_REMOVED()");
-		NamingEvent event;
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_REMOVED, null,
-				binding2, null);
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_REMOVED, binding1,
-				null, "anything");
-		assertNull(event.getOldBinding());
-	}
-
-	public void testConstructor_ValidateArgs_RENAMED() {
-		log.setMethod("testConstructor_ValidateArgs_RENAMED()");
-		NamingEvent event;
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_RENAMED, binding1,
-				binding2, null);
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_RENAMED, null,
-				binding2, "anything");
-		assertNull(event.getNewBinding());
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_RENAMED, binding1,
-				null, "anything");
-		assertNull(event.getOldBinding());
-	}
-
-	public void testDispatch_ADDED() {
-		log.setMethod("testDispatch_ADDED()");
-		NamingEvent event;
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_ADDED, binding1,
-				binding2, "anything");
-
-		event.dispatch(new TestAllListener(event));
-	}
-
-	public void testDispatch_REMOVED() {
-		log.setMethod("testDispatch_REMOVED()");
-		NamingEvent event;
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_REMOVED, binding1,
-				binding2, "anything");
-
-		event.dispatch(new TestAllListener(event));
-	}
-
-	public void testDispatch_RENAMED() {
-		log.setMethod("testDispatch_RENAMED()");
-		NamingEvent event;
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_RENAMED, binding1,
-				binding2, "anything");
-
-		event.dispatch(new TestAllListener(event));
-	}
-
-	public void testDispatch_CHANGED() {
-		log.setMethod("testDispatch_CHANGED()");
-		NamingEvent event;
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_CHANGED, binding1,
-				binding2, "anything");
-
-		event.dispatch(new TestAllListener(event));
-	}
-
-	public void testDispatch_ADDED_BadListenerType() {
-		log.setMethod("testDispatch_ADDED_BadListenerType()");
-		NamingEvent event;
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_ADDED, binding1,
-				binding2, "anything");
-
-		try {
-			event.dispatch(new TestEmptyListener(event));
-			fail("should throw ClassCastException");
-		} catch (ClassCastException e) {
-		}
-	}
-
-	public void testDispatch_REMOVED_BadListenerType() {
-		log.setMethod("testDispatch_REMOVED_BadListenerType()");
-		NamingEvent event;
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_REMOVED, binding1,
-				binding2, "anything");
-
-		try {
-			event.dispatch(new TestEmptyListener(event));
-			fail("should throw ClassCastException");
-		} catch (ClassCastException e) {
-		}
-	}
-
-	public void testDispatch_RENAMED_BadListenerType() {
-		log.setMethod("testDispatch_RENAMED_BadListenerType()");
-		NamingEvent event;
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_RENAMED, binding1,
-				binding2, "anything");
-
-		try {
-			event.dispatch(new TestEmptyListener(event));
-			fail("should throw ClassCastException");
-		} catch (ClassCastException e) {
-		}
-	}
-
-	public void testDispatch_CHANGED_BadListenerType() {
-		log.setMethod("testDispatch_CHANGED_BadListenerType()");
-		NamingEvent event;
-
-		event = new NamingEvent(eventctx, NamingEvent.OBJECT_CHANGED, binding1,
-				binding2, "anything");
-
-		try {
-			event.dispatch(new TestEmptyListener(event));
-			fail("should throw ClassCastException");
-		} catch (ClassCastException e) {
-		}
-	}
-
-	class TestEmptyListener implements NamingListener {
-
-		protected NamingEvent expectedEvent;
-
-		public TestEmptyListener(NamingEvent expectedEvent) {
-			this.expectedEvent = expectedEvent;
-		}
-
-		public void namingExceptionThrown(
-				NamingExceptionEvent namingexceptionevent) {
-			log.log("namingExceptionThrown called, " + namingexceptionevent);
-		}
-
-	}
-
-	class TestAllListener extends TestEmptyListener implements
-			NamespaceChangeListener, ObjectChangeListener {
-
-		public TestAllListener(NamingEvent expectedEvent) {
-			super(expectedEvent);
-		}
-
-		public void objectAdded(NamingEvent namingevent) {
-			assertTrue(expectedEvent == namingevent);
-		}
-
-		public void objectRemoved(NamingEvent namingevent) {
-			assertTrue(expectedEvent == namingevent);
-		}
-
-		public void objectRenamed(NamingEvent namingevent) {
-			assertTrue(expectedEvent == namingevent);
-		}
-
-		public void objectChanged(NamingEvent namingevent) {
-			assertTrue(expectedEvent == namingevent);
-		}
-	}
-
-	static class EventContextMockUp implements EventContext {
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.event.EventContext#addNamingListener(javax.naming.Name,
-		 *      int, javax.naming.event.NamingListener)
-		 */
-		public void addNamingListener(Name name, int i,
-				NamingListener naminglistener) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.event.EventContext#addNamingListener(java.lang.String,
-		 *      int, javax.naming.event.NamingListener)
-		 */
-		public void addNamingListener(String s, int i,
-				NamingListener naminglistener) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.event.EventContext#removeNamingListener(javax.naming.event.NamingListener)
-		 */
-		public void removeNamingListener(NamingListener naminglistener)
-				throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.event.EventContext#targetMustExist()
-		 */
-		public boolean targetMustExist() throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#addToEnvironment(java.lang.String,
-		 *      java.lang.Object)
-		 */
-		public Object addToEnvironment(String s, Object o)
-				throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#bind(javax.naming.Name, java.lang.Object)
-		 */
-		public void bind(Name n, Object o) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#bind(java.lang.String, java.lang.Object)
-		 */
-		public void bind(String s, Object o) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#close()
-		 */
-		public void close() throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#composeName(javax.naming.Name,
-		 *      javax.naming.Name)
-		 */
-		public Name composeName(Name n, Name pfx) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#composeName(java.lang.String,
-		 *      java.lang.String)
-		 */
-		public String composeName(String s, String pfx) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#createSubcontext(javax.naming.Name)
-		 */
-		public Context createSubcontext(Name n) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#createSubcontext(java.lang.String)
-		 */
-		public Context createSubcontext(String s) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#destroySubcontext(javax.naming.Name)
-		 */
-		public void destroySubcontext(Name n) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#destroySubcontext(java.lang.String)
-		 */
-		public void destroySubcontext(String s) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#getEnvironment()
-		 */
-		public Hashtable getEnvironment() throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#getNameInNamespace()
-		 */
-		public String getNameInNamespace() throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#getNameParser(javax.naming.Name)
-		 */
-		public NameParser getNameParser(Name n) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#getNameParser(java.lang.String)
-		 */
-		public NameParser getNameParser(String s) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#list(javax.naming.Name)
-		 */
-		public NamingEnumeration list(Name n) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#list(java.lang.String)
-		 */
-		public NamingEnumeration list(String s) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#listBindings(javax.naming.Name)
-		 */
-		public NamingEnumeration listBindings(Name n) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#listBindings(java.lang.String)
-		 */
-		public NamingEnumeration listBindings(String s) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#lookup(javax.naming.Name)
-		 */
-		public Object lookup(Name n) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#lookup(java.lang.String)
-		 */
-		public Object lookup(String s) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#lookupLink(javax.naming.Name)
-		 */
-		public Object lookupLink(Name n) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#lookupLink(java.lang.String)
-		 */
-		public Object lookupLink(String s) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#rebind(javax.naming.Name, java.lang.Object)
-		 */
-		public void rebind(Name n, Object o) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#rebind(java.lang.String, java.lang.Object)
-		 */
-		public void rebind(String s, Object o) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#removeFromEnvironment(java.lang.String)
-		 */
-		public Object removeFromEnvironment(String s) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#rename(javax.naming.Name,
-		 *      javax.naming.Name)
-		 */
-		public void rename(Name nOld, Name nNew) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#rename(java.lang.String, java.lang.String)
-		 */
-		public void rename(String sOld, String sNew) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#unbind(javax.naming.Name)
-		 */
-		public void unbind(Name n) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see javax.naming.Context#unbind(java.lang.String)
-		 */
-		public void unbind(String s) throws NamingException {
-			throw new UnsupportedOperationException("in EventContextMockUp");
-		}
+    public void testConstructorAndGetters() {
+        log.setMethod("testConstructorAndGetters()");
+        NamingEvent event = null;
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_CHANGED, binding1, binding2,
+                "anything");
+
+        assertEquals(eventctx, event.getEventContext());
+        assertEquals(NamingEvent.OBJECT_CHANGED, event.getType());
+        assertEquals(binding1, event.getNewBinding());
+        assertEquals(binding2, event.getOldBinding());
+        assertEquals("anything", event.getChangeInfo());
+
+        assertEquals(eventctx, event.getSource());
+    }
+
+    public void testConstructorAndGetters_Null_EventContext() {
+        log.setMethod("testConstructorAndGetters_Null_EventContext()");
+
+        try {
+            new NamingEvent(null, NamingEvent.OBJECT_CHANGED, binding1, binding2, "anything");
+            fail("IllegalArgumentException excepted");
+        } catch (IllegalArgumentException e) {
+        }
+    }
+
+    public void testConstructorAndGetters_Null_Type() {
+        log.setMethod("testConstructorAndGetters_Null_Type()");
+        NamingEvent event = new NamingEvent(eventctx, -1, binding1, binding2, "anything");
+        assertEquals(-1, event.getType());
+    }
+
+    public void testConstructor_ValidateArgs_ADDED() {
+        log.setMethod("testConstructor_ValidateArgs_ADDED()");
+        NamingEvent event = new NamingEvent(eventctx, NamingEvent.OBJECT_ADDED, binding1, null,
+                null);
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_ADDED, null, binding2, "anything");
+        assertNull(event.getNewBinding());
+    }
+
+    public void testConstructor_ValidateArgs_CHANGED() {
+        log.setMethod("testConstructor_ValidateArgs_CHANGED()");
+        NamingEvent event;
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_CHANGED, binding1, binding2, null);
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_CHANGED, null, binding2,
+                "anything");
+        assertNull(event.getNewBinding());
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_CHANGED, binding1, null,
+                "anything");
+        assertNull(event.getOldBinding());
+    }
+
+    public void testConstructor_ValidateArgs_REMOVED() {
+        log.setMethod("testConstructor_ValidateArgs_REMOVED()");
+        NamingEvent event;
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_REMOVED, null, binding2, null);
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_REMOVED, binding1, null,
+                "anything");
+        assertNull(event.getOldBinding());
+    }
+
+    public void testConstructor_ValidateArgs_RENAMED() {
+        log.setMethod("testConstructor_ValidateArgs_RENAMED()");
+        NamingEvent event;
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_RENAMED, binding1, binding2, null);
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_RENAMED, null, binding2,
+                "anything");
+        assertNull(event.getNewBinding());
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_RENAMED, binding1, null,
+                "anything");
+        assertNull(event.getOldBinding());
+    }
+
+    public void testDispatch_ADDED() {
+        log.setMethod("testDispatch_ADDED()");
+        NamingEvent event;
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_ADDED, binding1, binding2,
+                "anything");
+
+        event.dispatch(new TestAllListener(event));
+    }
+
+    public void testDispatch_REMOVED() {
+        log.setMethod("testDispatch_REMOVED()");
+        NamingEvent event;
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_REMOVED, binding1, binding2,
+                "anything");
+
+        event.dispatch(new TestAllListener(event));
+    }
+
+    public void testDispatch_RENAMED() {
+        log.setMethod("testDispatch_RENAMED()");
+        NamingEvent event;
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_RENAMED, binding1, binding2,
+                "anything");
+
+        event.dispatch(new TestAllListener(event));
+    }
+
+    public void testDispatch_CHANGED() {
+        log.setMethod("testDispatch_CHANGED()");
+        NamingEvent event;
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_CHANGED, binding1, binding2,
+                "anything");
+
+        event.dispatch(new TestAllListener(event));
+    }
+
+    public void testDispatch_ADDED_BadListenerType() {
+        log.setMethod("testDispatch_ADDED_BadListenerType()");
+        NamingEvent event;
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_ADDED, binding1, binding2,
+                "anything");
+
+        try {
+            event.dispatch(new TestEmptyListener(event));
+            fail("should throw ClassCastException");
+        } catch (ClassCastException e) {
+        }
+    }
+
+    public void testDispatch_REMOVED_BadListenerType() {
+        log.setMethod("testDispatch_REMOVED_BadListenerType()");
+        NamingEvent event;
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_REMOVED, binding1, binding2,
+                "anything");
+
+        try {
+            event.dispatch(new TestEmptyListener(event));
+            fail("should throw ClassCastException");
+        } catch (ClassCastException e) {
+        }
+    }
+
+    public void testDispatch_RENAMED_BadListenerType() {
+        log.setMethod("testDispatch_RENAMED_BadListenerType()");
+        NamingEvent event;
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_RENAMED, binding1, binding2,
+                "anything");
+
+        try {
+            event.dispatch(new TestEmptyListener(event));
+            fail("should throw ClassCastException");
+        } catch (ClassCastException e) {
+        }
+    }
+
+    public void testDispatch_CHANGED_BadListenerType() {
+        log.setMethod("testDispatch_CHANGED_BadListenerType()");
+        NamingEvent event;
+
+        event = new NamingEvent(eventctx, NamingEvent.OBJECT_CHANGED, binding1, binding2,
+                "anything");
+
+        try {
+            event.dispatch(new TestEmptyListener(event));
+            fail("should throw ClassCastException");
+        } catch (ClassCastException e) {
+        }
+    }
+
+    class TestEmptyListener implements NamingListener {
+
+        protected NamingEvent expectedEvent;
+
+        public TestEmptyListener(NamingEvent expectedEvent) {
+            this.expectedEvent = expectedEvent;
+        }
+
+        public void namingExceptionThrown(NamingExceptionEvent namingexceptionevent) {
+            log.log("namingExceptionThrown called, " + namingexceptionevent);
+        }
+
+    }
+
+    class TestAllListener extends TestEmptyListener implements NamespaceChangeListener,
+            ObjectChangeListener {
+
+        public TestAllListener(NamingEvent expectedEvent) {
+            super(expectedEvent);
+        }
+
+        public void objectAdded(NamingEvent namingevent) {
+            assertTrue(expectedEvent == namingevent);
+        }
+
+        public void objectRemoved(NamingEvent namingevent) {
+            assertTrue(expectedEvent == namingevent);
+        }
+
+        public void objectRenamed(NamingEvent namingevent) {
+            assertTrue(expectedEvent == namingevent);
+        }
+
+        public void objectChanged(NamingEvent namingevent) {
+            assertTrue(expectedEvent == namingevent);
+        }
+    }
+
+    static class EventContextMockUp implements EventContext {
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.event.EventContext#addNamingListener(javax.naming.Name,
+         *      int, javax.naming.event.NamingListener)
+         */
+        public void addNamingListener(Name name, int i, NamingListener naminglistener)
+                throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.event.EventContext#addNamingListener(java.lang.String,
+         *      int, javax.naming.event.NamingListener)
+         */
+        public void addNamingListener(String s, int i, NamingListener naminglistener)
+                throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.event.EventContext#removeNamingListener(javax.naming.event.NamingListener)
+         */
+        public void removeNamingListener(NamingListener naminglistener) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.event.EventContext#targetMustExist()
+         */
+        public boolean targetMustExist() throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#addToEnvironment(java.lang.String,
+         *      java.lang.Object)
+         */
+        public Object addToEnvironment(String s, Object o) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#bind(javax.naming.Name, java.lang.Object)
+         */
+        public void bind(Name n, Object o) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#bind(java.lang.String, java.lang.Object)
+         */
+        public void bind(String s, Object o) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#close()
+         */
+        public void close() throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#composeName(javax.naming.Name,
+         *      javax.naming.Name)
+         */
+        public Name composeName(Name n, Name pfx) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#composeName(java.lang.String,
+         *      java.lang.String)
+         */
+        public String composeName(String s, String pfx) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#createSubcontext(javax.naming.Name)
+         */
+        public Context createSubcontext(Name n) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#createSubcontext(java.lang.String)
+         */
+        public Context createSubcontext(String s) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#destroySubcontext(javax.naming.Name)
+         */
+        public void destroySubcontext(Name n) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#destroySubcontext(java.lang.String)
+         */
+        public void destroySubcontext(String s) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        public Hashtable<?, ?> getEnvironment() throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#getNameInNamespace()
+         */
+        public String getNameInNamespace() throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#getNameParser(javax.naming.Name)
+         */
+        public NameParser getNameParser(Name n) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#getNameParser(java.lang.String)
+         */
+        public NameParser getNameParser(String s) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#list(javax.naming.Name)
+         */
+        public NamingEnumeration<NameClassPair> list(Name n) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#list(java.lang.String)
+         */
+        public NamingEnumeration<NameClassPair> list(String s) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#listBindings(javax.naming.Name)
+         */
+        public NamingEnumeration<Binding> listBindings(Name n) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#listBindings(java.lang.String)
+         */
+        public NamingEnumeration<Binding> listBindings(String s) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#lookup(javax.naming.Name)
+         */
+        public Object lookup(Name n) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#lookup(java.lang.String)
+         */
+        public Object lookup(String s) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#lookupLink(javax.naming.Name)
+         */
+        public Object lookupLink(Name n) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#lookupLink(java.lang.String)
+         */
+        public Object lookupLink(String s) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#rebind(javax.naming.Name, java.lang.Object)
+         */
+        public void rebind(Name n, Object o) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#rebind(java.lang.String, java.lang.Object)
+         */
+        public void rebind(String s, Object o) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#removeFromEnvironment(java.lang.String)
+         */
+        public Object removeFromEnvironment(String s) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#rename(javax.naming.Name,
+         *      javax.naming.Name)
+         */
+        public void rename(Name nOld, Name nNew) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#rename(java.lang.String, java.lang.String)
+         */
+        public void rename(String sOld, String sNew) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#unbind(javax.naming.Name)
+         */
+        public void unbind(Name n) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see javax.naming.Context#unbind(java.lang.String)
+         */
+        public void unbind(String s) throws NamingException {
+            throw new UnsupportedOperationException("in EventContextMockUp");
+        }
 
-	}
+    }
 
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/NamingExceptionEventTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/NamingExceptionEventTest.java?view=diff&rev=449555&r1=449554&r2=449555
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/NamingExceptionEventTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/event/NamingExceptionEventTest.java Sun Sep 24 20:33:27 2006
@@ -17,8 +17,10 @@
 
 import java.util.Hashtable;
 
+import javax.naming.Binding;
 import javax.naming.Context;
 import javax.naming.Name;
+import javax.naming.NameClassPair;
 import javax.naming.NameParser;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -31,63 +33,12 @@
 
 public class NamingExceptionEventTest extends TestCase {
 
-	/*
-	 * ------------------------------------------------------------------- 
-	 * Class Variables
-	 * -------------------------------------------------------------------
-	 */
-
 	static Log log = new Log(NamingExceptionEventTest.class);
 
 	static NamingException ex = new NamingException("sample");
 
 	static EventContext ctx = new EventContextMockUp();
 
-	/*
-	 * -------------------------------------------------------------------
-	 * Constructors
-	 * -------------------------------------------------------------------
-	 */
-
-	/**
-	 * Constructor for NamingExceptionEventTest.
-	 * 
-	 * @param arg0
-	 */
-	public NamingExceptionEventTest(String arg0) {
-		super(arg0);
-	}
-
-	/*
-	 * -------------------------------------------------------------------
-	 * Methods override parent class TestCase
-	 * -------------------------------------------------------------------
-	 */
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see junit.framework.TestCase#setUp()
-	 */
-	protected void setUp() throws Exception {
-		super.setUp();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see junit.framework.TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
-	/*
-	 * -------------------------------------------------------------------
-	 * Methods
-	 * -------------------------------------------------------------------
-	 */
-
 	public void testConstructorAndGetters() {
 		log.setMethod("testConstructorAndGetters()");
 		NamingExceptionEvent event;
@@ -277,7 +228,7 @@
 		 * 
 		 * @see javax.naming.Context#getEnvironment()
 		 */
-		public Hashtable getEnvironment() throws NamingException {
+		public Hashtable<?, ?> getEnvironment() throws NamingException {
 			throw new UnsupportedOperationException("in EventContextMockUp");
 		}
 
@@ -313,7 +264,7 @@
 		 * 
 		 * @see javax.naming.Context#list(javax.naming.Name)
 		 */
-		public NamingEnumeration list(Name n) throws NamingException {
+		public NamingEnumeration<NameClassPair> list(Name n) throws NamingException {
 			throw new UnsupportedOperationException("in EventContextMockUp");
 		}
 
@@ -322,7 +273,7 @@
 		 * 
 		 * @see javax.naming.Context#list(java.lang.String)
 		 */
-		public NamingEnumeration list(String s) throws NamingException {
+		public NamingEnumeration<NameClassPair> list(String s) throws NamingException {
 			throw new UnsupportedOperationException("in EventContextMockUp");
 		}
 
@@ -331,7 +282,7 @@
 		 * 
 		 * @see javax.naming.Context#listBindings(javax.naming.Name)
 		 */
-		public NamingEnumeration listBindings(Name n) throws NamingException {
+		public NamingEnumeration<Binding> listBindings(Name n) throws NamingException {
 			throw new UnsupportedOperationException("in EventContextMockUp");
 		}
 
@@ -340,7 +291,7 @@
 		 * 
 		 * @see javax.naming.Context#listBindings(java.lang.String)
 		 */
-		public NamingEnumeration listBindings(String s) throws NamingException {
+		public NamingEnumeration<Binding> listBindings(String s) throws NamingException {
 			throw new UnsupportedOperationException("in EventContextMockUp");
 		}
 



Mime
View raw message