jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1186727 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/ main/java/org/apache/jackrabbit/core/persistence/ test/java/org/apache/jackrabbit/core/persistence/
Date Thu, 20 Oct 2011 10:40:43 GMT
Author: jukka
Date: Thu Oct 20 10:40:42 2011
New Revision: 1186727

URL: http://svn.apache.org/viewvc?rev=1186727&view=rev
Log:
JCR-3117: Stats for the PersistenceManager

Don't require the full RepositoryContext to PMContext for simpler test cases

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PMContext.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/PersistenceManagerTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=1186727&r1=1186726&r2=1186727&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Thu Oct 20 10:40:42 2011
@@ -1332,7 +1332,13 @@ public class RepositoryImpl extends Abst
         try {
             PersistenceManager pm = pmConfig
                     .newInstance(PersistenceManager.class);
-            PMContext pmContext = new PMContext(homeDir, fs, context);
+            PMContext pmContext = new PMContext(
+                    homeDir, fs,
+                    context.getRootNodeId(),
+                    context.getNamespaceRegistry(),
+                    context.getNodeTypeRegistry(),
+                    context.getDataStore(),
+                    context.getRepositoryStatistics());
             pm.init(pmContext);
             return pm;
         } catch (Exception e) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PMContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PMContext.java?rev=1186727&r1=1186726&r2=1186727&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PMContext.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/PMContext.java
Thu Oct 20 10:40:42 2011
@@ -20,7 +20,6 @@ import java.io.File;
 
 import javax.jcr.NamespaceRegistry;
 
-import org.apache.jackrabbit.core.RepositoryContext;
 import org.apache.jackrabbit.core.data.DataStore;
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.id.NodeId;
@@ -73,18 +72,24 @@ public class PMContext {
      *
      * @param homeDir the physical home directory
      * @param fs the virtual jackrabbit filesystem
-     * @param context repository component context
+     * @param rootNodeId id of the root node
+     * @param nsReg        namespace registry
+     * @param ntReg        node type registry
      */
     public PMContext(File homeDir,
-                     FileSystem fs,
-                     RepositoryContext context) {
+            FileSystem fs,
+            NodeId rootNodeId,
+            NamespaceRegistry nsReg,
+            NodeTypeRegistry ntReg,
+            DataStore dataStore,
+            RepositoryStatisticsImpl stats) {
         this.physicalHomeDir = homeDir;
         this.fs = fs;
-        this.rootNodeId = context.getRootNodeId();
-        this.nsReg = context.getNamespaceRegistry();
-        this.ntReg = context.getNodeTypeRegistry();
-        this.dataStore = context.getDataStore();
-        this.stats = context.getRepositoryStatistics();
+        this.rootNodeId = rootNodeId;
+        this.nsReg = nsReg;
+        this.ntReg = ntReg;
+        this.dataStore = dataStore;
+        this.stats = stats;
     }
 
 

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/PersistenceManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/PersistenceManagerTest.java?rev=1186727&r1=1186726&r2=1186727&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/PersistenceManagerTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/persistence/PersistenceManagerTest.java
Thu Oct 20 10:40:42 2011
@@ -18,6 +18,8 @@ package org.apache.jackrabbit.core.persi
 
 import java.io.File;
 import java.util.Arrays;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
 
 import javax.jcr.PropertyType;
 
@@ -40,6 +42,7 @@ import org.apache.jackrabbit.core.state.
 import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
+import org.apache.jackrabbit.core.stats.RepositoryStatisticsImpl;
 import org.apache.jackrabbit.core.util.db.ConnectionFactory;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
@@ -116,13 +119,15 @@ public class PersistenceManagerTest exte
 
     private void assertPersistenceManager(PersistenceManager manager)
             throws Exception {
+        ScheduledExecutorService pool = Executors.newScheduledThreadPool(1);
         manager.init(new PMContext(
                 directory,
                 new MemoryFileSystem(),
                 RepositoryImpl.ROOT_NODE_ID,
                 new NamespaceRegistryImpl(new MemoryFileSystem()),
                 null,
-                null));
+                null,
+                new RepositoryStatisticsImpl(pool)));
         try {
             assertCreateNewNode(manager);
             assertCreateNewProperty(manager);
@@ -130,6 +135,7 @@ public class PersistenceManagerTest exte
             assertCreateUpdateDelete(manager);
         } finally {
             manager.close();
+            pool.shutdown();
         }
     }
 



Mime
View raw message