directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1026685 - in /directory/apacheds/branches/apacheds-config/server-config/src: main/java/org/apache/directory/server/config/ test/java/org/apache/directory/server/config/
Date Sat, 23 Oct 2010 21:50:17 GMT
Author: elecharny
Date: Sat Oct 23 21:50:17 2010
New Revision: 1026685

URL: http://svn.apache.org/viewvc?rev=1026685&view=rev
Log:
o Make the tests succeed

Modified:
    directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
    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/NtpServerConfigReaderTest.java

Modified: directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java?rev=1026685&r1=1026684&r2=1026685&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
Sat Oct 23 21:50:17 2010
@@ -948,7 +948,7 @@ public class ConfigPartitionReader
         
         // Search for the element starting at some point in the DIT
         AttributeType adsdAt = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT
);
-        EqualityNode filter = new EqualityNode( adsdAt, new StringValue( name ) );
+        EqualityNode<?> filter = new EqualityNode( adsdAt, new StringValue( name )
);
         SearchControls controls = new SearchControls();
         controls.setSearchScope( scope.ordinal() );
 

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=1026685&r1=1026684&r2=1026685&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:50:17 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.DhcpServerBean;
 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;
@@ -58,9 +55,7 @@ import org.junit.runner.RunWith;
 public class DhcpServerConfigReaderTest
 {
 
-    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 +93,15 @@ public class DhcpServerConfigReaderTest
         {
             throw new Exception( "Schema load failed : " + LdapExceptionUtils.printErrors(
errors ) );
         }
+    }
+
+
+
 
+    @Test
+    public void testDhcpService() throws Exception
+    {
         File configDir = new File( workDir, "dhcpserver" ); // could be any directory, cause
the config is now in a single file
-        
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "dhcpserver.ldif",
true );
 
         SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
@@ -109,33 +110,12 @@ public class DhcpServerConfigReaderTest
         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_DHCP_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 );
+        DhcpServerBean dhcpServerBean = (DhcpServerBean)configBean.getDirectoryServiceBeans().get(
0 );
+        assertNotNull( dhcpServerBean );
     }
 }

Modified: directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java?rev=1026685&r1=1026684&r2=1026685&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/NtpServerConfigReaderTest.java
Sat Oct 23 21:50:17 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.NtpServerBean;
 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,18 +54,14 @@ import org.junit.runner.RunWith;
 @Concurrent()
 public class NtpServerConfigReaderTest
 {
-
-    private static DirectoryService dirService;
-
-    private static LdapServer server;
-
     private static SchemaManager schemaManager;
 
+    private static File workDir = new File( System.getProperty( "java.io.tmpdir" ) + "/server-work"
);
+
 
     @BeforeClass
     public static void readConfig() throws Exception
     {
-        File workDir = new File( System.getProperty( "java.io.tmpdir" ) + "/server-work"
);
         FileUtils.deleteDirectory( workDir );
         workDir.mkdir();
 
@@ -98,9 +91,13 @@ public class NtpServerConfigReaderTest
         {
             throw new Exception( "Schema load failed : " + LdapExceptionUtils.printErrors(
errors ) );
         }
+    }
+
 
+    @Test
+    public void testNtpService() throws Exception
+    {
         File configDir = new File( workDir, "ntpserver" ); // could be any directory, cause
the config is now in a single file
-        
         String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "ntpserver.ldif",
true );
 
         SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
@@ -109,33 +106,12 @@ public class NtpServerConfigReaderTest
         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_NTP_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 );
+        NtpServerBean ntpServerBean = (NtpServerBean)configBean.getDirectoryServiceBeans().get(
0 );
+        assertNotNull( ntpServerBean );
     }
 }



Mime
View raw message