jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r761715 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/PersistenceManagerIteratorTest.java
Date Fri, 03 Apr 2009 16:04:26 GMT
Author: mreutegg
Date: Fri Apr  3 16:04:25 2009
New Revision: 761715

URL: http://svn.apache.org/viewvc?rev=761715&view=rev
Log:
PersistenceManagerIteratorTest fails when workspace is shut down during test run.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/PersistenceManagerIteratorTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/PersistenceManagerIteratorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/PersistenceManagerIteratorTest.java?rev=761715&r1=761714&r2=761715&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/PersistenceManagerIteratorTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/PersistenceManagerIteratorTest.java
Fri Apr  3 16:04:25 2009
@@ -67,64 +67,69 @@
         }
 
         for (int i = 0; i < names.length; i++) {
-            Method m = r.getClass().getDeclaredMethod("getWorkspaceInfo", new Class[] { String.class
});
-            m.setAccessible(true);
-            Object info = m.invoke(r, new String[] { names[i] });
-            m = info.getClass().getDeclaredMethod("getPersistenceManager", new Class[0]);
-            m.setAccessible(true);
-            PersistenceManager pm = (PersistenceManager) m.invoke(info, new Object[0]);
-            if (!(pm instanceof AbstractBundlePersistenceManager)) {
-                log("PM skipped: " + pm.getClass());
-                continue;
-            }
-            AbstractBundlePersistenceManager apm = (AbstractBundlePersistenceManager) pm;
-            log("PM: " + pm.getClass().getName());
-
-            log("All nodes in one step");
-            NodeIdIterator it = apm.getAllNodeIds(null, 0);
-            NodeId after = null;
-            NodeId first = null;
-            while (it.hasNext()) {
-                NodeId id = it.nextNodeId();
-                log("  " + id.toString());
-                if (first == null) {
-                    // initialize first node id
-                    first = id;
-                }
-                if (after != null) {
-                    assertFalse(id.getUUID().compareTo(after.getUUID()) == 0);
+            Session s = helper.getSuperuserSession(names[i]);
+            try {
+                Method m = r.getClass().getDeclaredMethod("getWorkspaceInfo", new Class[]
{ String.class });
+                m.setAccessible(true);
+                Object info = m.invoke(r, new String[] { names[i] });
+                m = info.getClass().getDeclaredMethod("getPersistenceManager", new Class[0]);
+                m.setAccessible(true);
+                PersistenceManager pm = (PersistenceManager) m.invoke(info, new Object[0]);
+                if (!(pm instanceof AbstractBundlePersistenceManager)) {
+                    log("PM skipped: " + pm.getClass());
+                    continue;
                 }
-                after = id;
-            }
+                AbstractBundlePersistenceManager apm = (AbstractBundlePersistenceManager)
pm;
+                log("PM: " + pm.getClass().getName());
 
-            // start with first
-            after = first;
-            log("All nodes using batches");
-            while (true) {
-                log(" bigger than: " + after);
-                it = apm.getAllNodeIds(after, 2);
-                if (!it.hasNext()) {
-                    break;
-                }
+                log("All nodes in one step");
+                NodeIdIterator it = apm.getAllNodeIds(null, 0);
+                NodeId after = null;
+                NodeId first = null;
                 while (it.hasNext()) {
                     NodeId id = it.nextNodeId();
-                    log("    " + id.toString());
-                    assertFalse(id.getUUID().compareTo(after.getUUID()) == 0);
+                    log("  " + id.toString());
+                    if (first == null) {
+                        // initialize first node id
+                        first = id;
+                    }
+                    if (after != null) {
+                        assertFalse(id.getUUID().compareTo(after.getUUID()) == 0);
+                    }
                     after = id;
                 }
-            }
 
-            log("Random access");
-            for (int j = 0; j < 50; j++) {
-                after = new NodeId(UUID.randomUUID());
-                log(" bigger than: " + after);
-                it = apm.getAllNodeIds(after, 2);
-                while (it.hasNext()) {
-                    NodeId id = it.nextNodeId();
-                    log("    " + id.toString());
-                    assertFalse(id.getUUID().compareTo(after.getUUID()) == 0);
-                    after = id;
+                // start with first
+                after = first;
+                log("All nodes using batches");
+                while (true) {
+                    log(" bigger than: " + after);
+                    it = apm.getAllNodeIds(after, 2);
+                    if (!it.hasNext()) {
+                        break;
+                    }
+                    while (it.hasNext()) {
+                        NodeId id = it.nextNodeId();
+                        log("    " + id.toString());
+                        assertFalse(id.getUUID().compareTo(after.getUUID()) == 0);
+                        after = id;
+                    }
+                }
+
+                log("Random access");
+                for (int j = 0; j < 50; j++) {
+                    after = new NodeId(UUID.randomUUID());
+                    log(" bigger than: " + after);
+                    it = apm.getAllNodeIds(after, 2);
+                    while (it.hasNext()) {
+                        NodeId id = it.nextNodeId();
+                        log("    " + id.toString());
+                        assertFalse(id.getUUID().compareTo(after.getUUID()) == 0);
+                        after = id;
+                    }
                 }
+            } finally {
+                s.logout();
             }
         }
     }



Mime
View raw message