You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/02/20 04:58:21 UTC

svn commit: r379013 [45/45] - in /directory/trunks/apacheds: ./ core-plugin/ core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/ core-shared/ core-shared/src/...

Modified: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/ReferralTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/ReferralTest.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/ReferralTest.java (original)
+++ directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/ReferralTest.java Sun Feb 19 19:57:02 2006
@@ -58,27 +58,27 @@
     /**
      * Create attributes for a person entry.
      */
-    protected Attributes getPersonAttributes(String sn, String cn)
+    protected Attributes getPersonAttributes( String sn, String cn )
     {
         Attributes attributes = new BasicAttributes();
-        Attribute attribute = new BasicAttribute("objectClass");
-        attribute.add("top");
-        attribute.add("person");
-        attributes.put(attribute);
-        attributes.put("cn", cn);
-        attributes.put("sn", sn);
-        attributes.put("description", cn + " is a person.");
+        Attribute attribute = new BasicAttribute( "objectClass" );
+        attribute.add( "top" );
+        attribute.add( "person" );
+        attributes.put( attribute );
+        attributes.put( "cn", cn );
+        attributes.put( "sn", sn );
+        attributes.put( "description", cn + " is a person." );
         return attributes;
     }
 
-    
+
     public void setUp() throws Exception
     {
         super.setUp();
         addReferralEntry();
     }
-    
-    
+
+
     public void tearDown() throws Exception
     {
         if ( td.refCtx != null )
@@ -86,36 +86,36 @@
             td.refCtx.close();
             td.rootCtx.close();
         }
-        
+
         super.tearDown();
     }
 
-    
+
     /**
      * Get's the root "ou=system" using the SUN JNDI provider on the embedded ApacheDS instance
      */
     private LdapContext getSystemRoot() throws NamingException
     {
         Hashtable env = new Hashtable();
-        env.put("java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory");
-        env.put("java.naming.provider.url", "ldap://localhost:" + port + "/ou=system" ); 
-        env.put("java.naming.security.principal", "uid=admin,ou=system" ); 
-        env.put("java.naming.security.credentials", "secret" );
-        env.put("java.naming.security.authentication", "simple");
-        LdapContext ctx = new InitialLdapContext(env, null);
-        assertNotNull(ctx);
+        env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
+        env.put( "java.naming.provider.url", "ldap://localhost:" + port + "/ou=system" );
+        env.put( "java.naming.security.principal", "uid=admin,ou=system" );
+        env.put( "java.naming.security.credentials", "secret" );
+        env.put( "java.naming.security.authentication", "simple" );
+        LdapContext ctx = new InitialLdapContext( env, null );
+        assertNotNull( ctx );
         return ctx;
     }
-    
-    
-    class TestData {
+
+    class TestData
+    {
         LdapContext rootCtx;
         Name ctxDn;
         LdapContext refCtx;
         List refs;
     }
-    
-    
+
+
     public void addReferralEntry() throws NamingException
     {
         String ref0 = "ldap://fermi:10389/ou=users,ou=system";
@@ -126,7 +126,7 @@
         // -------------------------------------------------------------------
         // Adds a referral entry regardless of referral handling settings
         // -------------------------------------------------------------------
-        
+
         // Add a referral entry ( should be fine with or without the control )
         Attributes referral = new BasicAttributes( "objectClass", "top", true );
         referral.get( "objectClass" ).add( "referral" );
@@ -138,13 +138,25 @@
 
         // Just in case if server is a remote server destroy remaing referral
         td.rootCtx.addToEnvironment( Context.REFERRAL, "ignore" );
-        try { td.rootCtx.destroySubcontext( "uid=akarasulu,ou=users" ); } catch( NameNotFoundException e ) {}
-        try { td.rootCtx.destroySubcontext( "ou=users" ); } catch( NameNotFoundException e ) {}
+        try
+        {
+            td.rootCtx.destroySubcontext( "uid=akarasulu,ou=users" );
+        }
+        catch ( NameNotFoundException e )
+        {
+        }
+        try
+        {
+            td.rootCtx.destroySubcontext( "ou=users" );
+        }
+        catch ( NameNotFoundException e )
+        {
+        }
         try
         {
             td.refCtx = ( LdapContext ) td.rootCtx.createSubcontext( "ou=users", referral );
         }
-        catch( NameAlreadyBoundException e )
+        catch ( NameAlreadyBoundException e )
         {
             td.refCtx = ( LdapContext ) td.rootCtx.lookup( "ou=users" );
         }
@@ -153,19 +165,18 @@
         assertTrue( referral.get( "objectClass" ).contains( "referral" ) );
     }
 
-    
+
     public void checkAncestorReferrals( ReferralException e ) throws Exception
     {
         assertEquals( "ldap://fermi:10389", e.getReferralInfo() );
         assertTrue( e.skipReferral() );
-        assertEquals( "ldap://hertz:10389/cn=alex karasulu,ou=apache,ou=users,dc=example,dc=com", 
-            e.getReferralInfo() );
+        assertEquals( "ldap://hertz:10389/cn=alex karasulu,ou=apache,ou=users,dc=example,dc=com", e.getReferralInfo() );
         assertTrue( e.skipReferral() );
         assertEquals( "ldap://maxwell:10389", e.getReferralInfo() );
         assertFalse( e.skipReferral() );
     }
 
-    
+
     public void checkParentReferrals( ReferralException e ) throws Exception
     {
         assertEquals( "ldap://fermi:10389", e.getReferralInfo() );
@@ -175,8 +186,8 @@
         assertEquals( "ldap://maxwell:10389", e.getReferralInfo() );
         assertFalse( e.skipReferral() );
     }
-    
-    
+
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for an add operation with the parent context being a referral.
@@ -196,18 +207,18 @@
         userEntry.put( "sn", "karasulu" );
         userEntry.put( "cn", "alex karasulu" );
 
-        try 
+        try
         {
             td.refCtx.createSubcontext( "cn=alex karasulu", userEntry );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkParentReferrals( e );
         }
     }
-    
-    
+
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for an add operation with an ancestor context being a referral.
@@ -227,18 +238,18 @@
         userEntry.put( "sn", "karasulu" );
         userEntry.put( "cn", "alex karasulu" );
 
-        try 
+        try
         {
             td.refCtx.createSubcontext( "cn=alex karasulu,ou=apache", userEntry );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkAncestorReferrals( e );
         }
     }
-    
-    
+
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for an delete operation with the parent context being a referral.
@@ -254,18 +265,18 @@
         // -------------------------------------------------------------------
 
         td.refCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
             td.refCtx.destroySubcontext( "cn=alex karasulu" );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkParentReferrals( e );
         }
     }
-    
-    
+
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a delete operation with an ancestor context being a referral.
@@ -281,18 +292,18 @@
         // -------------------------------------------------------------------
 
         td.refCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
             td.refCtx.destroySubcontext( "cn=alex karasulu,ou=apache" );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkAncestorReferrals( e );
         }
     }
-    
-    
+
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a modify operation with the parent context being a referral.
@@ -308,19 +319,19 @@
         // -------------------------------------------------------------------
 
         td.refCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
-            td.refCtx.modifyAttributes( "cn=alex karasulu", DirContext.ADD_ATTRIBUTE, 
-                new BasicAttributes( "description", "just some text", true ) );
+            td.refCtx.modifyAttributes( "cn=alex karasulu", DirContext.ADD_ATTRIBUTE, new BasicAttributes(
+                "description", "just some text", true ) );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkParentReferrals( e );
         }
     }
-    
-    
+
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a modify operation with an ancestor context being a referral.
@@ -336,19 +347,19 @@
         // -------------------------------------------------------------------
 
         td.refCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
-            td.refCtx.modifyAttributes( "cn=alex karasulu,ou=apache", DirContext.ADD_ATTRIBUTE, 
-                new BasicAttributes( "description", "just some text", true ) );
+            td.refCtx.modifyAttributes( "cn=alex karasulu,ou=apache", DirContext.ADD_ATTRIBUTE, new BasicAttributes(
+                "description", "just some text", true ) );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkAncestorReferrals( e );
         }
     }
-    
-    
+
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a modify operation with the parent context being a referral.
@@ -364,20 +375,20 @@
         // -------------------------------------------------------------------
 
         td.refCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
-            ModificationItem[] mods = new ModificationItem[] { new ModificationItem( 
-                DirContext.ADD_ATTRIBUTE, new BasicAttribute( "description", "just some text" ) ) };
+            ModificationItem[] mods = new ModificationItem[]
+                { new ModificationItem( DirContext.ADD_ATTRIBUTE, new BasicAttribute( "description", "just some text" ) ) };
             td.refCtx.modifyAttributes( "cn=alex karasulu", mods );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkParentReferrals( e );
         }
     }
-    
-    
+
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a modify operation with an ancestor context being a referral.
@@ -393,20 +404,20 @@
         // -------------------------------------------------------------------
 
         td.refCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
-            ModificationItem[] mods = new ModificationItem[] { new ModificationItem( 
-                DirContext.ADD_ATTRIBUTE, new BasicAttribute( "description", "just some text" ) ) };
+            ModificationItem[] mods = new ModificationItem[]
+                { new ModificationItem( DirContext.ADD_ATTRIBUTE, new BasicAttribute( "description", "just some text" ) ) };
             td.refCtx.modifyAttributes( "cn=alex karasulu,ou=apache", mods );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkAncestorReferrals( e );
         }
     }
 
-    
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a modify rdn interceptor operation (corresponds to a subset of the modify 
@@ -423,18 +434,18 @@
         // -------------------------------------------------------------------
 
         td.refCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
             td.refCtx.rename( "cn=alex karasulu", "cn=aok" );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkParentReferrals( e );
         }
     }
-    
-    
+
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a modify rdn interceptor operation (corresponds to a subset of the modify 
@@ -451,18 +462,18 @@
         // -------------------------------------------------------------------
 
         td.refCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
             td.refCtx.rename( "cn=alex karasulu,ou=apache", "cn=aok,ou=apache" );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkAncestorReferrals( e );
         }
     }
 
-    
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a move interceptor operation (corresponds to a subset of the modify 
@@ -479,21 +490,21 @@
         // -------------------------------------------------------------------
 
         td.refCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
             td.refCtx.rename( "cn=alex karasulu", "cn=alex karasulu,ou=groups" );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( PartialResultException e )
+        catch ( PartialResultException e )
         {
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkParentReferrals( e );
         }
     }
-    
-    
+
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a move interceptor operation (corresponds to a subset of the modify 
@@ -510,21 +521,21 @@
         // -------------------------------------------------------------------
 
         td.refCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
             td.refCtx.rename( "cn=alex karasulu,ou=apache", "cn=alex karasulu,ou=groups" );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( PartialResultException e )
+        catch ( PartialResultException e )
         {
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkAncestorReferrals( e );
         }
     }
 
-    
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a move interceptor operation (corresponds to a subset of the modify 
@@ -541,21 +552,21 @@
         // -------------------------------------------------------------------
 
         td.refCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
             td.refCtx.rename( "cn=alex karasulu", "cn=aok,ou=groups" );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( PartialResultException e )
+        catch ( PartialResultException e )
         {
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkParentReferrals( e );
         }
     }
-    
-    
+
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a move interceptor operation (corresponds to a subset of the modify 
@@ -572,21 +583,21 @@
         // -------------------------------------------------------------------
 
         td.refCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
             td.refCtx.rename( "cn=alex karasulu,ou=apache", "cn=aok,ou=groups" );
             fail( "Should fail here throwing a ReferralException" );
         }
-        catch( PartialResultException e )
+        catch ( PartialResultException e )
         {
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             checkAncestorReferrals( e );
         }
     }
 
-    
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a move interceptor operation (corresponds to a subset of the modify 
@@ -604,7 +615,7 @@
 
         createLocalUser();
         td.rootCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
             td.rootCtx.rename( "cn=akarasulu", "cn=akarasulu,ou=users" );
             fail( "Should fail here throwing a LdapNamingException with ResultCodeEnum = AFFECTSMULTIPLEDSAS" );
@@ -612,12 +623,12 @@
         // this should have a result code of 71 for affectsMultipleDSAs
         // however there is absolutely no way for us to tell if this is 
         // the case because of JNDI exception resolution issues with LDAP
-        catch( NamingException e )
+        catch ( NamingException e )
         {
         }
     }
-    
-    
+
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a move interceptor operation (corresponds to a subset of the modify 
@@ -635,7 +646,7 @@
 
         createDeepLocalUser();
         td.rootCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
             td.rootCtx.rename( "cn=akarasulu,ou=deep", "cn=akarasulu,ou=users" );
             fail( "Should fail here throwing a LdapNamingException with ResultCodeEnum = AFFECTSMULTIPLEDSAS" );
@@ -643,12 +654,12 @@
         // this should have a result code of 71 for affectsMultipleDSAs
         // however there is absolutely no way for us to tell if this is 
         // the case because of JNDI exception resolution issues with LDAP
-        catch( NamingException e )
+        catch ( NamingException e )
         {
         }
     }
 
-    
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a move interceptor operation (corresponds to a subset of the modify 
@@ -666,7 +677,7 @@
 
         createLocalUser();
         td.rootCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
             td.rootCtx.rename( "cn=akarasulu", "cn=aok,ou=users" );
             fail( "Should fail here throwing a LdapNamingException with ResultCodeEnum = AFFECTSMULTIPLEDSAS" );
@@ -674,12 +685,12 @@
         // this should have a result code of 71 for affectsMultipleDSAs
         // however there is absolutely no way for us to tell if this is 
         // the case because of JNDI exception resolution issues with LDAP
-        catch( NamingException e )
+        catch ( NamingException e )
         {
         }
     }
-    
-    
+
+
     /**
      * Checks for correct core behavoir when Context.REFERRAL is set to <b>throw</b>
      * for a move interceptor operation (corresponds to a subset of the modify 
@@ -697,7 +708,7 @@
 
         createDeepLocalUser();
         td.rootCtx.addToEnvironment( Context.REFERRAL, "throw" );
-        try 
+        try
         {
             td.rootCtx.rename( "cn=akarasulu,ou=deep", "cn=aok,ou=users" );
             fail( "Should fail here throwing a LdapNamingException with ResultCodeEnum = AFFECTSMULTIPLEDSAS" );
@@ -705,12 +716,12 @@
         // this should have a result code of 71 for affectsMultipleDSAs
         // however there is absolutely no way for us to tell if this is 
         // the case because of JNDI exception resolution issues with LDAP
-        catch( NamingException e )
+        catch ( NamingException e )
         {
         }
     }
-    
-    
+
+
     public void createLocalUser() throws Exception
     {
         LdapContext userCtx = null;
@@ -719,12 +730,18 @@
         referral.put( "cn", "akarasulu" );
         referral.put( "sn", "karasulu" );
 
-        try { td.rootCtx.destroySubcontext( "uid=akarasulu" ); } catch( NameNotFoundException e ) {}
+        try
+        {
+            td.rootCtx.destroySubcontext( "uid=akarasulu" );
+        }
+        catch ( NameNotFoundException e )
+        {
+        }
         try
         {
             userCtx = ( LdapContext ) td.rootCtx.createSubcontext( "cn=akarasulu", referral );
         }
-        catch( NameAlreadyBoundException e )
+        catch ( NameAlreadyBoundException e )
         {
             td.refCtx = ( LdapContext ) td.rootCtx.lookup( "cn=akarasulu" );
         }
@@ -732,8 +749,8 @@
         assertTrue( referral.get( "cn" ).contains( "akarasulu" ) );
         assertTrue( referral.get( "sn" ).contains( "karasulu" ) );
     }
-    
-    
+
+
     public void createDeepLocalUser() throws Exception
     {
         LdapContext userCtx = null;
@@ -742,14 +759,26 @@
         referral.put( "cn", "akarasulu" );
         referral.put( "sn", "karasulu" );
 
-        try { td.rootCtx.destroySubcontext( "uid=akarasulu,ou=deep" ); } catch( NameNotFoundException e ) {}
-        try { td.rootCtx.destroySubcontext( "ou=deep" ); } catch( NameNotFoundException e ) {}
+        try
+        {
+            td.rootCtx.destroySubcontext( "uid=akarasulu,ou=deep" );
+        }
+        catch ( NameNotFoundException e )
+        {
+        }
+        try
+        {
+            td.rootCtx.destroySubcontext( "ou=deep" );
+        }
+        catch ( NameNotFoundException e )
+        {
+        }
         try
         {
             td.rootCtx.createSubcontext( "ou=deep" );
             userCtx = ( LdapContext ) td.rootCtx.createSubcontext( "cn=akarasulu,ou=deep", referral );
         }
-        catch( NameAlreadyBoundException e )
+        catch ( NameAlreadyBoundException e )
         {
             td.refCtx = ( LdapContext ) td.rootCtx.lookup( "cn=akarasulu,ou=deep" );
         }
@@ -757,8 +786,8 @@
         assertTrue( referral.get( "cn" ).contains( "akarasulu" ) );
         assertTrue( referral.get( "sn" ).contains( "karasulu" ) );
     }
-    
-    
+
+
     public void testSearchBaseIsReferral() throws Exception
     {
         SearchControls controls = new SearchControls();
@@ -769,7 +798,7 @@
             td.rootCtx.search( "ou=users", "(objectClass=*)", controls );
             fail( "should never get here" );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             assertEquals( "ldap://fermi:10389/ou=users,ou=system??sub", e.getReferralInfo() );
             assertTrue( e.skipReferral() );
@@ -780,7 +809,7 @@
         }
     }
 
-    
+
     public void testSearchBaseParentIsReferral() throws Exception
     {
         SearchControls controls = new SearchControls();
@@ -790,7 +819,7 @@
         {
             td.refCtx.search( "cn=alex karasulu", "(objectClass=*)", controls );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             assertEquals( "ldap://fermi:10389/cn=alex karasulu,ou=users,ou=system??base", e.getReferralInfo() );
             assertTrue( e.skipReferral() );
@@ -801,7 +830,7 @@
         }
     }
 
-    
+
     public void testSearchBaseAncestorIsReferral() throws Exception
     {
         SearchControls controls = new SearchControls();
@@ -811,18 +840,20 @@
         {
             td.refCtx.search( "cn=alex karasulu,ou=apache", "(objectClass=*)", controls );
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             assertEquals( "ldap://fermi:10389/cn=alex karasulu,ou=apache,ou=users,ou=system??base", e.getReferralInfo() );
             assertTrue( e.skipReferral() );
-            assertEquals( "ldap://hertz:10389/cn=alex karasulu,ou=apache,ou=users,dc=example,dc=com??base", e.getReferralInfo() );
+            assertEquals( "ldap://hertz:10389/cn=alex karasulu,ou=apache,ou=users,dc=example,dc=com??base", e
+                .getReferralInfo() );
             assertTrue( e.skipReferral() );
-            assertEquals( "ldap://maxwell:10389/cn=alex karasulu,ou=apache,ou=users,ou=system??base", e.getReferralInfo() );
+            assertEquals( "ldap://maxwell:10389/cn=alex karasulu,ou=apache,ou=users,ou=system??base", e
+                .getReferralInfo() );
             assertFalse( e.skipReferral() );
         }
     }
 
-    
+
     public void testSearchContinuations() throws Exception
     {
         SearchControls controls = new SearchControls();
@@ -831,29 +862,29 @@
         Map results = new HashMap();
         while ( list.hasMore() )
         {
-            SearchResult result = ( SearchResult) list.next();
-            results.put ( result.getName(), result );
+            SearchResult result = ( SearchResult ) list.next();
+            results.put( result.getName(), result );
         }
-        
+
         assertNotNull( results.get( "ou=users" ) );
-        
+
         // -------------------------------------------------------------------
         // Now we will throw exceptions when searching for referrals 
         // -------------------------------------------------------------------
-        
+
         td.rootCtx.addToEnvironment( Context.REFERRAL, "throw" );
         list = td.rootCtx.search( "", "(objectClass=*)", controls );
         results = new HashMap();
-        
+
         try
         {
             while ( list.hasMore() )
             {
                 SearchResult result = ( SearchResult ) list.next();
-                results.put ( result.getName(), result );
+                results.put( result.getName(), result );
             }
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             assertEquals( "ldap://fermi:10389/ou=users,ou=system??sub", e.getReferralInfo() );
             assertTrue( e.skipReferral() );
@@ -862,24 +893,24 @@
             assertEquals( "ldap://maxwell:10389/ou=users,ou=system??sub", e.getReferralInfo() );
             assertFalse( e.skipReferral() );
         }
-        
+
         assertNull( results.get( "ou=users" ) );
 
         // try again but this time with single level scope
-        
+
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         list = td.rootCtx.search( "", "(objectClass=*)", controls );
         results = new HashMap();
-        
+
         try
         {
             while ( list.hasMore() )
             {
                 SearchResult result = ( SearchResult ) list.next();
-                results.put ( result.getName(), result );
+                results.put( result.getName(), result );
             }
         }
-        catch( ReferralException e )
+        catch ( ReferralException e )
         {
             assertEquals( "ldap://fermi:10389/ou=users,ou=system??base", e.getReferralInfo() );
             assertTrue( e.skipReferral() );
@@ -888,7 +919,7 @@
             assertEquals( "ldap://maxwell:10389/ou=users,ou=system??base", e.getReferralInfo() );
             assertFalse( e.skipReferral() );
         }
-        
+
         assertNull( results.get( "ou=users" ) );
     }
 }

Propchange: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/ReferralTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/ReferralTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java (original)
+++ directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java Sun Feb 19 19:57:02 2006
@@ -15,6 +15,7 @@
  */
 package org.apache.directory.server;
 
+
 import java.util.Hashtable;
 
 import javax.naming.NamingEnumeration;
@@ -44,25 +45,25 @@
     public static final String RDN = "cn=Tori Amos";
     public static final String RDN2 = "cn=Rolling-Stones";
     public static final String PERSON_DESCRIPTION = "an American singer-songwriter";
-    
-    
+
 
     /**
      * Creation of required attributes of a person entry.
      */
-    protected Attributes getPersonAttributes(String sn, String cn)
+    protected Attributes getPersonAttributes( String sn, String cn )
     {
         Attributes attributes = new BasicAttributes();
-        Attribute attribute = new BasicAttribute("objectClass");
-        attribute.add("top");
-        attribute.add("person");
-        attributes.put(attribute);
-        attributes.put("cn", cn);
-        attributes.put("sn", sn);
+        Attribute attribute = new BasicAttribute( "objectClass" );
+        attribute.add( "top" );
+        attribute.add( "person" );
+        attributes.put( attribute );
+        attributes.put( "cn", cn );
+        attributes.put( "sn", sn );
 
         return attributes;
     }
 
+
     /**
      * Create context and a person entry.
      */
@@ -71,37 +72,39 @@
         super.setUp();
 
         Hashtable env = new Hashtable();
-        env.put("java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory");
-        env.put("java.naming.provider.url", "ldap://localhost:" + port + "/ou=system");
-        env.put("java.naming.security.principal", "uid=admin,ou=system");
-        env.put("java.naming.security.credentials", "secret");
-        env.put("java.naming.security.authentication", "simple");
+        env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
+        env.put( "java.naming.provider.url", "ldap://localhost:" + port + "/ou=system" );
+        env.put( "java.naming.security.principal", "uid=admin,ou=system" );
+        env.put( "java.naming.security.credentials", "secret" );
+        env.put( "java.naming.security.authentication", "simple" );
 
-        ctx = new InitialLdapContext(env, null);
-        assertNotNull(ctx);
+        ctx = new InitialLdapContext( env, null );
+        assertNotNull( ctx );
 
         // Create a person with description
-        Attributes attributes = this.getPersonAttributes("Amos", "Tori Amos");
-        attributes.put("description", "an American singer-songwriter");
-        ctx.createSubcontext(RDN, attributes);
+        Attributes attributes = this.getPersonAttributes( "Amos", "Tori Amos" );
+        attributes.put( "description", "an American singer-songwriter" );
+        ctx.createSubcontext( RDN, attributes );
 
         // Create a second person with description
-        attributes = this.getPersonAttributes("Jagger", "Rolling-Stones");
-        attributes.put("description", "an English singer-songwriter");
-        ctx.createSubcontext(RDN2, attributes);
+        attributes = this.getPersonAttributes( "Jagger", "Rolling-Stones" );
+        attributes.put( "description", "an English singer-songwriter" );
+        ctx.createSubcontext( RDN2, attributes );
     }
 
+
     /**
      * Remove person entry and close context.
      */
     public void tearDown() throws Exception
     {
-        ctx.unbind(RDN);
+        ctx.unbind( RDN );
         ctx.close();
         ctx = null;
         super.tearDown();
     }
 
+
     /**
      * Add a new attribute to a person entry.
      * 
@@ -111,80 +114,81 @@
     {
         // Setting up search controls for compare op
         SearchControls ctls = new SearchControls();
-        ctls.setReturningAttributes(new String[] {"*"}); // no attributes
-        ctls.setSearchScope(SearchControls.OBJECT_SCOPE);
+        ctls.setReturningAttributes( new String[]
+            { "*" } ); // no attributes
+        ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
 
         // Search for all entries
-        NamingEnumeration results = ctx.search(RDN, "(cn=*)", ctls);
+        NamingEnumeration results = ctx.search( RDN, "(cn=*)", ctls );
         assertTrue( results.hasMore() );
 
-        results = ctx.search(RDN2, "(cn=*)", ctls);
+        results = ctx.search( RDN2, "(cn=*)", ctls );
         assertTrue( results.hasMore() );
-        
+
         // Search for all entries ending by Amos
-        results = ctx.search(RDN, "(cn=*Amos)", ctls);
+        results = ctx.search( RDN, "(cn=*Amos)", ctls );
         assertTrue( results.hasMore() );
 
-        results = ctx.search(RDN2, "(cn=*Amos)", ctls);
+        results = ctx.search( RDN2, "(cn=*Amos)", ctls );
         assertFalse( results.hasMore() );
 
         // Search for all entries ending by amos
-        results = ctx.search(RDN, "(cn=*amos)", ctls);
+        results = ctx.search( RDN, "(cn=*amos)", ctls );
         assertTrue( results.hasMore() );
 
-        results = ctx.search(RDN2, "(cn=*amos)", ctls);
+        results = ctx.search( RDN2, "(cn=*amos)", ctls );
         assertFalse( results.hasMore() );
 
         // Search for all entries starting by Tori
-        results = ctx.search(RDN, "(cn=Tori*)", ctls);
+        results = ctx.search( RDN, "(cn=Tori*)", ctls );
         assertTrue( results.hasMore() );
 
-        results = ctx.search(RDN2, "(cn=Tori*)", ctls);
+        results = ctx.search( RDN2, "(cn=Tori*)", ctls );
         assertFalse( results.hasMore() );
 
         // Search for all entries starting by tori
-        results = ctx.search(RDN, "(cn=tori*)", ctls);
+        results = ctx.search( RDN, "(cn=tori*)", ctls );
         assertTrue( results.hasMore() );
 
-        results = ctx.search(RDN2, "(cn=tori*)", ctls);
+        results = ctx.search( RDN2, "(cn=tori*)", ctls );
         assertFalse( results.hasMore() );
 
         // Search for all entries containing ori
-        results = ctx.search(RDN, "(cn=*ori*)", ctls);
+        results = ctx.search( RDN, "(cn=*ori*)", ctls );
         assertTrue( results.hasMore() );
 
-        results = ctx.search(RDN2, "(cn=*ori*)", ctls);
+        results = ctx.search( RDN2, "(cn=*ori*)", ctls );
         assertFalse( results.hasMore() );
 
         // Search for all entries containing o and i
-        results = ctx.search(RDN, "(cn=*o*i*)", ctls);
+        results = ctx.search( RDN, "(cn=*o*i*)", ctls );
         assertTrue( results.hasMore() );
 
-        results = ctx.search(RDN2, "(cn=*o*i*)", ctls);
+        results = ctx.search( RDN2, "(cn=*o*i*)", ctls );
         assertTrue( results.hasMore() );
 
         // Search for all entries containing o, space and o
-        results = ctx.search(RDN, "(cn=*o* *o*)", ctls);
+        results = ctx.search( RDN, "(cn=*o* *o*)", ctls );
         assertTrue( results.hasMore() );
 
-        results = ctx.search(RDN2, "(cn=*o* *o*)", ctls);
+        results = ctx.search( RDN2, "(cn=*o* *o*)", ctls );
         assertFalse( results.hasMore() );
 
-        results = ctx.search(RDN2, "(cn=*o*-*o*)", ctls);
+        results = ctx.search( RDN2, "(cn=*o*-*o*)", ctls );
         assertTrue( results.hasMore() );
 
         // Search for all entries starting by To and containing A
-        results = ctx.search(RDN, "(cn=To*A*)", ctls);
+        results = ctx.search( RDN, "(cn=To*A*)", ctls );
         assertTrue( results.hasMore() );
 
-        results = ctx.search(RDN2, "(cn=To*A*)", ctls);
+        results = ctx.search( RDN2, "(cn=To*A*)", ctls );
         assertFalse( results.hasMore() );
 
         // Search for all entries ending by os and containing ri
-        results = ctx.search(RDN, "(cn=*ri*os)", ctls);
+        results = ctx.search( RDN, "(cn=*ri*os)", ctls );
         assertTrue( results.hasMore() );
 
-        results = ctx.search(RDN2, "(cn=*ri*os)", ctls);
+        results = ctx.search( RDN2, "(cn=*ri*os)", ctls );
         assertFalse( results.hasMore() );
     }
 }

Propchange: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/UnknownExtendedOperationTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/UnknownExtendedOperationTest.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/UnknownExtendedOperationTest.java (original)
+++ directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/UnknownExtendedOperationTest.java Sun Feb 19 19:57:02 2006
@@ -16,6 +16,7 @@
  */
 package org.apache.directory.server;
 
+
 import java.util.Hashtable;
 
 import javax.naming.CommunicationException;
@@ -27,6 +28,7 @@
 
 import org.apache.directory.server.unit.AbstractServerTest;
 
+
 /**
  * Check the behaviour of the server for an unknown extended operation. Created
  * to demonstrate DIREVE-256 ("Extended operation causes client to hang.").
@@ -38,6 +40,7 @@
 {
     private LdapContext ctx = null;
 
+
     /**
      * Create context.
      */
@@ -46,16 +49,17 @@
         super.setUp();
 
         Hashtable env = new Hashtable();
-        env.put("java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory");
-        env.put("java.naming.provider.url", "ldap://localhost:" + port + "/ou=system");
-        env.put("java.naming.security.principal", "uid=admin,ou=system");
-        env.put("java.naming.security.credentials", "secret");
-        env.put("java.naming.security.authentication", "simple");
+        env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
+        env.put( "java.naming.provider.url", "ldap://localhost:" + port + "/ou=system" );
+        env.put( "java.naming.security.principal", "uid=admin,ou=system" );
+        env.put( "java.naming.security.credentials", "secret" );
+        env.put( "java.naming.security.authentication", "simple" );
 
-        ctx = new InitialLdapContext(env, null);
-        assertNotNull(ctx);
+        ctx = new InitialLdapContext( env, null );
+        assertNotNull( ctx );
     }
 
+
     /**
      * Close context.
      */
@@ -66,16 +70,20 @@
         super.tearDown();
     }
 
+
     /**
      * Calls an extended exception, which does not exist. Expected behaviour is
      * a CommunicationException.
      */
     public void testUnknownExtendedOperation() throws NamingException
     {
-        try {
-            ctx.extendedOperation(new UnknownExtendedOperationRequest());
-            fail("Calling an unknown extended operation should fail.");
-        } catch (CommunicationException ce) {
+        try
+        {
+            ctx.extendedOperation( new UnknownExtendedOperationRequest() );
+            fail( "Calling an unknown extended operation should fail." );
+        }
+        catch ( CommunicationException ce )
+        {
             // expected behaviour
         }
     }
@@ -88,18 +96,21 @@
 
         private static final long serialVersionUID = 1L;
 
+
         public String getID()
         {
             return "1.1"; // Never an OID for an extended operation
         }
 
+
         public byte[] getEncodedValue()
         {
             return null;
         }
 
-        public ExtendedResponse createExtendedResponse(String id, byte[] berValue, int offset, int length)
-                throws NamingException
+
+        public ExtendedResponse createExtendedResponse( String id, byte[] berValue, int offset, int length )
+            throws NamingException
         {
             return null;
         }

Propchange: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/UnknownExtendedOperationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/UnknownExtendedOperationTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java (original)
+++ directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java Sun Feb 19 19:57:02 2006
@@ -30,6 +30,7 @@
 import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 
+import org.apache.directory.server.core.configuration.ConfigurationException;
 import org.apache.directory.server.core.configuration.MutableDirectoryPartitionConfiguration;
 import org.apache.directory.server.core.unit.AbstractAdminTestCase;
 
@@ -46,6 +47,7 @@
     {
     }
 
+
     public void setUp() throws Exception
     {
         BasicAttributes attrs;
@@ -53,12 +55,12 @@
         Set pcfgs = new HashSet();
 
         MutableDirectoryPartitionConfiguration pcfg;
-        
+
         // Add partition 'testing'
         pcfg = new MutableDirectoryPartitionConfiguration();
         pcfg.setName( "testing" );
         pcfg.setSuffix( "ou=testing" );
-        
+
         indexedAttrs = new HashSet();
         indexedAttrs.add( "ou" );
         indexedAttrs.add( "objectClass" );
@@ -74,20 +76,20 @@
         attr.add( "testing" );
         attrs.put( attr );
         pcfg.setContextEntry( attrs );
-        
+
         pcfgs.add( pcfg );
-        
+
         // Add partition 'example'
         pcfg = new MutableDirectoryPartitionConfiguration();
         pcfg.setName( "example" );
         pcfg.setSuffix( "dc=example" );
-        
+
         indexedAttrs = new HashSet();
         indexedAttrs.add( "ou" );
         indexedAttrs.add( "dc" );
         indexedAttrs.add( "objectClass" );
         pcfg.setIndexedAttributes( indexedAttrs );
-        
+
         attrs = new BasicAttributes( true );
         attr = new BasicAttribute( "objectClass" );
         attr.add( "top" );
@@ -98,14 +100,14 @@
         attr.add( "example" );
         attrs.put( attr );
         pcfg.setContextEntry( attrs );
-        
+
         pcfgs.add( pcfg );
 
         // Add partition 'MixedCase'
         pcfg = new MutableDirectoryPartitionConfiguration();
         pcfg.setName( "mixedcase" );
         pcfg.setSuffix( "dc=MixedCase" );
-        
+
         indexedAttrs = new HashSet();
         indexedAttrs.add( "dc" );
         indexedAttrs.add( "objectClass" );
@@ -121,14 +123,15 @@
         attr.add( "MixedCase" );
         attrs.put( attr );
         pcfg.setContextEntry( attrs );
-        
+
         pcfgs.add( pcfg );
-        
+
         configuration.setContextPartitionConfigurations( pcfgs );
 
         super.setUp();
     }
 
+
     /**
      * Makes sure the system context has the right attributes and values.
      *
@@ -272,5 +275,26 @@
         assertTrue( attribute.contains( "top" ) );
 
         assertTrue( attribute.contains( "domain" ) );
+    }
+
+    public void testBadPartition() throws Exception
+    {
+        MutableDirectoryPartitionConfiguration pcfg;
+
+        // Add partition 'test=testing'
+        pcfg = new MutableDirectoryPartitionConfiguration();
+        pcfg.setName( "testing" );
+        
+        try
+        {
+            pcfg.setSuffix( "ou=test=testing" );
+        }
+        catch ( ConfigurationException ce )
+        {
+            assertTrue( true );
+            return;
+        }
+        
+        fail();
     }
 }

Propchange: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id