Author: sascharodekamp
Date: Thu Sep 29 12:00:32 2011
New Revision: 1177274
URL:
http://svn.apache.org/viewvc?rev=1177274&view=revLog:
Add versionning for to the speedtest
Modified:
ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/services/JackrabbitServices.java
Modified: ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/services/JackrabbitServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/services/JackrabbitServices.java?rev=1177274&r1=1177273&r2=1177274&view=diff==============================================================================
--- ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/services/JackrabbitServices.java (original)
+++ ofbiz/branches/jackrabbit20100709/framework/jcr/src/org/ofbiz/jcr/services/JackrabbitServices.java Thu Sep 29 12:00:32 2011
@@ -3,7 +3,11 @@ package org.ofbiz.jcr.services;
import java.util.Date;
import java.util.Map;
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
import javax.jcr.Session;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.version.VersionManager;
import org.ofbiz.base.util.Debug;
import org.ofbiz.entity.GenericValue;
@@ -17,7 +21,7 @@ public class JackrabbitServices {
private static String module = JackrabbitServices.class.getName();
- public static Map<String, Object> determineJackrabbitRepositorySpeed(DispatchContext ctx, Map<String, Object> context) {
+ public static Map<String, Object> determineJackrabbitRepositorySpeed(DispatchContext ctx, Map<String, Object> context) throws UnsupportedRepositoryOperationException, RepositoryException {
Map<String, Object> result = ServiceUtil.returnSuccess();
GenericValue userLogin = (GenericValue) context.get("userLogin");
Integer maxNodes = (Integer) context.get("maxNodes");
@@ -26,12 +30,18 @@ public class JackrabbitServices {
Long diff = 0l;
Session session = JCRFactoryUtil.getSession();
+ VersionManager vm = session.getWorkspace().getVersionManager();
start = new Date().getTime();
for (int i = 0; i <= maxNodes; i++) {
try {
// add a node
- session.getRootNode().addNode("__Speedtest_Node-" + i);
+ Node n = session.getRootNode().addNode("__Speedtest_Node-" + i);
+ n.addMixin("mix:versionable");
+ n.setProperty("anyProperty", "Blah");
session.save();
+ vm.checkin(n.getPath());
+
+ vm.checkout("/__Speedtest_Node-" + i);
// remove the node
session.removeItem("/__Speedtest_Node-" + i);
session.save();