directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r376623 [37/38] - in /directory/sandbox/akarasulu/rc1/apacheds: 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/src/main/java/org/...
Date Fri, 10 Feb 2006 10:49:57 GMT
Modified: directory/sandbox/akarasulu/rc1/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/GracefulShutdownCommand.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/GracefulShutdownCommand.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/GracefulShutdownCommand.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/GracefulShutdownCommand.java Fri Feb 10 02:48:07 2006
@@ -39,7 +39,7 @@
  */
 public class GracefulShutdownCommand extends ToolCommand
 {
-    public static final String PORT_RANGE = "(" + AvailablePortFinder.MIN_PORT_NUMBER + ", " 
+    public static final String PORT_RANGE = "(" + AvailablePortFinder.MIN_PORT_NUMBER + ", "
         + AvailablePortFinder.MAX_PORT_NUMBER + ")";
 
     private static final int DELAY_MAX = 86400;
@@ -52,7 +52,7 @@
     private int delay;
     private int timeOffline;
 
-    
+
     protected GracefulShutdownCommand()
     {
         super( "graceful" );
@@ -61,11 +61,13 @@
     private boolean isWaiting;
     private boolean isSuccess = false;
     private Thread executeThread = null;
+
+
     public void execute( CommandLine cmd ) throws Exception
     {
         executeThread = Thread.currentThread();
         processOptions( cmd );
-        
+
         if ( isDebugEnabled() )
         {
             System.out.println( "Parameters for GracefulShutdown extended request:" );
@@ -75,7 +77,7 @@
             System.out.println( "delay = " + delay );
             System.out.println( "timeOffline = " + timeOffline );
         }
-        
+
         Hashtable env = new Hashtable();
         env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
         env.put( "java.naming.provider.url", "ldap://" + host + ":" + port );
@@ -84,10 +86,10 @@
         env.put( "java.naming.security.authentication", "simple" );
 
         LdapContext ctx = new InitialLdapContext( env, null );
-        if ( ! isQuietEnabled() )
+        if ( !isQuietEnabled() )
         {
-            System.out.println( "Connection to the server established.\n"+
-                "Sending extended request and blocking for shutdown:" );
+            System.out.println( "Connection to the server established.\n"
+                + "Sending extended request and blocking for shutdown:" );
             isWaiting = true;
             Thread t = new Thread( new Ticker() );
             t.start();
@@ -97,7 +99,7 @@
             ctx.extendedOperation( new GracefulShutdownRequest( 0, timeOffline, delay ) );
             isSuccess = true;
         }
-        catch( Throwable t )
+        catch ( Throwable t )
         {
             isSuccess = false;
             System.err.print( "failed with error: " + t.getMessage() );
@@ -105,14 +107,14 @@
         isWaiting = false;
         ctx.close();
     }
-    
-    
+
     class Ticker implements Runnable
     {
         public void run()
         {
-            if ( ! isQuietEnabled() ) System.out.print( "[waiting for shutdown] " );
-            while( isWaiting )
+            if ( !isQuietEnabled() )
+                System.out.print( "[waiting for shutdown] " );
+            while ( isWaiting )
             {
                 try
                 {
@@ -123,11 +125,13 @@
                     // TODO Auto-generated catch block
                     e.printStackTrace();
                 }
-                if ( ! isQuietEnabled() ) System.out.print( "." );
+                if ( !isQuietEnabled() )
+                    System.out.print( "." );
             }
             if ( isSuccess )
             {
-                if ( ! isQuietEnabled() ) System.out.println( "\n[shutdown complete]" );
+                if ( !isQuietEnabled() )
+                    System.out.println( "\n[shutdown complete]" );
                 try
                 {
                     executeThread.join( 1000 );
@@ -140,7 +144,8 @@
             }
             else
             {
-                if ( ! isQuietEnabled() ) System.out.println( "\n[shutdown failed]" );
+                if ( !isQuietEnabled() )
+                    System.out.println( "\n[shutdown failed]" );
                 try
                 {
                     executeThread.join( 1000 );
@@ -161,12 +166,12 @@
         {
             System.out.println( "Processing options for graceful shutdown ..." );
         }
-        
+
         // -------------------------------------------------------------------
         // figure out and error check the port value
         // -------------------------------------------------------------------
 
-        if ( cmd.hasOption( 'p' ) )   // - user provided port w/ -p takes precedence
+        if ( cmd.hasOption( 'p' ) ) // - user provided port w/ -p takes precedence
         {
             String val = cmd.getOptionValue( 'p' );
             try
@@ -178,20 +183,20 @@
                 System.err.println( "port value of '" + val + "' is not a number" );
                 System.exit( 1 );
             }
-            
+
             if ( port > AvailablePortFinder.MAX_PORT_NUMBER )
             {
-                System.err.println( "port value of '" + val + "' is larger than max port number: " 
+                System.err.println( "port value of '" + val + "' is larger than max port number: "
                     + AvailablePortFinder.MAX_PORT_NUMBER );
                 System.exit( 1 );
             }
             else if ( port < AvailablePortFinder.MIN_PORT_NUMBER )
             {
-                System.err.println( "port value of '" + val + "' is smaller than the minimum port number: " 
+                System.err.println( "port value of '" + val + "' is smaller than the minimum port number: "
                     + AvailablePortFinder.MIN_PORT_NUMBER );
                 System.exit( 1 );
             }
-            
+
             if ( isDebugEnabled() )
             {
                 System.out.println( "port overriden by -p option: " + port );
@@ -200,7 +205,7 @@
         else if ( getConfiguration() != null )
         {
             port = getConfiguration().getLdapPort();
-            
+
             if ( isDebugEnabled() )
             {
                 System.out.println( "port overriden by server.xml configuration: " + port );
@@ -210,7 +215,7 @@
         {
             System.out.println( "port set to default: " + port );
         }
-        
+
         // -------------------------------------------------------------------
         // figure out the host value
         // -------------------------------------------------------------------
@@ -218,7 +223,7 @@
         if ( cmd.hasOption( 'h' ) )
         {
             host = cmd.getOptionValue( 'h' );
-            
+
             if ( isDebugEnabled() )
             {
                 System.out.println( "host overriden by -h option: " + host );
@@ -228,7 +233,7 @@
         {
             System.out.println( "host set to default: " + host );
         }
-        
+
         // -------------------------------------------------------------------
         // figure out the password value
         // -------------------------------------------------------------------
@@ -246,7 +251,7 @@
         {
             System.out.println( "password set to default: " + password );
         }
-        
+
         // -------------------------------------------------------------------
         // figure out the delay value
         // -------------------------------------------------------------------
@@ -263,11 +268,10 @@
                 System.err.println( "delay value of '" + val + "' is not a number" );
                 System.exit( 1 );
             }
-            
+
             if ( delay > DELAY_MAX )
             {
-                System.err.println( "delay value of '" + val 
-                    + "' is larger than max delay (seconds) allowed: " 
+                System.err.println( "delay value of '" + val + "' is larger than max delay (seconds) allowed: "
                     + DELAY_MAX );
                 System.exit( 1 );
             }
@@ -276,7 +280,7 @@
                 System.err.println( "delay value of '" + val + "' is less than zero and makes no sense" );
                 System.exit( 1 );
             }
-            
+
             if ( isDebugEnabled() )
             {
                 System.out.println( "delay seconds overriden by -e option: " + delay );
@@ -287,7 +291,6 @@
             System.out.println( "Using default delay value of " + delay );
         }
 
-    
         // -------------------------------------------------------------------
         // figure out the timeOffline value
         // -------------------------------------------------------------------
@@ -304,12 +307,11 @@
                 System.err.println( "timeOffline value of '" + val + "' is not a number" );
                 System.exit( 1 );
             }
-            
+
             if ( timeOffline > TIME_OFFLINE_MAX )
             {
-                System.err.println( "timeOffline value of '" + val 
-                    + "' is larger than max timeOffline (minutes) allowed: " 
-                    + TIME_OFFLINE_MAX );
+                System.err.println( "timeOffline value of '" + val
+                    + "' is larger than max timeOffline (minutes) allowed: " + TIME_OFFLINE_MAX );
                 System.exit( 1 );
             }
             else if ( timeOffline < 0 )
@@ -317,7 +319,7 @@
                 System.err.println( "timeOffline value of '" + val + "' is less than zero and makes no sense" );
                 System.exit( 1 );
             }
-            
+
             if ( isDebugEnabled() )
             {
                 System.out.println( "timeOffline seconds overriden by -t option: " + timeOffline );
@@ -336,7 +338,7 @@
         Option op = new Option( "h", "host", true, "server host: defaults to localhost" );
         op.setRequired( false );
         opts.addOption( op );
-        op = new Option(  "p", "port", true, "server port: defaults to 10389 or server.xml specified port" );
+        op = new Option( "p", "port", true, "server port: defaults to 10389 or server.xml specified port" );
         op.setRequired( false );
         opts.addOption( op );
         op = new Option( "e", "delay", true, "delay (seconds) before shutdown: defaults to 0" );
@@ -345,8 +347,7 @@
         op = new Option( "w", "password", true, "the apacheds administrator's password: defaults to secret" );
         op.setRequired( false );
         opts.addOption( op );
-        op = new Option( "t", "time-offline", true, 
-            "server offline time (minutes): defaults to 0 (indefinate)" );
+        op = new Option( "t", "time-offline", true, "server offline time (minutes): defaults to 0 (indefinate)" );
         op.setRequired( false );
         opts.addOption( op );
         op = new Option( "i", "install-path", true, "path to apacheds installation directory" );

Modified: directory/sandbox/akarasulu/rc1/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/ToolCommand.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/ToolCommand.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/ToolCommand.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/ToolCommand.java Fri Feb 10 02:48:07 2006
@@ -40,24 +40,26 @@
     private String version;
     private InstallationLayout layout;
     private ServerStartupConfiguration configuration;
-    
 
-    protected ToolCommand( String name )
+
+    protected ToolCommand(String name)
     {
         this.name = name;
     }
-    
-    
+
+
     public abstract void execute( CommandLine cmd ) throws Exception;
+
+
     public abstract Options getOptions();
 
-    
+
     public String getName()
     {
         return this.name;
     }
-    
-    
+
+
     public void setLayout( File installationDirectory )
     {
         this.layout = new InstallationLayout( installationDirectory );

Modified: directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java Fri Feb 10 02:48:07 2006
@@ -63,6 +63,7 @@
 
     protected int port = -1;
 
+
     /**
      * Get's the initial context factory for the provider's ou=system context
      * root.
@@ -152,7 +153,13 @@
         env.putAll( new ShutdownConfiguration().toJndiEnvironment() );
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
-        try { new InitialContext( env ); } catch( Exception e ) {}
+        try
+        {
+            new InitialContext( env );
+        }
+        catch ( Exception e )
+        {
+        }
 
         sysRoot = null;
         doDelete( configuration.getWorkingDirectory() );

Modified: directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/AddObjectClassesToEntryTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/AddObjectClassesToEntryTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/AddObjectClassesToEntryTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/AddObjectClassesToEntryTest.java Fri Feb 10 02:48:07 2006
@@ -75,7 +75,7 @@
      */
     public void tearDown() throws Exception
     {
-        ctx.unbind(RDN);
+        ctx.unbind( RDN );
         ctx.close();
         ctx = null;
         super.tearDown();
@@ -90,20 +90,20 @@
      */
     public void testSetUpTearDown() throws NamingException
     {
-        DirContext person = (DirContext) ctx.lookup(RDN);
-        assertNotNull(person);
+        DirContext person = ( DirContext ) ctx.lookup( RDN );
+        assertNotNull( person );
 
         // Check object classes
 
-        Attributes attributes = person.getAttributes("");
-        Attribute ocls = attributes.get("objectClass");
+        Attributes attributes = person.getAttributes( "" );
+        Attribute ocls = attributes.get( "objectClass" );
 
-        String[] expectedOcls = { "top", "person" };
+        String[] expectedOcls =
+            { "top", "person" };
         for ( int i = 0; i < expectedOcls.length; i++ )
         {
             String name = expectedOcls[i];
-            assertTrue( "object class " + name + " is NOT present when it should be!",
-                    ocls.contains( name ) );
+            assertTrue( "object class " + name + " is NOT present when it should be!", ocls.contains( name ) );
         }
     }
 
@@ -118,25 +118,25 @@
 
         // modify object classes, add two more
         Attributes attributes = new BasicAttributes( true );
-        Attribute ocls = new BasicAttribute("objectClass");
-        ocls.add("organizationalPerson");
-        ocls.add("inetOrgPerson");
-        attributes.put(ocls);
+        Attribute ocls = new BasicAttribute( "objectClass" );
+        ocls.add( "organizationalPerson" );
+        ocls.add( "inetOrgPerson" );
+        attributes.put( ocls );
 
-        DirContext person = (DirContext) ctx.lookup(RDN);
-        person.modifyAttributes("", DirContext.ADD_ATTRIBUTE, attributes);
+        DirContext person = ( DirContext ) ctx.lookup( RDN );
+        person.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, attributes );
 
         // Read again from directory
-        person = (DirContext) ctx.lookup(RDN);
-        attributes = person.getAttributes("");
-        Attribute newOcls = attributes.get("objectClass");
-
-        String[] expectedOcls = { "top", "person", "organizationalPerson",
-                "inetOrgPerson" };
-        for (int i = 0; i < expectedOcls.length; i++) {
+        person = ( DirContext ) ctx.lookup( RDN );
+        attributes = person.getAttributes( "" );
+        Attribute newOcls = attributes.get( "objectClass" );
+
+        String[] expectedOcls =
+            { "top", "person", "organizationalPerson", "inetOrgPerson" };
+        for ( int i = 0; i < expectedOcls.length; i++ )
+        {
             String name = expectedOcls[i];
-            assertTrue("object class " + name + " is present", newOcls
-                    .contains(name));
+            assertTrue( "object class " + name + " is present", newOcls.contains( name ) );
         }
     }
 
@@ -152,17 +152,17 @@
 
         // modify object classes, add two more
         Attributes attributes = new BasicAttributes( true );
-        Attribute desc = new BasicAttribute("description", newDescription);
-        attributes.put(desc);
+        Attribute desc = new BasicAttribute( "description", newDescription );
+        attributes.put( desc );
 
-        DirContext person = (DirContext) ctx.lookup(RDN);
-        person.modifyAttributes("", DirContext.REPLACE_ATTRIBUTE, attributes);
+        DirContext person = ( DirContext ) ctx.lookup( RDN );
+        person.modifyAttributes( "", DirContext.REPLACE_ATTRIBUTE, attributes );
 
         // Read again from directory
-        person = (DirContext) ctx.lookup(RDN);
-        attributes = person.getAttributes("");
-        Attribute newDesc = attributes.get("description");
+        person = ( DirContext ) ctx.lookup( RDN );
+        attributes = person.getAttributes( "" );
+        Attribute newDesc = attributes.get( "description" );
 
-        assertTrue("new Description", newDesc.contains(newDescription));
+        assertTrue( "new Description", newDesc.contains( newDescription ) );
     }
 }

Modified: directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/BadDnTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/BadDnTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/BadDnTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/BadDnTest.java Fri Feb 10 02:48:07 2006
@@ -72,17 +72,16 @@
      * Test with bindDn that is under a naming context but points to non-existant user.
      * @todo make this pass: see http://issues.apache.org/jira/browse/DIREVE-339
      */
-//    public void testBadBindDnMalformed() throws Exception
-//    {
-//        try
-//        {
-//            bind( "system", "blah" );
-//            fail( "should never get here due to a " );
-//        }
-//        catch ( InvalidNameException e ){}
-//    }
+    //    public void testBadBindDnMalformed() throws Exception
+    //    {
+    //        try
+    //        {
+    //            bind( "system", "blah" );
+    //            fail( "should never get here due to a " );
+    //        }
+    //        catch ( InvalidNameException e ){}
+    //    }
 
-    
     /**
      * Test with bindDn that is under a naming context but points to non-existant user.
      */

Modified: directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ChangeListener.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ChangeListener.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ChangeListener.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ChangeListener.java Fri Feb 10 02:48:07 2006
@@ -55,15 +55,16 @@
         control.setReturnECs( true );
         control.setCritical( true );
         control.setChangeTypes( PersistentSearchControl.ALL_CHANGES );
-        Control[] ctxCtls = new Control[] { control };
-        
+        Control[] ctxCtls = new Control[]
+            { control };
+
         try
         {
             Control[] respCtls;
             ctx.setRequestControls( ctxCtls );
             EntryChangeControl ecCtl = null;
             NamingEnumeration list = ctx.search( "", "objectClass=*", null );
-            while( list.hasMore() )
+            while ( list.hasMore() )
             {
                 SearchResult result = ( SearchResult ) list.next();
                 if ( result instanceof HasControls )
@@ -71,9 +72,9 @@
                     respCtls = ( ( HasControls ) result ).getControls();
                     if ( respCtls != null )
                     {
-                        for ( int ii = 0; ii < respCtls.length; ii ++ )
+                        for ( int ii = 0; ii < respCtls.length; ii++ )
                         {
-                            if ( respCtls[ii].getID().equals( 
+                            if ( respCtls[ii].getID().equals(
                                 org.apache.directory.shared.ldap.message.EntryChangeControl.CONTROL_OID ) )
                             {
                                 EntryChangeControlDecoder decoder = new EntryChangeControlDecoder();
@@ -82,7 +83,7 @@
                         }
                     }
                 }
-                
+
                 StringBuffer buf = new StringBuffer();
                 buf.append( "DN: " ).append( result.getName() ).append( "\n" );
                 if ( ecCtl != null )
@@ -93,38 +94,45 @@
                     buf.append( "        previousDN   : " ).append( ecCtl.getPreviousDn() ).append( "\n" );
                     buf.append( "        changeNumber : " ).append( ecCtl.getChangeNumber() ).append( "\n" );
                 }
-                
+
                 System.out.println( buf.toString() );
-                
+
                 if ( ecCtl != null )
                 {
                     System.out.println( "==============================================" );
                 }
             }
         }
-        catch( Exception e ) 
+        catch ( Exception e )
         {
             e.printStackTrace();
         }
     }
-    
-    
+
     static class ShutdownHook implements Runnable
     {
         final Context ctx;
-        
-        ShutdownHook( Context ctx )
+
+
+        ShutdownHook(Context ctx)
         {
             this.ctx = ctx;
         }
-        
+
+
         public void run()
         {
             if ( ctx != null )
             {
-                try { ctx.close(); } catch( Exception e ){ e.printStackTrace(); };
+                try
+                {
+                    ctx.close();
+                }
+                catch ( Exception e )
+                {
+                    e.printStackTrace();
+                };
             }
         }
     }
 }
-

Modified: directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/MatchingRuleCompareTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/MatchingRuleCompareTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/MatchingRuleCompareTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/MatchingRuleCompareTest.java Fri Feb 10 02:48:07 2006
@@ -15,6 +15,7 @@
  */
 package org.apache.directory.server;
 
+
 import java.util.Hashtable;
 
 import javax.naming.NamingEnumeration;
@@ -30,6 +31,7 @@
 
 import org.apache.directory.server.unit.AbstractServerTest;
 
+
 /**
  * Tests with compare operations on attributes which use different matching
  * rules. Created to demonstrate JIRA DIREVE-243 ("Compare operation does not
@@ -51,32 +53,35 @@
     public static final String GROUP_CN = "Artists";
     public static final String GROUP_RDN = "cn=" + GROUP_CN;
 
-    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;
     }
 
-    protected Attributes getGroupOfNamesAttributes(String cn, String member)
+
+    protected Attributes getGroupOfNamesAttributes( String cn, String member )
     {
         Attributes attributes = new BasicAttributes();
-        Attribute attribute = new BasicAttribute("objectClass");
-        attribute.add("top");
-        attribute.add("groupOfNames");
-        attributes.put(attribute);
-        attributes.put("cn", cn);
-        attributes.put("member", member);
+        Attribute attribute = new BasicAttribute( "objectClass" );
+        attribute.add( "top" );
+        attribute.add( "groupOfNames" );
+        attributes.put( attribute );
+        attributes.put( "cn", cn );
+        attributes.put( "member", member );
 
         return attributes;
     }
 
+
     /**
      * Create context, a person entry and a group.
      */
@@ -85,40 +90,42 @@
         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
-        Attributes attributes = this.getPersonAttributes(PERSON_SN, PERSON_CN);
-        attributes.put("telephoneNumber", PERSON_TELEPHONE);
-        attributes.put("userPassword", PERSON_PWD);
-        ctx.createSubcontext(PERSON_RDN, attributes);
+        Attributes attributes = this.getPersonAttributes( PERSON_SN, PERSON_CN );
+        attributes.put( "telephoneNumber", PERSON_TELEPHONE );
+        attributes.put( "userPassword", PERSON_PWD );
+        ctx.createSubcontext( PERSON_RDN, attributes );
 
         // Create a group
-        DirContext member = (DirContext) ctx.lookup(PERSON_RDN);
-        attributes = this.getGroupOfNamesAttributes(GROUP_CN, member.getNameInNamespace());
-        ctx.createSubcontext(GROUP_RDN, attributes);
+        DirContext member = ( DirContext ) ctx.lookup( PERSON_RDN );
+        attributes = this.getGroupOfNamesAttributes( GROUP_CN, member.getNameInNamespace() );
+        ctx.createSubcontext( GROUP_RDN, attributes );
     }
 
+
     /**
      * Remove entries and close context.
      */
     public void tearDown() throws Exception
     {
-        ctx.unbind(PERSON_RDN);
-        ctx.unbind(GROUP_RDN);
+        ctx.unbind( PERSON_RDN );
+        ctx.unbind( GROUP_RDN );
 
         ctx.close();
 
         super.tearDown();
     }
 
+
     /**
      * Compare with caseIgnoreMatch matching rule.
      * 
@@ -128,24 +135,30 @@
     {
         // Setting up search controls for compare op
         SearchControls ctls = new SearchControls();
-        ctls.setReturningAttributes(new String[] {}); // no attributes
-        ctls.setSearchScope(SearchControls.OBJECT_SCOPE);
-
-        String[] values = { PERSON_SN, PERSON_SN.toUpperCase(), PERSON_SN.toLowerCase(), PERSON_SN + "X" };
-        boolean[] expected = { true, true, true, false };
+        ctls.setReturningAttributes( new String[]
+            {} ); // no attributes
+        ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
+
+        String[] values =
+            { PERSON_SN, PERSON_SN.toUpperCase(), PERSON_SN.toLowerCase(), PERSON_SN + "X" };
+        boolean[] expected =
+            { true, true, true, false };
 
-        for (int i = 0; i < values.length; i++) {
+        for ( int i = 0; i < values.length; i++ )
+        {
             String value = values[i];
 
-            NamingEnumeration enumeration = ctx.search(PERSON_RDN, "sn={0}", new String[] { value }, ctls);
+            NamingEnumeration enumeration = ctx.search( PERSON_RDN, "sn={0}", new String[]
+                { value }, ctls );
             boolean result = enumeration.hasMore();
 
-            assertEquals("compare sn value '" + PERSON_SN + "' with '" + value + "'", expected[i], result);
+            assertEquals( "compare sn value '" + PERSON_SN + "' with '" + value + "'", expected[i], result );
 
             enumeration.close();
         }
     }
 
+
     //
 
     /**
@@ -154,31 +167,29 @@
      * @throws NamingException
      */
 
-// Comment this out until we have the telephone number match working.
-
-//    public void testTelephoneNumberMatch() throws NamingException
-//    {
-//        // Setting up search controls for compare op
-//        SearchControls ctls = new SearchControls();
-//        ctls.setReturningAttributes(new String[] {}); // no attributes
-//        ctls.setSearchScope(SearchControls.OBJECT_SCOPE);
-//
-//        String[] values = { "", "1234567890abc", "   1234567890 A B C", "123 456 7890 abc", "123-456-7890 abC",
-//                "123456-7890 A bc" };
-//        boolean[] expected = { false, true, true, true, true, true };
-//
-//        for (int i = 0; i < values.length; i++) {
-//            String value = values[i];
-//
-//            NamingEnumeration enumeration = ctx.search(PERSON_RDN, "telephoneNumber={0}", new String[] { value }, ctls);
-//            boolean result = enumeration.hasMore();
-//
-//            assertEquals("compare '" + PERSON_TELEPHONE + "' with '" + value + "'", expected[i], result);
-//
-//            enumeration.close();
-//        }
-//    }
-
+    // Comment this out until we have the telephone number match working.
+    //    public void testTelephoneNumberMatch() throws NamingException
+    //    {
+    //        // Setting up search controls for compare op
+    //        SearchControls ctls = new SearchControls();
+    //        ctls.setReturningAttributes(new String[] {}); // no attributes
+    //        ctls.setSearchScope(SearchControls.OBJECT_SCOPE);
+    //
+    //        String[] values = { "", "1234567890abc", "   1234567890 A B C", "123 456 7890 abc", "123-456-7890 abC",
+    //                "123456-7890 A bc" };
+    //        boolean[] expected = { false, true, true, true, true, true };
+    //
+    //        for (int i = 0; i < values.length; i++) {
+    //            String value = values[i];
+    //
+    //            NamingEnumeration enumeration = ctx.search(PERSON_RDN, "telephoneNumber={0}", new String[] { value }, ctls);
+    //            boolean result = enumeration.hasMore();
+    //
+    //            assertEquals("compare '" + PERSON_TELEPHONE + "' with '" + value + "'", expected[i], result);
+    //
+    //            enumeration.close();
+    //        }
+    //    }
     /**
      * Compare with octetStringMatch matching rule.
      * 
@@ -188,24 +199,30 @@
     {
         // Setting up search controls for compare op
         SearchControls ctls = new SearchControls();
-        ctls.setReturningAttributes(new String[] {}); // no attributes
-        ctls.setSearchScope(SearchControls.OBJECT_SCOPE);
-
-        String[] values = { "", PERSON_PWD, PERSON_PWD.toUpperCase(), PERSON_PWD.toLowerCase(), PERSON_PWD + "X" };
-        boolean[] expected = { false, true, false, false, false };
+        ctls.setReturningAttributes( new String[]
+            {} ); // no attributes
+        ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
+
+        String[] values =
+            { "", PERSON_PWD, PERSON_PWD.toUpperCase(), PERSON_PWD.toLowerCase(), PERSON_PWD + "X" };
+        boolean[] expected =
+            { false, true, false, false, false };
 
-        for (int i = 0; i < values.length; i++) {
+        for ( int i = 0; i < values.length; i++ )
+        {
             String value = values[i];
 
-            NamingEnumeration enumeration = ctx.search(PERSON_RDN, "userPassword={0}", new String[] { value }, ctls);
+            NamingEnumeration enumeration = ctx.search( PERSON_RDN, "userPassword={0}", new String[]
+                { value }, ctls );
             boolean result = enumeration.hasMore();
 
-            assertEquals("compare '" + PERSON_PWD + "' with '" + value + "'", expected[i], result);
+            assertEquals( "compare '" + PERSON_PWD + "' with '" + value + "'", expected[i], result );
 
             enumeration.close();
         }
     }
 
+
     /**
      * Compare with distinguishedNameMatch matching rule.
      * 
@@ -214,25 +231,29 @@
     public void testDistinguishedNameMatch() throws NamingException
     {
         // determine member DN of person
-        DirContext member = (DirContext) ctx.lookup(PERSON_RDN);
+        DirContext member = ( DirContext ) ctx.lookup( PERSON_RDN );
         String memberDN = member.getNameInNamespace();
 
         // Setting up search controls for compare op
         SearchControls ctls = new SearchControls();
-        ctls.setReturningAttributes(new String[] {}); // no attributes
-        ctls.setSearchScope(SearchControls.OBJECT_SCOPE);
-
-        String[] values = { "", memberDN, "cn=nobody", memberDN.toLowerCase(),
-                PERSON_RDN + " , " + ctx.getNameInNamespace() };
-        boolean[] expected = { false, true, false, true, true };
+        ctls.setReturningAttributes( new String[]
+            {} ); // no attributes
+        ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
+
+        String[] values =
+            { "", memberDN, "cn=nobody", memberDN.toLowerCase(), PERSON_RDN + " , " + ctx.getNameInNamespace() };
+        boolean[] expected =
+            { false, true, false, true, true };
 
-        for (int i = 0; i < values.length; i++) {
+        for ( int i = 0; i < values.length; i++ )
+        {
             String value = values[i];
 
-            NamingEnumeration enumeration = ctx.search(GROUP_RDN, "member={0}", new Object[] { value }, ctls);
+            NamingEnumeration enumeration = ctx.search( GROUP_RDN, "member={0}", new Object[]
+                { value }, ctls );
             boolean result = enumeration.hasMore();
 
-            assertEquals("compare '" + memberDN + "' with '" + value + "'", expected[i], result);
+            assertEquals( "compare '" + memberDN + "' with '" + value + "'", expected[i], result );
 
             enumeration.close();
         }

Modified: directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/MiscTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/MiscTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/MiscTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/MiscTest.java Fri Feb 10 02:48:07 2006
@@ -84,12 +84,12 @@
             partition.setIndexedAttributes( Collections.singleton( "dc" ) );
             partitions.add( partition );
             configuration.setContextPartitionConfigurations( partitions );
-	}
+        }
         else if ( this.getName().equals( "testAnonymousBindsEnabledBaseSearch" ) )
         {
             // allow anonymous access
             configuration.setAllowAnonymousAccess( true );
-            
+
             // create a partition to search
             Set partitions = new HashSet();
             partitions.addAll( configuration.getContextPartitionConfigurations() );
@@ -106,7 +106,6 @@
             partitions.add( partition );
             configuration.setContextPartitionConfigurations( partitions );
         }
- 
 
         super.setUp();
     }
@@ -129,18 +128,18 @@
         env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
 
         boolean connected = false;
-        while( ! connected )
+        while ( !connected )
         {
             try
             {
                 ic = new InitialDirContext( env );
                 connected = true;
             }
-            catch( Exception e )
+            catch ( Exception e )
             {
             }
         }
-        
+
         try
         {
             ic.search( "", "(objectClass=*)", new SearchControls() );
@@ -160,7 +159,7 @@
         {
             ic.createSubcontext( "ou=blah", attrs );
         }
-        catch( NoPermissionException e )
+        catch ( NoPermissionException e )
         {
         }
     }
@@ -198,6 +197,7 @@
         assertEquals( "", result.getName().trim() );
     }
 
+
     /**
      * Test to make sure that if anonymous binds are allowed a user may search 
      * within a a partition.
@@ -227,9 +227,10 @@
         list.close();
 
         assertNotNull( result );
-        assertNotNull( result.getAttributes().get("dc") );
+        assertNotNull( result.getAttributes().get( "dc" ) );
     }
 
+
     /**
      * Reproduces the problem with
      * <a href="http://issues.apache.org/jira/browse/DIREVE-239">DIREVE-239</a>.
@@ -243,7 +244,7 @@
         final Hashtable env = new Hashtable();
 
         env.put( Context.PROVIDER_URL, "ldap://localhost:" + port );
-        env.put("java.naming.ldap.version", "3");
+        env.put( "java.naming.ldap.version", "3" );
         env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
 
         Attributes attributes = new BasicAttributes();
@@ -256,7 +257,8 @@
         ctx.createSubcontext( "ou=blah,ou=system", attributes );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.OBJECT_SCOPE );
-        controls.setReturningAttributes( new String[] { "+" } );
+        controls.setReturningAttributes( new String[]
+            { "+" } );
         NamingEnumeration list = ctx.search( "ou=blah,ou=system", "(objectClass=*)", controls );
         SearchResult result = ( SearchResult ) list.next();
         list.close();
@@ -278,7 +280,7 @@
         final Hashtable env = new Hashtable();
 
         env.put( Context.PROVIDER_URL, "ldap://localhost:" + port + "/dc=aPache,dc=org" );
-        env.put("java.naming.ldap.version", "3");
+        env.put( "java.naming.ldap.version", "3" );
         env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
         InitialDirContext ctx = new InitialDirContext( env );
         Attributes attrs = ctx.getAttributes( "" );
@@ -332,8 +334,8 @@
         assertNotNull( e );
         assertFalse( e.getClass().equals( EmptyEnumeration.class ) );
     }
-    
-    
+
+
     public void testFailureWithUnsupportedControl() throws Exception
     {
         Control unsupported = new Control()
@@ -341,39 +343,47 @@
             boolean isCritical = true;
             private static final long serialVersionUID = 1L;
 
+
             public String getType()
             {
                 return "1.1.1.1";
             }
 
-            public void setType(String oid)
+
+            public void setType( String oid )
             {
             }
 
+
             public byte[] getValue()
             {
                 return new byte[0];
             }
 
-            public void setValue(byte[] value)
+
+            public void setValue( byte[] value )
             {
             }
 
+
             public boolean isCritical()
             {
                 return isCritical;
             }
 
-            public void setCritical(boolean isCritical)
+
+            public void setCritical( boolean isCritical )
             {
                 this.isCritical = isCritical;
             }
 
+
             public String getID()
             {
                 return "1.1.1.1";
             }
 
+
             public byte[] getEncodedValue()
             {
                 return new byte[0];
@@ -382,7 +392,7 @@
         final Hashtable env = new Hashtable();
 
         env.put( Context.PROVIDER_URL, "ldap://localhost:" + port + "/ou=system" );
-        env.put("java.naming.ldap.version", "3");
+        env.put( "java.naming.ldap.version", "3" );
         env.put( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
         env.put( Context.SECURITY_AUTHENTICATION, "simple" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
@@ -398,18 +408,21 @@
         user.put( oc );
         user.put( "sn", "Bush" );
         user.put( "userPassword", "Aerial" );
-        ctx.setRequestControls( new Control[] { unsupported } );
-        
+        ctx.setRequestControls( new Control[]
+            { unsupported } );
+
         try
         {
             ctx.createSubcontext( "cn=Kate Bush", user );
         }
-        catch( OperationNotSupportedException e ) {}
-        
+        catch ( OperationNotSupportedException e )
+        {
+        }
+
         unsupported.setCritical( false );
         DirContext kate = ctx.createSubcontext( "cn=Kate Bush", user );
         assertNotNull( kate );
-        assertTrue( ArrayUtils.isEquals( Asn1StringUtils.getBytesUtf8( "Aerial" ), 
-            kate.getAttributes( "" ).get( "userPassword" ).get() ) );
+        assertTrue( ArrayUtils.isEquals( Asn1StringUtils.getBytesUtf8( "Aerial" ), kate.getAttributes( "" ).get(
+            "userPassword" ).get() ) );
     }
 }

Modified: directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyAddTest.java Fri Feb 10 02:48:07 2006
@@ -15,6 +15,7 @@
  */
 package org.apache.directory.server;
 
+
 import java.util.Hashtable;
 
 import javax.naming.NamingException;
@@ -45,25 +46,25 @@
     private LdapContext ctx = null;
     public static final String RDN = "cn=Tori Amos";
     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.
      */
@@ -72,33 +73,35 @@
         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 );
 
     }
 
+
     /**
      * 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.
      * 
@@ -109,17 +112,18 @@
 
         // Add telephoneNumber attribute
         String newValue = "1234567890";
-        Attributes attrs = new BasicAttributes("telephoneNumber", newValue);
-        ctx.modifyAttributes(RDN, DirContext.ADD_ATTRIBUTE, attrs);
+        Attributes attrs = new BasicAttributes( "telephoneNumber", newValue );
+        ctx.modifyAttributes( RDN, DirContext.ADD_ATTRIBUTE, attrs );
 
         // Verify, that attribute value is added
-        attrs = ctx.getAttributes(RDN);
-        Attribute attr = attrs.get("telephoneNumber");
-        assertNotNull(attr);
-        assertTrue(attr.contains(newValue));
-        assertEquals(1, attr.size());
+        attrs = ctx.getAttributes( RDN );
+        Attribute attr = attrs.get( "telephoneNumber" );
+        assertNotNull( attr );
+        assertTrue( attr.contains( newValue ) );
+        assertEquals( 1, attr.size() );
     }
 
+
     /**
      * Add a new attribute with two values.
      * 
@@ -129,23 +133,25 @@
     {
 
         // Add telephoneNumber attribute
-        String[] newValues = { "1234567890", "999999999" };
-        Attribute attr = new BasicAttribute("telephoneNumber");
-        attr.add(newValues[0]);
-        attr.add(newValues[1]);
+        String[] newValues =
+            { "1234567890", "999999999" };
+        Attribute attr = new BasicAttribute( "telephoneNumber" );
+        attr.add( newValues[0] );
+        attr.add( newValues[1] );
         Attributes attrs = new BasicAttributes();
-        attrs.put(attr);
-        ctx.modifyAttributes(RDN, DirContext.ADD_ATTRIBUTE, attrs);
+        attrs.put( attr );
+        ctx.modifyAttributes( RDN, DirContext.ADD_ATTRIBUTE, attrs );
 
         // Verify, that attribute values are present
-        attrs = ctx.getAttributes(RDN);
-        attr = attrs.get("telephoneNumber");
-        assertNotNull(attr);
-        assertTrue(attr.contains(newValues[0]));
-        assertTrue(attr.contains(newValues[1]));
-        assertEquals(newValues.length, attr.size());
+        attrs = ctx.getAttributes( RDN );
+        attr = attrs.get( "telephoneNumber" );
+        assertNotNull( attr );
+        assertTrue( attr.contains( newValues[0] ) );
+        assertTrue( attr.contains( newValues[1] ) );
+        assertEquals( newValues.length, attr.size() );
     }
 
+
     /**
      * Add an additional value.
      * 
@@ -156,20 +162,21 @@
 
         // A new description attribute value
         String newValue = "A new description for this person";
-        assertFalse(newValue.equals(PERSON_DESCRIPTION));
-        Attributes attrs = new BasicAttributes("description", newValue);
+        assertFalse( newValue.equals( PERSON_DESCRIPTION ) );
+        Attributes attrs = new BasicAttributes( "description", newValue );
 
-        ctx.modifyAttributes(RDN, DirContext.ADD_ATTRIBUTE, attrs);
+        ctx.modifyAttributes( RDN, DirContext.ADD_ATTRIBUTE, attrs );
 
         // Verify, that attribute value is added
-        attrs = ctx.getAttributes(RDN);
-        Attribute attr = attrs.get("description");
-        assertNotNull(attr);
-        assertTrue(attr.contains(newValue));
-        assertTrue(attr.contains(PERSON_DESCRIPTION));
-        assertEquals(2, attr.size());
+        attrs = ctx.getAttributes( RDN );
+        Attribute attr = attrs.get( "description" );
+        assertNotNull( attr );
+        assertTrue( attr.contains( newValue ) );
+        assertTrue( attr.contains( PERSON_DESCRIPTION ) );
+        assertEquals( 2, attr.size() );
     }
 
+
     /**
      * Try to add an already existing attribute value.
      * 
@@ -184,25 +191,26 @@
     {
 
         // Change description attribute
-        Attributes attrs = new BasicAttributes("description", PERSON_DESCRIPTION);
+        Attributes attrs = new BasicAttributes( "description", PERSON_DESCRIPTION );
         try
         {
-            ctx.modifyAttributes(RDN, DirContext.ADD_ATTRIBUTE, attrs);
-            fail("Adding an already existing atribute value should fail.");
+            ctx.modifyAttributes( RDN, DirContext.ADD_ATTRIBUTE, attrs );
+            fail( "Adding an already existing atribute value should fail." );
         }
-        catch (AttributeInUseException e)
+        catch ( AttributeInUseException e )
         {
             // expected behaviour
         }
 
         // Verify, that attribute is still there, and is the only one
-        attrs = ctx.getAttributes(RDN);
-        Attribute attr = attrs.get("description");
-        assertNotNull(attr);
-        assertTrue(attr.contains(PERSON_DESCRIPTION));
-        assertEquals(1, attr.size());
+        attrs = ctx.getAttributes( RDN );
+        Attribute attr = attrs.get( "description" );
+        assertNotNull( attr );
+        assertTrue( attr.contains( PERSON_DESCRIPTION ) );
+        assertEquals( 1, attr.size() );
     }
 
+
     /**
      * Try to add a duplicate attribute value to an entry, where this attribute
      * is already present (objectclass in this case). Expected behaviour is that
@@ -214,23 +222,28 @@
     public void testAddDuplicateValueToExistingAttribute() throws NamingException
     {
         // modify object classes, add a new value twice
-        Attribute ocls = new BasicAttribute("objectClass", "organizationalPerson");
+        Attribute ocls = new BasicAttribute( "objectClass", "organizationalPerson" );
         ModificationItem[] modItems = new ModificationItem[2];
-        modItems[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, ocls);
-        modItems[1] = new ModificationItem(DirContext.ADD_ATTRIBUTE, ocls);
-        try {
-            ctx.modifyAttributes(RDN, modItems);
-            fail("Adding a duplicate attribute value should cause an error.");
-        } catch (AttributeInUseException ex) {}
+        modItems[0] = new ModificationItem( DirContext.ADD_ATTRIBUTE, ocls );
+        modItems[1] = new ModificationItem( DirContext.ADD_ATTRIBUTE, ocls );
+        try
+        {
+            ctx.modifyAttributes( RDN, modItems );
+            fail( "Adding a duplicate attribute value should cause an error." );
+        }
+        catch ( AttributeInUseException ex )
+        {
+        }
 
         // Check, whether attribute objectClass is unchanged
-        Attributes attrs = ctx.getAttributes(RDN);
-        ocls = attrs.get("objectClass");
-        assertEquals(ocls.size(), 2);
-        assertTrue(ocls.contains("top"));
-        assertTrue(ocls.contains("person"));
+        Attributes attrs = ctx.getAttributes( RDN );
+        ocls = attrs.get( "objectClass" );
+        assertEquals( ocls.size(), 2 );
+        assertTrue( ocls.contains( "top" ) );
+        assertTrue( ocls.contains( "person" ) );
     }
 
+
     /**
      * Try to add a duplicate attribute value to an entry, where this attribute
      * is not present. Expected behaviour is that the modify operation causes an
@@ -241,20 +254,25 @@
     public void testAddDuplicateValueToNewAttribute() throws NamingException
     {
         // add the same description value twice
-        Attribute desc = new BasicAttribute("description", "another description value besides songwriter");
+        Attribute desc = new BasicAttribute( "description", "another description value besides songwriter" );
         ModificationItem[] modItems = new ModificationItem[2];
-        modItems[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, desc);
-        modItems[1] = new ModificationItem(DirContext.ADD_ATTRIBUTE, desc);
-        try {
-            ctx.modifyAttributes(RDN, modItems);
-            fail("Adding a duplicate attribute value should cause an error.");
-        } catch (AttributeInUseException ex) {}
+        modItems[0] = new ModificationItem( DirContext.ADD_ATTRIBUTE, desc );
+        modItems[1] = new ModificationItem( DirContext.ADD_ATTRIBUTE, desc );
+        try
+        {
+            ctx.modifyAttributes( RDN, modItems );
+            fail( "Adding a duplicate attribute value should cause an error." );
+        }
+        catch ( AttributeInUseException ex )
+        {
+        }
 
         // Check, whether attribute description is still not present
-        Attributes attrs = ctx.getAttributes(RDN);
-        assertEquals( 1, attrs.get("description").size() );
+        Attributes attrs = ctx.getAttributes( RDN );
+        assertEquals( 1, attrs.get( "description" ).size() );
     }
-    
+
+
     /**
      * Create an entry with a bad attribute : this should fail.
      * 
@@ -263,32 +281,33 @@
     public void testAddUnexistingAttribute() 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");
-
-        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" );
+
+        ctx = new InitialLdapContext( env, null );
+        assertNotNull( ctx );
+
         // Create a third person with a voice attribute
-        Attributes attributes = this.getPersonAttributes("Jackson", "Michael Jackson");
-        attributes.put("voice", "He is bad ...");
-        
+        Attributes attributes = this.getPersonAttributes( "Jackson", "Michael Jackson" );
+        attributes.put( "voice", "He is bad ..." );
+
         try
         {
-        ctx.createSubcontext( "cn=Mickael Jackson", attributes);
+            ctx.createSubcontext( "cn=Mickael Jackson", attributes );
         }
-        catch ( InvalidAttributeIdentifierException iaie)
+        catch ( InvalidAttributeIdentifierException iaie )
         {
             assertTrue( true );
             return;
         }
-        
+
         fail( "Should never reach this point" );
     }
 
+
     /**
      * Modu=ify the entry with a bad attribute : this should fail 
      * 
@@ -299,18 +318,18 @@
         // Add a not existing attribute
         String newValue = "unbelievable";
         Attributes attrs = new BasicAttributes( "voice", newValue );
-        
+
         try
         {
             ctx.modifyAttributes( RDN, DirContext.ADD_ATTRIBUTE, attrs );
         }
-        catch (InvalidAttributeIdentifierException iaie )
+        catch ( InvalidAttributeIdentifierException iaie )
         {
             // We have a failure : the attribute is unknown in the schema
             assertTrue( true );
             return;
         }
-        
+
         fail( "Cannot reach this point" );
     }
 }

Modified: directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java Fri Feb 10 02:48:07 2006
@@ -16,6 +16,7 @@
  */
 package org.apache.directory.server;
 
+
 import java.util.Hashtable;
 
 import javax.naming.NameNotFoundException;
@@ -43,23 +44,25 @@
 
     private LdapContext ctx = null;
 
+
     /**
      * 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;
     }
 
+
     /**
      * Create context
      */
@@ -68,15 +71,16 @@
         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");
-        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" );
+        ctx = new InitialLdapContext( env, null );
+        assertNotNull( ctx );
     }
 
+
     /**
      * Close context
      */
@@ -88,14 +92,16 @@
         super.tearDown();
     }
 
+
     /**
      * Just a little test to check wether opening the connection succeeds.
      */
     public void testSetUpTearDown() throws NamingException
     {
-        assertNotNull(ctx);
+        assertNotNull( ctx );
     }
 
+
     /**
      * Modify Rdn of an entry, delete its old rdn value.
      * 
@@ -106,38 +112,42 @@
         // Create a person, cn value is rdn
         String oldCn = "Myra Ellen Amos";
         String oldRdn = "cn=" + oldCn;
-        Attributes attributes = this.getPersonAttributes("Amos", oldCn);
-        ctx.createSubcontext(oldRdn, attributes);
+        Attributes attributes = this.getPersonAttributes( "Amos", oldCn );
+        ctx.createSubcontext( oldRdn, attributes );
 
         // modify Rdn
         String newCn = "Tori Amos";
         String newRdn = "cn=" + newCn;
-        ctx.addToEnvironment("java.naming.ldap.deleteRDN", "true");
-        ctx.rename(oldRdn, newRdn);
+        ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "true" );
+        ctx.rename( oldRdn, newRdn );
 
         // Check, whether old Entry does not exists
-        try {
-            ctx.lookup(oldRdn);
-            fail("Entry must not exist");
-        } catch (NameNotFoundException ignored) {
+        try
+        {
+            ctx.lookup( oldRdn );
+            fail( "Entry must not exist" );
+        }
+        catch ( NameNotFoundException ignored )
+        {
             // expected behaviour
-            assertTrue(true);
+            assertTrue( true );
         }
 
         // Check, whether new Entry exists
-        DirContext tori = (DirContext) ctx.lookup(newRdn);
-        assertNotNull(tori);
+        DirContext tori = ( DirContext ) ctx.lookup( newRdn );
+        assertNotNull( tori );
 
         // Check values of cn
-        Attribute cn = tori.getAttributes("").get("cn");
-        assertTrue(cn.contains(newCn));
-        assertTrue(!cn.contains(oldCn)); // old value is gone
-        assertEquals(1, cn.size());
+        Attribute cn = tori.getAttributes( "" ).get( "cn" );
+        assertTrue( cn.contains( newCn ) );
+        assertTrue( !cn.contains( oldCn ) ); // old value is gone
+        assertEquals( 1, cn.size() );
 
         // Remove entry (use new rdn)
-        ctx.unbind(newRdn);
+        ctx.unbind( newRdn );
     }
 
+
     /**
      * Modify Rdn of an entry, keep its old rdn value.
      * 
@@ -148,38 +158,42 @@
         // Create a person, cn value is rdn
         String oldCn = "Myra Ellen Amos";
         String oldRdn = "cn=" + oldCn;
-        Attributes attributes = this.getPersonAttributes("Amos", oldCn);
-        ctx.createSubcontext(oldRdn, attributes);
+        Attributes attributes = this.getPersonAttributes( "Amos", oldCn );
+        ctx.createSubcontext( oldRdn, attributes );
 
         // modify Rdn
         String newCn = "Tori Amos";
         String newRdn = "cn=" + newCn;
-        ctx.addToEnvironment("java.naming.ldap.deleteRDN", "false");
-        ctx.rename(oldRdn, newRdn);
+        ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "false" );
+        ctx.rename( oldRdn, newRdn );
 
         // Check, whether old entry does not exist
-        try {
-            ctx.lookup(oldRdn);
-            fail("Entry must not exist");
-        } catch (NameNotFoundException ignored) {
+        try
+        {
+            ctx.lookup( oldRdn );
+            fail( "Entry must not exist" );
+        }
+        catch ( NameNotFoundException ignored )
+        {
             // expected behaviour
-            assertTrue(true);
+            assertTrue( true );
         }
 
         // Check, whether new entry exists
-        DirContext tori = (DirContext) ctx.lookup(newRdn);
-        assertNotNull(tori);
+        DirContext tori = ( DirContext ) ctx.lookup( newRdn );
+        assertNotNull( tori );
 
         // Check values of cn
-        Attribute cn = tori.getAttributes("").get("cn");
-        assertTrue(cn.contains(newCn));
-        assertTrue(cn.contains(oldCn)); // old value is still there
-        assertEquals(2, cn.size());
+        Attribute cn = tori.getAttributes( "" ).get( "cn" );
+        assertTrue( cn.contains( newCn ) );
+        assertTrue( cn.contains( oldCn ) ); // old value is still there
+        assertEquals( 2, cn.size() );
 
         // Remove entry (use new rdn)
-        ctx.unbind(newRdn);
+        ctx.unbind( newRdn );
     }
 
+
     /**
      * Modify Rdn of an entry, delete its old rdn value. Here, the rdn attribute
      * cn has another value as well.
@@ -191,87 +205,95 @@
         // Create a person, cn value is rdn
         String oldCn = "Myra Ellen Amos";
         String oldRdn = "cn=" + oldCn;
-        Attributes attributes = this.getPersonAttributes("Amos", oldCn);
+        Attributes attributes = this.getPersonAttributes( "Amos", oldCn );
 
         // add a second cn value
         String alternateCn = "Myra E. Amos";
-        Attribute cn = attributes.get("cn");
-        cn.add(alternateCn);
-        assertEquals(2, cn.size());
+        Attribute cn = attributes.get( "cn" );
+        cn.add( alternateCn );
+        assertEquals( 2, cn.size() );
 
-        ctx.createSubcontext(oldRdn, attributes);
+        ctx.createSubcontext( oldRdn, attributes );
 
         // modify Rdn
         String newCn = "Tori Amos";
         String newRdn = "cn=" + newCn;
-        ctx.addToEnvironment("java.naming.ldap.deleteRDN", "true");
-        ctx.rename(oldRdn, newRdn);
+        ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "true" );
+        ctx.rename( oldRdn, newRdn );
 
         // Check, whether old Entry does not exist anymore
-        try {
-            ctx.lookup(oldRdn);
-            fail("Entry must not exist");
-        } catch (NameNotFoundException ignored) {
+        try
+        {
+            ctx.lookup( oldRdn );
+            fail( "Entry must not exist" );
+        }
+        catch ( NameNotFoundException ignored )
+        {
             // expected behaviour
-            assertTrue(true);
+            assertTrue( true );
         }
 
         // Check, whether new Entry exists
-        DirContext tori = (DirContext) ctx.lookup(newRdn);
-        assertNotNull(tori);
+        DirContext tori = ( DirContext ) ctx.lookup( newRdn );
+        assertNotNull( tori );
 
         // Check values of cn
-        cn = tori.getAttributes("").get("cn");
-        assertTrue(cn.contains(newCn));
-        assertTrue(!cn.contains(oldCn)); // old value is gone
-        assertTrue(cn.contains(alternateCn)); // alternate value is still available
-        assertEquals(2, cn.size());
+        cn = tori.getAttributes( "" ).get( "cn" );
+        assertTrue( cn.contains( newCn ) );
+        assertTrue( !cn.contains( oldCn ) ); // old value is gone
+        assertTrue( cn.contains( alternateCn ) ); // alternate value is still available
+        assertEquals( 2, cn.size() );
 
         // Remove entry (use new rdn)
-        ctx.unbind(newRdn);
+        ctx.unbind( newRdn );
     }
-    
+
+
     /**
      * Modify DN of an entry, changing RDN from cn to sn.
      * 
      * @throws NamingException
      */
-    public void testModifyRdnDifferentAttribute() throws NamingException {
+    public void testModifyRdnDifferentAttribute() throws NamingException
+    {
 
         // Create a person, cn value is rdn
         String cnVal = "Tori Amos";
         String snVal = "Amos";
         String oldRdn = "cn=" + cnVal;
-        Attributes attributes = this.getPersonAttributes(snVal, cnVal);
-        ctx.createSubcontext(oldRdn, attributes);
+        Attributes attributes = this.getPersonAttributes( snVal, cnVal );
+        ctx.createSubcontext( oldRdn, attributes );
 
         // modify Rdn from cn=... to sn=...
         String newRdn = "sn=" + snVal;
-        ctx.addToEnvironment("java.naming.ldap.deleteRDN", "false");
-        ctx.rename(oldRdn, newRdn);
+        ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "false" );
+        ctx.rename( oldRdn, newRdn );
 
         // Check, whether old Entry does not exists
-        try {
-            ctx.lookup(oldRdn);
-            fail("Entry must not exist");
-        } catch (NameNotFoundException ignored) {
+        try
+        {
+            ctx.lookup( oldRdn );
+            fail( "Entry must not exist" );
+        }
+        catch ( NameNotFoundException ignored )
+        {
             // expected behaviour
         }
 
         // Check, whether new Entry exists
-        DirContext tori = (DirContext) ctx.lookup(newRdn);
-        assertNotNull(tori);
+        DirContext tori = ( DirContext ) ctx.lookup( newRdn );
+        assertNotNull( tori );
 
         // Check values of cn and sn
         // especially the number of cn and sn occurences
-        Attribute cn = tori.getAttributes("").get("cn");
-        assertTrue(cn.contains(cnVal));
-        assertEquals("Number of cn occurences", 1, cn.size());
-        Attribute sn = tori.getAttributes("").get("sn");
-        assertTrue(sn.contains(snVal));
-        assertEquals("Number of sn occurences", 1, sn.size());
-        
+        Attribute cn = tori.getAttributes( "" ).get( "cn" );
+        assertTrue( cn.contains( cnVal ) );
+        assertEquals( "Number of cn occurences", 1, cn.size() );
+        Attribute sn = tori.getAttributes( "" ).get( "sn" );
+        assertTrue( sn.contains( snVal ) );
+        assertEquals( "Number of sn occurences", 1, sn.size() );
+
         // Remove entry (use new rdn)
-        ctx.unbind(newRdn);
+        ctx.unbind( newRdn );
     }
 }

Modified: directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRemoveTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRemoveTest.java?rev=376623&r1=376622&r2=376623&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRemoveTest.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRemoveTest.java Fri Feb 10 02:48:07 2006
@@ -15,6 +15,7 @@
  */
 package org.apache.directory.server;
 
+
 import java.util.Hashtable;
 
 import javax.naming.NamingException;
@@ -46,22 +47,24 @@
 
     public static final String RDN = "cn=Tori Amos";
 
+
     /**
      * 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.
      */
@@ -70,44 +73,47 @@
         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 );
 
     }
 
+
     /**
      * Remove person entry and close context.
      */
     public void tearDown() throws Exception
     {
-        ctx.unbind(RDN);
+        ctx.unbind( RDN );
         ctx.close();
         ctx = null;
         super.tearDown();
     }
 
+
     /**
      * Just a little test to check wether opening the connection and creation of
      * the person succeeds succeeds.
      */
     public void testSetUpTearDown() throws NamingException
     {
-        assertNotNull(ctx);
-        DirContext tori = (DirContext) ctx.lookup(RDN);
-        assertNotNull(tori);
+        assertNotNull( ctx );
+        DirContext tori = ( DirContext ) ctx.lookup( RDN );
+        assertNotNull( tori );
     }
 
+
     /**
      * Remove an attribute, which is not required.
      * 
@@ -119,17 +125,18 @@
     public void testRemoveNotRequiredAttribute() throws NamingException
     {
         // Remove description Attribute
-        Attribute attr = new BasicAttribute("description");
+        Attribute attr = new BasicAttribute( "description" );
         Attributes attrs = new BasicAttributes();
-        attrs.put(attr);
-        ctx.modifyAttributes(RDN, DirContext.REMOVE_ATTRIBUTE, attrs);
+        attrs.put( attr );
+        ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs );
 
         // Verify, that attribute is deleted
-        attrs = ctx.getAttributes(RDN);
-        attr = attrs.get("description");
-        assertNull(attr);
+        attrs = ctx.getAttributes( RDN );
+        attr = attrs.get( "description" );
+        assertNull( attr );
     }
 
+
     /**
      * Remove two not required attributes.
      * 
@@ -142,23 +149,24 @@
     {
 
         // add telephoneNumber to entry
-        Attributes tn = new BasicAttributes("telephoneNumber", "12345678");
-        ctx.modifyAttributes(RDN, DirContext.ADD_ATTRIBUTE, tn);
+        Attributes tn = new BasicAttributes( "telephoneNumber", "12345678" );
+        ctx.modifyAttributes( RDN, DirContext.ADD_ATTRIBUTE, tn );
 
         // Remove description and telephoneNumber to Attribute
         Attributes attrs = new BasicAttributes();
-        attrs.put(new BasicAttribute("description"));
-        attrs.put(new BasicAttribute("telephoneNumber"));
-        ctx.modifyAttributes(RDN, DirContext.REMOVE_ATTRIBUTE, attrs);
+        attrs.put( new BasicAttribute( "description" ) );
+        attrs.put( new BasicAttribute( "telephoneNumber" ) );
+        ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs );
 
         // Verify, that attributes are deleted
-        attrs = ctx.getAttributes(RDN);
-        assertNull(attrs.get("description"));
-        assertNull(attrs.get("telephoneNumber"));
-        assertNotNull(attrs.get("cn"));
-        assertNotNull(attrs.get("sn"));
+        attrs = ctx.getAttributes( RDN );
+        assertNull( attrs.get( "description" ) );
+        assertNull( attrs.get( "telephoneNumber" ) );
+        assertNotNull( attrs.get( "cn" ) );
+        assertNotNull( attrs.get( "sn" ) );
     }
 
+
     /**
      * Remove a required attribute. The sn attribute of the person entry is used
      * here.
@@ -171,18 +179,22 @@
     {
 
         // Remove sn attribute
-        Attribute attr = new BasicAttribute("sn");
+        Attribute attr = new BasicAttribute( "sn" );
         Attributes attrs = new BasicAttributes();
-        attrs.put(attr);
+        attrs.put( attr );
 
-        try {
-            ctx.modifyAttributes(RDN, DirContext.REMOVE_ATTRIBUTE, attrs);
-            fail("Deletion of required attribute should fail.");
-        } catch (SchemaViolationException e) {
+        try
+        {
+            ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs );
+            fail( "Deletion of required attribute should fail." );
+        }
+        catch ( SchemaViolationException e )
+        {
             // expected behaviour
         }
     }
 
+
     /**
      * Remove a required attribute from RDN.
      * 
@@ -194,18 +206,22 @@
     {
 
         // Remove sn attribute
-        Attribute attr = new BasicAttribute("cn");
+        Attribute attr = new BasicAttribute( "cn" );
         Attributes attrs = new BasicAttributes();
-        attrs.put(attr);
+        attrs.put( attr );
 
-        try {
-            ctx.modifyAttributes(RDN, DirContext.REMOVE_ATTRIBUTE, attrs);
-            fail("Deletion of RDN attribute should fail.");
-        } catch (SchemaViolationException e) {
+        try
+        {
+            ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs );
+            fail( "Deletion of RDN attribute should fail." );
+        }
+        catch ( SchemaViolationException e )
+        {
             // expected behaviour
         }
     }
 
+
     /**
      * Remove a not required attribute from RDN.
      * 
@@ -218,26 +234,30 @@
 
         // Change RDN to another attribute
         String newRdn = "description=an American singer-songwriter";
-        ctx.addToEnvironment("java.naming.ldap.deleteRDN", "false");
-        ctx.rename(RDN, newRdn);
+        ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "false" );
+        ctx.rename( RDN, newRdn );
 
         // Remove description, which is now RDN attribute
-        Attribute attr = new BasicAttribute("description");
+        Attribute attr = new BasicAttribute( "description" );
         Attributes attrs = new BasicAttributes();
-        attrs.put(attr);
+        attrs.put( attr );
 
-        try {
-            ctx.modifyAttributes(newRdn, DirContext.REMOVE_ATTRIBUTE, attrs);
-            fail("Deletion of RDN attribute should fail.");
-        } catch (SchemaViolationException e) {
+        try
+        {
+            ctx.modifyAttributes( newRdn, DirContext.REMOVE_ATTRIBUTE, attrs );
+            fail( "Deletion of RDN attribute should fail." );
+        }
+        catch ( SchemaViolationException e )
+        {
             // expected behaviour
         }
 
         // Change RDN back to original
-        ctx.addToEnvironment("java.naming.ldap.deleteRDN", "false");
-        ctx.rename(newRdn, RDN);
+        ctx.addToEnvironment( "java.naming.ldap.deleteRDN", "false" );
+        ctx.rename( newRdn, RDN );
     }
 
+
     /**
      * Remove a an attribute which is not present on the entry, but in the
      * schema.
@@ -250,18 +270,22 @@
     {
 
         // Remove telephoneNumber Attribute
-        Attribute attr = new BasicAttribute("telephoneNumber");
+        Attribute attr = new BasicAttribute( "telephoneNumber" );
         Attributes attrs = new BasicAttributes();
-        attrs.put(attr);
+        attrs.put( attr );
 
-        try {
-            ctx.modifyAttributes(RDN, DirContext.REMOVE_ATTRIBUTE, attrs);
-            fail("Deletion of attribute, which is not present in the entry, should fail.");
-        } catch (NoSuchAttributeException e) {
+        try
+        {
+            ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs );
+            fail( "Deletion of attribute, which is not present in the entry, should fail." );
+        }
+        catch ( NoSuchAttributeException e )
+        {
             // expected behaviour
         }
     }
 
+
     /**
      * Remove a an attribute which is not present in the schema.
      * 
@@ -273,16 +297,21 @@
     {
 
         // Remove phantasy attribute
-        Attribute attr = new BasicAttribute("XXX");
+        Attribute attr = new BasicAttribute( "XXX" );
         Attributes attrs = new BasicAttributes();
-        attrs.put(attr);
+        attrs.put( attr );
 
-        try {
-            ctx.modifyAttributes(RDN, DirContext.REMOVE_ATTRIBUTE, attrs);
-            fail("Deletion of an invalid attribute should fail.");
-        } catch (NoSuchAttributeException e) {
+        try
+        {
+            ctx.modifyAttributes( RDN, DirContext.REMOVE_ATTRIBUTE, attrs );
+            fail( "Deletion of an invalid attribute should fail." );
+        }
+        catch ( NoSuchAttributeException e )
+        {
             // expected behaviour
-        } catch (InvalidAttributeIdentifierException e) {
+        }
+        catch ( InvalidAttributeIdentifierException e )
+        {
             // expected behaviour
         }
     }



Mime
View raw message