You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/10/23 23:52:48 UTC
svn commit: r1026688 - in
/directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config:
DhcpServerConfigReaderTest.java LdapServerConfigReaderTest.java
Author: elecharny
Date: Sat Oct 23 21:52:48 2010
New Revision: 1026688
URL: http://svn.apache.org/viewvc?rev=1026688&view=rev
Log:
Fixed some more errors
Modified:
directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java
directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
Modified: directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java?rev=1026688&r1=1026687&r2=1026688&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java (original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/DhcpServerConfigReaderTest.java Sat Oct 23 21:52:48 2010
@@ -96,8 +96,6 @@ public class DhcpServerConfigReaderTest
}
-
-
@Test
public void testDhcpService() throws Exception
{
Modified: directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java?rev=1026688&r1=1026687&r2=1026688&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java (original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/LdapServerConfigReaderTest.java Sat Oct 23 21:52:48 2010
@@ -21,8 +21,7 @@
package org.apache.directory.server.config;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotNull;
import java.io.File;
import java.util.List;
@@ -31,9 +30,8 @@ import org.apache.commons.io.FileUtils;
import org.apache.directory.junit.tools.Concurrent;
import org.apache.directory.junit.tools.ConcurrentJunitRunner;
import org.apache.directory.server.config.beans.ConfigBean;
-import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.config.beans.LdapServerBean;
import org.apache.directory.server.core.partition.ldif.SingleFileLdifPartition;
-import org.apache.directory.server.ldap.LdapServer;
import org.apache.directory.shared.ldap.name.DN;
import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
@@ -42,7 +40,6 @@ import org.apache.directory.shared.ldap.
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.LdapExceptionUtils;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -57,10 +54,7 @@ import org.junit.runner.RunWith;
@Concurrent()
public class LdapServerConfigReaderTest
{
-
- private static DirectoryService dirService;
-
- private static LdapServer server;
+ private static File workDir = new File( System.getProperty( "java.io.tmpdir" ) + "/server-work" );
private static SchemaManager schemaManager;
@@ -98,9 +92,13 @@ public class LdapServerConfigReaderTest
{
throw new Exception( "Schema load failed : " + LdapExceptionUtils.printErrors( errors ) );
}
+ }
+
+ @Test
+ public void testDhcpService() throws Exception
+ {
File configDir = new File( workDir, "ldapserver" ); // could be any directory, cause the config is now in a single file
-
String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "ldapserver.ldif", true );
SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile );
@@ -109,33 +107,12 @@ public class LdapServerConfigReaderTest
configPartition.setSchemaManager( schemaManager );
configPartition.initialize();
-
ConfigPartitionReader cpReader = new ConfigPartitionReader( configPartition, workDir );
ConfigBean configBean = cpReader.readConfig( new DN( "ou=servers,ads-directoryServiceId=default,ou=config" ), ConfigSchemaConstants.ADS_LDAP_SERVER_OC.getValue() );
- }
-
- @AfterClass
- public static void cleanup() throws Exception
- {
- server.stop();
- dirService.shutdown();
- }
-
-
- @Test
- public void testDirService()
- {
- assertTrue( dirService.isStarted() );
- assertEquals( "default", dirService.getInstanceId() );
- }
-
-
- @Test
- public void testLdapServer()
- {
- assertTrue( server.isStarted() );
- assertEquals( dirService, server.getDirectoryService() );
+ assertNotNull( configBean );
+ LdapServerBean ldapServerBean = (LdapServerBean)configBean.getDirectoryServiceBeans().get( 0 );
+ assertNotNull( ldapServerBean );
}
}