directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1208343 - in /directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm: ./ impl/avl/ search/impl/
Date Wed, 30 Nov 2011 09:32:59 GMT
Author: saya
Date: Wed Nov 30 09:32:51 2011
New Revision: 1208343

URL: http://svn.apache.org/viewvc?rev=1208343&view=rev
Log:
changed tests to use partition interface and operation execution manager instead of store
interface.

Modified:
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/XdbmStoreUtils.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java?rev=1208343&r1=1208342&r2=1208343&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
Wed Nov 30 09:32:51 2011
@@ -35,6 +35,8 @@ import java.util.UUID;
 import net.sf.ehcache.store.AbstractStore;
 
 import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.xdbm.impl.avl.AvlIndex;
 import org.apache.directory.server.xdbm.impl.avl.AvlPartitionTest;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
@@ -62,6 +64,7 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.directory.server.core.api.partition.OperationExecutionManager;
 import org.apache.directory.server.core.api.partition.index.Index;
 
 
@@ -85,6 +88,9 @@ public class PartitionTest
     
     /** The CN AttributType instance */
     private static AttributeType CN_AT;
+    
+    /** Operation execution manager */
+    private static OperationExecutionManager executionManager;
 
     @BeforeClass
     public static void setup() throws Exception
@@ -97,6 +103,12 @@ public class PartitionTest
             int targetPos = path.indexOf( "target" );
             workingDirectory = path.substring( 0, targetPos + 6 );
         }
+        
+        File logDir = new File( workingDirectory + File.separatorChar + "txnlog" + File.separatorChar
);
+        logDir.mkdirs();
+        TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
+        OperationExecutionManagerFactory.init();
+        executionManager = OperationExecutionManagerFactory.instance();
 
         File schemaRepository = new File( workingDirectory, "schema" );
         SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory
) );
@@ -192,14 +204,14 @@ public class PartitionTest
 
         Modification add = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
attrib );
 
-        UUID entryId = partition.getEntryId( dn );
-        Entry lookedup = partition.lookup( entryId );
+        UUID entryId = executionManager.getEntryId( partition, dn );
+        Entry lookedup = executionManager.lookup( partition, entryId );
 
         // before modification: no "uidObject" tuple in objectClass index
         assertFalse( partition.getObjectClassIndex().forward( "uidObject", entryId ) );
         assertFalse( lookedup.get( "objectClass" ).contains( "uidObject" ) );
 
-        lookedup = partition.modify( dn, add );
+        lookedup = executionManager.modify( partition, dn, add );
 
         // after modification: expect "uidObject" tuple in objectClass index
         assertTrue( partition.getObjectClassIndex().forward( "uidObject", entryId ) );
@@ -222,15 +234,15 @@ public class PartitionTest
 
         Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
attrib );
 
-        UUID entryId = partition.getEntryId( dn );
-        Entry lookedup = partition.lookup( entryId );
+        UUID entryId = executionManager.getEntryId( partition, dn );
+        Entry lookedup = executionManager.lookup( partition, entryId );
 
         // before modification: expect "sales" tuple in ou index
         Index<String> ouIndex = ( Index<String> ) partition.getUserIndex( OU_AT
);
         assertTrue( ouIndex.forward( "sales", entryId ) );
         assertTrue( lookedup.get( "ou" ).contains( "sales" ) );
 
-        lookedup = partition.modify( dn, add );
+        lookedup = executionManager.modify( partition, dn, add );
 
         // after modification: no "sales" tuple in ou index
         assertFalse( ouIndex.forward( "sales", entryId ) );
@@ -251,8 +263,8 @@ public class PartitionTest
 
         Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
attrib );
 
-        UUID entryId = partition.getEntryId( dn );
-        Entry lookedup = partition.lookup( entryId );
+        UUID entryId = executionManager.getEntryId( partition, dn );
+        Entry lookedup = executionManager.lookup( partition, entryId );
 
         // before modification: expect "sales" tuple in ou index
         Index<String> ouIndex = ( Index<String> ) partition.getUserIndex( OU_AT
);
@@ -260,7 +272,7 @@ public class PartitionTest
         assertTrue( ouIndex.forward( "sales", entryId ) );
         assertTrue( lookedup.get( "ou" ).contains( "sales" ) );
 
-        lookedup = partition.modify( dn, add );
+        lookedup = executionManager.modify( partition, dn, add );
 
         // after modification: no "sales" tuple in ou index
         assertFalse( partition.getPresenceIndex().forward( SchemaConstants.OU_AT_OID, entryId
) );
@@ -286,14 +298,14 @@ public class PartitionTest
 
         Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
attrib );
 
-        UUID entryId = partition.getEntryId( dn );
-        Entry lookedup = partition.lookup( entryId );
+        UUID entryId = executionManager.getEntryId( partition, dn );
+        Entry lookedup = executionManager.lookup( partition, entryId );
 
         // before modification: expect "person" tuple in objectClass index
         assertTrue( partition.getObjectClassIndex().forward( "person", entryId ) );
         assertTrue( lookedup.get( "objectClass" ).contains( "person" ) );
 
-        lookedup = partition.modify( dn, add );
+        lookedup = executionManager.modify( partition, dn, add );
 
         // after modification: no "person" tuple in objectClass index
         assertFalse( partition.getObjectClassIndex().forward( "person", entryId ) );
@@ -314,15 +326,15 @@ public class PartitionTest
 
         Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
attrib );
 
-        UUID entryId = partition.getEntryId( dn );
-        Entry lookedup = partition.lookup( entryId );
+        UUID entryId = executionManager.getEntryId( partition, dn );
+        Entry lookedup = executionManager.lookup( partition, entryId );
 
         // before modification: expect "person" tuple in objectClass index
         assertTrue( partition.getObjectClassIndex().reverse( entryId ) );
         assertTrue( partition.getObjectClassIndex().forward( "person", entryId ) );
         assertTrue( lookedup.get( "objectClass" ).contains( "person" ) );
 
-        lookedup = partition.modify( dn, add );
+        lookedup = executionManager.modify( partition, dn, add );
 
         // after modification: no tuple in objectClass index
         assertFalse( partition.getObjectClassIndex().reverse( entryId ) );
@@ -345,13 +357,13 @@ public class PartitionTest
 
         Modification add = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
attrib );
 
-        UUID entryId = partition.getEntryId( dn );
-        Entry lookedup = partition.lookup( entryId );
+        UUID entryId = executionManager.getEntryId( partition, dn );
+        Entry lookedup = executionManager.lookup( partition, entryId );
         
         assertNotSame( csn, lookedup.get( csnAt ).getString() );
         assertNotSame( csn, partition.getEntryCsnIndex().reverseLookup( entryId ) );
 
-        lookedup = partition.modify( dn, add );
+        lookedup = executionManager.modify( partition, dn, add );
         
         String updateCsn = lookedup.get( csnAt ).getString();
         assertEquals( csn, updateCsn );
@@ -365,7 +377,7 @@ public class PartitionTest
         assertNotSame( csn, updateCsn );
         assertNotSame( csn, partition.getEntryCsnIndex().reverseLookup( entryId ) );
         
-        lookedup = partition.modify( dn, new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
csnAt, csn ) );
+        lookedup = executionManager.modify( partition, dn, new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
csnAt, csn ) );
         
         assertEquals( csn, lookedup.get( csnAt ).getString() );
         assertEquals( csn, partition.getEntryCsnIndex().reverseLookup( entryId ) );
@@ -389,7 +401,7 @@ public class PartitionTest
         // move
         Dn newSuperior = new Dn( schemaManager, "o=Good Times Co." );
         Dn newDn = new Dn( schemaManager, "cn=user,o=Good Times Co." );
-        partition.move( dn, newSuperior, newDn, null );
+        executionManager.move( partition, dn, newSuperior, newDn, null, entry );
         entry = verifyParentId( newDn );
         
         // move and rename
@@ -397,16 +409,16 @@ public class PartitionTest
         Dn oldDn = newDn;
         Rdn newRdn = new Rdn( schemaManager, "cn=userMovedAndRenamed" );
         
-        partition.moveAndRename( oldDn, newParentDn, newRdn, entry, false );
+        executionManager.moveAndRename( partition, oldDn, newParentDn, newRdn, entry.clone(),
entry, false );
         verifyParentId( newParentDn.add( newRdn ) );
     }
     
     
     private Entry verifyParentId( Dn dn ) throws Exception
     {
-        UUID entryId = partition.getEntryId( dn );
-        Entry entry = partition.lookup( entryId );
-        UUID parentId = partition.getParentId( entryId );
+        UUID entryId = executionManager.getEntryId( partition, dn );
+        Entry entry = executionManager.lookup( partition, entryId );
+        UUID parentId = executionManager.getParentId( partition, entryId );
         
         Attribute parentIdAt = entry.get( SchemaConstants.ENTRY_PARENT_ID_AT );
         assertNotNull( parentIdAt );

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/XdbmStoreUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/XdbmStoreUtils.java?rev=1208343&r1=1208342&r2=1208343&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/XdbmStoreUtils.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/XdbmStoreUtils.java
Wed Nov 30 09:32:51 2011
@@ -24,6 +24,7 @@ import java.util.UUID;
 
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.partition.Partition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.csn.CsnFactory;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
@@ -59,7 +60,7 @@ public class XdbmStoreUtils
      */
     //This will suppress PMD.AvoidUsingHardCodedIP warnings in this class
     @SuppressWarnings("PMD.AvoidUsingHardCodedIP")
-    public static void loadExampleData( Store store, SchemaManager schemaManager ) throws
Exception
+    public static void loadExampleData( Partition store, SchemaManager schemaManager ) throws
Exception
     {
         int idx = 1;
         Dn suffixDn = new Dn( schemaManager, "o=Good Times Co." );
@@ -182,12 +183,12 @@ public class XdbmStoreUtils
      * @param idx index used to build the entry uuid
      * @throws Exception in case of any problems in adding the entry to the store
      */
-    public static void injectEntryInStore( Store store, Entry entry, int idx ) throws Exception
+    public static void injectEntryInStore( Partition store, Entry entry, int idx ) throws
Exception
     {
         entry.add( SchemaConstants.ENTRY_CSN_AT, CSN_FACTORY.newInstance().toString() );
         entry.add( SchemaConstants.ENTRY_UUID_AT, Strings.getUUIDString( idx ).toString()
);
 
         AddOperationContext addContext = new AddOperationContext( null, entry );
-        ((Partition)store).add( addContext );
+        OperationExecutionManagerFactory.instance().add( store, addContext );
     }
 }

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java?rev=1208343&r1=1208342&r2=1208343&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
Wed Nov 30 09:32:51 2011
@@ -36,6 +36,9 @@ import org.apache.directory.server.const
 import org.apache.directory.server.core.api.entry.ClonedServerEntry;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
+import org.apache.directory.server.core.api.partition.OperationExecutionManager;
 import org.apache.directory.server.core.api.partition.index.GenericIndex;
 import org.apache.directory.server.core.api.partition.index.Index;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
@@ -96,6 +99,9 @@ public class AvlPartitionTest
     
     /** The ApacheAlias AttributeType instance */
     private static AttributeType APACHE_ALIAS_AT;
+    
+    /** Operation execution manager */
+    private static OperationExecutionManager executionManager;
 
     @BeforeClass
     public static void setup() throws Exception
@@ -108,6 +114,12 @@ public class AvlPartitionTest
             int targetPos = path.indexOf( "target" );
             workingDirectory = path.substring( 0, targetPos + 6 );
         }
+        
+        File logDir = new File( workingDirectory + File.separatorChar + "txnlog" + File.separatorChar
);
+        logDir.mkdirs();
+        TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
+        OperationExecutionManagerFactory.init();
+        executionManager = OperationExecutionManagerFactory.instance();
 
         File schemaRepository = new File( workingDirectory, "schema" );
         SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory
) );
@@ -399,34 +411,34 @@ public class AvlPartitionTest
     public void testFreshStore() throws Exception
     {
         Dn dn = new Dn( schemaManager, "o=Good Times Co." );
-        assertEquals( UUID.fromString( "00000000-0000-0000-0000-000000000001" ),  partition.getEntryId(
dn ) );
+        assertEquals( UUID.fromString( "00000000-0000-0000-0000-000000000001" ),  executionManager.getEntryId(
partition, dn ) );
         assertEquals( 11, partition.count() );
 
         // note that the suffix entry returns 0 for it's parent which does not exist
-        assertEquals( UUID.fromString( "00000000-0000-0000-0000-000000000000" ), partition.getParentId(
partition.getEntryId( dn ) ) );
-        assertNull( partition.getParentId( UUID.fromString( "00000000-0000-0000-0000-000000000000"
) ) );
+        assertEquals( UUID.fromString( "00000000-0000-0000-0000-000000000000" ), executionManager.getParentId(
partition, executionManager.getEntryId( partition, dn ) ) );
+        assertNull( executionManager.getParentId( partition, UUID.fromString( "00000000-0000-0000-0000-000000000000"
) ) );
 
         // should be allowed
-        partition.delete( UUID.fromString( "00000000-0000-0000-0000-000000000001" ) );
+        executionManager.delete( partition, dn, UUID.fromString( "00000000-0000-0000-0000-000000000001"
) );
     }
 
 
     @Test
     public void testEntryOperations() throws Exception
     {
-        assertEquals( 3, partition.getChildCount( UUID.fromString( "00000000-0000-0000-0000-000000000001"
) ) );
+        assertEquals( 3, executionManager.getChildCount( partition, UUID.fromString( "00000000-0000-0000-0000-000000000001"
) ) );
 
-        Cursor<IndexEntry<UUID>> cursor = partition.list( UUID.fromString( "00000000-0000-0000-0000-000000000001"
) );
+        Cursor<IndexEntry<UUID>> cursor = executionManager.list( partition, UUID.fromString(
"00000000-0000-0000-0000-000000000001" ) );
         assertNotNull( cursor );
         cursor.beforeFirst();
         assertTrue( cursor.next() );
         assertEquals( Strings.getUUIDString( 2 ),  cursor.get().getId() );
         assertTrue( cursor.next() );
-        assertEquals( 3, partition.getChildCount( Strings.getUUIDString( 1 ) ) );
+        assertEquals( 3, executionManager.getChildCount( partition, Strings.getUUIDString(
1 ) ) );
 
-        partition.delete( Strings.getUUIDString( 2 ) );
+        executionManager.delete( partition, executionManager.buildEntryDn( partition, Strings.getUUIDString(
2 ) ), Strings.getUUIDString( 2 ) );
 
-        assertEquals( 2, partition.getChildCount( Strings.getUUIDString( 1 ) ) );
+        assertEquals( 2, executionManager.getChildCount( partition, Strings.getUUIDString(
1 ) ) );
         assertEquals( 10, partition.count() );
 
         // add an alias and delete to test dropAliasIndices method
@@ -440,9 +452,9 @@ public class AvlPartitionTest
         entry.add( "entryUUID", Strings.getUUIDString( 12 ).toString() );
 
         AddOperationContext addContext = new AddOperationContext( null, entry );
-        partition.add( addContext );
+        executionManager.add( partition, addContext );
 
-        partition.delete( Strings.getUUIDString( 12 ) );
+        executionManager.delete( partition, dn, Strings.getUUIDString( 12 ) );
     }
 
 
@@ -488,7 +500,7 @@ public class AvlPartitionTest
         entry.add( "entryUUID", Strings.getUUIDString( 12 ).toString() );
 
         AddOperationContext addContext = new AddOperationContext( null, entry );
-        partition.add( addContext );
+        executionManager.add( partition, addContext );
 
         cursor = idx.forwardCursor( Strings.getUUIDString( 2 ) );
         cursor.afterLast();
@@ -498,7 +510,7 @@ public class AvlPartitionTest
         Dn newParentDn = new Dn( schemaManager, "ou=Board of Directors,o=Good Times Co."
);
 
         Dn newDn = newParentDn.add( martinDn.getRdn() );
-        partition.move( martinDn, newParentDn, newDn, new ClonedServerEntry( entry ) );
+        executionManager.move( partition, martinDn, newParentDn, newDn, entry.clone(), entry
);
 
         cursor = idx.forwardCursor( Strings.getUUIDString( 3 ) );
         cursor.afterLast();
@@ -514,7 +526,7 @@ public class AvlPartitionTest
         entry.add( "entryUUID", Strings.getUUIDString( 13 ).toString() );
 
         addContext = new AddOperationContext( null, entry );
-        partition.add( addContext );
+        executionManager.add( partition, addContext );
 
         // dn id 14
         Dn jimmyDn = new Dn( schemaManager, "cn=Jimmy Wales,ou=Marketing, ou=Sales,o=Good
Times Co." );
@@ -526,10 +538,10 @@ public class AvlPartitionTest
         entry.add( "entryUUID", Strings.getUUIDString( 14 ).toString() );
 
         addContext = new AddOperationContext( null, entry );
-        partition.add( addContext );
+        executionManager.add( partition, addContext );
 
         newDn = newParentDn.add( marketingDn.getRdn() );
-        partition.move( marketingDn, newParentDn, newDn, new ClonedServerEntry( entry ) );
+        executionManager.move( partition, marketingDn, newParentDn, newDn, entry.clone(),
entry );
 
         cursor = idx.forwardCursor( Strings.getUUIDString( 3 ) );
         cursor.afterLast();
@@ -584,7 +596,7 @@ public class AvlPartitionTest
         entry.add( "entryUUID", Strings.getUUIDString( 15 ).toString() );
 
         AddOperationContext addContext = new AddOperationContext( null, entry );
-        partition.add( addContext );
+        executionManager.add( partition, addContext );
     }
 
 
@@ -598,7 +610,7 @@ public class AvlPartitionTest
         entry.add( "entryUUID", Strings.getUUIDString( 16 ).toString() );
 
         AddOperationContext addContext = new AddOperationContext( null, entry );
-        partition.add( addContext );
+        executionManager.add( partition, addContext );
     }
 
 
@@ -612,7 +624,7 @@ public class AvlPartitionTest
 
         Modification add = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
attrib );
 
-        partition.modify( dn, add );
+        executionManager.modify( partition, dn, add );
     }
 
 
@@ -628,11 +640,11 @@ public class AvlPartitionTest
         entry.add( "entryUUID", Strings.getUUIDString( 17 ).toString() );
 
         AddOperationContext addContext = new AddOperationContext( null, entry );
-        partition.add( addContext );
+        executionManager.add( partition, addContext );
 
         Rdn rdn = new Rdn( "sn=James" );
 
-        partition.rename( dn, rdn, true, null );
+        executionManager.rename( partition, dn, rdn, true, null, addContext.getModifiedEntry()
);
     }
 
 
@@ -648,16 +660,16 @@ public class AvlPartitionTest
         entry.add( "entryUUID", Strings.getUUIDString( 18 ).toString() );
 
         AddOperationContext addContext = new AddOperationContext( null, entry );
-        partition.add( addContext );
+        executionManager.add( partition, addContext );
 
         Rdn rdn = new Rdn( "sn=Ja\\+es" );
 
-        partition.rename( dn, rdn, true, null );
+        executionManager.rename( partition, dn, rdn, true, null, addContext.getModifiedEntry()
);
 
         Dn dn2 = new Dn( schemaManager, "sn=Ja\\+es,ou=Engineering,o=Good Times Co." );
-        UUID id = partition.getEntryId( dn2 );
+        UUID id = executionManager.getEntryId( partition, dn2 );
         assertNotNull( id );
-        Entry entry2 = partition.lookup( id );
+        Entry entry2 = executionManager.lookup( partition, id );
         assertEquals( "ja+es", entry2.get( "sn" ).getString() );
     }
 
@@ -674,13 +686,15 @@ public class AvlPartitionTest
         childEntry.add( "entryUUID", Strings.getUUIDString( 19 ).toString() );
 
         AddOperationContext addContext = new AddOperationContext( null, childEntry );
-        partition.add( addContext );
+        executionManager.add( partition, addContext );
 
         Dn parentDn = new Dn( schemaManager, "ou=Sales,o=Good Times Co." );
 
         Rdn rdn = new Rdn( "cn=Ryan" );
 
-        partition.moveAndRename( childDn, parentDn, rdn, new ClonedServerEntry( childEntry
), true );
+        childEntry = ( DefaultEntry )addContext.getModifiedEntry();
+        Entry modifiedChildEntry = childEntry.clone();
+        executionManager.moveAndRename( partition, childDn, parentDn, rdn, modifiedChildEntry,
childEntry, true );
 
         // to drop the alias indices   
         childDn = new Dn( schemaManager, "commonName=Jim Bean,ou=Apache,ou=Board of Directors,o=Good
Times Co." );
@@ -690,9 +704,10 @@ public class AvlPartitionTest
         assertEquals( 3, partition.getSubAliasIndex().count() );
 
         Dn newDn = parentDn.add( childDn.getRdn() );
-        partition.move( childDn, parentDn, newDn, childEntry );
+        executionManager.move( partition, childDn, parentDn, newDn, modifiedChildEntry.clone(),
modifiedChildEntry );
 
-        assertEquals( 4, partition.getSubAliasIndex().count() );
+        // Count should be two after one add and two removes
+        assertEquals( 2, partition.getSubAliasIndex().count() );
     }
 
 
@@ -709,14 +724,14 @@ public class AvlPartitionTest
 
         Modification add = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
attrib );
 
-        Entry lookedup = partition.lookup( partition.getEntryId( dn ) );
+        Entry lookedup = executionManager.lookup( partition, executionManager.getEntryId(
partition, dn ) );
 
-        partition.modify( dn, add );
+        executionManager.modify( partition, dn, add );
         assertTrue( lookedup.get( "sn" ).contains( attribVal ) );
 
-        partition.modify( dn, new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,

+        executionManager.modify( partition, dn, new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,

             schemaManager.getAttributeType( "telephoneNumber" ), "+1974045779" ) );
-        lookedup = partition.lookup( partition.getEntryId( dn ) );
+        lookedup = executionManager.lookup( partition, executionManager.getEntryId( partition,
dn ) );
         assertTrue( lookedup.get( "telephoneNumber" ).contains( "+1974045779" ) );
     }
 
@@ -734,14 +749,14 @@ public class AvlPartitionTest
 
         Modification add = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
attrib );
 
-        Entry lookedup = partition.lookup( partition.getEntryId( dn ) );
+        Entry lookedup = executionManager.lookup( partition, executionManager.getEntryId(
partition, dn ) );
 
         assertEquals( "WAlkeR", lookedup.get( "sn" ).get().getString() ); // before replacing
 
-        lookedup = partition.modify( dn, add );
+        lookedup = executionManager.modify( partition, dn, add );
         assertEquals( attribVal, lookedup.get( "sn" ).get().getString() );
 
-        lookedup = partition.modify( dn, new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
SN_AT, "JWalker" ) );
+        lookedup = executionManager.modify( partition, dn, new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
SN_AT, "JWalker" ) );
         assertEquals( "JWalker", lookedup.get( "sn" ).get().getString() );
     }
 
@@ -756,18 +771,18 @@ public class AvlPartitionTest
 
         Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
attrib );
 
-        Entry lookedup = partition.lookup( partition.getEntryId( dn ) );
+        Entry lookedup = executionManager.lookup( partition, executionManager.getEntryId(
partition, dn ) );
 
         assertNotNull( lookedup.get( "sn" ).get() );
 
-        lookedup = partition.modify( dn, add );
+        lookedup = executionManager.modify( partition, dn, add );
         assertNull( lookedup.get( "sn" ) );
 
         // add an entry for the sake of testing the remove operation
-        lookedup = partition.modify( dn, new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
SN_AT, "JWalker" ) );
+        lookedup = executionManager.modify( partition, dn, new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
SN_AT, "JWalker" ) );
         assertNotNull( lookedup.get( "sn" ) );
 
-        lookedup = partition.modify( dn, new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
SN_AT ) );
+        lookedup = executionManager.modify( partition, dn, new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE,
SN_AT ) );
         assertNull( lookedup.get( "sn" ) );
     }
 
@@ -783,7 +798,7 @@ public class AvlPartitionTest
         entry.add( "entryUUID", Strings.getUUIDString( 20 ).toString() );
 
         AddOperationContext addContext = new AddOperationContext( null, entry );
-        partition.add( addContext );
+        executionManager.add( partition, addContext );
 
         Attribute attrib = new DefaultAttribute( SchemaConstants.OU_AT, OU_AT );
 
@@ -792,11 +807,11 @@ public class AvlPartitionTest
 
         Modification add = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
attrib );
 
-        Entry lookedup = partition.lookup( partition.getEntryId( dn ) );
+        Entry lookedup = executionManager.lookup( partition, executionManager.getEntryId(
partition, dn ) );
 
         assertNull( lookedup.get( "ou" ) ); // before replacing
 
-        lookedup = partition.modify( dn, add );
+        lookedup = executionManager.modify( partition, dn, add );
         assertEquals( attribVal, lookedup.get( "ou" ).get().getString() );
     }
 }

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java?rev=1208343&r1=1208342&r2=1208343&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
Wed Nov 30 09:32:51 2011
@@ -150,7 +150,7 @@ public class AndCursorTest
 
         ((Partition)store).initialize();
         
-        XdbmStoreUtils.loadExampleData( store, schemaManager );
+        XdbmStoreUtils.loadExampleData( ( Partition )store, schemaManager );
 
         evaluatorBuilder = new EvaluatorBuilder( ( Partition )store, schemaManager );
         cursorBuilder = new CursorBuilder( ( Partition )store, evaluatorBuilder );

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=1208343&r1=1208342&r2=1208343&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
Wed Nov 30 09:32:51 2011
@@ -145,10 +145,10 @@ public class GreaterEqTest
         ( ( Store ) store ).addIndex( new AvlIndex( SchemaConstants.OU_AT_OID ) );
         ( ( Store ) store ).addIndex( new AvlIndex( SchemaConstants.CN_AT_OID ) );
         ( ( Store ) store ).addIndex( new AvlIndex( SchemaConstants.POSTALCODE_AT_OID ) );
-        ((Partition)store).setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
-        ((Partition)store).initialize();
+        store.setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
+        store.initialize();
 
-        XdbmStoreUtils.loadExampleData( ( Store ) store, schemaManager );
+        XdbmStoreUtils.loadExampleData( store, schemaManager );
         LOG.debug( "Created new store" );
     }
 
@@ -623,7 +623,7 @@ public class GreaterEqTest
         attrs.add( "entryUUID", Strings.getUUIDString( 12 ).toString() );
         
         AddOperationContext addContext = new AddOperationContext( null, attrs );
-        ((Partition)store).add( addContext );
+        OperationExecutionManagerFactory.instance().add( store, addContext );
 
         indexEntry.setId( Strings.getUUIDString( 12 ) );
         assertTrue( evaluator.evaluate( indexEntry ) );

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java?rev=1208343&r1=1208342&r2=1208343&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
Wed Nov 30 09:32:51 2011
@@ -150,7 +150,7 @@ public class LessEqTest
 
         store.initialize();
 
-        XdbmStoreUtils.loadExampleData( ( Store )store, schemaManager );
+        XdbmStoreUtils.loadExampleData( store, schemaManager );
         LOG.debug( "Created new store" );
     }
 
@@ -651,7 +651,7 @@ public class LessEqTest
         attrs.add( "entryUUID", Strings.getUUIDString( 12 ).toString() );
         
         AddOperationContext addContext = new AddOperationContext( null, attrs );
-        ((Partition)store).add( addContext );
+        OperationExecutionManagerFactory.instance().add( store, addContext );
 
         indexEntry.setId( Strings.getUUIDString( 12 ) );
         assertTrue( evaluator.evaluate( indexEntry ) );

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java?rev=1208343&r1=1208342&r2=1208343&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
Wed Nov 30 09:32:51 2011
@@ -146,7 +146,7 @@ public class NestedFilterTest
         ((Partition)store).setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
         ((Partition)store).initialize();
 
-        XdbmStoreUtils.loadExampleData( store, schemaManager );
+        XdbmStoreUtils.loadExampleData( ( Partition )store, schemaManager );
 
         evaluatorBuilder = new EvaluatorBuilder( ( Partition )store, schemaManager );
         cursorBuilder = new CursorBuilder( ( Partition )store, evaluatorBuilder );

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java?rev=1208343&r1=1208342&r2=1208343&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
Wed Nov 30 09:32:51 2011
@@ -147,7 +147,7 @@ public class NotCursorTest
 
         ((Partition)store).initialize();
         
-        XdbmStoreUtils.loadExampleData( store, schemaManager );
+        XdbmStoreUtils.loadExampleData( ( Partition )store, schemaManager );
 
         evaluatorBuilder = new EvaluatorBuilder( ( Partition )store, schemaManager );
         cursorBuilder = new CursorBuilder( ( Partition )store, evaluatorBuilder );

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java?rev=1208343&r1=1208342&r2=1208343&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
Wed Nov 30 09:32:51 2011
@@ -141,7 +141,7 @@ public class OneLevelScopeTest
 
         store.initialize();
 
-        XdbmStoreUtils.loadExampleData( ( Store )store, schemaManager );
+        XdbmStoreUtils.loadExampleData( store, schemaManager );
         LOG.debug( "Created new store" );
     }
 
@@ -677,7 +677,7 @@ public class OneLevelScopeTest
         entry.add( "entryUUID", Strings.getUUIDString( 12 ).toString() );
 
         AddOperationContext addContext = new AddOperationContext( null, entry );
-        ((Partition)store).add( addContext );
+        OperationExecutionManagerFactory.instance().add( store, addContext );
 
         dn = new Dn( schemaManager, SchemaConstants.CN_AT_OID + "=jdoe," + SchemaConstants.OU_AT_OID
+ "=board of directors,"
             + SchemaConstants.O_AT_OID + "=good times co." );
@@ -690,7 +690,7 @@ public class OneLevelScopeTest
         entry.add( "entryUUID", Strings.getUUIDString( 13 ).toString() );
         
         addContext = new AddOperationContext( null, entry );
-        ((Partition)store).add( addContext );
+        OperationExecutionManagerFactory.instance().add( store, addContext );
 
         ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING, new Dn( SchemaConstants.OU_AT_OID
             + "=board of directors," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.ONELEVEL
);

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java?rev=1208343&r1=1208342&r2=1208343&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
Wed Nov 30 09:32:51 2011
@@ -148,7 +148,7 @@ public class OrCursorTest
 
         store.initialize();
 
-        XdbmStoreUtils.loadExampleData( ( Store )store, schemaManager );
+        XdbmStoreUtils.loadExampleData( store, schemaManager );
 
         evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
         cursorBuilder = new CursorBuilder( store, evaluatorBuilder );

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java?rev=1208343&r1=1208342&r2=1208343&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
Wed Nov 30 09:32:51 2011
@@ -137,7 +137,7 @@ public class PresenceTest
 
         store.initialize();
 
-        XdbmStoreUtils.loadExampleData( ( Store )store, schemaManager );
+        XdbmStoreUtils.loadExampleData( store, schemaManager );
         
         LOG.debug( "Created new store" );
     }

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java?rev=1208343&r1=1208342&r2=1208343&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
Wed Nov 30 09:32:51 2011
@@ -133,7 +133,7 @@ public class SubstringTest
 
         store.initialize();
 
-        XdbmStoreUtils.loadExampleData( ( Store )store, schemaManager );
+        XdbmStoreUtils.loadExampleData( store, schemaManager );
         
         LOG.debug( "Created new store" );
     }

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java?rev=1208343&r1=1208342&r2=1208343&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
Wed Nov 30 09:32:51 2011
@@ -141,7 +141,7 @@ public class SubtreeScopeTest
 
         store.initialize();
 
-        XdbmStoreUtils.loadExampleData( ( Store )store, schemaManager );
+        XdbmStoreUtils.loadExampleData( store, schemaManager );
         
         LOG.debug( "Created new store" );
     }
@@ -642,7 +642,7 @@ public class SubtreeScopeTest
         entry.add( "entryUUID", Strings.getUUIDString( 12 ).toString() );
 
         AddOperationContext addContext = new AddOperationContext( null, entry );
-        ((Partition)store).add( addContext );
+        OperationExecutionManagerFactory.instance().add( store, addContext );
 
         dn = new Dn( schemaManager, SchemaConstants.CN_AT_OID + "=jdoe," + SchemaConstants.OU_AT_OID
+ "=board of directors,"
             + SchemaConstants.O_AT_OID + "=good times co." );
@@ -655,7 +655,7 @@ public class SubtreeScopeTest
         entry.add( "entryUUID", Strings.getUUIDString( 13 ).toString() );
         
         addContext = new AddOperationContext( null, entry );
-        ((Partition)store).add( addContext );
+        OperationExecutionManagerFactory.instance().add( store, addContext );
 
         ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING, new Dn( SchemaConstants.OU_AT_OID
             + "=board of directors," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.SUBTREE
);



Mime
View raw message