directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1214095 - in /directory/apacheds/branches/apacheds-txns/jdbm-partition/src: main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ test/java/org/apache/di...
Date Wed, 14 Dec 2011 08:11:31 GMT
Author: saya
Date: Wed Dec 14 08:11:31 2011
New Revision: 1214095

URL: http://svn.apache.org/viewvc?rev=1214095&view=rev
Log:
change txn manager and execution manager instances to non static.

Modified:
    directory/apacheds/branches/apacheds-txns/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
    directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTxnTest.java
    directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java

Modified: directory/apacheds/branches/apacheds-txns/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1214095&r1=1214094&r2=1214095&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
(original)
+++ directory/apacheds/branches/apacheds-txns/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Wed Dec 14 08:11:31 2011
@@ -35,6 +35,8 @@ import jdbm.recman.SnapshotRecordManager
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.core.api.partition.index.Index;
 import org.apache.directory.server.xdbm.search.impl.CursorBuilder;
@@ -83,9 +85,10 @@ public class JdbmPartition extends Abstr
     /**
      * Creates a store based on JDBM B+Trees.
      */
-    public JdbmPartition( SchemaManager schemaManager )
+    public JdbmPartition( SchemaManager schemaManager, TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory )
     {
-        super( schemaManager );
+        super( schemaManager, txnManagerFactory, executionManagerFactory );
 
         // Initialize the cache size
         if ( cacheSize < 0 )
@@ -111,10 +114,10 @@ public class JdbmPartition extends Abstr
             }
             else
             {
-                optimizer = new DefaultOptimizer( this );
+                optimizer = new DefaultOptimizer( this, txnManagerFactory, executionManagerFactory
);
             }
     
-            EvaluatorBuilder evaluatorBuilder = new EvaluatorBuilder( this, schemaManager
);
+            EvaluatorBuilder evaluatorBuilder = new EvaluatorBuilder( this, schemaManager,
txnManagerFactory, executionManagerFactory );
             CursorBuilder cursorBuilder = new CursorBuilder( this, evaluatorBuilder );
     
             searchEngine = new DefaultSearchEngine( this, cursorBuilder, evaluatorBuilder,
optimizer );

Modified: directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=1214095&r1=1214094&r2=1214095&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
Wed Dec 14 08:11:31 2011
@@ -105,6 +105,10 @@ public class JdbmStoreTest
     
     /** 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
@@ -120,9 +124,9 @@ public class JdbmStoreTest
         
         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
) );
@@ -155,7 +159,7 @@ public class JdbmStoreTest
         wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
 
         // initialize the store
-        store = new JdbmPartition( schemaManager );
+        store = new JdbmPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         store.setId( "example" );
         store.setCacheSize( 10 );
         store.setPartitionPath( wkdir.toURI() );
@@ -174,7 +178,7 @@ public class JdbmStoreTest
 
         store.initialize();
 
-        XdbmStoreUtils.loadExampleData( store, schemaManager );
+        XdbmStoreUtils.loadExampleData( store, schemaManager, executionManager );
         LOG.debug( "Created new store" );
     }
 
@@ -213,7 +217,7 @@ public class JdbmStoreTest
         wkdir2 = new File( wkdir2.getParentFile(), getClass().getSimpleName() );
 
         // initialize the 2nd store
-        JdbmPartition store2 = new JdbmPartition( schemaManager );
+        JdbmPartition store2 = new JdbmPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         store2.setId( "example2" );
         store2.setCacheSize( 10 );
         store2.setPartitionPath( wkdir2.toURI() );
@@ -245,7 +249,7 @@ public class JdbmStoreTest
     @Test
     public void testSimplePropertiesUnlocked() throws Exception
     {
-        JdbmPartition jdbmPartition = new JdbmPartition( schemaManager );
+        JdbmPartition jdbmPartition = new JdbmPartition( schemaManager, txnManagerFactory,
executionManagerFactory );
         jdbmPartition.setSyncOnWrite( true ); // for code coverage
 
         assertNull( jdbmPartition.getAliasIndex() );
@@ -939,7 +943,7 @@ public class JdbmStoreTest
         assertTrue( uuidIndexDbFile.exists() );
         assertTrue( uuidIndexTxtFile.exists() );
 
-        store = new JdbmPartition( schemaManager );
+        store = new JdbmPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         store.setId( "example" );
         store.setCacheSize( 10 );
         store.setPartitionPath( wkdir.toURI() );

Modified: directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTxnTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTxnTest.java?rev=1214095&r1=1214094&r2=1214095&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTxnTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTxnTest.java
Wed Dec 14 08:11:31 2011
@@ -1,6 +1,24 @@
 
 package org.apache.directory.server.core.partition.impl.btree.jdbm;
-
+/*
+ *  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.
+ *
+ */
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -54,6 +72,10 @@ public class JdbmStoreTxnTest
     
     /** log dir */
     private static File logDir;
+    
+    /** txn and operation execution manager factories */
+    private static TxnManagerFactory txnManagerFactory;
+    private static OperationExecutionManagerFactory executionManagerFactory;
 
     @BeforeClass
     public static void setup() throws Exception
@@ -70,10 +92,10 @@ public class JdbmStoreTxnTest
         
         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
) );
@@ -99,7 +121,7 @@ public class JdbmStoreTxnTest
         wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
         
         // initialize the store
-        store = new JdbmPartition( schemaManager );
+        store = new JdbmPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         store.setId( "example" );
         store.setCacheSize( 10 );
         store.setPartitionPath( wkdir.toURI() );
@@ -118,7 +140,7 @@ public class JdbmStoreTxnTest
 
         store.initialize();
 
-        XdbmStoreUtils.loadExampleData( store, schemaManager );
+        XdbmStoreUtils.loadExampleData( store, schemaManager, executionManager );
     }
 
 

Modified: directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java?rev=1214095&r1=1214094&r2=1214095&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
Wed Dec 14 08:11:31 2011
@@ -30,6 +30,8 @@ import java.io.File;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.DupsContainerCursorTest;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.name.Rdn;
@@ -52,6 +54,10 @@ import org.junit.Test;
 public class PartitionTreeTest
 {
     private static SchemaManager schemaManager;
+    
+    /** txn and operation execution manager factories */
+    private static TxnManagerFactory txnManagerFactory;
+    private static OperationExecutionManagerFactory executionManagerFactory;
 
 
     @BeforeClass
@@ -65,6 +71,11 @@ public class PartitionTreeTest
             int targetPos = path.indexOf( "target" );
             workingDirectory = path.substring( 0, targetPos + 6 );
         }
+        
+        File logDir = new File( workingDirectory + File.separatorChar + "txnlog" + File.separatorChar
);
+        logDir.mkdirs();
+        txnManagerFactory = new TxnManagerFactory( logDir.getPath(), 1 << 13, 1 <<
14 );
+        executionManagerFactory = new OperationExecutionManagerFactory( txnManagerFactory
);
 
         File schemaRepository = new File( workingDirectory, "schema" );
         SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory
) );
@@ -91,7 +102,7 @@ public class PartitionTreeTest
         DnNode<Partition> partitionLookupTree = new DnNode<Partition>();
 
         Dn suffix = new Dn( schemaManager, "dc=example, dc=com" );
-        Partition partition = new JdbmPartition( schemaManager );
+        Partition partition = new JdbmPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         partition.setSuffixDn( suffix );
 
         partitionLookupTree.add( suffix, partition );
@@ -119,13 +130,13 @@ public class PartitionTreeTest
         DnNode<Partition> partitionLookupTree = new DnNode<Partition>();
 
         Dn suffix1 = new Dn( schemaManager, "dc=example, dc=com" );
-        Partition partition1 = new JdbmPartition( schemaManager );
+        Partition partition1 = new JdbmPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         partition1.setSuffixDn( suffix1 );
 
         partitionLookupTree.add( suffix1, partition1 );
 
         Dn suffix2 = new Dn( schemaManager, "ou=system" );
-        Partition partition2 = new JdbmPartition( schemaManager );
+        Partition partition2 = new JdbmPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         partition2.setSuffixDn( suffix2 );
 
         partitionLookupTree.add( suffix2, partition2 );
@@ -159,13 +170,13 @@ public class PartitionTreeTest
         DnNode<Partition> partitionLookupTree = new DnNode<Partition>();
 
         Dn suffix1 = new Dn( schemaManager, "dc=example1, dc=com" );
-        Partition partition1 = new JdbmPartition( schemaManager );
+        Partition partition1 = new JdbmPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         partition1.setSuffixDn( suffix1 );
 
         partitionLookupTree.add( suffix1, partition1 );
 
         Dn suffix2 = new Dn( schemaManager, "dc=example2, dc=com" );
-        Partition partition2 = new JdbmPartition( schemaManager );
+        Partition partition2 = new JdbmPartition( schemaManager, txnManagerFactory, executionManagerFactory
);
         partition2.setSuffixDn( suffix2 );
 
         partitionLookupTree.add( suffix2, partition2 );



Mime
View raw message