You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2005/03/24 07:32:53 UTC

svn commit: r158885 - in directory/apacheds/branches/interceptor_revamp/core/src: main/java/org/apache/ldap/server/jndi/ServerContextFactory.java test/org/apache/ldap/server/jndi/RootDSETest.java test/org/apache/ldap/server/jndi/SimpleAuthenticationTest.java

Author: akarasulu
Date: Wed Mar 23 22:32:51 2005
New Revision: 158885

URL: http://svn.apache.org/viewcvs?view=rev&rev=158885
Log:
changes ...

 o reapplied change for making minaRegistry etc static vars - this will surely
   cause a conflict when merging things back to the trunk
 o corrected tests that were bombing out because they could not bind to 389
   as non-admin users by using the AvailablePortFinder


Modified:
    directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java
    directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/RootDSETest.java
    directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/SimpleAuthenticationTest.java

Modified: directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java?view=diff&r1=158884&r2=158885
==============================================================================
--- directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java (original)
+++ directory/apacheds/branches/interceptor_revamp/core/src/main/java/org/apache/ldap/server/jndi/ServerContextFactory.java Wed Mar 23 22:32:51 2005
@@ -56,6 +56,10 @@
     
     private static final ServiceRegistry DEFAULT_MINA_REGISTRY;
     
+    private static Service minaService;
+
+    private static ServiceRegistry minaRegistry;
+
     static
     {
         ServiceRegistry tmp = null;
@@ -75,8 +79,6 @@
     // Members
     // ------------------------------------------------------------------------
 
-    private Service minaService;
-    private ServiceRegistry minaRegistry;
 
     /**
      * Default constructor that sets the provider of this ServerContextFactory.

Modified: directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/RootDSETest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/RootDSETest.java?view=diff&r1=158884&r2=158885
==============================================================================
--- directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/RootDSETest.java (original)
+++ directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/RootDSETest.java Wed Mar 23 22:32:51 2005
@@ -30,6 +30,7 @@
 import junit.framework.TestCase;
 import org.apache.commons.io.FileUtils;
 import org.apache.ldap.common.exception.LdapNoPermissionException;
+import org.apache.mina.util.AvailablePortFinder;
 
 
 /**
@@ -88,6 +89,11 @@
         env.put( EnvKeys.SHUTDOWN, "" );
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
+
+        int port = AvailablePortFinder.getNextAvailable( 1024 );
+
+        env.put( EnvKeys.LDAP_PORT, String.valueOf( port ) );
+
         try { new InitialContext( env ); } catch( Exception e ) {}
     }
 
@@ -106,6 +112,11 @@
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
         env.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() );
+
+        int port = AvailablePortFinder.getNextAvailable( 1024 );
+
+        env.put( EnvKeys.LDAP_PORT, String.valueOf( port ) );
+
         InitialContext initCtx = new InitialContext( env );
         assertNotNull( initCtx );
     }
@@ -125,6 +136,11 @@
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
         env.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() );
+
+        int port = AvailablePortFinder.getNextAvailable( 1024 );
+
+        env.put( EnvKeys.LDAP_PORT, String.valueOf( port ) );
+
         InitialContext initCtx = new InitialContext( env );
         assertNotNull( initCtx );
 
@@ -149,6 +165,11 @@
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
         env.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() );
+
+        int port = AvailablePortFinder.getNextAvailable( 1024 );
+
+        env.put( EnvKeys.LDAP_PORT, String.valueOf( port ) );
+
         InitialContext initCtx = new InitialContext( env );
         assertNotNull( initCtx );
 
@@ -173,6 +194,11 @@
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
         env.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() );
+
+        int port = AvailablePortFinder.getNextAvailable( 1024 );
+
+        env.put( EnvKeys.LDAP_PORT, String.valueOf( port ) );
+
         InitialContext initCtx = new InitialContext( env );
         assertNotNull( initCtx );
 
@@ -207,6 +233,11 @@
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
         env.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() );
+
+        int port = AvailablePortFinder.getNextAvailable( 1024 );
+
+        env.put( EnvKeys.LDAP_PORT, String.valueOf( port ) );
+
         InitialContext initCtx = new InitialContext( env );
         assertNotNull( initCtx );
 
@@ -241,6 +272,11 @@
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
         env.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() );
+
+        int port = AvailablePortFinder.getNextAvailable( 1024 );
+
+        env.put( EnvKeys.LDAP_PORT, String.valueOf( port ) );
+
         InitialContext initCtx = new InitialContext( env );
         assertNotNull( initCtx );
 
@@ -277,6 +313,11 @@
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
         env.put( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() );
+
+        int port = AvailablePortFinder.getNextAvailable( 1024 );
+
+        env.put( EnvKeys.LDAP_PORT, String.valueOf( port ) );
+
         InitialContext initCtx = new InitialContext( env );
         assertNotNull( initCtx );
 

Modified: directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/SimpleAuthenticationTest.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/SimpleAuthenticationTest.java?view=diff&r1=158884&r2=158885
==============================================================================
--- directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/SimpleAuthenticationTest.java (original)
+++ directory/apacheds/branches/interceptor_revamp/core/src/test/org/apache/ldap/server/jndi/SimpleAuthenticationTest.java Wed Mar 23 22:32:51 2005
@@ -34,6 +34,7 @@
 import org.apache.ldap.common.exception.LdapNoPermissionException;
 import org.apache.ldap.common.util.ArrayUtils;
 import org.apache.ldap.server.AbstractServerTest;
+import org.apache.mina.util.AvailablePortFinder;
 
 
 /**
@@ -186,6 +187,10 @@
         env.put( Context.SECURITY_AUTHENTICATION, "none" );
         env.put( EnvKeys.DISABLE_ANONYMOUS, "true" );
 
+        int port = AvailablePortFinder.getNextAvailable( 1024 );
+
+        env.put( EnvKeys.LDAP_PORT, String.valueOf( port ) );
+
         try
         {
             setSysRoot( env );
@@ -197,6 +202,9 @@
 
         // ok this should start up the system now as admin
         Hashtable anonymous = new Hashtable();
+
+        anonymous.put( EnvKeys.LDAP_PORT, String.valueOf( port ) );
+
         InitialLdapContext ctx = ( InitialLdapContext ) setSysRoot( anonymous );
         assertNotNull( ctx );