harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r507703 [9/9] - in /harmony/enhanced/classlib/trunk/modules: jndi/META-INF/ jndi/make/ jndi/src/main/java/javax/naming/ldap/ jndi/src/main/java/org/apache/harmony/jndi/internal/ jndi/src/main/java/org/apache/harmony/jndi/internal/nls/ jndi/...
Date Wed, 14 Feb 2007 21:42:44 GMT
Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestRdnWhiteBoxDevelopment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestRdnWhiteBoxDevelopment.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestRdnWhiteBoxDevelopment.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestRdnWhiteBoxDevelopment.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,747 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You 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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+package org.apache.harmony.jndi.tests.javax.naming.ldap.whitebox;
+
+import java.util.Arrays;
+import javax.naming.InvalidNameException;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.ldap.Rdn;
+import junit.framework.TestCase;
+
+/**
+ * <p>This class test is made to test all cases of package where the coverage was not 100%.</p>
+ * <p>We are gonna find here a lot cases from diferent classes, notice here that the conventional structure
+ * followed in the rest of the proyect is applied  here.</p>
+ * 
+ */
+public class TestRdnWhiteBoxDevelopment extends TestCase {
+    
+    private Rdn rdn;
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(TestRdnWhiteBoxDevelopment.class);
+    }
+
+    public TestRdnWhiteBoxDevelopment(String name) {
+        super(name);
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+       
+    }
+
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive several multivalued types.</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testRdnString() {
+        try {
+            rdn = new Rdn("test=now+cn=mio+cn=mio2+ou=please+cn=mio3+ou=please2");
+            assertNotNull(rdn);
+        } catch (InvalidNameException e1) {
+            fail("Failed with: "+e1);
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive several multivalued types.</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testRdnString001() {
+        try {
+            rdn = new Rdn("cn=mio+ou=please+cn=mio2+cn=mio3");
+            assertNotNull(rdn);
+        } catch (InvalidNameException e1) {
+            fail("Failed with: "+e1);
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive several multivalued types.</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testRdnString002() {
+        try {
+            rdn = new Rdn("ou=please+test=now+cn=mio+cn=mio2+ou=please+cn=mio3+ou=please2+nueva=prueba");
+            assertNotNull(rdn);
+        } catch (InvalidNameException e1) {
+            fail("Failed with: "+e1);
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive several multivalued types.</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testRdnString003() {
+        try {
+            rdn = new Rdn("au=please+d=d+b=now+cn=mio+cn=mio2+ou=please+cn=mio3+b=please2+na=prueba");
+            assertNotNull(rdn);
+        } catch (InvalidNameException e1) {
+            fail("Failed with: "+e1);
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive the special character "#".</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testRdnString004() {
+        try {
+            rdn = new Rdn("au=#00420ced");
+            assertNotNull(rdn);
+        } catch (InvalidNameException e1) {
+            fail("Failed with: "+e1);
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive the special character "#".</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testRdnString005() {
+        try {
+            rdn = new Rdn("au=\\#00420ced");
+            assertNotNull(rdn);
+        } catch (InvalidNameException e1) {
+            fail("Failed with: "+e1);
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive the special character "#".</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testRdnString016() {
+        
+        String x="t=\\#0FA3TA";
+        try {
+            Rdn y=new Rdn(x);
+            assertNotNull(y);
+        } catch (InvalidNameException e) {
+            fail("Failed with:"+e);
+        }
+        
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive utf8.</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testRdnString017() {
+        try {
+            rdn = new Rdn("t=\\4CM\\4E+u=Minombre\\40+a=\\4C\\0d");
+        } catch (InvalidNameException e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive the special character "=".</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testRdnString018() {
+        
+        String x="v=a=a";
+        try {
+            rdn =new Rdn(x);
+            assertNotNull(rdn);
+        } catch (InvalidNameException e) {
+            fail("Failed with:"+e);
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive the special character "#".</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testRdnString019() {
+        
+        String x="v=a=+a=+v=#0D8F";
+        try {
+            rdn =new Rdn(x);
+            assertNotNull(rdn);
+        } catch (InvalidNameException e) {
+            fail("Failed with:"+e);
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive the special character "=".</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testParsingEqualCharacter() {
+        String x="v=======";
+        try {
+            rdn =new Rdn(x);
+            assertNotNull(rdn);
+        } catch (InvalidNameException e) {
+            fail("Failed with:"+e);
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive the special character "\".</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testQuotedTypeCHECK() {
+        
+        String x="v=+a=+\\\\a="; //+v=#0D8F";
+        try {
+            rdn =new Rdn(x);
+            fail("Type should not contains quoted chars");
+        } catch (InvalidNameException e) {
+           
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive the special character "+".</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testIgnoreEndingPlusChar() {
+        String x="a=k+";
+        try {
+            rdn =new Rdn(x);
+            Rdn rdn2 = new Rdn("a=k");
+            assertTrue(rdn.equals(rdn2));
+            assertNotNull(rdn);
+        } catch (InvalidNameException e) {
+            fail("Failed with:"+e);
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive the special character "<".</p>
+     * <p>The expected result is a not null instance.</p>
+     */
+    public void testParsingMinorCharacter() {
+        String x="v=<";
+        try {
+            rdn =new Rdn(x);
+            assertNotNull(rdn);
+        } catch (InvalidNameException e) {
+            fail("Failed with:"+e);
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.Rdn(String)'</p>
+     * <p>Here we are testing if the constructor can recive the special character "#".</p>
+     * <p>The expected result is that two rdns must not be the same.</p>
+     */
+    public final void testEquals() {
+        try {
+            rdn = new Rdn("au=#00420ced");
+            assertNotSame(rdn,rdn = new Rdn("au=\\#00420ced"));
+        } catch (InvalidNameException e) {
+            fail("Failed with: "+e);
+        }
+        
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.equals(Rdn)'</p>
+     * <p>Here we are testing if the method can recive a Rdn.</p>
+     * <p>The expected result is that two rdns must be the same.</p>
+     */
+    public void testRDNEqualsCompare() {
+            String t="a=\\<a+a=a\\=a+t=test+t=test+v=fsdasd+v=LL";
+            Rdn rdn;
+            try {
+                rdn = new Rdn("t=test+v=\\4C\\4C+t=test+a=a=a+v=fsdasd+a=<a");
+                Rdn rdn1=new Rdn(rdn.toString());
+                assertTrue(rdn.equals(rdn1));
+            } catch (InvalidNameException e) {
+                fail("Failed with:"+e);
+            }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.equals(Rdn)'</p>
+     * <p>Here we are testing if the method can recive a Rdn.</p>
+     * <p>The expected result is that two rdns must be the same.</p>
+     */
+    public void testRDNequals() {
+
+    	byte[] aux=new byte[]{116,101,115,116};//this is equal to say "test" in ascii.
+        Rdn x1 = null;
+        Rdn x2 = null;
+        Rdn x3 = null;
+        try {
+            x1 = new Rdn("t=test");
+            x2=new Rdn(x1);
+            x3=new Rdn("t",aux);
+        }catch (InvalidNameException e) {
+         	fail();
+        }
+        
+        assertFalse("Should not be equals.",x2.equals(x3));
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.equals(Rdn)'</p>
+     * <p>Here we are testing if the method can recive a Rdn.</p>
+     * <p>The expected result is that two rdns must be the same.</p>
+     */
+	public void testRDNequals2() {
+        Rdn x2 = null;
+        Rdn x3 = null; 
+        try {
+            x2 = new Rdn("cn","#0001");
+            x3 = new Rdn("cn",new byte[]{0,1});
+        } catch (InvalidNameException e) {
+            e.printStackTrace();
+        }
+        assertTrue("Should be equals.",x2.equals(x3));
+    }
+	
+	/**
+     * <p>Test method for 'javax.naming.ldap.Rdn.equals(Rdn)'</p>
+     * <p>Here we are testing if the method can recive a Rdn.</p>
+     * <p>The expected result is that two rdns must be the same.</p>
+     */
+	public void testRDNequals3() {
+        Rdn x1 = null;
+		Rdn x2 = null;
+        Rdn x3 = null;
+        Rdn x4 = null;
+        Rdn x5 = null;
+        MyBasicAttributes set = new MyBasicAttributes("cn",new byte[]{116,116,116});
+        try {
+        	
+            x2 = new Rdn("cn=ttt");
+            x3 = new Rdn("cn",new byte[]{116,116,116});
+            x1 = new Rdn(x2);
+            x4 = new Rdn(set);
+        } catch (InvalidNameException e) {
+        	fail("Failed with:"+e);
+        }
+        assertFalse("Should not be equals.",x3.equals(x2));
+        assertFalse("Should not be equals.",x1.equals(x3));
+        assertTrue("Should be equals.",x3.equals(x3));
+        assertTrue("Should be equals.",x3.equals(x4));
+        try {
+        	x1 = new Rdn("cn",new byte[]{11,116,11});
+        	x2 = new Rdn("cn",new byte[]{116,116,116});
+            x3 = new Rdn("cn",new byte[]{116,116,116});
+            x4 = new Rdn("cn=#30");
+            x5 = new Rdn("cn", new byte[]{0});
+        
+        } catch (InvalidNameException e) {
+        	fail("Failed with:"+e);
+        }
+        assertFalse(x1.equals(x3));
+        assertTrue(x2.equals(x3));
+        assertFalse(x5.equals(x4));
+        
+    }
+	  
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.equals(Rdn)'</p>
+     * <p>Here we are testing if the method can recive a Rdn with a different array.</p>
+     * <p>The expected result is that two rdns must not be the same.</p>
+     */
+    public final void testEqualsArrays() {
+        try {
+        	Rdn x=new Rdn("t",new byte[]{01,00,02});
+        	Rdn y=new Rdn("t",new byte[]{00,03,01});
+        	assertFalse(x.equals(y));
+        } catch (InvalidNameException e) {
+            fail("Failed with: "+e);
+        }
+        
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.escapedValue(Object)'</p>
+     * <p>Here we are testing if this method can escape some values.</p>
+     * <p>The expected result is that the method return the string escaped.</p>
+     */
+    public final void testEscapedValue001() {
+        assertEquals("t�a\\, mar�a",Rdn.escapeValue("t�a, mar�a"));
+    }
+
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.escapedValue(Object)'</p>
+     * <p>Here we are testing if this method can escape some values.</p>
+     * <p>The expected result is that the method return the string escaped.</p>
+     */
+    public final void testEscapedValue002() {
+        assertEquals("#00420ced",Rdn.escapeValue(new byte[]{0,66,12,-19}));
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.escapedValue(Object)'</p>
+     * <p>Here we are testing if this method can escape some values.</p>
+     * <p>The expected result is that the method return the string escaped.</p>
+     */
+    public final void testescapedValue003() {
+        assertEquals("#fa08",Rdn.escapeValue(new byte[]{-6, 8}));
+    }
+
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.escapedValue(Object)'</p>
+     * <p>Here we are testing if this method can escape some values.</p>
+     * <p>The expected result is that the method return the string escaped.</p>
+     */
+    public final void testEscapedValue004() {
+        assertEquals("t�a\\, mar�a \\#\\,sobrante\\>\\<",Rdn.escapeValue("t�a, mar�a #,sobrante><"));
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.escapedValue(Object)'</p>
+     * <p>Here we are testing if this method can escape some values.</p>
+     * <p>The expected result is that the method return the string escaped.</p>
+     */
+    public final void testEscapedValue005() {
+        assertEquals("t�a\\, mar�a \\#\\,sobrante\\>\\<",Rdn.escapeValue("t�a, mar�a #,sobrante><"));
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.toString()'</p>
+     * <p>Here we are testing if this method returns the correct string.</p>
+     */
+    public void testToString001() {
+        try {
+            String t="t=test+v=value+t=test2+v=value2";
+            Rdn rdn=new Rdn(t);
+            assertEquals("t=test+t=test2+v=value+v=value2",rdn.toString());
+        } catch (Throwable e) {
+            fail("Failed with:"+e);
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.toString()'</p>
+     * <p>Here we are testing if this method returns the correct string.</p>
+     */
+    public void testToString002() {
+        try {
+            String t="SN=Lu\\C4\\8Di\\C4\\87";
+            Rdn rdn=new Rdn(t);
+            assertEquals(8,rdn.toString().getBytes().length);
+        } catch (Throwable e) {
+            fail("Failed with:"+e);
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.toString()'</p>
+     * <p>Here we are testing if this method returns the correct string.</p>
+     */    
+    public void testToString003() {
+        try {
+            String t="v=#080100";
+            Rdn rdn=new Rdn("v",new byte[]{8,01,0});
+            assertEquals(t,rdn.toString());
+        } catch (Throwable e) {
+            fail("Failed with:"+e);
+        }
+        
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.toString()'</p>
+     * <p>Here we are testing if this method returns the correct string.</p>
+     */   
+    public void testToString004() {
+        try {
+        	String x="a";
+            Rdn rdn=new Rdn("v"," ");
+            if("v=\\ "==rdn.toString())fail("Should not happens this.");
+        } catch (Throwable e) {
+            fail("Failed with:"+e);
+        }
+        
+    }
+     
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.escapedValue(Object)'</p>
+     * <p>Here we are testing if this method can escape some values.</p>
+     * <p>The expected result is that the method return the string escaped.</p>
+     */
+    public void testUnescapedValue001() {
+    	
+        assertEquals(Arrays.toString(new byte[]{-6, 8}),Arrays.toString((byte[]) Rdn.unescapeValue("#fa08")));    
+    }
+    
+
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.escapedValue(Object)'</p>
+     * <p>Here we are testing if this method can escape some values.</p>
+     * <p>The expected result is that the method return the string escaped.</p>
+     */
+    public void testUnescapedValue002() {
+        try {
+            Rdn.unescapeValue("##fa08");
+            fail("An exception must be thrown.");
+        } catch (IllegalArgumentException e) {
+        	
+        }
+    }
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.escapedValue(Object)'</p>
+     * <p>Here we are testing if this method can escape some values.</p>
+     * <p>The expected result is that the method return the string escaped.</p>
+     */
+    public void testUnescapedValue003() {
+        assertEquals("t=LMN+u=Minombre@+a=L",Rdn.unescapeValue("t=\\4CM\\4E+u=Minombre\\40+a=\\4C"));
+    }   
+    
+    /**
+     * <p>Test method for 'javax.naming.ldap.Rdn.hashCode()'</p>
+     * <p>Here we are testing if this method return the hash of an object distinct in the value of a string.</p>
+     */
+    public void testHashCode(){
+    	try {
+			Rdn x=new Rdn("t",new byte[]{01,00,02});
+			assertNotNull(x);
+			assertNotSame(0,x.hashCode());
+		} catch (InvalidNameException e) {
+			fail("Failed with:"+e);
+		}
+    }
+    
+    /**
+	 * <p>Test method for 'javax.naming.ldap.Rdn.getValue()'</p>
+	 * <p>Here we are testing if this method retrieves one of this Rdn's value. In this case should raise an exception
+	 * because the rdn is empty.</p>
+	 * <p>The expected result is an exception.</p>
+	 */
+	public void testGetValue001() {
+		try {
+			Rdn rdn=new Rdn("t"," ");
+			System.out.println(rdn.getValue());
+			
+		} catch (Throwable e) {
+			fail("Failed with:"+e);
+		}
+		
+	}
+
+	/**
+	 * <p>Test method to test if the constructor take literally what is between '"'.</p>
+	 *
+	 */
+	public void testRDNComillas() {
+        Rdn x2 = null;
+        Rdn x3 = null; 
+        try {
+            x2 = new Rdn("cn","\"mio\"");
+            x3 = new Rdn("cn","\"mio\"");
+        } catch (InvalidNameException e) {
+            fail("Failed with:"+e);
+        }
+        assertTrue("Should be equals.",x2.equals(x3));
+    }
+	
+	/**
+	 * <p>Test method to test if the constructor take literally what is between '"'.</p>
+	 *
+	 */
+	public void testRDNComillas2() {
+        Rdn x2 = null;
+        try {
+            String temp="cn=mio\\,zapato\\,veloz\\;\\\" \\#";
+        	x2 = new Rdn("cn=\"mio,zapato,veloz;\\\" \\#\"");
+            assertEquals(0,temp.compareToIgnoreCase(x2.toString()));
+        } catch (InvalidNameException e) {
+            fail();
+        }
+    }
+
+	/**
+	 * <p>Test methdo to test if the constructor can recive the correct lenght to a byte array.</p>
+	 *
+	 */
+	public void testRDNWrongHexValue() {
+        try {
+            Rdn x2 = new Rdn("cn=#A");
+            fail();
+        } catch (InvalidNameException e) {
+        } catch (IllegalArgumentException e) {
+        }
+    
+    }
+	
+	/**
+	 * Here we are testing to send the escaped special characters and utf8. 
+	 *
+	 */
+	public void testRdnEscapeValue002(){
+		String fName="cn=\\;\\\"";
+		try {
+			Rdn x=new Rdn(fName);
+			assertNotNull(x);
+		} catch (InvalidNameException e) {
+			fail("Failed with:"+e);
+		}
+		
+		
+		
+	}
+	
+	/**
+	 * Here we are testing to send the escaped special characters and utf8. 
+	 *
+	 */
+	public void testRdnEscapeValue003(){
+		String fName="cn=\\<\\>";
+		try {
+			Rdn x=new Rdn(fName);
+			assertNotNull(x);
+		} catch (InvalidNameException e) {
+			fail("Failed with:"+e);
+		}
+		
+		
+		
+	}
+
+	/**
+	 * Here we are testing to send the escaped special characters and utf8. 
+	 *
+	 */
+	public void testRdnEscapeValue004(){
+		String fName="cn=\\<\\>\\\\";
+		try {
+			Rdn x=new Rdn(fName);
+			fail("Failed, an exception must be thrown. ");
+		} catch (InvalidNameException e) {
+			fail("Failed with:"+e);
+		} catch (Exception e) {
+			
+		}
+		
+		
+		
+	}
+	
+	/**
+	 * Here we are testing to send the escaped special characters and utf8. 
+	 *
+	 */
+	public void testRdnEscapeValue005(){
+		String fName="cn=\\<\\>\\=";
+		try {
+			Rdn x=new Rdn(fName);
+			assertNotNull(x);
+		} catch (InvalidNameException e) {
+			fail("Failed with:"+e);
+		}
+		
+		
+		
+	}
+	/**
+	 * Here we are testing to send the escaped special characters and utf8. 
+	 *
+	 */
+	public void testRdnEscapeValue006(){
+		String fName="cn=\\<\\>\"\\+\"";
+		try {
+			Rdn x=new Rdn(fName);
+			assertNotNull(x);
+		} catch (InvalidNameException e) {
+			fail("Failed with:"+e);
+		}
+		
+		
+		
+	}
+
+	/**
+	 * Here we are testing to send the escaped special characters and utf8. 
+	 *
+	 */
+	public void testRdnEscapeValue007(){
+		String fName="cn=\\<\\>\\4C";
+		try {
+			Rdn x=new Rdn(fName);
+			assertNotNull(x);
+		} catch (InvalidNameException e) {
+			fail("Failed with:"+e);
+		}
+		
+		
+		
+	}
+	
+	/**
+	 * Here we are testing to send the escaped special characters and utf8. 
+	 *
+	 */
+	public void testRdnEscapeValue008(){
+		String fName="cn=\\<\\>\\ ";
+		try {
+			Rdn x=new Rdn(fName);
+			assertNotNull(x);
+		} catch (InvalidNameException e) {
+			fail("Failed with:"+e);
+		}
+		
+		
+		
+	}
+	/*
+	 * Class to help us to do the white box.
+	 */
+	private class MyBasicAttributes extends BasicAttributes {
+		
+		private static final long serialVersionUID = 1L;
+		private Object myo;
+		MyBasicAttributes(String x,Object o){
+			super(x,o);
+			this.myo=o;
+		}
+		public Object getValue(){
+			return myo;
+		}
+	}
+
+}
+
+

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

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestStartTlsRequestWhiteBoxDevelopment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestStartTlsRequestWhiteBoxDevelopment.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestStartTlsRequestWhiteBoxDevelopment.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestStartTlsRequestWhiteBoxDevelopment.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,219 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You 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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+package org.apache.harmony.jndi.tests.javax.naming.ldap.whitebox;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+
+import javax.naming.NamingException;
+import javax.naming.ldap.StartTlsRequest;
+import javax.naming.ldap.StartTlsResponse;
+
+import junit.framework.TestCase;
+
+/**
+ * <p>This class test is made to test all cases of package where the coverage was not 100%.</p>
+ * <p>We are gonna find here a lot cases from diferent classes, notice here that the conventional structure
+ * followed in the rest of the proyect is applied  here.</p>
+ * 
+ * For this tests to run correctly, should not exist any META-INF/services/javax.naming.ldap.StartTlsRespose
+ * file within any directory and/or jar file in the following path: user.dir, bootclasspath and java.home 
+ * 
+ */
+public class TestStartTlsRequestWhiteBoxDevelopment extends TestCase {
+	public static void main(String[] args) {
+		junit.textui.TestRunner.run(TestStartTlsRequestWhiteBoxDevelopment.class);
+	}
+
+	public TestStartTlsRequestWhiteBoxDevelopment(String name) {
+		super(name);
+	}
+
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+	
+	public void testFile001(){
+		File path = new File(System.getProperty("user.dir")+File.separator+"META-INF"+File.separator+"services"+File.separator+"javax.naming.ldap.StartTlsResponse");
+		path.getParentFile().mkdirs();		
+		PrintStream out=null;
+		try {
+			out= new PrintStream(new FileOutputStream(path));
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		}		
+		out.println("org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockStartTlsResponse");		
+		StartTlsRequest str = new StartTlsRequest();
+		String ID="1.3.6.1.4.1.1466.20037";
+		int t1=210,t2=650;
+		byte[] t0=ID.getBytes();
+		try {
+			StartTlsResponse x=(StartTlsResponse) str.createExtendedResponse(ID,t0,t1,t2);
+			path.delete();
+			assertEquals("org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockStartTlsResponse",x.getClass().getCanonicalName() );
+		} catch (Throwable e){
+			path.delete();
+			fail("failed with: " + e);
+		}
+	}
+	
+	public void testFile002(){
+		File path = new File(System.getProperty("user.dir")+File.separator+"META-INF"+File.separator+"services"+File.separator+"javax.naming.ldap.StartTlsResponse");		
+		path.getParentFile().mkdirs();		
+		PrintStream out=null;
+		try {
+			out= new PrintStream(new FileOutputStream(path));
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		}		
+		out.println("org.fitc.algo.que.no\n"+
+				    "org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockStartTlsResponse");
+		StartTlsRequest str = new StartTlsRequest();
+		String ID="1.3.6.1.4.1.1466.20037";
+		int t1=210,t2=650;
+		byte[] t0=ID.getBytes();
+		try {
+			StartTlsResponse x=(StartTlsResponse) str.createExtendedResponse(ID,t0,t1,t2);
+			path.delete();
+			assertEquals("org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockStartTlsResponse",x.getClass().getCanonicalName());
+		} catch (Throwable e){
+			path.delete();
+			fail("Failed with: "+ e);
+		}		
+	}
+	public void testFile003(){
+		File path = new File(System.getProperty("user.dir")+File.separator+"META-INF"+File.separator+"services"+File.separator+"javax.naming.ldap.StartTlsResponse");		
+		path.getParentFile().mkdirs();		
+		PrintStream out=null;
+		try {
+			out= new PrintStream(new FileOutputStream(path));
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		}		
+		out.println("org.fitc.algo.que.no\n");
+				    
+		StartTlsRequest str = new StartTlsRequest();
+		String ID="1.3.6.1.4.1.1466.20037";
+		int t1=210,t2=650;
+		byte[] t0=ID.getBytes();
+		try {
+			StartTlsResponse x=(StartTlsResponse) str.createExtendedResponse(ID,t0,t1,t2);
+			path.delete();
+			fail("NamignException expected");
+		}catch (NamingException e){
+			path.delete();			
+		}catch (Throwable e){
+			path.delete();		
+			e.printStackTrace();
+			fail("Failed with: "+ e);
+		}
+	}
+	public void testFile004(){
+		StartTlsRequest str = new StartTlsRequest();
+		String ID="1.3.6.1.4.1.1466.20037";
+		int t1=210,t2=650;
+		byte[] t0=ID.getBytes();
+		try {
+			StartTlsResponse x=(StartTlsResponse) str.createExtendedResponse(ID,t0,t1,t2);			
+			fail("NamignException expected");
+		}catch (NamingException e){	
+		}catch (Throwable e){					
+			e.printStackTrace();
+			fail("Failed with: "+ e);
+		}
+	}
+	
+	public void testJar001(){
+		File path = new File(System.getProperty("user.dir")+"/miarchivo.jar");
+		FileOutputStream os=null;
+		JarOutputStream jos=null;
+		JarEntry je=new JarEntry("META-INF"+File.separator+"services"+File.separator+"javax.naming.ldap.StartTlsResponse");		
+		try {
+			os=new FileOutputStream(path);
+			jos=new JarOutputStream(os);
+			jos.putNextEntry(je);
+			jos.write("org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockStartTlsResponse".getBytes());
+			jos.flush();
+			jos.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		
+		StartTlsRequest str = new StartTlsRequest();
+		String ID="1.3.6.1.4.1.1466.20037";
+		int t1=210,t2=650;
+		byte[] t0=ID.getBytes();
+		try {
+			StartTlsResponse x=(StartTlsResponse) str.createExtendedResponse(ID,t0,t1,t2);
+			path.delete();
+			assertEquals("org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap.MockStartTlsResponse",x.getClass().getCanonicalName() );
+		} catch (Throwable e){
+			path.delete();
+			fail("failed with: " + e);
+		}		
+		path.delete();
+	}
+	
+	
+	public void testJar002(){
+		File path = new File(System.getProperty("user.dir")+"/miarchivo.jar");
+		FileOutputStream os=null;
+		JarOutputStream jos=null;
+		JarEntry je=new JarEntry("META-INF"+File.separator+"services"+File.separator+"javax.naming.ldap.StartTlsResponse");		
+		try {
+			os=new FileOutputStream(path);
+			jos=new JarOutputStream(os);
+			jos.putNextEntry(je);
+			jos.write("org.fitc.algo.que.no\n".getBytes());
+			jos.flush();
+			jos.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		
+		StartTlsRequest str = new StartTlsRequest();
+		String ID="1.3.6.1.4.1.1466.20037";
+		int t1=210,t2=650;
+		byte[] t0=ID.getBytes();
+		try {
+			StartTlsResponse x=(StartTlsResponse) str.createExtendedResponse(ID,t0,t1,t2);
+			path.delete();
+			fail("NamignException expected");
+		}catch (NamingException e){
+			path.delete();			
+		}catch (Throwable e){
+			path.delete();		
+			e.printStackTrace();
+			fail("Failed with: "+ e);
+		}
+	}
+}
\ No newline at end of file

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

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockContext.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockContext.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockContext.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockContext.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,267 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You 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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+package org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap;
+
+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;
+import javax.naming.ldap.Control;
+
+/**
+ * <p>Implementation of the interfaces Context. This class has the intention of
+ * give us a context to test another classes.</p> 
+ *
+ */
+public class MockContext implements Context {
+	
+	/**
+	 * <p>This field is the properties of init context.</p>.
+	 */
+	protected Hashtable props;
+	/**
+	 * <p>This field is the control of init context.</p>.
+	 */
+	protected Control[] concs;
+	/**
+	 * <p>Constructor method for the context.</p>.
+	 */
+	public MockContext(Hashtable envmt) {
+		this.props = new Hashtable();
+		            
+	}
+	/**
+	 * <p>Method to get the propeties of this context.</p>
+	 */
+	public Hashtable getProps() {
+		return this.props;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Object lookup(Name arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Object lookup(String arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void bind(Name arg0, Object arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void bind(String arg0, Object arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void rebind(Name arg0, Object arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void rebind(String arg0, Object arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void unbind(Name arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void unbind(String arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void rename(Name arg0, Name arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void rename(String arg0, String arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NamingEnumeration<NameClassPair> list(Name arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NamingEnumeration<NameClassPair> list(String arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NamingEnumeration<Binding> listBindings(Name arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NamingEnumeration<Binding> listBindings(String arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void destroySubcontext(Name arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void destroySubcontext(String arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Context createSubcontext(Name arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Context createSubcontext(String arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Object lookupLink(Name arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Object lookupLink(String arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NameParser getNameParser(Name arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NameParser getNameParser(String arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Name composeName(Name arg0, Name arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public String composeName(String arg0, String arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Object addToEnvironment(String arg0, Object arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Object removeFromEnvironment(String arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Hashtable<?, ?> getEnvironment() throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void close() throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public String getNameInNamespace() throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

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

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockContextFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockContextFactory.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockContextFactory.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockContextFactory.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,51 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You 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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+package org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.spi.InitialContextFactory;
+
+/**
+ * <p>Implementation of the interfaces InitialContextFactory. This class has the intention of
+ * give us a context to test another classes.</p> 
+ *
+ */
+public class MockContextFactory implements InitialContextFactory {
+
+	/**
+	 * <p>This method creates an Initial Context for beginning name resolution.</p>
+	 * @param envmt The properties.
+	 * @return The Context representing a LDAP server.
+	 * @throws NamingException If an error is encounter.
+	 */
+	public Context getInitialContext(Hashtable envmt) throws NamingException {
+
+		return new MockInitialLdapContext(envmt);
+	
+	}
+	
+	
+}

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

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockControl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockControl.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockControl.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockControl.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,91 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You 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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+package org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap;
+
+import javax.naming.ldap.Control;
+
+/**
+ * <p>Implementation of the interfaces Control. This class has the intention of
+ * give us a Control to test another classes.</p> 
+ *
+ */
+public class MockControl implements Control {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	private String id;
+	private boolean criticality;
+	private byte[] value;
+	
+	/**
+	 * Constructor method to the our control.
+	 * @param id The Id field of this control.
+	 * @param crit The citicality of the control.
+	 * @param value The BER value of the control.
+	 */
+	public MockControl(String id,boolean crit,byte[] value) {
+		this.id=id;
+		this.criticality=crit;
+		this.value=value;
+	}
+	
+	/**
+	 * Constructor method to the our control.
+	 * @param id The Id field of this control.
+	 */
+	public MockControl(String id){
+		this.id=id;
+		this.criticality=false;
+		this.value=null;
+	}
+
+	/**
+	 * This method give us the Id of the control.
+	 * @return The Id of the control.
+	 */
+	public String getID() {
+		// TODO Auto-generated method stub
+		return id;
+	}
+
+	/**
+	 * This method give us the criticality of the control.
+	 * @return The criticality.
+	 */
+	public boolean isCritical() {
+		// TODO Auto-generated method stub
+		return criticality;
+	}
+
+	/**
+	 * This method give us the BER value of the control.
+	 * @return The BER value.
+	 */
+	public byte[] getEncodedValue() {
+		// TODO Auto-generated method stub
+		return value;
+	}
+
+}

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

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockControlFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockControlFactory.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockControlFactory.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockControlFactory.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,52 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You 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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+package org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap;
+
+import javax.naming.NamingException;
+import javax.naming.ldap.Control;
+import javax.naming.ldap.ControlFactory;
+
+/**
+ * <p>Implementation of the interfaces ControlFactory. This class has the intention of
+ * give us a Control to test another classes.</p> 
+ *
+ */
+public class MockControlFactory extends ControlFactory {
+
+	/**
+	 * Constructor method that initiate the inherti constructor.
+	 *
+	 */
+	public MockControlFactory() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Method not implemented.
+	 */
+	public Control getControlInstance(Control arg0) throws NamingException {
+		return null;
+	}
+
+}

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

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockDirContext.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockDirContext.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockDirContext.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockDirContext.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,236 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You 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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+package org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+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;
+import javax.naming.directory.SearchResult;
+
+
+/**
+ * <p>Implementation of the interfaces DirContext. This class has the intention of
+ * give us a dircontext to test another classes.</p> 
+ *
+ */
+public class MockDirContext extends MockContext implements DirContext {
+
+	protected Context defaultInitCtx;//FIXME
+	/**
+	 * <p>Constructor method for the dircontext.</p>.
+	 */
+	public MockDirContext(Hashtable h) {
+		super(h);
+		this.defaultInitCtx=this;//FIXME
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Attributes getAttributes(Name arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Attributes getAttributes(String arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Attributes getAttributes(Name arg0, String[] arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Attributes getAttributes(String arg0, String[] arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void modifyAttributes(Name arg0, int arg1, Attributes arg2) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void modifyAttributes(String arg0, int arg1, Attributes arg2) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void modifyAttributes(Name arg0, ModificationItem[] arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void modifyAttributes(String arg0, ModificationItem[] arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void bind(Name arg0, Object arg1, Attributes arg2) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void bind(String arg0, Object arg1, Attributes arg2) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void rebind(Name arg0, Object arg1, Attributes arg2) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void rebind(String arg0, Object arg1, Attributes arg2) throws NamingException {
+		// TODO Auto-generated method stub
+		
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public DirContext createSubcontext(Name arg0, Attributes arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public DirContext createSubcontext(String arg0, Attributes arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public DirContext getSchema(Name arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public DirContext getSchema(String arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public DirContext getSchemaClassDefinition(Name arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public DirContext getSchemaClassDefinition(String arg0) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NamingEnumeration<SearchResult> search(Name arg0, Attributes arg1, String[] arg2) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NamingEnumeration<SearchResult> search(String arg0, Attributes arg1, String[] arg2) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NamingEnumeration<SearchResult> search(Name arg0, Attributes arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NamingEnumeration<SearchResult> search(String arg0, Attributes arg1) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NamingEnumeration<SearchResult> search(Name arg0, String arg1, SearchControls arg2) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NamingEnumeration<SearchResult> search(String arg0, String arg1, SearchControls arg2) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NamingEnumeration<SearchResult> search(Name arg0, String arg1, Object[] arg2, SearchControls arg3) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NamingEnumeration<SearchResult> search(String arg0, String arg1, Object[] arg2, SearchControls arg3) throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+}

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

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockInitialLdapContext.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockInitialLdapContext.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockInitialLdapContext.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockInitialLdapContext.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,178 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You 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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+package org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap;
+
+import java.util.Hashtable;
+
+import javax.naming.NamingException;
+import javax.naming.ldap.Control;
+import javax.naming.ldap.ExtendedRequest;
+import javax.naming.ldap.ExtendedResponse;
+import javax.naming.ldap.InitialLdapContext;
+import javax.naming.ldap.LdapContext;
+
+/**
+ * <p>Implementation of the interfaces LdapContext. This class has the intention of
+ * give us a context to test another classes.</p> 
+ *
+ */
+public class MockInitialLdapContext extends MockDirContext implements LdapContext {
+
+	/**
+	 * <p>This field is the properties of init context.</p>.
+	 */
+	private Hashtable env=null;
+	/**
+	 * <p>This field is a temporary control of init context.</p>.
+	 */
+	Control[] tempcs=null;
+	/**
+	 * <p>This field is a falg to know if a reconection was made.</p>.
+	 */
+	boolean flag=false;
+	/**
+	 * <p>This field is the connection control of init context.</p>.
+	 */
+	Control[] concs=null;
+	/**
+	 * <p>This field is the request control of init context.</p>.
+	 */
+	private Control[] reqcs;
+	/**
+	 * <p>This field is the last response control of init context.</p>.
+	 */
+	Control[] last=null;
+	
+	/**
+	 * <p>This method retrives the properties.</p>
+	 */
+	public Hashtable getProps(){
+		return env;
+		
+	}
+	
+	/**
+	 * <p>Constructor method for this mock.</p>
+	 * @param envmt The properties.
+	 * @throws NamingException If an error is encounter.
+	 */
+	public MockInitialLdapContext(Hashtable envmt) throws NamingException {
+		super(envmt);
+		this.env=(Hashtable) envmt.clone();
+		
+	}
+	/**
+	 * <p>This method is performs an extended operation.</p>
+	 * @param arg0 The extended request for the operation.
+	 * @return ExtendedResponse The extended response of this operation.
+	 */
+	public ExtendedResponse extendedOperation(ExtendedRequest arg0)	throws NamingException , NullPointerException{
+
+		if(arg0==null) throw new NullPointerException();
+		if(arg0.getID()=="1.3.6.1.4.1.1466.20037") return new MockStartTlsResponse();
+		return null;
+	}
+	
+	/**
+	 * <p>This method creates a new instance of this context initialized using request controls.</p>
+	 * @param arg0 The controls to be use for the new instance.
+	 * @return LdapContext The new context.
+	 */
+	public LdapContext newInstance(Control[] arg0) throws NamingException {
+		if(arg0==null||arg0!=null){
+			return new InitialLdapContext(env,arg0);
+		}
+		throw new NamingException();
+	}
+	
+	/**
+	 * <p>This method reconnects to the LDAP server using the supplied controls and this context's environment.</p>
+	 * @param arg0 The controls to be use for the reconnection.
+	 */
+	public void reconnect(Control[] arg0) throws NamingException {
+		
+		tempcs=arg0;
+		flag=true;
+
+	}
+	
+	/**
+	 * <p>This method close the connection to the LDAP server.</p>
+	 */
+	public void close() throws NamingException {
+
+		super.close();
+
+	}
+	
+	/**
+	 * <p>This methdo retrives the connection controls.</p>
+	 * @return The connection controls.
+	 */
+	public Control[] getConnectControls() throws NamingException {
+		if(flag){
+			this.last=tempcs;
+			return tempcs;
+		}
+		this.last=concs;
+		return this.concs;
+		
+	}
+
+	/**
+	 * <p>This method set new controls to a request.</p>
+	 * @param arg0 The new set of controls.
+	 */
+	public void setRequestControls(Control[] arg0) throws NamingException {
+		
+		if (null != arg0) {
+            this.reqcs = new Control[arg0.length];
+            System.arraycopy(arg0, 0, reqcs, 0, arg0.length);
+            
+        }else {
+        	this.reqcs=arg0;
+        }
+
+	}
+
+	/**
+	 * <p>This method get the set of controls of a request.</p>
+	 * @return The set of controls.
+	 */
+	public Control[] getRequestControls() throws NamingException {
+		this.last=reqcs;
+		return this.reqcs;
+		
+		
+	}
+	/**
+	 * <p>This method get the set of controls of a request.</p>
+	 * @return The set of controls.
+	 */
+	public Control[] getResponseControls() throws NamingException {
+		
+		return this.last;
+				
+	}
+		
+}

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

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockLdapReferralException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockLdapReferralException.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockLdapReferralException.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockLdapReferralException.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,92 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You 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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+package org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.ldap.Control;
+import javax.naming.ldap.LdapReferralException;
+
+/**
+ * <p>Implementation of the class LdapReferralException. This class has the intention of
+ * give us an instance of the class to test it.</p> 
+ *
+ */
+public class MockLdapReferralException extends LdapReferralException {
+
+	/**
+	 * The serial to the class.
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public MockLdapReferralException(String arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+
+	public MockLdapReferralException() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	public Context getReferralContext() throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Context getReferralContext(Hashtable<?, ?> arg0)
+			throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Context getReferralContext(Hashtable<?, ?> arg0, Control[] arg1)
+			throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Object getReferralInfo() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean skipReferral() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public void retryReferral() {
+		// TODO Auto-generated method stub
+
+	}
+
+}

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

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockStartTlsResponse.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockStartTlsResponse.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockStartTlsResponse.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockStartTlsResponse.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,97 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You 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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+package org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap;
+
+import java.io.IOException;
+
+import javax.naming.ldap.StartTlsResponse;
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLSocketFactory;
+
+/**
+ * <p>This mock give us our Implementation of the class StartTlsResponse. This class has the intention of
+ * help us to test another classes.</p> 
+ *
+ */
+public class MockStartTlsResponse extends StartTlsResponse {
+
+	/**
+	 * The serial of the class.
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Constructor method to our TLSResponse.
+	 *
+	 */
+	public MockStartTlsResponse() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void setEnabledCipherSuites(String[] arg0) {
+		// TODO Auto-generated method stub
+
+	}
+
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void setHostnameVerifier(HostnameVerifier arg0) {
+		// TODO Auto-generated method stub
+
+	}
+
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public SSLSession negotiate() throws IOException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public SSLSession negotiate(SSLSocketFactory arg0) throws IOException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/**
+	 * Method to close our TlsResponse.
+	 */
+	public void close() throws IOException {
+		try {
+			super.finalize();
+		} catch (Throwable e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+}

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

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockUnsolicitedNotification.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockUnsolicitedNotification.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockUnsolicitedNotification.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockUnsolicitedNotification.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,129 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You 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. 
+ */ 
+/**
+ * @author Hugo Beilis
+ * @author Leonardo Soler
+ * @author Gabriel Miretti
+ * @version 1.0
+ */
+package org.apache.harmony.jndi.tests.javax.naming.spi.mock.ldap;
+
+import javax.naming.NamingException;
+import javax.naming.event.NamingExceptionEvent;
+import javax.naming.ldap.Control;
+import javax.naming.ldap.UnsolicitedNotification;
+import javax.naming.ldap.UnsolicitedNotificationEvent;
+import javax.naming.ldap.UnsolicitedNotificationListener;
+
+/**
+ * <p>Implementation of the interfaces UnsolicitedNotificationListener and UnsolicitedNotification. This class has the intention of
+ * give us a notifiction or a listener to test another classes.</p> 
+ *
+ */
+public class MockUnsolicitedNotification implements
+		UnsolicitedNotificationListener, UnsolicitedNotification {
+	/**
+	 * @serialField Serial of the class.
+	 */
+	private static final long serialVersionUID = 1L;
+	/**
+	 * <p>This flag has the intention of give us a way to know if a notification was recived.</p>
+	 */
+	private boolean flag;
+
+	/**
+	 * <p>Constructor method of this mock, here we call the inherit constructor and also we initialized the rest of fields.</p>
+	 *
+	 */
+	public MockUnsolicitedNotification() {
+		super();
+		flag=false;//Flag to know if a the notification was recived.
+		
+	}
+	/**
+	 * <p>Here we recived the notification, so we set the flag true.</p>
+	 */
+	public void notificationReceived(UnsolicitedNotificationEvent arg0) {
+		flag=true;
+
+	}
+
+	/**
+	 * <p>Method to see if the notitfication was recived.</p>
+	 * @return The flag of the notification.
+	 */
+	public boolean getFlag(){
+		return flag;
+	}
+	
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public void namingExceptionThrown(NamingExceptionEvent arg0) {
+		// TODO Auto-generated method stub
+
+	}
+
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public String[] getReferrals() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public NamingException getException() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public String getID() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	/**
+	 * <p>Method implemented for testing serialization on UnsolicitedNotificationEvent.</p>
+	 */
+	public long getIDSerial() {
+		// TODO Auto-generated method stub
+		return this.serialVersionUID;
+	}
+
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public byte[] getEncodedValue() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/**
+	 * <p>Method not implemented yet.</p>
+	 */
+	public Control[] getControls() throws NamingException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

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

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DNParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DNParser.java?view=diff&rev=507703&r1=507702&r2=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DNParser.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DNParser.java Wed Feb 14 13:42:41 2007
@@ -47,19 +47,21 @@
 public class DNParser {
 
     // length of distinguished name string
-    private final int length;
+    protected final int length;
+
+    protected int pos, beg, end;
 
     // tmp vars to store positions of the currently parsed item
-    private int pos, beg, end, cur;
+    protected int cur;
 
     // distinguished name chars
-    private char[] chars;
+    protected char[] chars;
 
     // raw string contains '"' or '\'
-    private boolean hasQE;
+    protected boolean hasQE;
 
     // DER encoding of currently parsed item
-    private byte[] encoded;
+    protected byte[] encoded;
 
     /**
      * Constructs DN parser
@@ -72,7 +74,7 @@
     }
 
     // gets next attribute type: (ALPHA 1*keychar) / oid
-    private String nextAT() throws IOException {
+    protected String nextAT() throws IOException {
 
         hasQE = false; // reset
 
@@ -135,7 +137,7 @@
     }
 
     // gets quoted attribute value: QUOTATION *( quotechar / pair ) QUOTATION 
-    private String quotedAV() throws IOException {
+    protected String quotedAV() throws IOException {
 
         pos++;
         beg = pos;
@@ -224,7 +226,7 @@
     }
 
     // gets string attribute value: *( stringchar / pair )
-    private String escapedAV() throws IOException {
+    protected String escapedAV() throws IOException {
 
         beg = pos;
         end = pos;
@@ -302,7 +304,7 @@
 
     // decodes UTF-8 char
     // see http://www.unicode.org for UTF-8 bit distribution table
-    private char getUTF8() throws IOException {
+    protected char getUTF8() throws IOException {
 
         int res = getByte(pos);
         pos++; //FIXME tmp
@@ -351,7 +353,7 @@
     // According to BNF syntax:
     // hexchar    = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
     //                    / "a" / "b" / "c" / "d" / "e" / "f"
-    private int getByte(int position) throws IOException {
+    protected int getByte(int position) throws IOException {
 
         if ((position + 1) >= length) {
             // to avoid ArrayIndexOutOfBoundsException



Mime
View raw message