jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r759880 - in /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core: data/CopyValueTest.java data/ExportImportTest.java data/TestTwoGetStreams.java integration/NodeImplTest.java query/AbstractIndexingTest.java
Date Mon, 30 Mar 2009 08:49:13 GMT
Author: mreutegg
Date: Mon Mar 30 08:49:12 2009
New Revision: 759880

URL: http://svn.apache.org/viewvc?rev=759880&view=rev
Log:
Missing session logout in test cases

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/CopyValueTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ExportImportTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/NodeImplTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractIndexingTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/CopyValueTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/CopyValueTest.java?rev=759880&r1=759879&r2=759880&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/CopyValueTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/CopyValueTest.java
Mon Mar 30 08:49:12 2009
@@ -50,28 +50,27 @@
     }
 
     private void doTestCopy(int length) throws Exception {
-        Session session = helper.getReadWriteSession();
-        Node root = session.getRootNode();
+        Node root = superuser.getRootNode();
         if(root.hasNode("testCopy")) {
             root.getNode("testCopy").remove();
-            session.save();
+            superuser.save();
         }
         Node testRoot = root.addNode("testCopy");
         Node n = testRoot.addNode("a");
-        session.save();
+        superuser.save();
         byte[] data = new byte[length + 1];
         n.setProperty("data", new ByteArrayInputStream(data));
-        session.save();
+        superuser.save();
         data = new byte[length];
         n.setProperty("data", new ByteArrayInputStream(data));
         Property p = testRoot.getNode("a").getProperty("data");
         assertEquals(length, p.getLength());
-        session.getWorkspace().copy("/testCopy/a", "/testCopy/b");
+        superuser.getWorkspace().copy("/testCopy/a", "/testCopy/b");
         assertEquals(length, p.getLength());
         p = testRoot.getNode("b").getProperty("data");
         assertEquals(length + 1, p.getLength());
         testRoot.remove();
-        session.save();
+        superuser.save();
     }
 
     /**
@@ -81,11 +80,10 @@
      */
     public void testRandomOperations() throws Exception {
         Random random = new Random(1);
-        Session session = helper.getReadWriteSession();
-        Node root = session.getRootNode();
+        Node root = superuser.getRootNode();
         if(root.hasNode("testRandom")) {
             root.getNode("testRandom").remove();
-            session.save();
+            superuser.save();
         }
         Node testRoot = root.addNode("testRandom");
         int len = 1000;
@@ -115,12 +113,12 @@
             case 1:
                 opCounts[op]++;
                 log("save");
-                session.save();
+                superuser.save();
                 break;
             case 2:
                 opCounts[op]++;
                 log("refresh");
-                session.refresh(false);
+                superuser.refresh(false);
                 break;
             case 3:
                 if (hasNode1) {
@@ -145,19 +143,19 @@
                     opCounts[op]++;
                     log(node1 + " copy " + node2);
                     // todo: why is save required?
-                    session.save();
-                    session.getWorkspace().copy("/testRandom/" + node1,
+                    superuser.save();
+                    superuser.getWorkspace().copy("/testRandom/" + node1,
                             "/testRandom/" + node2);
                 }
                 break;
             }
         }
-        session.save();
+        superuser.save();
         for(int i=0; i<opCounts.length; i++) {
             log(i + ": " + opCounts[i]);
         }
         testRoot.remove();
-        session.save();
+        superuser.save();
     }
 
     private void log(String s) {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ExportImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ExportImportTest.java?rev=759880&r1=759879&r2=759880&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ExportImportTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ExportImportTest.java
Mon Mar 30 08:49:12 2009
@@ -60,8 +60,8 @@
     }
     
     private void doTestExportImportLargeText(char[] chars) throws RepositoryException {
+        Session session = helper.getReadWriteSession();
         try {
-            Session session = helper.getReadWriteSession();
             Node root = session.getRootNode();
             clean(root);
             Node test = root.addNode("testText");
@@ -93,6 +93,8 @@
         } catch (Exception e) {
             e.printStackTrace();
             assertFalse(e.getMessage(), true);
+        } finally {
+            session.logout();
         }
     }
 
@@ -109,8 +111,8 @@
     }
 
     private void doTestExportImportBinary(int len) throws RepositoryException {
+        Session session = helper.getReadWriteSession();
         try {
-            Session session = helper.getReadWriteSession();
             Node root = session.getRootNode();
             clean(root);
             Node test = root.addNode("testBinary");
@@ -146,6 +148,8 @@
         } catch (Exception e) {
             e.printStackTrace();
             assertFalse(e.getMessage(), true);
+        } finally {
+            session.logout();
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java?rev=759880&r1=759879&r2=759880&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java
Mon Mar 30 08:49:12 2009
@@ -40,8 +40,7 @@
     private static final int STREAM_LENGTH = 1 * 1024 * 1024;
     
     private boolean isDataStoreEnabled() throws RepositoryException {
-        Session session = helper.getSuperuserSession();
-        RepositoryImpl rep = (RepositoryImpl) session.getRepository();        
+        RepositoryImpl rep = (RepositoryImpl) superuser.getRepository();
         return rep.getDataStore() != null;
     }
     
@@ -54,12 +53,10 @@
             return;
         }
         
-        Session session = helper.getSuperuserSession();
-        
-        Node root = session.getRootNode();
+        Node root = superuser.getRootNode();
         root.setProperty("p1", new RandomInputStream(1, STREAM_LENGTH));
         root.setProperty("p2", new RandomInputStream(1, STREAM_LENGTH));
-        session.save();
+        superuser.save();
 
         Value v1 = root.getProperty("p1").getValue();
         Value v2 = root.getProperty("p2").getValue();
@@ -78,7 +75,7 @@
             Value v = root.getProperty("p1").getValue();
             root.setProperty("p3", v);
         }
-        session.save();
+        superuser.save();
         time = System.currentTimeMillis() - time;
         // streaming the value again and again takes about 4.3 seconds
         // on my computer; copying the data identifier takes about 16 ms
@@ -95,11 +92,10 @@
             return;
         }
         
-        Session session = helper.getSuperuserSession();
-        Node root = session.getRootNode();
+        Node root = superuser.getRootNode();
         root.setProperty("p1", new RandomInputStream(1, STREAM_LENGTH));
         root.setProperty("p2", new RandomInputStream(2, STREAM_LENGTH));
-        session.save();
+        superuser.save();
 
         InputStream i1 = root.getProperty("p1").getStream();
         InputStream i2 = root.getProperty("p2").getStream();
@@ -126,11 +122,10 @@
             return;
         }
         
-        Session session = helper.getSuperuserSession();
-        Node root = session.getRootNode();
+        Node root = superuser.getRootNode();
         root.setProperty("p1", new RandomInputStream(1, STREAM_LENGTH));
         root.setProperty("p2", new RandomInputStream(1, STREAM_LENGTH));
-        session.save();
+        superuser.save();
 
         InputStream i1 = root.getProperty("p1").getStream();
         InputStream i2 = root.getProperty("p2").getStream();
@@ -157,10 +152,9 @@
             return;
         }
         
-        Session session = helper.getSuperuserSession();
-        Node root = session.getRootNode();
+        Node root = superuser.getRootNode();
         root.setProperty("p1", new RandomInputStream(1, STREAM_LENGTH));
-        session.save();
+        superuser.save();
 
         InputStream i1 = root.getProperty("p1").getStream();
         InputStream i2 = root.getProperty("p1").getStream();

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/NodeImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/NodeImplTest.java?rev=759880&r1=759879&r2=759880&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/NodeImplTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/NodeImplTest.java
Mon Mar 30 08:49:12 2009
@@ -41,6 +41,7 @@
     protected void tearDown() throws Exception {
         node.remove();
         testRootNode.save();
+        super.tearDown();
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractIndexingTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractIndexingTest.java?rev=759880&r1=759879&r2=759880&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractIndexingTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractIndexingTest.java
Mon Mar 30 08:49:12 2009
@@ -38,8 +38,11 @@
     }
 
     protected void tearDown() throws Exception {
-        cleanUpTestRoot(session);
-        session = null;
+        if (session != null) {
+            cleanUpTestRoot(session);
+            session.logout();
+            session = null;
+        }
         testRootNode = null;
         super.tearDown();
     }



Mime
View raw message