directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r900681 - /directory/apacheds/branches/cidit/default-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
Date Tue, 19 Jan 2010 07:05:14 GMT
Author: kayyagari
Date: Tue Jan 19 07:05:14 2010
New Revision: 900681

URL: http://svn.apache.org/viewvc?rev=900681&view=rev
Log:
added a fix to start the server on a available port when the configured port is already in
use

Modified:
    directory/apacheds/branches/cidit/default-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java

Modified: directory/apacheds/branches/cidit/default-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/cidit/default-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java?rev=900681&r1=900680&r2=900681&view=diff
==============================================================================
--- directory/apacheds/branches/cidit/default-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
(original)
+++ directory/apacheds/branches/cidit/default-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
Tue Jan 19 07:05:14 2010
@@ -32,6 +32,7 @@
 import org.apache.directory.server.core.partition.ldif.LdifPartition;
 import org.apache.directory.server.core.schema.SchemaPartition;
 import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.server.protocol.shared.transport.Transport;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
 import org.apache.directory.shared.ldap.schema.ldif.extractor.impl.DefaultSchemaLdifExtractor;
@@ -39,6 +40,7 @@
 import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
 import org.apache.directory.shared.ldap.schema.registries.SchemaLoader;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
+import org.apache.mina.util.AvailablePortFinder;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -122,6 +124,18 @@
         server = cpReader.getLdapServer();
         server.setDirectoryService( dirService );
 
+        // this is a hack to use a different port than the one
+        // configured in the actual configuration data
+        // in case the configured port is already in use during the test run
+        Transport[] transports = server.getTransports();
+        for( Transport t : transports )
+        {
+            int port = t.getPort();
+            port = AvailablePortFinder.getNextAvailable( port );
+            t.setPort( port );
+            t.init();
+        }
+
         server.start();
     }
 



Mime
View raw message