You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2010/03/20 16:24:27 UTC

svn commit: r925628 - in /directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core: configuration/PartitionConfigurationIT.java operations/search/SearchWithIndicesITest.java

Author: seelmann
Date: Sat Mar 20 15:24:27 2010
New Revision: 925628

URL: http://svn.apache.org/viewvc?rev=925628&view=rev
Log:
Partial fix for DIRSERVER-1480:
o use partition factory to create partition and index

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesITest.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java?rev=925628&r1=925627&r2=925628&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java Sat Mar 20 15:24:27 2010
@@ -32,11 +32,13 @@ import junit.framework.Assert;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory;
+import org.apache.directory.server.core.factory.PartitionFactory;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.jndi.CoreContextFactory;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
+import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.shared.ldap.csn.CsnFactory;
 import org.apache.directory.shared.ldap.name.DN;
 import org.junit.Test;
@@ -49,21 +51,20 @@ import org.junit.runner.RunWith;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-@RunWith ( FrameworkRunner.class )
+@RunWith(FrameworkRunner.class)
 public class PartitionConfigurationIT extends AbstractLdapTestUnit
 {
 
     @Test
     public void testAddAndRemove() throws Exception
     {
-        JdbmPartition partition = new JdbmPartition();
-        partition.setId( "removable" );
-        partition.setSuffix( "ou=removable" );
-        partition.setPartitionDir( service.getWorkingDirectory() );
-        
+        PartitionFactory partitionFactory = DefaultDirectoryServiceFactory.DEFAULT.getPartitionFactory();
+        Partition partition = partitionFactory.createPartition( "removable", "ou=removable", 100, service
+            .getWorkingDirectory() );
+
         // Test AddContextPartition
         service.addPartition( partition );
-        
+
         DN suffixDn = new DN( "ou=removable" );
         suffixDn.normalize( service.getSchemaManager().getNormalizerMapping() );
         ServerEntry ctxEntry = new DefaultServerEntry( service.getSchemaManager(), suffixDn );
@@ -73,8 +74,8 @@ public class PartitionConfigurationIT ex
         ctxEntry.put( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
         ctxEntry.put( "entryUUID", UUID.randomUUID().toString() );
         partition.add( new AddOperationContext( service.getAdminSession(), ctxEntry ) );
-        
-        Hashtable<String,Object> env = new Hashtable<String,Object>();
+
+        Hashtable<String, Object> env = new Hashtable<String, Object>();
         env.put( Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName() );
         env.put( DirectoryService.JNDI_KEY, service );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesITest.java?rev=925628&r1=925627&r2=925628&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesITest.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesITest.java Sat Mar 20 15:24:27 2010
@@ -40,13 +40,10 @@ import javax.naming.directory.SearchCont
 import javax.naming.directory.SearchResult;
 import javax.naming.ldap.LdapContext;
 
-import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.partition.Partition;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
-import org.apache.directory.server.xdbm.Index;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -58,7 +55,7 @@ import org.junit.runner.RunWith;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-@RunWith ( FrameworkRunner.class )
+@RunWith(FrameworkRunner.class)
 public class SearchWithIndicesITest extends AbstractLdapTestUnit
 {
 
@@ -89,9 +86,7 @@ public class SearchWithIndicesITest exte
         }
 
         Partition systemPartition = service.getSystemPartition();
-        Set<Index<? extends Object, ServerEntry, Long>> indexedAtributes = ( ( JdbmPartition ) systemPartition )
-            .getIndexedAttributes();
-        indexedAtributes.add( new JdbmIndex<String, ServerEntry>( "gidNumber" ) );
+        DefaultDirectoryServiceFactory.DEFAULT.getPartitionFactory().addIndex( systemPartition, "gidNumber", 100 );
 
         // -------------------------------------------------------------------
         // Add a bunch of nis groups