directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1214091 [3/3] - in /directory/apacheds/branches/apacheds-txns/xdbm-partition/src: main/java/org/apache/directory/server/core/partition/impl/avl/ main/java/org/apache/directory/server/core/partition/impl/btree/ main/java/org/apache/director...
Date Wed, 14 Dec 2011 08:09:38 GMT
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=1214091&r1=1214090&r2=1214091&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 Dec 14 08:09:37 2011
@@ -74,6 +74,9 @@ public class PresenceTest
     Partition store;
     static SchemaManager schemaManager = null;
 
+    /** txn and operation execution manager factories */
+    private static TxnManagerFactory txnManagerFactory;
+    private static OperationExecutionManagerFactory executionManagerFactory;
 
     @BeforeClass
     public static void setup() throws Exception
@@ -120,11 +123,11 @@ public class PresenceTest
         
         File logDir = new File( wkdir.getPath() + File.separatorChar + "txnlog" + File.separatorChar
);
         logDir.mkdirs();
-        TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
-        OperationExecutionManagerFactory.init();
+        txnManagerFactory = new TxnManagerFactory( logDir.getPath(), 1 << 13, 1 <<
14 );
+        executionManagerFactory = new OperationExecutionManagerFactory( txnManagerFactory
);
 
         // initialize the store
-        store = new AvlPartition( schemaManager );
+        store = new AvlPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         store.setId( "example" );
         ( ( Store )store).setCacheSize( 10 );
         ( ( Store )store).setPartitionPath( wkdir.toURI() );
@@ -137,7 +140,7 @@ public class PresenceTest
 
         store.initialize();
 
-        XdbmStoreUtils.loadExampleData( store, schemaManager );
+        XdbmStoreUtils.loadExampleData( store, schemaManager, executionManagerFactory.instance()
);
         
         LOG.debug( "Created new store" );
     }
@@ -165,8 +168,8 @@ public class PresenceTest
     public void testIndexedServerEntry() throws Exception
     {
         PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "cn" ) );
-        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
-        PresenceCursor cursor = new PresenceCursor( store, evaluator );
+        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        PresenceCursor cursor = new PresenceCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         assertEquals( node, evaluator.getExpression() );
 
@@ -232,8 +235,8 @@ public class PresenceTest
         assertEquals( SchemaConstants.CN_AT_OID, cursor.get().getValue() );
 
         node = new PresenceNode( schemaManager.getAttributeType( "ou" ) );
-        evaluator = new PresenceEvaluator( node, store, schemaManager );
-        cursor = new PresenceCursor( store, evaluator );
+        evaluator = new PresenceEvaluator( node, store, schemaManager, txnManagerFactory,
executionManagerFactory );
+        cursor = new PresenceCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
 
         cursor.beforeFirst();
         assertTrue( cursor.next() );
@@ -284,8 +287,8 @@ public class PresenceTest
     public void testSystemIndexedServerEntry( String oid ) throws Exception
     {
         PresenceNode node = new PresenceNode( schemaManager.getAttributeType( oid ) );
-        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
-        PresenceCursor cursor = new PresenceCursor( store, evaluator );
+        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        PresenceCursor cursor = new PresenceCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         assertEquals( node, evaluator.getExpression() );
 
@@ -306,8 +309,8 @@ public class PresenceTest
     public void testNonIndexedServerEntry() throws Exception
     {
         PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
-        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
-        PresenceCursor cursor = new PresenceCursor( store, evaluator );
+        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        PresenceCursor cursor = new PresenceCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         assertEquals( node, evaluator.getExpression() );
 
@@ -367,8 +370,8 @@ public class PresenceTest
         // ----------- organizationName attribute
 
         node = new PresenceNode( schemaManager.getAttributeType( "o" ) );
-        evaluator = new PresenceEvaluator( node, store, schemaManager );
-        cursor = new PresenceCursor( store, evaluator );
+        evaluator = new PresenceEvaluator( node, store, schemaManager, txnManagerFactory,
executionManagerFactory );
+        cursor = new PresenceCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
 
         cursor.beforeFirst();
         assertTrue( cursor.next() );
@@ -387,7 +390,7 @@ public class PresenceTest
     public void testEvaluatorIndexed() throws Exception
     {
         PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "cn" ) );
-        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
+        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
         ForwardIndexEntry<String> entry = new ForwardIndexEntry<String>();
         entry.setValue( SchemaConstants.CN_AT_OID );
         entry.setId( Strings.getUUIDString( 3 ) );
@@ -411,7 +414,7 @@ public class PresenceTest
     private void testEvaluatorSystemIndexed( String oid ) throws Exception
     {
         PresenceNode node = new PresenceNode( schemaManager.getAttributeType( oid ) );
-        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
+        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
 
         ForwardIndexEntry<String> entry = new ForwardIndexEntry<String>();
         // no need to set a value or id, because the evaluator must always evaluate to true
@@ -429,7 +432,7 @@ public class PresenceTest
     public void testEvaluatorNotIndexed() throws Exception
     {
         PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "name" ) );
-        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
+        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
         ForwardIndexEntry<String> entry = new ForwardIndexEntry<String>();
         entry.setValue( SchemaConstants.NAME_AT_OID );
         entry.setId( Strings.getUUIDString( 3 ) );
@@ -440,7 +443,7 @@ public class PresenceTest
         assertTrue( evaluator.evaluate( entry ) );
 
         node = new PresenceNode( schemaManager.getAttributeType( "searchGuide" ) );
-        evaluator = new PresenceEvaluator( node, store, schemaManager );
+        evaluator = new PresenceEvaluator( node, store, schemaManager, txnManagerFactory,
executionManagerFactory );
         entry = new ForwardIndexEntry<String>();
         entry.setValue( SchemaConstants.SEARCHGUIDE_AT_OID );
         entry.setId( Strings.getUUIDString( 3 ) );
@@ -452,7 +455,7 @@ public class PresenceTest
         assertFalse( evaluator.evaluate( entry ) );
 
         node = new PresenceNode( schemaManager.getAttributeType( "st" ) );
-        evaluator = new PresenceEvaluator( node, store, schemaManager );
+        evaluator = new PresenceEvaluator( node, store, schemaManager, txnManagerFactory,
executionManagerFactory );
         entry = new ForwardIndexEntry<String>();
         entry.setValue( SchemaConstants.ST_AT_OID );
         entry.setId( Strings.getUUIDString( 3 ) );
@@ -469,8 +472,8 @@ public class PresenceTest
     public void testInvalidCursorPositionException() throws Exception
     {
         PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
-        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
-        PresenceCursor cursor = new PresenceCursor( store, evaluator );
+        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        PresenceCursor cursor = new PresenceCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
         cursor.get();
     }
 
@@ -479,8 +482,8 @@ public class PresenceTest
     public void testInvalidCursorPositionException2() throws Exception
     {
         PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "cn" ) );
-        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
-        PresenceCursor cursor = new PresenceCursor( store, evaluator );
+        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        PresenceCursor cursor = new PresenceCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
         cursor.get();
     }
 
@@ -489,8 +492,8 @@ public class PresenceTest
     public void testUnsupportBeforeWithoutIndex() throws Exception
     {
         PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
-        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
-        PresenceCursor cursor = new PresenceCursor( store, evaluator );
+        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        PresenceCursor cursor = new PresenceCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         // test before()
         ForwardIndexEntry<String> entry = new ForwardIndexEntry<String>();
@@ -503,8 +506,8 @@ public class PresenceTest
     public void testUnsupportAfterWithoutIndex() throws Exception
     {
         PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
-        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
-        PresenceCursor cursor = new PresenceCursor( store, evaluator );
+        PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        PresenceCursor cursor = new PresenceCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         // test before()
         ForwardIndexEntry<String> entry = new ForwardIndexEntry<String>();

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=1214091&r1=1214090&r2=1214091&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 Dec 14 08:09:37 2011
@@ -68,6 +68,10 @@ public class SubstringTest
     File wkdir;
     Partition store;
     static SchemaManager schemaManager = null;
+    
+    /** txn and operation execution manager factories */
+    private static TxnManagerFactory txnManagerFactory;
+    private static OperationExecutionManagerFactory executionManagerFactory;
 
 
     @BeforeClass
@@ -115,11 +119,11 @@ public class SubstringTest
 
         File logDir = new File( wkdir.getPath() + File.separatorChar + "txnlog" + File.separatorChar
);
         logDir.mkdirs();
-        TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
-        OperationExecutionManagerFactory.init();
+        txnManagerFactory = new TxnManagerFactory( logDir.getPath(), 1 << 13, 1 <<
14 );
+        executionManagerFactory = new OperationExecutionManagerFactory( txnManagerFactory
);
         
         // initialize the store
-        store = new AvlPartition( schemaManager );
+        store = new AvlPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         store.setId( "example" );
         ( (Store )store ).setCacheSize( 10 );
         ( (Store )store ).setPartitionPath( wkdir.toURI() );
@@ -133,7 +137,7 @@ public class SubstringTest
 
         store.initialize();
 
-        XdbmStoreUtils.loadExampleData( store, schemaManager );
+        XdbmStoreUtils.loadExampleData( store, schemaManager, executionManagerFactory.instance()
);
         
         LOG.debug( "Created new store" );
     }
@@ -161,8 +165,8 @@ public class SubstringTest
     public void testIndexedCnStartsWithJ() throws Exception
     {
         SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "cn" ), "j",
null );
-        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager
);
-        SubstringCursor cursor = new SubstringCursor( store, evaluator );
+        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        SubstringCursor cursor = new SubstringCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         assertEquals( node, evaluator.getExpression() );
 
@@ -204,7 +208,7 @@ public class SubstringTest
 
         // ---------- test first ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.first();
 
         assertTrue( cursor.available() );
@@ -238,7 +242,7 @@ public class SubstringTest
 
         // ---------- test afterLast ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.afterLast();
         assertFalse( cursor.available() );
 
@@ -274,7 +278,7 @@ public class SubstringTest
 
         // ---------- test last ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.last();
         assertTrue( cursor.available() );
 
@@ -312,8 +316,8 @@ public class SubstringTest
     public void testIndexedCnStartsWithJim() throws Exception
     {
         SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "cn" ), "jim",
null );
-        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager
);
-        SubstringCursor cursor = new SubstringCursor( store, evaluator );
+        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        SubstringCursor cursor = new SubstringCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         assertEquals( node, evaluator.getExpression() );
 
@@ -337,7 +341,7 @@ public class SubstringTest
 
         // ---------- test first ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.first();
 
         assertTrue( cursor.available() );
@@ -357,7 +361,7 @@ public class SubstringTest
 
         // ---------- test afterLast ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.afterLast();
         assertFalse( cursor.available() );
 
@@ -379,7 +383,7 @@ public class SubstringTest
 
         // ---------- test last ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.last();
         assertTrue( cursor.available() );
 
@@ -403,8 +407,8 @@ public class SubstringTest
     public void testIndexedCnEndsWithBean() throws Exception
     {
         SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "cn" ), null,
"bean" );
-        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager
);
-        SubstringCursor cursor = new SubstringCursor( store, evaluator );
+        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        SubstringCursor cursor = new SubstringCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         assertEquals( node, evaluator.getExpression() );
 
@@ -428,7 +432,7 @@ public class SubstringTest
 
         // ---------- test first ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.first();
 
         assertTrue( cursor.available() );
@@ -448,7 +452,7 @@ public class SubstringTest
 
         // ---------- test afterLast ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.afterLast();
         assertFalse( cursor.available() );
 
@@ -470,7 +474,7 @@ public class SubstringTest
 
         // ---------- test last ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.last();
         assertTrue( cursor.available() );
 
@@ -494,8 +498,8 @@ public class SubstringTest
     public void testNonIndexedSnStartsWithB() throws Exception
     {
         SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "b",
null );
-        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager
);
-        SubstringCursor cursor = new SubstringCursor( store, evaluator );
+        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        SubstringCursor cursor = new SubstringCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         assertEquals( node, evaluator.getExpression() );
 
@@ -512,7 +516,7 @@ public class SubstringTest
 
         // ---------- test first ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.first();
 
         assertTrue( cursor.available() );
@@ -524,7 +528,7 @@ public class SubstringTest
 
         // ---------- test afterLast ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.afterLast();
         assertFalse( cursor.available() );
 
@@ -538,7 +542,7 @@ public class SubstringTest
 
         // ---------- test last ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.last();
         assertTrue( cursor.available() );
 
@@ -555,8 +559,8 @@ public class SubstringTest
     public void testIndexedSnEndsWithEr() throws Exception
     {
         SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "sn" ), null,
"er" );
-        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager
);
-        SubstringCursor cursor = new SubstringCursor( store, evaluator );
+        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        SubstringCursor cursor = new SubstringCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         assertEquals( node, evaluator.getExpression() );
 
@@ -572,7 +576,7 @@ public class SubstringTest
 
         // ---------- test first ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.first();
 
         assertTrue( cursor.available() );
@@ -584,7 +588,7 @@ public class SubstringTest
 
         // ---------- test afterLast ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.afterLast();
         assertFalse( cursor.available() );
 
@@ -598,7 +602,7 @@ public class SubstringTest
 
         // ---------- test last ----------
 
-        cursor = new SubstringCursor( store, evaluator );
+        cursor = new SubstringCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.last();
         assertTrue( cursor.available() );
 
@@ -615,7 +619,7 @@ public class SubstringTest
     public void testNonIndexedAttributes() throws Exception
     {
         SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "walk",
null );
-        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager
);
+        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
         ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
         indexEntry.setId( Strings.getUUIDString( 5 ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
@@ -627,35 +631,35 @@ public class SubstringTest
         assertFalse( evaluator.evaluate( indexEntry ) );
 
         node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "wa", null );
-        evaluator = new SubstringEvaluator( node, store, schemaManager );
+        evaluator = new SubstringEvaluator( node, store, schemaManager, txnManagerFactory,
executionManagerFactory );
         indexEntry = new ForwardIndexEntry<String>();
         indexEntry.setId( Strings.getUUIDString( 5 ) );
         indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 5 ) ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
         node = new SubstringNode( schemaManager.getAttributeType( "searchGuide" ), "j", null
);
-        evaluator = new SubstringEvaluator( node, store, schemaManager );
+        evaluator = new SubstringEvaluator( node, store, schemaManager, txnManagerFactory,
executionManagerFactory );
         indexEntry = new ForwardIndexEntry<String>();
         indexEntry.setId( Strings.getUUIDString( 6 ) );
         indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 6 ) ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
         node = new SubstringNode( schemaManager.getAttributeType( "st" ), "j", null );
-        evaluator = new SubstringEvaluator( node, store, schemaManager );
+        evaluator = new SubstringEvaluator( node, store, schemaManager, txnManagerFactory,
executionManagerFactory );
         indexEntry = new ForwardIndexEntry<String>();
         indexEntry.setId( Strings.getUUIDString( 6 ) );
         indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 6 ) ) );
         assertFalse( evaluator.evaluate( indexEntry ) );
 
         node = new SubstringNode( schemaManager.getAttributeType( "name" ), "j", null );
-        evaluator = new SubstringEvaluator( node, store, schemaManager );
+        evaluator = new SubstringEvaluator( node, store, schemaManager, txnManagerFactory,
executionManagerFactory );
         indexEntry = new ForwardIndexEntry<String>();
         indexEntry.setId( Strings.getUUIDString( 6 ) );
         indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 6 ) ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
         node = new SubstringNode( schemaManager.getAttributeType( "name" ), "s", null );
-        evaluator = new SubstringEvaluator( node, store, schemaManager );
+        evaluator = new SubstringEvaluator( node, store, schemaManager, txnManagerFactory,
executionManagerFactory );
         indexEntry = new ForwardIndexEntry<String>();
         indexEntry.setId( Strings.getUUIDString( 6 ) );
         indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 6 ) ) );
@@ -667,7 +671,7 @@ public class SubstringTest
     public void testEvaluatorIndexed() throws Exception
     {
         SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "cn" ), "jim",
null );
-        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager
);
+        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
         ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
         indexEntry.setId( Strings.getUUIDString( 6 ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
@@ -676,14 +680,14 @@ public class SubstringTest
         assertFalse( evaluator.evaluate( indexEntry ) );
 
         node = new SubstringNode( schemaManager.getAttributeType( "cn" ), "j", null );
-        evaluator = new SubstringEvaluator( node, store, schemaManager );
+        evaluator = new SubstringEvaluator( node, store, schemaManager, txnManagerFactory,
executionManagerFactory );
         indexEntry = new ForwardIndexEntry<String>();
         indexEntry.setId( Strings.getUUIDString( 6 ) );
         indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 6 ) ) );
         assertTrue( evaluator.evaluate( indexEntry ) );
 
         node = new SubstringNode( schemaManager.getAttributeType( "cn" ), "s", null );
-        evaluator = new SubstringEvaluator( node, store, schemaManager );
+        evaluator = new SubstringEvaluator( node, store, schemaManager, txnManagerFactory,
executionManagerFactory );
         indexEntry = new ForwardIndexEntry<String>();
         indexEntry.setId( Strings.getUUIDString( 6 ) );
         indexEntry.setEntry( store.getMasterTable().get( Strings.getUUIDString( 6 ) ) );
@@ -701,8 +705,8 @@ public class SubstringTest
     public void testInvalidCursorPositionException() throws Exception
     {
         SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "b",
null );
-        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager
);
-        SubstringCursor cursor = new SubstringCursor( store, evaluator );
+        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        SubstringCursor cursor = new SubstringCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
         cursor.get();
     }
 
@@ -711,8 +715,8 @@ public class SubstringTest
     public void testInvalidCursorPositionException2() throws Exception
     {
         SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "cn" ), "j",
null );
-        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager
);
-        SubstringCursor cursor = new SubstringCursor( store, evaluator );
+        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        SubstringCursor cursor = new SubstringCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
         cursor.get();
     }
 
@@ -721,8 +725,8 @@ public class SubstringTest
     public void testUnsupportBeforeWithoutIndex() throws Exception
     {
         SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "j",
null );
-        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager
);
-        SubstringCursor cursor = new SubstringCursor( store, evaluator );
+        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        SubstringCursor cursor = new SubstringCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         // test before()
         ForwardIndexEntry<String> entry = new ForwardIndexEntry<String>();
@@ -735,8 +739,8 @@ public class SubstringTest
     public void testUnsupportAfterWithoutIndex() throws Exception
     {
         SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "j",
null );
-        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager
);
-        SubstringCursor cursor = new SubstringCursor( store, evaluator );
+        SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager,
txnManagerFactory, executionManagerFactory );
+        SubstringCursor cursor = new SubstringCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         // test before()
         ForwardIndexEntry<String> entry = new ForwardIndexEntry<String>();

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=1214091&r1=1214090&r2=1214091&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 Dec 14 08:09:37 2011
@@ -77,6 +77,10 @@ public class SubtreeScopeTest
     File wkdir;
     Partition store;
     static SchemaManager schemaManager = null;
+    
+    /** txn and operation execution manager factories */
+    private static TxnManagerFactory txnManagerFactory;
+    private static OperationExecutionManagerFactory executionManagerFactory;
 
 
     @BeforeClass
@@ -124,11 +128,11 @@ public class SubtreeScopeTest
         
         File logDir = new File( wkdir.getPath() + File.separatorChar + "txnlog" + File.separatorChar
);
         logDir.mkdirs();
-        TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
-        OperationExecutionManagerFactory.init();
+        txnManagerFactory = new TxnManagerFactory( logDir.getPath(), 1 << 13, 1 <<
14 );
+        executionManagerFactory = new OperationExecutionManagerFactory( txnManagerFactory
);
 
         // initialize the store
-        store = new AvlPartition( schemaManager );
+        store = new AvlPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         store.setId( "example" );
         ( ( Store )store ).setCacheSize( 10 );
         ( ( Store )store ).setPartitionPath( wkdir.toURI() );
@@ -141,7 +145,7 @@ public class SubtreeScopeTest
 
         store.initialize();
 
-        XdbmStoreUtils.loadExampleData( store, schemaManager );
+        XdbmStoreUtils.loadExampleData( store, schemaManager, executionManagerFactory.instance()
);
         
         LOG.debug( "Created new store" );
     }
@@ -170,8 +174,8 @@ public class SubtreeScopeTest
     {
         ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, new Dn( SchemaConstants.OU_AT_OID
             + "=sales," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.SUBTREE
);
-        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node );
-        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator );
+        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node, txnManagerFactory,
executionManagerFactory );
+        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         // --------- Test beforeFirst() ---------
 
@@ -204,7 +208,7 @@ public class SubtreeScopeTest
 
         // --------- Test first() ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.first();
 
@@ -233,7 +237,7 @@ public class SubtreeScopeTest
 
         // --------- Test afterLast() ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.afterLast();
         assertFalse( cursor.available() );
 
@@ -263,7 +267,7 @@ public class SubtreeScopeTest
 
         // --------- Test last() ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.last();
 
@@ -292,7 +296,7 @@ public class SubtreeScopeTest
 
         // --------- Test previous() before positioning ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.previous();
 
@@ -326,8 +330,8 @@ public class SubtreeScopeTest
     {
         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
);
-        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node );
-        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator );
+        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node, txnManagerFactory,
executionManagerFactory );
+        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         // --------- Test beforeFirst() ---------
 
@@ -360,7 +364,7 @@ public class SubtreeScopeTest
 
         // --------- Test first() ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.first();
 
@@ -389,7 +393,7 @@ public class SubtreeScopeTest
 
         // --------- Test afterLast() ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.afterLast();
         assertFalse( cursor.available() );
 
@@ -419,7 +423,7 @@ public class SubtreeScopeTest
 
         // --------- Test last() ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.last();
 
@@ -448,7 +452,7 @@ public class SubtreeScopeTest
 
         // --------- Test previous() before positioning ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.previous();
 
@@ -477,7 +481,7 @@ public class SubtreeScopeTest
 
         // --------- Test next() before positioning ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.next();
 
@@ -512,8 +516,8 @@ public class SubtreeScopeTest
         ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING, new Dn( SchemaConstants.OU_AT_OID
             + "=apache," + SchemaConstants.OU_AT_OID + "=board of directors," + SchemaConstants.O_AT_OID
             + "=good times co." ), SearchScope.SUBTREE );
-        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node );
-        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator );
+        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node, txnManagerFactory,
executionManagerFactory );
+        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         // --------- Test beforeFirst() ---------
 
@@ -539,7 +543,7 @@ public class SubtreeScopeTest
 
         // --------- Test first() ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.first();
 
@@ -561,7 +565,7 @@ public class SubtreeScopeTest
 
         // --------- Test afterLast() ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.afterLast();
         assertFalse( cursor.available() );
 
@@ -584,7 +588,7 @@ public class SubtreeScopeTest
 
         // --------- Test last() ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.last();
 
@@ -606,7 +610,7 @@ public class SubtreeScopeTest
 
         // --------- Test previous() before positioning ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.previous();
 
@@ -642,7 +646,7 @@ public class SubtreeScopeTest
         entry.add( "entryUUID", Strings.getUUIDString( 12 ).toString() );
 
         AddOperationContext addContext = new AddOperationContext( null, entry );
-        OperationExecutionManagerFactory.instance().add( store, addContext );
+        executionManagerFactory.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,12 +659,12 @@ public class SubtreeScopeTest
         entry.add( "entryUUID", Strings.getUUIDString( 13 ).toString() );
         
         addContext = new AddOperationContext( null, entry );
-        OperationExecutionManagerFactory.instance().add( store, addContext );
+        executionManagerFactory.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
);
-        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node );
-        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator );
+        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node, txnManagerFactory,
executionManagerFactory );
+        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         // --------- Test beforeFirst() ---------
 
@@ -707,7 +711,7 @@ public class SubtreeScopeTest
 
         // --------- Test first() ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.first();
 
@@ -744,7 +748,7 @@ public class SubtreeScopeTest
 
         // --------- Test afterLast() ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         cursor.afterLast();
         assertFalse( cursor.available() );
 
@@ -788,7 +792,7 @@ public class SubtreeScopeTest
 
         // --------- Test last() ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.last();
 
@@ -831,7 +835,7 @@ public class SubtreeScopeTest
 
         // --------- Test previous() before positioning ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.previous();
 
@@ -874,7 +878,7 @@ public class SubtreeScopeTest
 
         // --------- Test next() before positioning ---------
 
-        cursor = new SubtreeScopeCursor( store, evaluator );
+        cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory
);
         assertFalse( cursor.available() );
         cursor.next();
 
@@ -922,7 +926,7 @@ public class SubtreeScopeTest
     {
         ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, new Dn( SchemaConstants.OU_AT_OID
             + "=sales," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.SUBTREE
);
-        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node );
+        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node, txnManagerFactory,
executionManagerFactory );
 
         ForwardIndexEntry<UUID> indexEntry = new ForwardIndexEntry<UUID>();
         indexEntry.setId( Strings.getUUIDString( 6 ) );
@@ -935,7 +939,7 @@ public class SubtreeScopeTest
     {
         ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_ALWAYS, new Dn( SchemaConstants.OU_AT_OID
             + "=engineering," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.SUBTREE
);
-        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node );
+        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node, txnManagerFactory,
executionManagerFactory );
         assertEquals( node, evaluator.getExpression() );
 
         /*
@@ -961,8 +965,8 @@ public class SubtreeScopeTest
     {
         ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, new Dn( SchemaConstants.OU_AT_OID
             + "=sales," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.SUBTREE
);
-        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node );
-        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator );
+        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node, txnManagerFactory,
executionManagerFactory );
+        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
         cursor.get();
     }
 
@@ -972,8 +976,8 @@ public class SubtreeScopeTest
     {
         ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, new Dn( SchemaConstants.OU_AT_OID
             + "=sales," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.SUBTREE
);
-        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node );
-        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator );
+        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node, txnManagerFactory,
executionManagerFactory );
+        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator, txnManagerFactory,
executionManagerFactory );
 
         // test before()
         ForwardIndexEntry<UUID> entry = new ForwardIndexEntry<UUID>();
@@ -987,8 +991,8 @@ public class SubtreeScopeTest
     {
         ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, new Dn( SchemaConstants.OU_AT_OID
             + "=sales," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.SUBTREE
);
-        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node );
-        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator );
+        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node, txnManagerFactory,
executionManagerFactory );
+        SubtreeScopeCursor cursor = new SubtreeScopeCursor( store, evaluator , txnManagerFactory,
executionManagerFactory );
 
         // test after()
         ForwardIndexEntry<UUID> entry = new ForwardIndexEntry<UUID>();
@@ -1002,7 +1006,7 @@ public class SubtreeScopeTest
     {
         ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, new Dn( SchemaConstants.OU_AT_OID
             + "=sales," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.ONELEVEL
);
-        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node );
+        SubtreeScopeEvaluator evaluator = new SubtreeScopeEvaluator( store, node, txnManagerFactory,
executionManagerFactory  );
         assertNull( evaluator );
     }
 }



Mime
View raw message