harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ghar...@apache.org
Subject svn commit: r397337 [10/11] - in /incubator/harmony/enhanced/classlib/trunk/modules/jndi: make/common/ src/test/java/com/sun/jndi/url/dir2/ src/test/java/com/sun/jndi/url/nntp/ src/test/java/jndiproperties/ src/test/java/org/ src/test/java/org/apache/ ...
Date Wed, 26 Apr 2006 23:26:01 GMT
Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/ResolveResultTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/ResolveResultTest.java?rev=397337&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/ResolveResultTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/ResolveResultTest.java Wed Apr 26 16:25:54 2006
@@ -0,0 +1,422 @@
+/* Copyright 2004 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.jndi.tests.javax.naming.spi;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Properties;
+
+import javax.naming.CompositeName;
+import javax.naming.CompoundName;
+import javax.naming.InvalidNameException;
+import javax.naming.Name;
+import javax.naming.spi.ResolveResult;
+
+import junit.framework.TestCase;
+
+public class ResolveResultTest extends TestCase {
+
+	private String strObj;
+
+	private String strName;
+
+	private CompositeName name;
+
+	protected void setUp() throws InvalidNameException {
+		strObj = "String object";
+		strName = "www.eclipse.org/org/index.html";
+		name = new CompositeName(strName);
+	}
+
+	public void testConstructor_NoParms() {
+		MyResolveResult resolveResult = new MyResolveResult();
+		assertNull(resolveResult.getResolvedObj());
+		assertNull(resolveResult.getRemainingName());
+	}
+
+	public void tsetConstructor_Simple() throws InvalidNameException {
+		CompositeName expectedName = new CompositeName(strName);
+		ResolveResult resolveResult = new ResolveResult(strObj, strName);
+
+		assertEquals(strObj, resolveResult.getResolvedObj());
+		assertEquals(expectedName, resolveResult.getRemainingName());
+	}
+
+	public void testConstructor_SimpleNull() {
+		strName = null;
+		try {
+			ResolveResult resolveResult = new ResolveResult(null, strName);
+			fail("Should throw NullPointerException.");
+		} catch (NullPointerException e) {
+		}
+	}
+
+	public void testConstructor_ByName() {
+		ResolveResult resolveResult = new ResolveResult(strObj, strName);
+
+		assertEquals(strObj, resolveResult.getResolvedObj());
+		assertEquals(name, resolveResult.getRemainingName());
+		// TO DO R: Is name is cloned? Confirm: yes.
+		assertSame(strObj, resolveResult.getResolvedObj());
+		assertNotSame(name, resolveResult.getRemainingName());
+	}
+
+	public void testConstructor_ByNameNull() {
+		/*
+		 * try { ResolveResult resolveResult = new ResolveResult(strObj,
+		 * (Name)null); fail("Should throw NullPointerException."); } catch
+		 * (NullPointerException e) { }
+		 */
+
+		ResolveResult resolveResult = new ResolveResult(strObj, (Name) null);
+		assertNull(resolveResult.getRemainingName());
+		assertSame(strObj, resolveResult.getResolvedObj());
+	}
+
+	public void testConstructor_ByNameObjectNull() {
+		ResolveResult resolveResult = new ResolveResult(null, name);
+		assertNull(resolveResult.getResolvedObj());
+	}
+
+	public void testConstructor_InvalidName() {
+		strName = "a/'a/b/b";
+		ResolveResult resolveResult = new ResolveResult(strObj, strName);
+
+		assertNull(resolveResult.getRemainingName());
+		assertEquals(strObj, resolveResult.getResolvedObj());
+	}
+
+	public void testConstrcutor_ByCompoundName() throws InvalidNameException {
+		Properties props = new Properties();
+		props.put("jndi.syntax.separator", "/");
+		props.put("jndi.syntax.direction", "left_to_right");
+		props.put("jndi.syntax.escape", "\\");
+		props.put("jndi.syntax.beginquote", "<");
+		props.put("jndi.syntax.endquote", ">");
+		props.put("jndi.syntax.beginquote2", "'");
+		props.put("jndi.syntax.endquote2", "'");
+		props.put("jndi.syntax.ignorecase", "false");
+		props.put("jndi.syntax.trimblanks", "false");
+		CompoundName compoundName = new CompoundName("a", props);
+
+		ResolveResult resolveResult = new ResolveResult(strObj, compoundName);
+		assertEquals(strObj, resolveResult.getResolvedObj());
+		assertEquals(compoundName, resolveResult.getRemainingName());
+	}
+
+	public void testAppendRemainingComponent() throws InvalidNameException {
+		ResolveResult resolveResult = new ResolveResult(strObj, name);
+		String nameComponent = "abc";
+		resolveResult.appendRemainingComponent(nameComponent);
+
+		assertEquals(strObj, resolveResult.getResolvedObj());
+		name.add(nameComponent);
+		assertEquals(name, resolveResult.getRemainingName());
+	}
+
+	public void testAppendRemainingComponent_Null() {
+		ResolveResult resolveResult = new ResolveResult(strObj, name);
+		resolveResult.appendRemainingComponent(null);
+
+		assertEquals(strObj, resolveResult.getResolvedObj());
+		assertEquals(name, resolveResult.getRemainingName());
+	}
+
+	public void testAppendRemainingComponent_InvalidName()
+			throws InvalidNameException {
+		ResolveResult resolveResult = new ResolveResult(strObj, name);
+		String nameComponent = "a/'a/b/b";
+		resolveResult.appendRemainingComponent(nameComponent);
+
+		assertEquals(strObj, resolveResult.getResolvedObj());
+		name.add(nameComponent);
+
+		assertEquals(name, resolveResult.getRemainingName());
+		// Impossible to throw exception
+	}
+
+	public void testAppendRemainingComponent_NullRemainingName()
+			throws InvalidNameException {
+		ResolveResult resolveResult = new ResolveResult(strObj, (Name) null);
+		String nameComponent = "a/'a/b'/b";
+		CompositeName newName = new CompositeName();
+		newName.add(nameComponent);
+		resolveResult.appendRemainingComponent(nameComponent);
+
+		assertEquals(newName, resolveResult.getRemainingName());
+	}
+
+	public void testAppendRemainingName() throws InvalidNameException {
+		ResolveResult resolveResult = new ResolveResult(strObj, name);
+
+		CompositeName newName = new CompositeName("a/b/c/d");
+		resolveResult.appendRemainingName(newName);
+
+		assertEquals(strObj, resolveResult.getResolvedObj());
+		name.addAll(newName);
+		assertEquals(name, resolveResult.getRemainingName());
+	}
+
+	public void testAppendRemainingName_Null() {
+		ResolveResult resolveResult = new ResolveResult(strObj, name);
+		resolveResult.appendRemainingName(null);
+
+		assertEquals(strObj, resolveResult.getResolvedObj());
+		assertEquals(name, resolveResult.getRemainingName());
+	}
+
+	public void testAppendRemainingName_InvalidName()
+			throws InvalidNameException {
+		ResolveResult resolveResult = new ResolveResult(strObj, name);
+
+		Properties props = new Properties();
+		props.put("jndi.syntax.separator", "/");
+		props.put("jndi.syntax.direction", "left_to_right");
+		props.put("jndi.syntax.escape", "\\");
+		props.put("jndi.syntax.beginquote", "<");
+		props.put("jndi.syntax.endquote", ">");
+		props.put("jndi.syntax.beginquote2", "'");
+		props.put("jndi.syntax.endquote2", "'");
+		props.put("jndi.syntax.ignorecase", "false");
+		props.put("jndi.syntax.trimblanks", "false");
+		CompoundName compoundName = new CompoundName("a", props);
+		try {
+			resolveResult.appendRemainingName(compoundName);
+			fail("Should throw a Error.");
+		} catch (Error e) {
+		}
+	}
+
+	public void testAppendRemainingName_withCompoundName()
+			throws InvalidNameException {
+		Properties props = new Properties();
+		props.put("jndi.syntax.separator", "/");
+		props.put("jndi.syntax.direction", "left_to_right");
+		props.put("jndi.syntax.escape", "\\");
+		props.put("jndi.syntax.beginquote", "<");
+		props.put("jndi.syntax.endquote", ">");
+		props.put("jndi.syntax.beginquote2", "'");
+		props.put("jndi.syntax.endquote2", "'");
+		props.put("jndi.syntax.ignorecase", "false");
+		props.put("jndi.syntax.trimblanks", "false");
+		CompoundName compoundName = new CompoundName("a", props);
+
+		ResolveResult resolveResult = new ResolveResult(strObj, compoundName);
+		CompositeName newName = new CompositeName("a/b/c/d");
+		try {
+			resolveResult.appendRemainingName(newName);
+			fail("Should throw a Error here.");
+		} catch (Error e) {
+		}
+
+		// compoundName.addAll(newName);
+		// assertEquals(compoundName, resolveResult.getRemainingName());
+	}
+
+	public void testAppendRemainingName_withCompoundName2()
+			throws InvalidNameException {
+		Properties props = new Properties();
+		props.put("jndi.syntax.separator", "/");
+		props.put("jndi.syntax.direction", "left_to_right");
+		props.put("jndi.syntax.escape", "\\");
+		props.put("jndi.syntax.beginquote", "<");
+		props.put("jndi.syntax.endquote", ">");
+		props.put("jndi.syntax.beginquote2", "'");
+		props.put("jndi.syntax.endquote2", "'");
+		props.put("jndi.syntax.ignorecase", "false");
+		props.put("jndi.syntax.trimblanks", "false");
+		CompoundName compoundName = new CompoundName("a", props);
+
+		ResolveResult resolveResult = new ResolveResult(strObj, compoundName);
+		CompoundName newName = new CompoundName("b", props);
+		resolveResult.appendRemainingName(newName);
+
+		compoundName.addAll(newName);
+		assertEquals(compoundName, resolveResult.getRemainingName());
+	}
+
+	public void testAppendRemainingName_NullRemainingName()
+			throws InvalidNameException {
+		ResolveResult resolveResult = new ResolveResult(strObj, (Name) null);
+		String nameComponent = "a/'a/b'/b";
+		CompositeName newName = new CompositeName();
+		newName.add(nameComponent);
+		resolveResult.appendRemainingName(newName);
+
+		assertEquals(newName, resolveResult.getRemainingName());
+		assertNotSame(newName, resolveResult.getRemainingName());
+	}
+
+	public void testSetRemainingName() throws InvalidNameException {
+		ResolveResult resolveResult = new ResolveResult(strObj, name);
+		name.add("1/2/3/4");
+		resolveResult.setRemainingName(name);
+
+		assertNotSame(name, resolveResult.getRemainingName());
+		assertEquals(strObj, resolveResult.getResolvedObj());
+		assertEquals(name, resolveResult.getRemainingName());
+		name.remove(name.size() - 1);
+		assertFalse(name.equals(resolveResult.getRemainingName()));
+	}
+
+	public void testSetRemainingName_Null() {
+		ResolveResult resolveResult = new ResolveResult(strObj, name);
+		resolveResult.setRemainingName(null);
+		assertNull(resolveResult.getRemainingName());
+	}
+
+	public void testSetRemainingName_InvalidName() throws InvalidNameException {
+		ResolveResult resolveResult = new ResolveResult(strObj, name);
+
+		Properties props = new Properties();
+		props.put("jndi.syntax.separator", "/");
+		props.put("jndi.syntax.direction", "left_to_right");
+		props.put("jndi.syntax.escape", "\\");
+		props.put("jndi.syntax.beginquote", "<");
+		props.put("jndi.syntax.endquote", ">");
+		props.put("jndi.syntax.beginquote2", "'");
+		props.put("jndi.syntax.endquote2", "'");
+		props.put("jndi.syntax.ignorecase", "false");
+		props.put("jndi.syntax.trimblanks", "false");
+		CompoundName compoundName = new CompoundName("a", props);
+
+		resolveResult.setRemainingName(compoundName);
+		assertEquals(compoundName, resolveResult.getRemainingName());
+	}
+
+	public void testSetRemainingName_withCompoundName()
+			throws InvalidNameException {
+		ResolveResult resolveResult = new ResolveResult(strObj, name);
+
+		Properties props = new Properties();
+		props.put("jndi.syntax.separator", "/");
+		props.put("jndi.syntax.direction", "left_to_right");
+		props.put("jndi.syntax.escape", "\\");
+		props.put("jndi.syntax.beginquote", "<");
+		props.put("jndi.syntax.endquote", ">");
+		props.put("jndi.syntax.beginquote2", "'");
+		props.put("jndi.syntax.endquote2", "'");
+		props.put("jndi.syntax.ignorecase", "false");
+		props.put("jndi.syntax.trimblanks", "false");
+		CompoundName compoundName = new CompoundName("a", props);
+
+		resolveResult.setRemainingName(compoundName);
+
+		CompositeName newName = new CompositeName("a/b/c/d");
+		try {
+			resolveResult.appendRemainingName(newName);
+			fail("Should throw a Error here");
+		} catch (Error e) {
+		}
+		// compoundName.addAll(newName);
+		// assertEquals(compoundName, resolveResult.getRemainingName());
+	}
+
+	public void testSetRemainingName_withCompoundName2()
+			throws InvalidNameException {
+		ResolveResult resolveResult = new ResolveResult(strObj, name);
+
+		Properties props = new Properties();
+		props.put("jndi.syntax.separator", "/");
+		props.put("jndi.syntax.direction", "left_to_right");
+		props.put("jndi.syntax.escape", "\\");
+		props.put("jndi.syntax.beginquote", "<");
+		props.put("jndi.syntax.endquote", ">");
+		props.put("jndi.syntax.beginquote2", "'");
+		props.put("jndi.syntax.endquote2", "'");
+		props.put("jndi.syntax.ignorecase", "false");
+		props.put("jndi.syntax.trimblanks", "false");
+		CompoundName compoundName = new CompoundName("a", props);
+
+		resolveResult.setRemainingName(compoundName);
+
+		CompoundName newName = new CompoundName("b", props);
+		resolveResult.appendRemainingName(newName);
+
+		compoundName.addAll(newName);
+		assertEquals(compoundName, resolveResult.getRemainingName());
+	}
+
+	public void testSetResolvedObj() {
+		ResolveResult resolveResult = new ResolveResult(strObj, name);
+		Integer intObj = new Integer(123456);
+		resolveResult.setResolvedObj(intObj);
+
+		assertEquals(intObj, resolveResult.getResolvedObj());
+		assertSame(intObj, resolveResult.getResolvedObj());
+	}
+
+	public void testGetRemainingName() throws InvalidNameException {
+		CompositeName expectedName = new CompositeName(strName);
+		ResolveResult resolveResult = new ResolveResult(strObj, strName);
+
+		assertEquals(expectedName, resolveResult.getRemainingName());
+	}
+
+	public void testGetResolvedObj() throws InvalidNameException {
+		ResolveResult resolveResult = new ResolveResult(strObj, strName);
+		assertEquals(strObj, resolveResult.getResolvedObj());
+	}
+
+	public void testSerializable_Simple() throws ClassNotFoundException,
+			IOException {
+		ResolveResult resolveResult = new ResolveResult(strObj, strName);
+
+		// write to byte array
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		ObjectOutputStream oos = new ObjectOutputStream(baos);
+		oos.writeObject(resolveResult);
+		byte[] buffer = baos.toByteArray();
+		oos.close();
+		baos.close();
+
+		// read from byte array
+		ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
+		ObjectInputStream ois = new ObjectInputStream(bais);
+		ResolveResult resolveResult2 = (ResolveResult) ois.readObject();
+		ois.close();
+		bais.close();
+
+		assertEquals(resolveResult.getResolvedObj(), resolveResult2
+				.getResolvedObj());
+		assertEquals(resolveResult.getRemainingName(), resolveResult2
+				.getRemainingName());
+	}
+
+	public void testSerializable_compatibility() throws ClassNotFoundException,
+			IOException {
+		ObjectInputStream ois = new ObjectInputStream(getClass()
+                .getClassLoader().getResourceAsStream(
+                        "/serialization/javax/naming/spi/ResolveResult.ser"));
+		ResolveResult resolveResult2 = (ResolveResult) ois.readObject();
+		ois.close();
+
+		ResolveResult resolveResult = new ResolveResult(strObj, strName);
+
+		assertEquals(resolveResult.getResolvedObj(), resolveResult2
+				.getResolvedObj());
+		assertEquals(resolveResult.getRemainingName(), resolveResult2
+				.getRemainingName());
+	}
+
+	class MyResolveResult extends ResolveResult {
+		public MyResolveResult() {
+			super();
+		}
+	}
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/ResolveResultTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/DazzleActionController.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/DazzleActionController.java?rev=397337&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/DazzleActionController.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/DazzleActionController.java Wed Apr 26 16:25:54 2006
@@ -0,0 +1,34 @@
+/* Copyright 2004 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.jndi.tests.javax.naming.spi.mock;
+
+import javax.naming.NamingException;
+
+public interface DazzleActionController {
+	public static String THROW_RUNTIMEEXCEPTION = "throw.RuntimeException";
+
+	public static String THROW_TRACKEDEXCEPTION = "throw.TrackedException";
+
+	public static String THROW_NAMINGEXCEPTION = "throw.NamingException";
+
+	public static String THROW_NULLPOINTEREXCEPTION = "throw.NullPointerException";
+
+	public static String RETURN_NULL = "return.NULL";
+
+	public static String RETURN_NORMAL = "return.normal";
+
+	Object doActions() throws NamingException;
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/DazzleActionController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/HTTP2/HTTP2URLContextFactory.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/HTTP2/HTTP2URLContextFactory.java?rev=397337&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/HTTP2/HTTP2URLContextFactory.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/HTTP2/HTTP2URLContextFactory.java Wed Apr 26 16:25:54 2006
@@ -0,0 +1,59 @@
+/* Copyright 2004 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.jndi.tests.javax.naming.spi.mock.HTTP2;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.spi.ObjectFactory;
+
+import org.apache.harmony.jndi.tests.javax.naming.spi.mock.MockDirContext;
+import org.apache.harmony.jndi.tests.javax.naming.spi.NamingManagerTest;
+
+public class HTTP2URLContextFactory implements ObjectFactory {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.spi.ObjectFactory#getObjectInstance(java.lang.Object,
+	 *      javax.naming.Name, javax.naming.Context, java.util.Hashtable)
+	 */
+	public Object getObjectInstance(Object o, Name n, Context c, Hashtable h)
+			throws Exception {
+
+		NamingManagerTest.issueIndicatedExceptions(h);
+		if (NamingManagerTest.returnNullIndicated(h)) {
+			return null;
+		}
+
+		Hashtable r = new Hashtable();
+		if (null != o) {
+			r.put("o", o);
+		}
+		if (null != n) {
+			r.put("n", n);
+		}
+		if (null != c) {
+			r.put("c", c);
+		}
+		if (null != h) {
+			r.put("h", h);
+		}
+		r.put("url.schema", "HTTP2");
+		return new MockDirContext(r);
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/HTTP2/HTTP2URLContextFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/InvokeRecord.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/InvokeRecord.java?rev=397337&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/InvokeRecord.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/InvokeRecord.java Wed Apr 26 16:25:54 2006
@@ -0,0 +1,126 @@
+/* Copyright 2004 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.jndi.tests.javax.naming.spi.mock;
+
+import java.util.ArrayList;
+
+import org.apache.harmony.jndi.tests.javax.naming.util.Log;
+
+public class InvokeRecord {
+
+	private static Log log = new Log(null);
+
+	private static ArrayList params = new ArrayList();
+
+	private static String urlSchema = null;
+
+	public static String getLatestUrlSchema() {
+		return urlSchema;
+	}
+
+	public static void set(String s, Object p1) {
+		urlSchema = s;
+		params.clear();
+		params.add(p1);
+	}
+
+	public static void set(String s, Object p1, Object p2) {
+		urlSchema = s;
+		params.clear();
+		params.add(p1);
+		params.add(p2);
+	}
+
+	public static void set(String s, Object p1, Object p2, Object p3) {
+		urlSchema = s;
+		params.clear();
+		params.add(p1);
+		params.add(p2);
+		params.add(p3);
+	}
+
+	public static void set(String s, Object p1, Object p2, Object p3, Object p4) {
+		urlSchema = s;
+		params.clear();
+		params.add(p1);
+		params.add(p2);
+		params.add(p3);
+		params.add(p4);
+	}
+
+	public static void set(String s, Object p1, Object p2, Object p3,
+			Object p4, Object p5) {
+		urlSchema = s;
+		params.clear();
+		params.add(p1);
+		params.add(p2);
+		params.add(p3);
+		params.add(p4);
+		params.add(p5);
+	}
+
+	public static boolean equals(String s, Object p1) {
+		ArrayList tmp = new ArrayList();
+		tmp.add(p1);
+		return equals(s, tmp);
+	}
+
+	public static boolean equals(String s, Object p1, Object p2) {
+		ArrayList tmp = new ArrayList();
+		tmp.add(p1);
+		tmp.add(p2);
+		return equals(s, tmp);
+	}
+
+	public static boolean equals(String s, Object p1, Object p2, Object p3) {
+		ArrayList tmp = new ArrayList();
+		tmp.add(p1);
+		tmp.add(p2);
+		tmp.add(p3);
+		return equals(s, tmp);
+	}
+
+	public static boolean equals(String s, Object p1, Object p2, Object p3,
+			Object p4) {
+		ArrayList tmp = new ArrayList();
+		tmp.add(p1);
+		tmp.add(p2);
+		tmp.add(p3);
+		tmp.add(p4);
+		return equals(s, tmp);
+	}
+
+	public static boolean equals(String s, Object p1, Object p2, Object p3,
+			Object p4, Object p5) {
+		ArrayList tmp = new ArrayList();
+		tmp.add(p1);
+		tmp.add(p2);
+		tmp.add(p3);
+		tmp.add(p4);
+		tmp.add(p5);
+		return equals(s, tmp);
+	}
+
+	private static boolean equals(String s, ArrayList tmp) {
+		boolean r = (urlSchema == null ? s == null : urlSchema.equals(s))
+				&& tmp.equals(params);
+		if (!r) {
+			log.log("expected: " + s + ", " + tmp);
+			log.log("but it's: " + urlSchema + ", " + params);
+		}
+		return r;
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/InvokeRecord.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockActionController.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockActionController.java?rev=397337&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockActionController.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockActionController.java Wed Apr 26 16:25:54 2006
@@ -0,0 +1,64 @@
+/* Copyright 2004 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.jndi.tests.javax.naming.spi.mock;
+
+import java.util.Hashtable;
+
+import javax.naming.NamingException;
+
+public class MockActionController implements DazzleActionController {
+	private Hashtable env;
+
+	public MockActionController() {
+		this.env = new Hashtable();
+	}
+
+	public MockActionController(Hashtable env) {
+		this.env = env;
+	}
+
+	public void addAction(String action, String value) {
+		this.env.put(action, value);
+	}
+
+	public Object doActions() throws NamingException {
+		Hashtable actions = (Hashtable) this.env.clone();
+		this.env.clear();
+
+		if (actions == null) {
+			return RETURN_NORMAL;
+		}
+
+		if (actions.get(THROW_RUNTIMEEXCEPTION) != null) {
+			throw new RuntimeException("Mock runtime exception!");
+		}
+
+		if (actions.get(THROW_NAMINGEXCEPTION) != null) {
+			throw new NamingException("Mock NamingExcepton");
+		}
+
+		if (actions.get(THROW_NULLPOINTEREXCEPTION) != null) {
+			throw new NullPointerException("Mock NullPointerException");
+		}
+
+		if (actions.get(RETURN_NULL) != null) {
+			return null;
+		}
+
+		return RETURN_NORMAL;
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockActionController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockApplet.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockApplet.java?rev=397337&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockApplet.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockApplet.java Wed Apr 26 16:25:54 2006
@@ -0,0 +1,39 @@
+/* Copyright 2004 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.jndi.tests.javax.naming.spi.mock;
+
+import java.applet.Applet;
+import java.util.Hashtable;
+
+public class MockApplet extends Applet {
+	private Hashtable props;
+
+	public MockApplet() {
+		this.props = new Hashtable();
+	}
+
+	public void setParameter(Object param, Object value) {
+		this.props.put(param, value);
+	}
+
+	public String getParameter(String param) {
+		return (String) this.props.get(param);
+	}
+
+	public Hashtable getAllParams() {
+		return this.props;
+	}
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockApplet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockContext.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockContext.java?rev=397337&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockContext.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockContext.java Wed Apr 26 16:25:54 2006
@@ -0,0 +1,366 @@
+/* Copyright 2004 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.jndi.tests.javax.naming.spi.mock;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NameParser;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+public class MockContext implements Context {
+	protected Hashtable props;
+
+	static protected DazzleActionController actions;
+
+	public MockContext() {
+		this.props = new Hashtable();
+	}
+
+	public MockContext(Hashtable props) {
+		if (null != props) {
+			this.props = (Hashtable) props.clone();
+		}
+	}
+
+	public boolean equals(Object obj) {
+		if (obj instanceof MockContext) {
+			MockContext theOther = (MockContext) obj;
+			boolean envmtEqual = (null == props ? null == theOther.props
+					: props.equals(theOther.props));
+			if (!envmtEqual) {
+				return false;
+			}
+
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+	public static void setActionController(
+			DazzleActionController actionController) {
+		MockContext.actions = actionController;
+	}
+
+	Object takeActions() throws NamingException {
+		if (actions == null) {
+			return DazzleActionController.RETURN_NORMAL;
+		} else {
+			Object obj = actions.doActions();
+			return obj;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#addToEnvironment(java.lang.String,
+	 *      java.lang.Object)
+	 */
+	public Object addToEnvironment(String s, Object o) throws NamingException {
+		return this.props.put(s, o);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#bind(javax.naming.Name, java.lang.Object)
+	 */
+	public void bind(Name n, Object o) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), n, o);
+		takeActions();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#bind(java.lang.String, java.lang.Object)
+	 */
+	public void bind(String s, Object o) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), s, o);
+		takeActions();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#close()
+	 */
+	public void close() throws NamingException {
+		InvokeRecord.set(null, "close");
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#composeName(javax.naming.Name,
+	 *      javax.naming.Name)
+	 */
+	public Name composeName(Name n, Name pfx) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), n, pfx);
+		takeActions();
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#composeName(java.lang.String, java.lang.String)
+	 */
+	public String composeName(String s, String pfx) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), s, pfx);
+		takeActions();
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#createSubcontext(javax.naming.Name)
+	 */
+	public Context createSubcontext(Name n) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), n);
+		takeActions();
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#createSubcontext(java.lang.String)
+	 */
+	public Context createSubcontext(String s) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), s);
+		takeActions();
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#destroySubcontext(javax.naming.Name)
+	 */
+	public void destroySubcontext(Name n) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), n);
+		takeActions();
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#destroySubcontext(java.lang.String)
+	 */
+	public void destroySubcontext(String s) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), s);
+		takeActions();
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#getEnvironment()
+	 */
+	public Hashtable getEnvironment() throws NamingException {
+		return this.props;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#getNameInNamespace()
+	 */
+	public String getNameInNamespace() throws NamingException {
+		return (String) takeActions();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#getNameParser(javax.naming.Name)
+	 */
+	public NameParser getNameParser(Name n) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), n);
+		takeActions();
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#getNameParser(java.lang.String)
+	 */
+	public NameParser getNameParser(String s) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), s);
+		takeActions();
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#list(javax.naming.Name)
+	 */
+	public NamingEnumeration list(Name n) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), n);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#list(java.lang.String)
+	 */
+	public NamingEnumeration list(String s) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), s);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#listBindings(javax.naming.Name)
+	 */
+	public NamingEnumeration listBindings(Name n) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), n);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#listBindings(java.lang.String)
+	 */
+	public NamingEnumeration listBindings(String s) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), s);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#lookup(javax.naming.Name)
+	 */
+	public Object lookup(Name n) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), n);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#lookup(java.lang.String)
+	 */
+	public Object lookup(String s) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), s);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#lookupLink(javax.naming.Name)
+	 */
+	public Object lookupLink(Name n) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), n);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#lookupLink(java.lang.String)
+	 */
+	public Object lookupLink(String s) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), s);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#rebind(javax.naming.Name, java.lang.Object)
+	 */
+	public void rebind(Name n, Object o) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), n, o);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#rebind(java.lang.String, java.lang.Object)
+	 */
+	public void rebind(String s, Object o) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), s, o);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#removeFromEnvironment(java.lang.String)
+	 */
+	public Object removeFromEnvironment(String s) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), s);
+		return this.props.remove(s);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#rename(javax.naming.Name, javax.naming.Name)
+	 */
+	public void rename(Name nOld, Name nNew) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), nOld, nNew);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#rename(java.lang.String, java.lang.String)
+	 */
+	public void rename(String sOld, String sNew) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), sOld, sNew);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#unbind(javax.naming.Name)
+	 */
+	public void unbind(Name n) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), n);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#unbind(java.lang.String)
+	 */
+	public void unbind(String s) throws NamingException {
+		InvokeRecord.set((String) this.props.get("url.schema"), s);
+
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockContextFactory.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockContextFactory.java?rev=397337&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockContextFactory.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockContextFactory.java Wed Apr 26 16:25:54 2006
@@ -0,0 +1,36 @@
+/* Copyright 2004 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.jndi.tests.javax.naming.spi.mock;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+
+public class MockContextFactory implements InitialContextFactory {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.spi.InitialContextFactory#getInitialContext(java.util.Hashtable)
+	 */
+	public Context getInitialContext(Hashtable envmt) throws NamingException {
+		envmt.remove("url.schema");
+		return new MockContext(envmt);
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockContextFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext.java?rev=397337&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext.java Wed Apr 26 16:25:54 2006
@@ -0,0 +1,366 @@
+/* Copyright 2004 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.jndi.tests.javax.naming.spi.mock;
+
+import java.util.Hashtable;
+
+import javax.naming.Name;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+import javax.naming.directory.SearchControls;
+
+public class MockDirContext extends MockContext implements DirContext {
+
+	public MockDirContext(Hashtable h) {
+		super(h);
+	}
+
+	/*
+	 * (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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "bind",
+				name, obj, attributes);
+	}
+
+	/*
+	 * (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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "bind",
+				s, obj, attributes);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#createSubcontext(javax.naming.Name,
+	 *      javax.naming.directory.Attributes)
+	 */
+	public DirContext createSubcontext(Name name, Attributes attributes)
+			throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"createSubcontext", name, attributes);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"createSubcontext", s, attributes);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getAttributes(javax.naming.Name)
+	 */
+	public Attributes getAttributes(Name name) throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getAttributes", name);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getAttributes", name, as);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getAttributes(java.lang.String)
+	 */
+	public Attributes getAttributes(String s) throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getAttributes", s);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getAttributes", s, as);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getSchema(javax.naming.Name)
+	 */
+	public DirContext getSchema(Name name) throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getSchema", name);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getSchema(java.lang.String)
+	 */
+	public DirContext getSchema(String s) throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getSchema", s);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getSchemaClassDefinition(javax.naming.Name)
+	 */
+	public DirContext getSchemaClassDefinition(Name name)
+			throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getSchemaClassDefinition", name);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getSchemaClassDefinition(java.lang.String)
+	 */
+	public DirContext getSchemaClassDefinition(String s) throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getSchemaClassDefinition", s);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"modifyAttributes", name, new Integer(i), attributes);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#modifyAttributes(javax.naming.Name,
+	 *      javax.naming.directory.ModificationItem[])
+	 */
+	public void modifyAttributes(Name name, ModificationItem[] amodificationitem)
+			throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"modifyAttributes", name, amodificationitem);
+	}
+
+	/*
+	 * (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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"modifyAttributes", s, new Integer(i), attributes);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#modifyAttributes(java.lang.String,
+	 *      javax.naming.directory.ModificationItem[])
+	 */
+	public void modifyAttributes(String s, ModificationItem[] amodificationitem)
+			throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"modifyAttributes", s, amodificationitem);
+
+	}
+
+	/*
+	 * (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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "rebind",
+				name, obj, attributes);
+	}
+
+	/*
+	 * (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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "rebind",
+				s, obj, attributes);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#search(javax.naming.Name,
+	 *      javax.naming.directory.Attributes)
+	 */
+	public NamingEnumeration search(Name name, Attributes attributes)
+			throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				name, attributes);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				name, attributes, as);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				name, s, aobj, searchcontrols);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				name, s, searchcontrols);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				s, attributes);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				s, attributes, as);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				s, s1, aobj, searchcontrols);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				s, s1, searchcontrols);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#close()
+	 */
+	public void close() throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "close");
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext2.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext2.java?rev=397337&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext2.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext2.java Wed Apr 26 16:25:54 2006
@@ -0,0 +1,366 @@
+/* Copyright 2004 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.jndi.tests.javax.naming.spi.mock;
+
+import java.util.Hashtable;
+
+import javax.naming.Name;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+import javax.naming.directory.SearchControls;
+
+public class MockDirContext2 extends MockContext implements DirContext {
+
+	public MockDirContext2(Hashtable h) {
+		super(h);
+	}
+
+	/*
+	 * (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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "bind",
+				name, obj, attributes);
+	}
+
+	/*
+	 * (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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "bind",
+				s, obj, attributes);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#createSubcontext(javax.naming.Name,
+	 *      javax.naming.directory.Attributes)
+	 */
+	public DirContext createSubcontext(Name name, Attributes attributes)
+			throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"createSubcontext", name, attributes);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"createSubcontext", s, attributes);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getAttributes(javax.naming.Name)
+	 */
+	public Attributes getAttributes(Name name) throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getAttributes", name);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getAttributes", name, as);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getAttributes(java.lang.String)
+	 */
+	public Attributes getAttributes(String s) throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getAttributes", s);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getAttributes", s, as);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getSchema(javax.naming.Name)
+	 */
+	public DirContext getSchema(Name name) throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getSchema", name);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getSchema(java.lang.String)
+	 */
+	public DirContext getSchema(String s) throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getSchema", s);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getSchemaClassDefinition(javax.naming.Name)
+	 */
+	public DirContext getSchemaClassDefinition(Name name)
+			throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getSchemaClassDefinition", name);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getSchemaClassDefinition(java.lang.String)
+	 */
+	public DirContext getSchemaClassDefinition(String s) throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"getSchemaClassDefinition", s);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"modifyAttributes", name, new Integer(i), attributes);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#modifyAttributes(javax.naming.Name,
+	 *      javax.naming.directory.ModificationItem[])
+	 */
+	public void modifyAttributes(Name name, ModificationItem[] amodificationitem)
+			throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"modifyAttributes", name, amodificationitem);
+	}
+
+	/*
+	 * (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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"modifyAttributes", s, new Integer(i), attributes);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#modifyAttributes(java.lang.String,
+	 *      javax.naming.directory.ModificationItem[])
+	 */
+	public void modifyAttributes(String s, ModificationItem[] amodificationitem)
+			throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"),
+				"modifyAttributes", s, amodificationitem);
+
+	}
+
+	/*
+	 * (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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "rebind",
+				name, obj, attributes);
+	}
+
+	/*
+	 * (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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "rebind",
+				s, obj, attributes);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#search(javax.naming.Name,
+	 *      javax.naming.directory.Attributes)
+	 */
+	public NamingEnumeration search(Name name, Attributes attributes)
+			throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				name, attributes);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				name, attributes, as);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				name, s, aobj, searchcontrols);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				name, s, searchcontrols);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				s, attributes);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				s, attributes, as);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				s, s1, aobj, searchcontrols);
+		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 {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "search",
+				s, s1, searchcontrols);
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#close()
+	 */
+	public void close() throws NamingException {
+		InvokeRecord.set((String) getEnvironment().get("url.schema"), "close");
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext3.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext3.java?rev=397337&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext3.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext3.java Wed Apr 26 16:25:54 2006
@@ -0,0 +1,673 @@
+/* Copyright 2004 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.jndi.tests.javax.naming.spi.mock;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NameParser;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+import javax.naming.directory.SearchControls;
+
+/**
+ * 
+ */
+public class MockDirContext3 implements DirContext {
+
+	private Hashtable prop;
+
+	public MockDirContext3(Hashtable h) {
+		this.prop = h;
+	}
+
+	/*
+	 * (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 {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (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 {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#createSubcontext(javax.naming.Name,
+	 *      javax.naming.directory.Attributes)
+	 */
+	public DirContext createSubcontext(Name name, Attributes attributes)
+			throws NamingException {
+		// Auto-generated method stub
+		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 {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getAttributes(javax.naming.Name)
+	 */
+	public Attributes getAttributes(Name name) throws NamingException {
+		// Auto-generated method stub
+		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 {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getAttributes(java.lang.String)
+	 */
+	public Attributes getAttributes(String s) throws NamingException {
+		// Auto-generated method stub
+		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 {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getSchema(javax.naming.Name)
+	 */
+	public DirContext getSchema(Name name) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getSchema(java.lang.String)
+	 */
+	public DirContext getSchema(String s) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getSchemaClassDefinition(javax.naming.Name)
+	 */
+	public DirContext getSchemaClassDefinition(Name name)
+			throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#getSchemaClassDefinition(java.lang.String)
+	 */
+	public DirContext getSchemaClassDefinition(String s) throws NamingException {
+		// Auto-generated method stub
+		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 {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#modifyAttributes(javax.naming.Name,
+	 *      javax.naming.directory.ModificationItem[])
+	 */
+	public void modifyAttributes(Name name, ModificationItem[] amodificationitem)
+			throws NamingException {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (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 {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#modifyAttributes(java.lang.String,
+	 *      javax.naming.directory.ModificationItem[])
+	 */
+	public void modifyAttributes(String s, ModificationItem[] amodificationitem)
+			throws NamingException {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (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 {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (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 {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.directory.DirContext#search(javax.naming.Name,
+	 *      javax.naming.directory.Attributes)
+	 */
+	public NamingEnumeration search(Name name, Attributes attributes)
+			throws NamingException {
+		// Auto-generated method stub
+		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 {
+		// Auto-generated method stub
+		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 {
+		// Auto-generated method stub
+		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 {
+		// Auto-generated method stub
+		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 {
+		// Auto-generated method stub
+		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 {
+		// Auto-generated method stub
+		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 {
+		// Auto-generated method stub
+		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 {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#addToEnvironment(java.lang.String,
+	 *      java.lang.Object)
+	 */
+	public Object addToEnvironment(String s, Object o) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#bind(javax.naming.Name, java.lang.Object)
+	 */
+	public void bind(Name n, Object o) throws NamingException {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#bind(java.lang.String, java.lang.Object)
+	 */
+	public void bind(String s, Object o) throws NamingException {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#close()
+	 */
+	public void close() throws NamingException {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#composeName(javax.naming.Name,
+	 *      javax.naming.Name)
+	 */
+	public Name composeName(Name n, Name pfx) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#composeName(java.lang.String, java.lang.String)
+	 */
+	public String composeName(String s, String pfx) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#createSubcontext(javax.naming.Name)
+	 */
+	public Context createSubcontext(Name n) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#createSubcontext(java.lang.String)
+	 */
+	public Context createSubcontext(String s) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#destroySubcontext(javax.naming.Name)
+	 */
+	public void destroySubcontext(Name n) throws NamingException {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#destroySubcontext(java.lang.String)
+	 */
+	public void destroySubcontext(String s) throws NamingException {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#getEnvironment()
+	 */
+	public Hashtable getEnvironment() throws NamingException {
+		// Auto-generated method stub
+		return this.prop;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#getNameInNamespace()
+	 */
+	public String getNameInNamespace() throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#getNameParser(javax.naming.Name)
+	 */
+	public NameParser getNameParser(Name n) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#getNameParser(java.lang.String)
+	 */
+	public NameParser getNameParser(String s) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#list(javax.naming.Name)
+	 */
+	public NamingEnumeration list(Name n) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#list(java.lang.String)
+	 */
+	public NamingEnumeration list(String s) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#listBindings(javax.naming.Name)
+	 */
+	public NamingEnumeration listBindings(Name n) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#listBindings(java.lang.String)
+	 */
+	public NamingEnumeration listBindings(String s) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#lookup(javax.naming.Name)
+	 */
+	public Object lookup(Name n) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#lookup(java.lang.String)
+	 */
+	public Object lookup(String s) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#lookupLink(javax.naming.Name)
+	 */
+	public Object lookupLink(Name n) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#lookupLink(java.lang.String)
+	 */
+	public Object lookupLink(String s) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#rebind(javax.naming.Name, java.lang.Object)
+	 */
+	public void rebind(Name n, Object o) throws NamingException {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#rebind(java.lang.String, java.lang.Object)
+	 */
+	public void rebind(String s, Object o) throws NamingException {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#removeFromEnvironment(java.lang.String)
+	 */
+	public Object removeFromEnvironment(String s) throws NamingException {
+		// Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#rename(javax.naming.Name, javax.naming.Name)
+	 */
+	public void rename(Name nOld, Name nNew) throws NamingException {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#rename(java.lang.String, java.lang.String)
+	 */
+	public void rename(String sOld, String sNew) throws NamingException {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#unbind(javax.naming.Name)
+	 */
+	public void unbind(Name n) throws NamingException {
+		// Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.Context#unbind(java.lang.String)
+	 */
+	public void unbind(String s) throws NamingException {
+		// Auto-generated method stub
+
+	}
+
+	/**
+	 * @param object
+	 * @param name
+	 * @param context
+	 * @param env
+	 * @param a
+	 * @return
+	 */
+	public boolean parameterEquals(Object o, Name n, Context c, Hashtable h,
+			Attributes a) {
+		Hashtable r = new Hashtable();
+		if (null != o) {
+			r.put("o", o);
+		}
+		if (null != n) {
+			r.put("n", n);
+		}
+		if (null != c) {
+			r.put("c", c);
+		}
+		if (null != h) {
+			r.put("h", h);
+		}
+		if (null != a) {
+			r.put("a", a);
+		}
+		return r.equals(this.prop);
+	}
+
+	public boolean equals(Object obj) {
+		if (!(obj instanceof MockDirContext3)) {
+			return false;
+		}
+		MockDirContext3 theOther = (MockDirContext3) obj;
+		return (null == prop ? null == theOther.prop : prop
+				.equals(theOther.prop));
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContext3.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContextFactory.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContextFactory.java?rev=397337&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContextFactory.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContextFactory.java Wed Apr 26 16:25:54 2006
@@ -0,0 +1,35 @@
+/* Copyright 2004 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.jndi.tests.javax.naming.spi.mock;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+
+public class MockDirContextFactory implements InitialContextFactory {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.spi.InitialContextFactory#getInitialContext(java.util.Hashtable)
+	 */
+	public Context getInitialContext(Hashtable envmt) throws NamingException {
+		envmt.remove("url.schema");
+		return new MockDirContext(envmt);
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContextFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContextObjectFactory.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContextObjectFactory.java?rev=397337&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContextObjectFactory.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContextObjectFactory.java Wed Apr 26 16:25:54 2006
@@ -0,0 +1,58 @@
+/* Copyright 2004 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.jndi.tests.javax.naming.spi.mock;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.spi.DirObjectFactory;
+
+import org.apache.harmony.jndi.tests.javax.naming.util.Log;
+
+public class MockDirContextObjectFactory implements DirObjectFactory {
+
+	Log log = new Log(MockDirContextObjectFactory.class);
+
+	public static final DirContext DIR_CONTEXT = new MockDirContext(
+			new Hashtable());
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.spi.DirObjectFactory#getObjectInstance(java.lang.Object,
+	 *      javax.naming.Name, javax.naming.Context, java.util.Hashtable,
+	 *      javax.naming.directory.Attributes)
+	 */
+	public Object getObjectInstance(Object o, Name n, Context c,
+			Hashtable envmt, Attributes a) throws Exception {
+		log.setMethod("getObjectInstance");
+		log.log("wrong method call");
+		return DIR_CONTEXT;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.naming.spi.ObjectFactory#getObjectInstance(java.lang.Object,
+	 *      javax.naming.Name, javax.naming.Context, java.util.Hashtable)
+	 */
+	public Object getObjectInstance(Object o, Name n, Context c, Hashtable envmt)
+			throws Exception {
+		return DIR_CONTEXT;
+	}
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/MockDirContextObjectFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message