You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sa...@apache.org on 2011/12/14 09:09:38 UTC
svn commit: r1214091 [2/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...
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java Wed Dec 14 08:09:37 2011
@@ -28,10 +28,8 @@ import org.apache.directory.server.i18n.
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.api.partition.index.Index;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
-import org.apache.directory.server.core.api.partition.index.MasterTable;
-import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
-import org.apache.directory.server.xdbm.search.Evaluator;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.entry.Attribute;
import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -49,11 +47,8 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class SubstringEvaluator implements Evaluator<SubstringNode>
+public class SubstringEvaluator extends AbstractEvaluator<SubstringNode>
{
- /** Database used while evaluating candidates */
- private final Partition db;
-
/** Reference to the SchemaManager */
private final SchemaManager schemaManager;
@@ -71,9 +66,6 @@ public class SubstringEvaluator implemen
/** The index to use if any */
private final Index<String> idx;
-
- /** Master table */
- private final MasterTable masterTable;
/**
@@ -85,10 +77,12 @@ public class SubstringEvaluator implemen
* @throws Exception if there are failures accessing resources and the db
*/
@SuppressWarnings("unchecked")
- public SubstringEvaluator( SubstringNode node, Partition db, SchemaManager schemaManager )
+ public SubstringEvaluator( SubstringNode node, Partition db, SchemaManager schemaManager,
+ TxnManagerFactory txnManagerFactory,
+ OperationExecutionManagerFactory executionManagerFactory )
throws Exception
{
- this.db = db;
+ super( db, txnManagerFactory, executionManagerFactory );
this.node = node;
this.schemaManager = schemaManager;
this.attributeType = node.getAttributeType();
@@ -120,7 +114,6 @@ public class SubstringEvaluator implemen
regex = null;
}
- TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
if ( db.hasIndexOn( attributeType ) )
{
Index<?> index = db.getIndex( attributeType );
@@ -130,8 +123,6 @@ public class SubstringEvaluator implemen
{
idx = null;
}
-
- masterTable = txnLogManager.wrap( db.getSuffixDn(), db.getMasterTable() );
}
@@ -261,7 +252,7 @@ public class SubstringEvaluator implemen
// wrapper or the raw normalized value
private boolean evaluateWithoutIndex( UUID id ) throws Exception
{
- return evaluateWithoutIndex( masterTable.get( id ) );
+ return evaluateWithoutIndex( getEntry( id ) );
}
@@ -348,7 +339,7 @@ public class SubstringEvaluator implemen
// resuscitate the entry if it has not been and set entry in IndexEntry
if ( null == entry )
{
- entry = masterTable.get( indexEntry.getId() );
+ entry = getEntry( indexEntry.getId() );
indexEntry.setEntry( entry );
}
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java Wed Dec 14 08:09:37 2011
@@ -70,7 +70,10 @@ public class SubtreeScopeCursor extends
/** Alias idx if dereferencing aliases */
private Index<String> aliasIdx;
-
+ /** Txn and Operation Execution Factories */
+ private TxnManagerFactory txnManagerFactory;
+ private OperationExecutionManagerFactory executionManagerFactory;
+
/**
* Creates a Cursor over entries satisfying subtree level scope criteria.
@@ -80,16 +83,20 @@ public class SubtreeScopeCursor extends
* @throws Exception on db access failures
*/
@SuppressWarnings("unchecked")
- public SubtreeScopeCursor( Partition db, SubtreeScopeEvaluator evaluator )
+ public SubtreeScopeCursor( Partition db, SubtreeScopeEvaluator evaluator, TxnManagerFactory txnManagerFactory,
+ OperationExecutionManagerFactory executionManagerFactory )
throws Exception
{
- TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
+ this.txnManagerFactory = txnManagerFactory;
+ this.executionManagerFactory = executionManagerFactory;
+
+ TxnLogManager txnLogManager = txnManagerFactory.txnLogManagerInstance();
this.db = db;
this.evaluator = evaluator;
if ( evaluator.getBaseId().compareTo( getContextEntryId() ) == 0 )
{
- scopeCursor = new AllEntriesCursor( db );
+ scopeCursor = new AllEntriesCursor( db, txnManagerFactory, executionManagerFactory );
}
else
{
@@ -130,7 +137,7 @@ public class SubtreeScopeCursor extends
{
try
{
- this.contextEntryId = OperationExecutionManagerFactory.instance().getEntryId( db, db.getSuffixDn() );
+ this.contextEntryId = executionManagerFactory.instance().getEntryId( db, db.getSuffixDn() );
}
catch ( Exception e )
{
@@ -337,8 +344,8 @@ public class SubtreeScopeCursor extends
if ( cursor == dereferencedCursor )
{
- Dn aliasTargetDn = OperationExecutionManagerFactory.instance().buildEntryDn( db, indexEntry.getId() );
- TxnManagerFactory.txnLogManagerInstance().addRead( aliasTargetDn, SearchScope.OBJECT );
+ Dn aliasTargetDn = executionManagerFactory.instance().buildEntryDn( db, indexEntry.getId() );
+ txnManagerFactory.txnLogManagerInstance().addRead( aliasTargetDn, SearchScope.OBJECT );
}
return indexEntry;
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java Wed Dec 14 08:09:37 2011
@@ -27,10 +27,8 @@ import org.apache.directory.server.core.
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.core.api.partition.index.Index;
import org.apache.directory.server.core.api.partition.index.IndexEntry;
-import org.apache.directory.server.core.api.txn.TxnLogManager;
import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
-import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.search.Evaluator;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.filter.ScopeNode;
@@ -43,7 +41,7 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class SubtreeScopeEvaluator implements Evaluator<ScopeNode>
+public class SubtreeScopeEvaluator extends AbstractEvaluator<ScopeNode>
{
/** The ScopeNode containing initial search scope constraints */
private final ScopeNode node;
@@ -65,9 +63,6 @@ public class SubtreeScopeEvaluator imple
/** True if the scope requires alias dereferencing while searching */
private final boolean dereferencing;
-
- /** The entry database/store */
- private final Partition db;
/** One level idx */
private final Index<UUID> subLevelIdx;
@@ -87,9 +82,11 @@ public class SubtreeScopeEvaluator imple
* @throws Exception on db access failure
*/
@SuppressWarnings("unchecked")
- public SubtreeScopeEvaluator( Partition db, ScopeNode node ) throws Exception
+ public SubtreeScopeEvaluator( Partition db, ScopeNode node,
+ TxnManagerFactory txnManagerFactory,
+ OperationExecutionManagerFactory executionManagerFactory ) throws Exception
{
- this.db = db;
+ super( db, txnManagerFactory, executionManagerFactory );
this.node = node;
if ( node.getScope() != SearchScope.SUBTREE )
@@ -97,13 +94,12 @@ public class SubtreeScopeEvaluator imple
throw new IllegalStateException( I18n.err( I18n.ERR_727 ) );
}
- baseId = OperationExecutionManagerFactory.instance().getEntryId( db, node.getBaseDn() );
+ baseId = executionManager.getEntryId( db, node.getBaseDn() );
baseIsContextEntry = ( getContextEntryId().compareTo( baseId ) == 0 );
dereferencing = node.getDerefAliases().isDerefInSearching() || node.getDerefAliases().isDerefAlways();
Index<?> index;
- TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
index = db.getSystemIndex( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID );
subLevelIdx = ( Index<UUID> )txnLogManager.wrap( db.getSuffixDn(), index );
@@ -133,7 +129,7 @@ public class SubtreeScopeEvaluator imple
{
try
{
- this.contextEntryId = OperationExecutionManagerFactory.instance().getEntryId( db, db.getSuffixDn() );
+ this.contextEntryId = executionManager.getEntryId( db, db.getSuffixDn() );
}
catch ( Exception e )
{
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=1214091&r1=1214090&r2=1214091&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 Dec 14 08:09:37 2011
@@ -91,6 +91,10 @@ public class PartitionTest
/** Operation execution manager */
private static OperationExecutionManager executionManager;
+
+ /** txn and operation execution manager factories */
+ private static TxnManagerFactory txnManagerFactory;
+ private static OperationExecutionManagerFactory executionManagerFactory;
@BeforeClass
public static void setup() throws Exception
@@ -106,9 +110,9 @@ public class PartitionTest
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();
+ txnManagerFactory = new TxnManagerFactory( logDir.getPath(), 1 << 13, 1 << 14 );
+ executionManagerFactory = new OperationExecutionManagerFactory( txnManagerFactory );
+ executionManager = executionManagerFactory.instance();
File schemaRepository = new File( workingDirectory, "schema" );
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
@@ -135,7 +139,7 @@ public class PartitionTest
{
// initialize the partition
- partition = new AvlPartition( schemaManager );
+ partition = new AvlPartition( schemaManager, txnManagerFactory, executionManagerFactory );
partition.setId( "example" );
partition.setSyncOnWrite( false );
@@ -146,7 +150,7 @@ public class PartitionTest
partition.initialize();
- XdbmStoreUtils.loadExampleData( partition, schemaManager );
+ XdbmStoreUtils.loadExampleData( partition, schemaManager, executionManagerFactory.instance() );
LOG.debug( "Created new partition" );
}
@@ -395,7 +399,7 @@ public class PartitionTest
entry.add( "sn", "user sn" );
// add
- XdbmStoreUtils.injectEntryInStore( partition, entry, 12 );
+ XdbmStoreUtils.injectEntryInStore( partition, entry, 12, executionManagerFactory.instance() );
verifyParentId( dn );
// move
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=1214091&r1=1214090&r2=1214091&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 Dec 14 08:09:37 2011
@@ -23,6 +23,7 @@ package org.apache.directory.server.xdbm
import java.util.UUID;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.api.partition.OperationExecutionManager;
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;
@@ -60,7 +61,7 @@ public class XdbmStoreUtils
*/
//This will suppress PMD.AvoidUsingHardCodedIP warnings in this class
@SuppressWarnings("PMD.AvoidUsingHardCodedIP")
- public static void loadExampleData( Partition store, SchemaManager schemaManager ) throws Exception
+ public static void loadExampleData( Partition store, SchemaManager schemaManager, OperationExecutionManager executionManager ) throws Exception
{
int idx = 1;
Dn suffixDn = new Dn( schemaManager, "o=Good Times Co." );
@@ -71,7 +72,7 @@ public class XdbmStoreUtils
entry.add( "o", "Good Times Co." );
entry.add( "postalCode", "1" );
entry.add( "postOfficeBox", "1" );
- injectEntryInStore( store, entry, idx++ );
+ injectEntryInStore( store, entry, idx++, executionManager );
// Entry #2
Dn dn = new Dn( schemaManager, "ou=Sales,o=Good Times Co." );
@@ -80,7 +81,7 @@ public class XdbmStoreUtils
entry.add( "ou", "Sales" );
entry.add( "postalCode", "1" );
entry.add( "postOfficeBox", "1" );
- injectEntryInStore( store, entry, idx++ );
+ injectEntryInStore( store, entry, idx++, executionManager );
// Entry #3
dn = new Dn( schemaManager, "ou=Board of Directors,o=Good Times Co." );
@@ -89,7 +90,7 @@ public class XdbmStoreUtils
entry.add( "ou", "Board of Directors" );
entry.add( "postalCode", "1" );
entry.add( "postOfficeBox", "1" );
- injectEntryInStore( store, entry, idx++ );
+ injectEntryInStore( store, entry, idx++, executionManager );
// Entry #4
dn = new Dn( schemaManager, "ou=Engineering,o=Good Times Co." );
@@ -98,7 +99,7 @@ public class XdbmStoreUtils
entry.add( "ou", "Engineering" );
entry.add( "postalCode", "2" );
entry.add( "postOfficeBox", "2" );
- injectEntryInStore( store, entry, idx++ );
+ injectEntryInStore( store, entry, idx++, executionManager );
// Entry #5
dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
@@ -109,7 +110,7 @@ public class XdbmStoreUtils
entry.add( "sn", "WAlkeR" );
entry.add( "postalCode", "3" );
entry.add( "postOfficeBox", "3" );
- injectEntryInStore( store, entry, idx++ );
+ injectEntryInStore( store, entry, idx++, executionManager );
// Entry #6
dn = new Dn( schemaManager, "cn=JIM BEAN,ou=Sales,o=Good Times Co." );
@@ -120,7 +121,7 @@ public class XdbmStoreUtils
entry.add( "surName", "BEAN" );
entry.add( "postalCode", "4" );
entry.add( "postOfficeBox", "4" );
- injectEntryInStore( store, entry, idx++ );
+ injectEntryInStore( store, entry, idx++, executionManager );
// Entry #7
dn = new Dn( schemaManager, "ou=Apache,ou=Board of Directors,o=Good Times Co." );
@@ -129,7 +130,7 @@ public class XdbmStoreUtils
entry.add( "ou", "Apache" );
entry.add( "postalCode", "5" );
entry.add( "postOfficeBox", "5" );
- injectEntryInStore( store, entry, idx++ );
+ injectEntryInStore( store, entry, idx++, executionManager );
// Entry #8
dn = new Dn( schemaManager, "cn=Jack Daniels,ou=Engineering,o=Good Times Co." );
@@ -140,7 +141,7 @@ public class XdbmStoreUtils
entry.add( "SN", "Daniels" );
entry.add( "postalCode", "6" );
entry.add( "postOfficeBox", "6" );
- injectEntryInStore( store, entry, idx++ );
+ injectEntryInStore( store, entry, idx++, executionManager );
// aliases -------------
@@ -151,7 +152,7 @@ public class XdbmStoreUtils
entry.add( "ou", "Apache" );
entry.add( "commonName", "Jim Bean" );
entry.add( "aliasedObjectName", "cn=Jim Bean,ou=Sales,o=Good Times Co." );
- injectEntryInStore( store, entry, idx++ );
+ injectEntryInStore( store, entry, idx++, executionManager );
// Entry #10
dn = new Dn( schemaManager, "commonName=Jim Bean,ou=Board of Directors,o=Good Times Co." );
@@ -159,7 +160,7 @@ public class XdbmStoreUtils
entry.add( "objectClass", "top", "alias", "extensibleObject" );
entry.add( "commonName", "Jim Bean" );
entry.add( "aliasedObjectName", "cn=Jim Bean,ou=Sales,o=Good Times Co." );
- injectEntryInStore( store, entry, idx++ );
+ injectEntryInStore( store, entry, idx++, executionManager );
// Entry #11
dn = new Dn( schemaManager, "2.5.4.3=Johnny Walker,ou=Engineering,o=Good Times Co." );
@@ -168,7 +169,7 @@ public class XdbmStoreUtils
entry.add( "ou", "Engineering" );
entry.add( "2.5.4.3", "Johnny Walker" );
entry.add( "aliasedObjectName", "cn=Johnny Walker,ou=Sales,o=Good Times Co." );
- injectEntryInStore( store, entry, idx++ );
+ injectEntryInStore( store, entry, idx++, executionManager );
}
@@ -183,12 +184,13 @@ 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( Partition store, Entry entry, int idx ) throws Exception
+ public static void injectEntryInStore( Partition store, Entry entry, int idx,
+ OperationExecutionManager executionManager ) 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 );
- OperationExecutionManagerFactory.instance().add( store, addContext );
+ executionManager.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=1214091&r1=1214090&r2=1214091&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 Dec 14 08:09:37 2011
@@ -102,6 +102,10 @@ public class AvlPartitionTest
/** Operation execution manager */
private static OperationExecutionManager executionManager;
+
+ /** txn and operation execution manager factories */
+ private static TxnManagerFactory txnManagerFactory;
+ private static OperationExecutionManagerFactory executionManagerFactory;
@BeforeClass
public static void setup() throws Exception
@@ -117,9 +121,9 @@ public class AvlPartitionTest
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();
+ txnManagerFactory = new TxnManagerFactory( logDir.getPath(), 1 << 13, 1 << 14 );
+ executionManagerFactory = new OperationExecutionManagerFactory( txnManagerFactory );
+ executionManager = executionManagerFactory.instance();
File schemaRepository = new File( workingDirectory, "schema" );
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
@@ -148,7 +152,7 @@ public class AvlPartitionTest
public void createStore() throws Exception
{
// initialize the partition
- partition = new AvlPartition( schemaManager );
+ partition = new AvlPartition( schemaManager, txnManagerFactory, executionManagerFactory );
partition.setId( "example" );
partition.setSyncOnWrite( false );
@@ -158,7 +162,7 @@ public class AvlPartitionTest
partition.initialize();
- XdbmStoreUtils.loadExampleData( partition, schemaManager );
+ XdbmStoreUtils.loadExampleData( partition, schemaManager, executionManagerFactory.instance() );
LOG.debug( "Created new partition" );
}
@@ -173,7 +177,7 @@ public class AvlPartitionTest
@Test
public void testSimplePropertiesUnlocked() throws Exception
{
- AvlPartition avlPartition = new AvlPartition( schemaManager );
+ AvlPartition avlPartition = new AvlPartition( schemaManager, txnManagerFactory, executionManagerFactory );
avlPartition.setSyncOnWrite( true ); // for code coverage
assertNull( avlPartition.getAliasIndex() );
Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTxnTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTxnTest.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTxnTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTxnTest.java Wed Dec 14 08:09:37 2011
@@ -1,4 +1,22 @@
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.directory.server.xdbm.impl.avl;
import static org.junit.Assert.assertEquals;
@@ -51,6 +69,10 @@ public class AvlPartitionTxnTest
{
private static AvlPartition partition;
private static SchemaManager schemaManager = null;
+
+ /** txn and operation execution manager factories */
+ private static TxnManagerFactory txnManagerFactory;
+ private static OperationExecutionManagerFactory executionManagerFactory;
/** Operation execution manager */
@@ -76,10 +98,10 @@ public class AvlPartitionTxnTest
logDir = new File( workingDirectory + File.separatorChar + "txnlog" + File.separatorChar );
logDir.mkdirs();
- TxnManagerFactory.init( logDir.getPath(), 1 << 13, 1 << 14 );
- OperationExecutionManagerFactory.init();
- executionManager = OperationExecutionManagerFactory.instance();
- txnManager = TxnManagerFactory.txnManagerInstance();
+ txnManagerFactory = new TxnManagerFactory( logDir.getPath(), 1 << 13, 1 << 14 );
+ executionManagerFactory = new OperationExecutionManagerFactory( txnManagerFactory );
+ executionManager = executionManagerFactory.instance();
+ txnManager = txnManagerFactory.txnManagerInstance();
File schemaRepository = new File( workingDirectory, "schema" );
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
@@ -101,7 +123,7 @@ public class AvlPartitionTxnTest
public void createStore() throws Exception
{
// initialize the partition
- partition = new AvlPartition( schemaManager );
+ partition = new AvlPartition( schemaManager, txnManagerFactory, executionManagerFactory );
partition.setId( "example" );
partition.setSyncOnWrite( false );
@@ -114,7 +136,7 @@ public class AvlPartitionTxnTest
try
{
txnManager.beginTransaction( false );
- XdbmStoreUtils.loadExampleData( partition, schemaManager );
+ XdbmStoreUtils.loadExampleData( partition, schemaManager, executionManagerFactory.instance() );
txnManager.commitTransaction();
}
catch ( Exception e )
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=1214091&r1=1214090&r2=1214091&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 Dec 14 08:09:37 2011
@@ -80,6 +80,10 @@ public class AndCursorTest
EvaluatorBuilder evaluatorBuilder;
CursorBuilder cursorBuilder;
private static SchemaManager schemaManager;
+
+ /** txn and operation execution manager factories */
+ private static TxnManagerFactory txnManagerFactory;
+ private static OperationExecutionManagerFactory executionManagerFactory;
@BeforeClass
@@ -133,11 +137,11 @@ public class AndCursorTest
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 );
((Partition)store).setId( "example" );
store.setCacheSize( 10 );
store.setPartitionPath( wkdir.toURI() );
@@ -150,9 +154,9 @@ public class AndCursorTest
((Partition)store).initialize();
- XdbmStoreUtils.loadExampleData( ( Partition )store, schemaManager );
+ XdbmStoreUtils.loadExampleData( ( Partition )store, schemaManager, executionManagerFactory.instance() );
- evaluatorBuilder = new EvaluatorBuilder( ( Partition )store, schemaManager );
+ evaluatorBuilder = new EvaluatorBuilder( ( Partition )store, schemaManager, txnManagerFactory, executionManagerFactory );
cursorBuilder = new CursorBuilder( ( Partition )store, evaluatorBuilder );
LOG.debug( "Created new store" );
@@ -220,8 +224,8 @@ public class AndCursorTest
Evaluator<? extends ExprNode> eval;
ExprNode exprNode = new SubstringNode( schemaManager.getAttributeType( "cn" ), "J", null );
- eval = new SubstringEvaluator( (SubstringNode) exprNode, ( Partition )store, schemaManager );
- IndexCursor<?> wrapped = new SubstringCursor( ( Partition )store, ( SubstringEvaluator ) eval );
+ eval = new SubstringEvaluator( (SubstringNode) exprNode, ( Partition )store, schemaManager, txnManagerFactory, executionManagerFactory );
+ IndexCursor<?> wrapped = new SubstringCursor( ( Partition )store, ( SubstringEvaluator ) eval, txnManagerFactory, executionManagerFactory );
/* adding this results in NPE adding Presence evaluator not
Substring evaluator but adding Substring cursor as wrapped cursor */
@@ -230,7 +234,7 @@ public class AndCursorTest
andNode.addNode( exprNode );
exprNode = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
- eval = new PresenceEvaluator( (PresenceNode) exprNode, ( Partition )store, schemaManager );
+ eval = new PresenceEvaluator( (PresenceNode) exprNode, ( Partition )store, schemaManager, txnManagerFactory, executionManagerFactory );
evaluators.add( eval );
andNode.addNode( exprNode );
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=1214091&r1=1214090&r2=1214091&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 Dec 14 08:09:37 2011
@@ -84,6 +84,10 @@ public class GreaterEqTest
File wkdir;
Partition store;
static SchemaManager schemaManager = null;
+
+ /** txn and operation execution manager factories */
+ private static TxnManagerFactory txnManagerFactory;
+ private static OperationExecutionManagerFactory executionManagerFactory;
@BeforeClass
@@ -98,7 +102,7 @@ public class GreaterEqTest
int targetPos = path.indexOf( "target" );
workingDirectory = path.substring( 0, targetPos + 6 );
}
-
+
File schemaRepository = new File( workingDirectory, "schema" );
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy( true );
@@ -132,11 +136,11 @@ public class GreaterEqTest
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() );
@@ -148,7 +152,7 @@ public class GreaterEqTest
store.setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
store.initialize();
- XdbmStoreUtils.loadExampleData( store, schemaManager );
+ XdbmStoreUtils.loadExampleData( store, schemaManager, executionManagerFactory.instance() );
LOG.debug( "Created new store" );
}
@@ -176,8 +180,8 @@ public class GreaterEqTest
{
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTALCODE_AT_OID );
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "3" ) );
- GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
- GreaterEqCursor<String> cursor = new GreaterEqCursor<String>( store, evaluator );
+ GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
+ GreaterEqCursor<String> cursor = new GreaterEqCursor<String>( store, evaluator, txnManagerFactory, executionManagerFactory );
assertNotNull( cursor );
assertFalse( cursor.available() );
assertFalse( cursor.isClosed() );
@@ -225,7 +229,7 @@ public class GreaterEqTest
// ---------- test first() ----------
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.first();
@@ -255,7 +259,7 @@ public class GreaterEqTest
// ---------- test afterLast() ----------
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.afterLast();
assertFalse( cursor.available() );
@@ -287,7 +291,7 @@ public class GreaterEqTest
// ---------- test last() ----------
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.last();
@@ -317,7 +321,7 @@ public class GreaterEqTest
// ---------- test before() ----------
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "5" );
@@ -340,7 +344,7 @@ public class GreaterEqTest
cursor.close();
assertTrue( cursor.isClosed() );
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "7" );
cursor.before( indexEntry );
@@ -350,7 +354,7 @@ public class GreaterEqTest
assertEquals( "6", cursor.get().getValue() );
cursor.close();
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "3" );
cursor.before( indexEntry );
@@ -362,7 +366,7 @@ public class GreaterEqTest
// ---------- test after() ----------
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "4" );
@@ -385,7 +389,7 @@ public class GreaterEqTest
cursor.close();
assertTrue( cursor.isClosed() );
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "7" );
cursor.after( indexEntry );
@@ -395,7 +399,7 @@ public class GreaterEqTest
assertEquals( "6", cursor.get().getValue() );
cursor.close();
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "3" );
cursor.after( indexEntry );
@@ -412,8 +416,10 @@ public class GreaterEqTest
{
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTOFFICEBOX_AT_OID );
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "3" ) );
- GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
- GreaterEqCursor<String> cursor = new GreaterEqCursor<String>( store, evaluator );
+ GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager,
+ txnManagerFactory, executionManagerFactory );
+ GreaterEqCursor<String> cursor = new GreaterEqCursor<String>( store, evaluator,
+ txnManagerFactory, executionManagerFactory );
assertNotNull( cursor );
assertFalse( cursor.available() );
assertFalse( cursor.isClosed() );
@@ -455,7 +461,7 @@ public class GreaterEqTest
// ---------- test first() ----------
set.clear();
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.first();
assertTrue( cursor.available() );
@@ -481,7 +487,7 @@ public class GreaterEqTest
// ---------- test afterLast() ----------
set.clear();
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.afterLast();
assertFalse( cursor.available() );
@@ -502,7 +508,7 @@ public class GreaterEqTest
// ---------- test last() ----------
set.clear();
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.last();
assertTrue( cursor.available() );
@@ -524,7 +530,7 @@ public class GreaterEqTest
// ---------- test before() ----------
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "2" );
try
@@ -538,7 +544,7 @@ public class GreaterEqTest
// ---------- test after() ----------
- cursor = new GreaterEqCursor( store, evaluator );
+ cursor = new GreaterEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "2" );
try
@@ -561,7 +567,7 @@ public class GreaterEqTest
{
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTALCODE_AT_OID );
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "3" ) );
- GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
+ GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
@@ -606,7 +612,7 @@ public class GreaterEqTest
{
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.STREET_AT_OID );
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "2" ) );
- GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
+ GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.STREET_AT_OID, evaluator.getAttributeType().getOid() );
@@ -623,7 +629,7 @@ public class GreaterEqTest
attrs.add( "entryUUID", Strings.getUUIDString( 12 ).toString() );
AddOperationContext addContext = new AddOperationContext( null, attrs );
- OperationExecutionManagerFactory.instance().add( store, addContext );
+ executionManagerFactory.instance().add( store, addContext );
indexEntry.setId( Strings.getUUIDString( 12 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
@@ -636,7 +642,7 @@ public class GreaterEqTest
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.C_POSTALCODE_AT_OID );
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "2" ) );
- GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
+ GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.C_POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
@@ -654,7 +660,7 @@ public class GreaterEqTest
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTOFFICEBOX_AT_OID );
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "3" ) );
- GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
+ GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.POSTOFFICEBOX_AT_OID, evaluator.getAttributeType().getOid() );
@@ -709,7 +715,7 @@ public class GreaterEqTest
try
{
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "3" ) );
- new GreaterEqEvaluator( node, store, schemaManager );
+ new GreaterEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
}
finally
{
@@ -747,7 +753,7 @@ public class GreaterEqTest
//schemaManager.register( at.getSyntax().getSyntaxChecker() );
GreaterEqNode node = new GreaterEqNode( at, new StringValue( at, "3" ) );
- new GreaterEqEvaluator( node, store, schemaManager );
+ new GreaterEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
schemaManager.delete( at );
}
}
\ No newline at end of file
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=1214091&r1=1214090&r2=1214091&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 Dec 14 08:09:37 2011
@@ -84,6 +84,10 @@ public class LessEqTest
File wkdir;
Partition store;
static SchemaManager schemaManager = null;
+
+ /** txn and operation execution manager factories */
+ private static TxnManagerFactory txnManagerFactory;
+ private static OperationExecutionManagerFactory executionManagerFactory;
@BeforeClass
@@ -132,11 +136,11 @@ public class LessEqTest
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 );
((Partition)store).setId( "example" );
( ( Store ) store ).setCacheSize( 10 );
( ( Store ) store ).setPartitionPath( wkdir.toURI() );
@@ -150,7 +154,7 @@ public class LessEqTest
store.initialize();
- XdbmStoreUtils.loadExampleData( store, schemaManager );
+ XdbmStoreUtils.loadExampleData( store, schemaManager, executionManagerFactory.instance() );
LOG.debug( "Created new store" );
}
@@ -178,8 +182,8 @@ public class LessEqTest
{
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTALCODE_AT_OID );
LessEqNode node = new LessEqNode( at, new StringValue( at, "3" ) );
- LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
- LessEqCursor<String> cursor = new LessEqCursor<String>( store, evaluator );
+ LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
+ LessEqCursor<String> cursor = new LessEqCursor<String>( store, evaluator, txnManagerFactory, executionManagerFactory );
assertNotNull( cursor );
assertFalse( cursor.available() );
assertFalse( cursor.isClosed() );
@@ -232,7 +236,7 @@ public class LessEqTest
// ---------- test first() ----------
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.first();
@@ -267,7 +271,7 @@ public class LessEqTest
// ---------- test afterLast() ----------
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.afterLast();
assertFalse( cursor.available() );
@@ -304,7 +308,7 @@ public class LessEqTest
// ---------- test last() ----------
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.last();
@@ -339,7 +343,7 @@ public class LessEqTest
// ---------- test before() ----------
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "2" );
@@ -362,7 +366,7 @@ public class LessEqTest
cursor.close();
assertTrue( cursor.isClosed() );
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "7" );
cursor.before( indexEntry );
@@ -372,7 +376,7 @@ public class LessEqTest
assertEquals( "3", cursor.get().getValue() );
cursor.close();
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory);
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "3" );
cursor.before( indexEntry );
@@ -384,7 +388,7 @@ public class LessEqTest
// ---------- test after() ----------
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "1" );
@@ -407,7 +411,7 @@ public class LessEqTest
cursor.close();
assertTrue( cursor.isClosed() );
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "7" );
cursor.after( indexEntry );
@@ -417,7 +421,7 @@ public class LessEqTest
assertEquals( "3", cursor.get().getValue() );
cursor.close();
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "3" );
cursor.after( indexEntry );
@@ -434,8 +438,8 @@ public class LessEqTest
{
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTOFFICEBOX_AT_OID );
LessEqNode node = new LessEqNode( at, new StringValue( at, "3" ) );
- LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
- LessEqCursor<String> cursor = new LessEqCursor<String>( store, evaluator );
+ LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
+ LessEqCursor<String> cursor = new LessEqCursor<String>( store, evaluator, txnManagerFactory, executionManagerFactory );
assertNotNull( cursor );
assertFalse( cursor.available() );
assertFalse( cursor.isClosed() );
@@ -478,7 +482,7 @@ public class LessEqTest
// ---------- test beforeFirst() ----------
set.clear();
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.first();
assertTrue( cursor.available() );
@@ -505,7 +509,7 @@ public class LessEqTest
// ---------- test afterLast() ----------
set.clear();
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.afterLast();
assertFalse( cursor.available() );
@@ -527,7 +531,7 @@ public class LessEqTest
// ---------- test last() ----------
set.clear();
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.last();
assertTrue( cursor.available() );
@@ -550,7 +554,7 @@ public class LessEqTest
// ---------- test before() ----------
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "2" );
try
@@ -564,7 +568,7 @@ public class LessEqTest
// ---------- test after() ----------
- cursor = new LessEqCursor( store, evaluator );
+ cursor = new LessEqCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
indexEntry = new ForwardIndexEntry<String>();
indexEntry.setValue( "2" );
try
@@ -588,7 +592,7 @@ public class LessEqTest
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTALCODE_AT_OID );
LessEqNode node = new LessEqNode( at, new StringValue( at, "3" ) );
- LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
+ LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
@@ -634,7 +638,7 @@ public class LessEqTest
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.STREET_AT_OID );
LessEqNode node = new LessEqNode( at, new StringValue( at, "2" ) );
- LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
+ LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.STREET_AT_OID, evaluator.getAttributeType().getOid() );
@@ -651,7 +655,7 @@ public class LessEqTest
attrs.add( "entryUUID", Strings.getUUIDString( 12 ).toString() );
AddOperationContext addContext = new AddOperationContext( null, attrs );
- OperationExecutionManagerFactory.instance().add( store, addContext );
+ executionManagerFactory.instance().add( store, addContext );
indexEntry.setId( Strings.getUUIDString( 12 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
@@ -664,7 +668,7 @@ public class LessEqTest
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.C_POSTALCODE_AT_OID );
LessEqNode node = new LessEqNode( at, new StringValue( at, "2" ) );
- LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
+ LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.C_POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
@@ -682,7 +686,7 @@ public class LessEqTest
AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTOFFICEBOX_AT_OID );
LessEqNode node = new LessEqNode( at, new StringValue( at, "3" ) );
- LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
+ LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.POSTOFFICEBOX_AT_OID, evaluator.getAttributeType().getOid() );
@@ -738,7 +742,7 @@ public class LessEqTest
{
LessEqNode node = new LessEqNode( at, new StringValue( at, "3" ) );
- new LessEqEvaluator( node, store, schemaManager );
+ new LessEqEvaluator( node, store, schemaManager , txnManagerFactory, executionManagerFactory );
}
finally
{
@@ -776,7 +780,7 @@ public class LessEqTest
desc.setObsolete( false );
LessEqNode node = new LessEqNode( at, new StringValue( at, "3" ) );
- new LessEqEvaluator( node, store, schemaManager );
+ new LessEqEvaluator( node, store, schemaManager, txnManagerFactory, executionManagerFactory );
schemaManager.delete( at );
}
}
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=1214091&r1=1214090&r2=1214091&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 Dec 14 08:09:37 2011
@@ -80,6 +80,10 @@ public class NestedFilterTest
CursorBuilder cursorBuilder;
Optimizer optimizer;
static FilterNormalizingVisitor visitor;
+
+ /** txn and operation execution manager factories */
+ private static TxnManagerFactory txnManagerFactory;
+ private static OperationExecutionManagerFactory executionManagerFactory;
@BeforeClass
@@ -131,11 +135,11 @@ public class NestedFilterTest
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 );
((Partition)store).setId( "example" );
store.setCacheSize( 10 );
store.setPartitionPath( wkdir.toURI() );
@@ -146,11 +150,11 @@ public class NestedFilterTest
((Partition)store).setSuffixDn( new Dn( schemaManager, "o=Good Times Co." ) );
((Partition)store).initialize();
- XdbmStoreUtils.loadExampleData( ( Partition )store, schemaManager );
+ XdbmStoreUtils.loadExampleData( ( Partition )store, schemaManager, executionManagerFactory.instance() );
- evaluatorBuilder = new EvaluatorBuilder( ( Partition )store, schemaManager );
+ evaluatorBuilder = new EvaluatorBuilder( ( Partition )store, schemaManager, txnManagerFactory, executionManagerFactory );
cursorBuilder = new CursorBuilder( ( Partition )store, evaluatorBuilder );
- optimizer = new DefaultOptimizer( ( Partition )store );
+ optimizer = new DefaultOptimizer( ( Partition )store, txnManagerFactory, executionManagerFactory );
LOG.debug( "Created new store" );
}
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=1214091&r1=1214090&r2=1214091&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 Dec 14 08:09:37 2011
@@ -82,6 +82,10 @@ public class NotCursorTest
static SchemaManager schemaManager = null;
EvaluatorBuilder evaluatorBuilder;
CursorBuilder cursorBuilder;
+
+ /** txn and operation execution manager factories */
+ private static TxnManagerFactory txnManagerFactory;
+ private static OperationExecutionManagerFactory executionManagerFactory;
@BeforeClass
@@ -130,11 +134,11 @@ public class NotCursorTest
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 );
((Partition)store).setId( "example" );
store.setCacheSize( 10 );
store.setPartitionPath( wkdir.toURI() );
@@ -147,9 +151,9 @@ public class NotCursorTest
((Partition)store).initialize();
- XdbmStoreUtils.loadExampleData( ( Partition )store, schemaManager );
+ XdbmStoreUtils.loadExampleData( ( Partition )store, schemaManager, executionManagerFactory.instance() );
- evaluatorBuilder = new EvaluatorBuilder( ( Partition )store, schemaManager );
+ evaluatorBuilder = new EvaluatorBuilder( ( Partition )store, schemaManager, txnManagerFactory, executionManagerFactory );
cursorBuilder = new CursorBuilder( ( Partition )store, evaluatorBuilder );
LOG.debug( "Created new store" );
@@ -217,10 +221,11 @@ public class NotCursorTest
ExprNode exprNode = new SubstringNode( schemaManager.getAttributeType( "cn" ), "J", null );
Evaluator<? extends ExprNode> eval = new SubstringEvaluator( (SubstringNode) exprNode, ( Partition )store,
- schemaManager );
+ schemaManager, txnManagerFactory, executionManagerFactory );
notNode.addNode( exprNode );
- NotCursor<String> cursor = new NotCursor( ( Partition )store, eval ); //cursorBuilder.build( andNode );
+ NotCursor<String> cursor = new NotCursor( ( Partition )store, eval,
+ txnManagerFactory, executionManagerFactory ); //cursorBuilder.build( andNode );
cursor.beforeFirst();
Set<UUID> set = new HashSet<UUID>();
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=1214091&r1=1214090&r2=1214091&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 Dec 14 08:09:37 2011
@@ -76,6 +76,10 @@ public class OneLevelScopeTest
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 OneLevelScopeTest
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 OneLevelScopeTest
store.initialize();
- XdbmStoreUtils.loadExampleData( store, schemaManager );
+ XdbmStoreUtils.loadExampleData( store, schemaManager, executionManagerFactory.instance() );
LOG.debug( "Created new store" );
}
@@ -170,8 +174,8 @@ public class OneLevelScopeTest
ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, new Dn( SchemaConstants.OU_AT_OID
+ "=sales," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.ONELEVEL );
OneLevelScopeEvaluator evaluator = new OneLevelScopeEvaluator( store,
- node );
- OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
+ node, txnManagerFactory, executionManagerFactory );
+ OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
// --------- Test beforeFirst() ---------
@@ -197,7 +201,7 @@ public class OneLevelScopeTest
// --------- Test first() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.first();
@@ -220,7 +224,7 @@ public class OneLevelScopeTest
// --------- Test afterLast() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.afterLast();
assertFalse( cursor.available() );
@@ -244,7 +248,7 @@ public class OneLevelScopeTest
// --------- Test last() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.last();
@@ -266,7 +270,7 @@ public class OneLevelScopeTest
// --------- Test previous() before positioning ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.previous();
@@ -288,7 +292,7 @@ public class OneLevelScopeTest
// --------- Test next() before positioning ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.next();
@@ -316,8 +320,8 @@ public class OneLevelScopeTest
ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, new Dn( SchemaConstants.OU_AT_OID
+ "=engineering," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.ONELEVEL );
OneLevelScopeEvaluator evaluator = new OneLevelScopeEvaluator( store,
- node );
- OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
+ node, txnManagerFactory, executionManagerFactory );
+ OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
// --------- Test beforeFirst() ---------
cursor.beforeFirst();
@@ -342,7 +346,7 @@ public class OneLevelScopeTest
// --------- Test first() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.first();
@@ -364,7 +368,7 @@ public class OneLevelScopeTest
// --------- Test afterLast() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.afterLast();
assertFalse( cursor.available() );
@@ -387,7 +391,7 @@ public class OneLevelScopeTest
// --------- Test last() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.last();
@@ -409,7 +413,7 @@ public class OneLevelScopeTest
// --------- Test previous() before positioning ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.previous();
@@ -431,7 +435,7 @@ public class OneLevelScopeTest
// --------- Test next() before positioning ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.next();
@@ -459,8 +463,8 @@ public class OneLevelScopeTest
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 );
OneLevelScopeEvaluator evaluator = new OneLevelScopeEvaluator( store,
- node );
- OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
+ node , txnManagerFactory, executionManagerFactory );
+ OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
// --------- Test beforeFirst() ---------
@@ -486,7 +490,7 @@ public class OneLevelScopeTest
// --------- Test first() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.first();
@@ -508,7 +512,7 @@ public class OneLevelScopeTest
// --------- Test afterLast() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.afterLast();
assertFalse( cursor.available() );
@@ -531,7 +535,7 @@ public class OneLevelScopeTest
// --------- Test last() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.last();
@@ -553,7 +557,7 @@ public class OneLevelScopeTest
// --------- Test previous() before positioning ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.previous();
@@ -582,8 +586,8 @@ public class OneLevelScopeTest
+ "=apache," + SchemaConstants.OU_AT_OID + "=board of directors," + SchemaConstants.O_AT_OID
+ "=good times co." ), SearchScope.ONELEVEL );
OneLevelScopeEvaluator evaluator = new OneLevelScopeEvaluator( store,
- node );
- OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
+ node, txnManagerFactory, executionManagerFactory );
+ OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
// --------- Test beforeFirst() ---------
@@ -602,7 +606,7 @@ public class OneLevelScopeTest
// --------- Test first() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.first();
@@ -617,7 +621,7 @@ public class OneLevelScopeTest
// --------- Test afterLast() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.afterLast();
assertFalse( cursor.available() );
@@ -633,7 +637,7 @@ public class OneLevelScopeTest
// --------- Test last() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.last();
@@ -648,7 +652,7 @@ public class OneLevelScopeTest
// --------- Test previous() before positioning ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.previous();
@@ -677,7 +681,7 @@ public class OneLevelScopeTest
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." );
@@ -690,13 +694,13 @@ public class OneLevelScopeTest
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.ONELEVEL );
OneLevelScopeEvaluator evaluator = new OneLevelScopeEvaluator( store,
- node );
- OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
+ node, txnManagerFactory, executionManagerFactory );
+ OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
// --------- Test beforeFirst() ---------
@@ -736,7 +740,7 @@ public class OneLevelScopeTest
// --------- Test first() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.first();
@@ -770,7 +774,7 @@ public class OneLevelScopeTest
// --------- Test afterLast() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.afterLast();
assertFalse( cursor.available() );
@@ -807,7 +811,7 @@ public class OneLevelScopeTest
// --------- Test last() ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.last();
@@ -843,7 +847,7 @@ public class OneLevelScopeTest
// --------- Test previous() before positioning ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.previous();
@@ -879,7 +883,7 @@ public class OneLevelScopeTest
// --------- Test next() before positioning ---------
- cursor = new OneLevelScopeCursor( store, evaluator );
+ cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
assertFalse( cursor.available() );
cursor.next();
@@ -921,7 +925,7 @@ public class OneLevelScopeTest
ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, new Dn( SchemaConstants.OU_AT_OID
+ "=sales," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.ONELEVEL );
OneLevelScopeEvaluator evaluator = new OneLevelScopeEvaluator( store,
- node );
+ node, txnManagerFactory, executionManagerFactory );
ForwardIndexEntry<UUID> indexEntry = new ForwardIndexEntry<UUID>();
indexEntry.setId( Strings.getUUIDString( 6 ) );
@@ -935,7 +939,7 @@ public class OneLevelScopeTest
ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_ALWAYS, new Dn( SchemaConstants.OU_AT_OID
+ "=engineering," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.ONELEVEL );
OneLevelScopeEvaluator evaluator = new OneLevelScopeEvaluator( store,
- node );
+ node, txnManagerFactory, executionManagerFactory );
assertEquals( node, evaluator.getExpression() );
/*
@@ -967,8 +971,8 @@ public class OneLevelScopeTest
ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, new Dn( SchemaConstants.OU_AT_OID
+ "=sales," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.ONELEVEL );
OneLevelScopeEvaluator evaluator = new OneLevelScopeEvaluator( store,
- node );
- OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
+ node, txnManagerFactory, executionManagerFactory );
+ OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
cursor.get();
}
@@ -979,8 +983,8 @@ public class OneLevelScopeTest
ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, new Dn( SchemaConstants.OU_AT_OID
+ "=sales," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.ONELEVEL );
OneLevelScopeEvaluator evaluator = new OneLevelScopeEvaluator( store,
- node );
- OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
+ node, txnManagerFactory, executionManagerFactory );
+ OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
// test before()
ForwardIndexEntry<UUID> entry = new ForwardIndexEntry<UUID>();
@@ -995,8 +999,8 @@ public class OneLevelScopeTest
ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, new Dn( SchemaConstants.OU_AT_OID
+ "=sales," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.ONELEVEL );
OneLevelScopeEvaluator evaluator = new OneLevelScopeEvaluator( store,
- node );
- OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
+ node, txnManagerFactory, executionManagerFactory );
+ OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator, txnManagerFactory, executionManagerFactory );
// test after()
ForwardIndexEntry<UUID> entry = new ForwardIndexEntry<UUID>();
@@ -1010,6 +1014,6 @@ public class OneLevelScopeTest
{
ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, new Dn( SchemaConstants.OU_AT_OID
+ "=sales," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.SUBTREE );
- new OneLevelScopeEvaluator( store, node );
+ new OneLevelScopeEvaluator( store, node, txnManagerFactory, executionManagerFactory );
}
}
\ No newline at end of file
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=1214091&r1=1214090&r2=1214091&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 Dec 14 08:09:37 2011
@@ -84,6 +84,10 @@ public class OrCursorTest
static SchemaManager schemaManager = null;
EvaluatorBuilder evaluatorBuilder;
CursorBuilder cursorBuilder;
+
+ /** txn and operation execution manager factories */
+ private static TxnManagerFactory txnManagerFactory;
+ private static OperationExecutionManagerFactory executionManagerFactory;
@BeforeClass
@@ -131,11 +135,11 @@ public class OrCursorTest
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() );
@@ -148,9 +152,9 @@ public class OrCursorTest
store.initialize();
- XdbmStoreUtils.loadExampleData( store, schemaManager );
+ XdbmStoreUtils.loadExampleData( store, schemaManager, executionManagerFactory.instance() );
- evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
+ evaluatorBuilder = new EvaluatorBuilder( store, schemaManager, txnManagerFactory, executionManagerFactory );
cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
LOG.debug( "Created new store" );
@@ -271,8 +275,8 @@ public class OrCursorTest
OrNode orNode = new OrNode();
ExprNode exprNode = new SubstringNode( schemaManager.getAttributeType( "cn" ), "J", null );
- eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
- Cursor subStrCursor1 = new SubstringCursor( store, ( SubstringEvaluator ) eval );
+ eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager, txnManagerFactory, executionManagerFactory );
+ Cursor subStrCursor1 = new SubstringCursor( store, ( SubstringEvaluator ) eval, txnManagerFactory, executionManagerFactory );
cursors.add( subStrCursor1 );
evaluators.add( eval );
orNode.addNode( exprNode );
@@ -285,9 +289,9 @@ public class OrCursorTest
// catch( IllegalArgumentException ie ){ }
exprNode = new SubstringNode( schemaManager.getAttributeType( "sn" ), "W", null );
- eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
+ eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager, txnManagerFactory, executionManagerFactory );
evaluators.add( eval );
- Cursor subStrCursor2 = new SubstringCursor( store, ( SubstringEvaluator ) eval );
+ Cursor subStrCursor2 = new SubstringCursor( store, ( SubstringEvaluator ) eval, txnManagerFactory, executionManagerFactory );
cursors.add( subStrCursor2 );
orNode.addNode( exprNode );