directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r584311 - in /directory/apacheds/branches/bigbang/server-unit/src: main/java/org/apache/directory/server/unit/ test/java/org/apache/directory/server/
Date Fri, 12 Oct 2007 22:57:20 GMT
Author: djencks
Date: Fri Oct 12 15:56:24 2007
New Revision: 584311

URL: http://svn.apache.org/viewvc?rev=584311&view=rev
Log:
Fix a lot of the NPES

Modified:
    directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/MiscTest.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java

Modified: directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java?rev=584311&r1=584310&r2=584311&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
(original)
+++ directory/apacheds/branches/bigbang/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
Fri Oct 12 15:56:24 2007
@@ -237,12 +237,17 @@
         socketAcceptor = new SocketAcceptor( null );
         ldapServer = new LdapServer( socketAcceptor, directoryService );
         ldapServer.setIpPort( port );
+        configureLdapServer();
         ldapServer.start();
 
         setContexts( "uid=admin,ou=system", "secret" );
     }
 
     protected void configureDirectoryService()
+    {
+    }
+
+    protected void configureLdapServer()
     {
     }
 

Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java?rev=584311&r1=584310&r2=584311&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java
(original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java
Fri Oct 12 15:56:24 2007
@@ -61,12 +61,22 @@
      */
     public void setUp() throws Exception
     {
+        super.setUp();
+        super.loadTestLdif( true );
+        ctx = getWiredContext();
+        assertNotNull( ctx );
+    }
+
+
+    @Override
+    protected void configureDirectoryService()
+    {
         JdbmPartition systemCfg = new JdbmPartition();
         systemCfg.setId( "system" );
-        
+
         // @TODO need to make this configurable for the system partition
         systemCfg.setCacheSize( 500 );
-        
+
         systemCfg.setSuffix( PartitionNexus.SYSTEM_PARTITION_SUFFIX );
 
         // Add indexed attributes for system partition
@@ -95,15 +105,9 @@
             NamespaceTools.getRdnValue( "ou=system" ) );
         systemEntry.put( "uid", "testUid" );
         systemCfg.setContextEntry( systemEntry );
-        
+
         directoryService.setSystemPartition( systemCfg );
-        
-        super.setUp();
-        super.loadTestLdif( true );
-        ctx = getWiredContext();
-        assertNotNull( ctx );
     }
-
 
     /**
      * Closes context and destroys server.

Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/MiscTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/MiscTest.java?rev=584311&r1=584310&r2=584311&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/MiscTest.java
(original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/MiscTest.java
Fri Oct 12 15:56:24 2007
@@ -20,6 +20,22 @@
 package org.apache.directory.server;
 
 
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.NoPermissionException;
+import javax.naming.OperationNotSupportedException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import javax.naming.ldap.InitialLdapContext;
+
 import netscape.ldap.LDAPAttribute;
 import netscape.ldap.LDAPConnection;
 import netscape.ldap.LDAPException;
@@ -35,16 +51,6 @@
 import org.apache.directory.shared.ldap.util.ArrayUtils;
 import org.apache.directory.shared.ldap.util.EmptyEnumeration;
 
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.NoPermissionException;
-import javax.naming.OperationNotSupportedException;
-import javax.naming.directory.*;
-import javax.naming.ldap.InitialLdapContext;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Set;
-
 
 /**
  * A set of miscellanous tests.
@@ -70,15 +76,21 @@
     public void setUp() throws Exception
     {
         if ( this.getName().equals( "testDisableAnonymousBinds" ) ||
-             this.getName().equals( "testCompareWithoutAuthentication" ) )
+                this.getName().equals( "testCompareWithoutAuthentication" ) )
         {
             setAllowAnonymousAccess( false );
-        }
-        else if ( this.getName().equals( "testEnableAnonymousBindsOnRootDSE" ) )
+        } else if ( this.getName().equals( "testEnableAnonymousBindsOnRootDSE" ) )
         {
             setAllowAnonymousAccess( false );
         }
-        else if ( this.getName().equals( "testUserAuthOnMixedCaseSuffix" ) )
+        super.setUp();
+    }
+
+
+    @Override
+    protected void configureDirectoryService()
+    {
+        if ( this.getName().equals( "testUserAuthOnMixedCaseSuffix" ) )
         {
             Set<Partition> partitions = new HashSet<Partition>();
             partitions.addAll( directoryService.getPartitions() );
@@ -96,8 +108,7 @@
             partition.setIndexedAttributes( indexedAttributes );
             partitions.add( partition );
             directoryService.setPartitions( partitions );
-        }
-        else if ( this.getName().equals( "testAnonymousBindsEnabledBaseSearch" ) )
+        } else if ( this.getName().equals( "testAnonymousBindsEnabledBaseSearch" ) )
         {
             // allow anonymous access
             setAllowAnonymousAccess( true );
@@ -120,11 +131,8 @@
             partitions.add( partition );
             directoryService.setPartitions( partitions );
         }
-
-        super.setUp();
     }
 
-
     public void testCompareWithoutAuthentication() throws LDAPException
     {
         LDAPConnection conn = new LDAPConnection();
@@ -135,13 +143,13 @@
             conn.compare( "uid=admin,ou=system", attr );
             fail( "Compare success without authentication" );
         }
-        catch( LDAPException e )
+        catch ( LDAPException e )
         {
             assertEquals( "no permission exception", 50, e.getLDAPResultCode() );
         }
     }
-    
-    
+
+
     /**
      * Test to make sure anonymous binds are disabled when going through
      * the wire protocol.
@@ -230,7 +238,7 @@
 
 
     /**
-     * Test to make sure that if anonymous binds are allowed a user may search 
+     * Test to make sure that if anonymous binds are allowed a user may search
      * within a a partition.
      *
      * @throws Exception if anything goes wrong
@@ -289,7 +297,7 @@
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.OBJECT_SCOPE );
         controls.setReturningAttributes( new String[]
-            { "+" } );
+                {"+"} );
         NamingEnumeration list = ctx.search( "ou=blah,ou=system", "(objectClass=*)", controls
);
         SearchResult result = ( SearchResult ) list.next();
         list.close();
@@ -440,7 +448,7 @@
         user.put( "sn", "Bush" );
         user.put( "userPassword", "Aerial" );
         ctx.setRequestControls( new MutableControl[]
-            { unsupported } );
+                {unsupported} );
 
         try
         {
@@ -454,6 +462,6 @@
         DirContext kate = ctx.createSubcontext( "cn=Kate Bush", user );
         assertNotNull( kate );
         assertTrue( ArrayUtils.isEquals( Asn1StringUtils.getBytesUtf8( "Aerial" ), kate.getAttributes(
"" ).get(
-            "userPassword" ).get() ) );
+                "userPassword" ).get() ) );
     }
 }

Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java?rev=584311&r1=584310&r2=584311&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java
(original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java
Fri Oct 12 15:56:24 2007
@@ -65,22 +65,33 @@
      */
     public void setUp() throws Exception
     {
+        super.setUp();
+        loadedEntries = super.loadTestLdif( true );
+        ctx = getWiredContext();
+        assertNotNull( ctx );
+        assertEquals( 5, loadedEntries.size() );
+    }
+
+
+    @Override
+    protected void configureDirectoryService()
+    {
         if ( this.getName().indexOf( "Indexed" ) != -1 )
         {
             JdbmPartition system = new JdbmPartition();
             system.setId( "system" );
-            
+
             // @TODO need to make this configurable for the system partition
             system.setCacheSize( 500 );
-            
+
             system.setSuffix( PartitionNexus.SYSTEM_PARTITION_SUFFIX );
-    
+
             // Add indexed attributes for system partition
             Set<Index> indexedAttrs = new HashSet<Index>();
             indexedAttrs.add( new JdbmIndex( SchemaConstants.OBJECT_CLASS_AT ) );
             indexedAttrs.add( new JdbmIndex( SchemaConstants.OU_AT ) );
             system.setIndexedAttributes( indexedAttrs );
-    
+
             // Add context entry for system partition
             Attributes systemEntry = new AttributesImpl();
             Attribute objectClassAttr = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT
);
@@ -93,17 +104,10 @@
             systemEntry.put( NamespaceTools.getRdnAttribute( PartitionNexus.SYSTEM_PARTITION_SUFFIX
),
                 NamespaceTools.getRdnValue( PartitionNexus.SYSTEM_PARTITION_SUFFIX ) );
             system.setContextEntry( systemEntry );
-            
+
             directoryService.setSystemPartition( system );
         }
-        
-        super.setUp();
-        loadedEntries = super.loadTestLdif( true );
-        ctx = getWiredContext();
-        assertNotNull( ctx );
-        assertEquals( 5, loadedEntries.size() );
     }
-
 
     /**
      * Closes context and destroys server.

Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java?rev=584311&r1=584310&r2=584311&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java
(original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java
Fri Oct 12 15:56:24 2007
@@ -58,6 +58,28 @@
      */
     public void setUp() throws Exception
     {
+        super.setUp();
+
+        Hashtable<String, String> env = new Hashtable<String, String>();
+        env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
+        env.put( "java.naming.provider.url", "ldap://localhost:" + port + "/dc=example,dc=com"
);
+        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 InitialDirContext( env );
+
+        Attributes attrs = new AttributesImpl( true );
+        attrs = getOrgUnitAttributes( "users" );
+        DirContext users = ctx.createSubcontext( "ou=users", attrs );
+
+        attrs = getPersonAttributes( "Nelson", "Horatio Nelson", "hnelson", "secret" );
+        users.createSubcontext( "uid=hnelson", attrs );
+    }
+
+
+    @Override
+    protected void configureDirectoryService()
+    {
         setAllowAnonymousAccess( false );
         ldapServer.setSaslHost( "localhost" );
 
@@ -84,23 +106,7 @@
 
         partitions.add( partition );
         directoryService.setPartitions( partitions );
-        super.setUp();
-
-        Hashtable<String, String> env = new Hashtable<String, String>();
-        env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
-        env.put( "java.naming.provider.url", "ldap://localhost:" + port + "/dc=example,dc=com"
);
-        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 InitialDirContext( env );
-
-        attrs = getOrgUnitAttributes( "users" );
-        DirContext users = ctx.createSubcontext( "ou=users", attrs );
-
-        attrs = getPersonAttributes( "Nelson", "Horatio Nelson", "hnelson", "secret" );
-        users.createSubcontext( "uid=hnelson", attrs );
     }
-
 
     /**
      * Tear down.

Modified: directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java?rev=584311&r1=584310&r2=584311&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java
(original)
+++ directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java
Fri Oct 12 15:56:24 2007
@@ -50,12 +50,6 @@
     
     public void setUp() throws Exception
     {
-        /////////////////////////////////////////////////////////
-        // Enable the Stored Procedure Extended Operation Handler
-        /////////////////////////////////////////////////////////
-        Set<ExtendedOperationHandler> handlers = new HashSet<ExtendedOperationHandler>(
ldapServer.getExtendedOperationHandlers() );
-        handlers.add( new StoredProcedureExtendedOperationHandler() );
-        ldapServer.setExtendedOperationHandlers( handlers );
 
         super.setUp();
 
@@ -73,6 +67,17 @@
         spCtx = ( LdapContext ) ctx.createSubcontext( "ou=Stored Procedures", spContainer
);
     }
 
+
+    @Override
+    protected void configureLdapServer()
+    {
+        /////////////////////////////////////////////////////////
+        // Enable the Stored Procedure Extended Operation Handler
+        /////////////////////////////////////////////////////////
+        Set<ExtendedOperationHandler> handlers = new HashSet<ExtendedOperationHandler>(
ldapServer.getExtendedOperationHandlers() );
+        handlers.add( new StoredProcedureExtendedOperationHandler() );
+        ldapServer.setExtendedOperationHandlers( handlers );
+    }
 
     public void tearDown() throws Exception
     {



Mime
View raw message