jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r803514 - in /jackrabbit/trunk: jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/retention/ jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/ap...
Date Wed, 12 Aug 2009 13:57:57 GMT
Author: mreutegg
Date: Wed Aug 12 13:57:57 2009
New Revision: 803514

URL: http://svn.apache.org/viewvc?rev=803514&view=rev
Log:
JCR-2258: Unclosed sessions in test cases

Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ShareableNodeTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/retention/AbstractRetentionTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/security/AbstractAccessControlTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CheckinTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CheckoutTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/FrozenNodeTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/RestoreTest.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/BinaryTest.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/MandatoryItemTest.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImplTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ShareableNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ShareableNodeTest.java?rev=803514&r1=803513&r2=803514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ShareableNodeTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ShareableNodeTest.java
Wed Aug 12 13:57:57 2009
@@ -38,6 +38,7 @@
 import javax.jcr.version.Version;
 
 import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
 
 /**
  * Tests features available with shareable nodes.
@@ -48,8 +49,13 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-        checkSupportedOption(Repository.OPTION_SHAREABLE_NODES_SUPPORTED);
-        ensureKnowsNodeType(superuser, mixShareable);
+        try {
+            checkSupportedOption(Repository.OPTION_SHAREABLE_NODES_SUPPORTED);
+            ensureKnowsNodeType(superuser, mixShareable);
+        } catch (NotExecutableException e) {
+            cleanUp();
+            throw e;
+        }
         mixShareable = superuser.getNamespacePrefix(NS_MIX_URI) + ":shareable";
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/retention/AbstractRetentionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/retention/AbstractRetentionTest.java?rev=803514&r1=803513&r2=803514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/retention/AbstractRetentionTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/retention/AbstractRetentionTest.java
Wed Aug 12 13:57:57 2009
@@ -40,7 +40,12 @@
 
         super.setUp();
 
-        retentionMgr = getRetentionManager(superuser);
+        try {
+            retentionMgr = getRetentionManager(superuser);
+        } catch (NotExecutableException e) {
+            cleanUp();
+            throw e;
+        }
         testNodePath = testRootNode.getPath();
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/security/AbstractAccessControlTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/security/AbstractAccessControlTest.java?rev=803514&r1=803513&r2=803514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/security/AbstractAccessControlTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/security/AbstractAccessControlTest.java
Wed Aug 12 13:57:57 2009
@@ -37,7 +37,12 @@
         checkSupportedOption(Repository.OPTION_ACCESS_CONTROL_SUPPORTED);
         
         super.setUp();
-        acMgr = getAccessControlManager(superuser);
+        try {
+            acMgr = getAccessControlManager(superuser);
+        } catch (NotExecutableException e) {
+            cleanUp();
+            throw e;
+        }
     }
 
     protected static AccessControlManager getAccessControlManager(Session s) throws RepositoryException,
NotExecutableException {

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CheckinTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CheckinTest.java?rev=803514&r1=803513&r2=803514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CheckinTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CheckinTest.java
Wed Aug 12 13:57:57 2009
@@ -36,9 +36,14 @@
     protected void setUp() throws Exception {
         super.setUp();
 
-        VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
-        String path = versionableNode.getPath();
-        versionManager.checkout(path);
+        try {
+            VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
+            String path = versionableNode.getPath();
+            versionManager.checkout(path);
+        } catch (RepositoryException e) {
+            cleanUp();
+            throw e;
+        }
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CheckoutTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CheckoutTest.java?rev=803514&r1=803513&r2=803514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CheckoutTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CheckoutTest.java
Wed Aug 12 13:57:57 2009
@@ -45,8 +45,13 @@
          if (!versionableNode.isCheckedOut()) {
              fail("A versionable node must be checked-out after persistent creation.");
          }
-         versionManager.checkin(path);
-     }
+        try {
+            versionManager.checkin(path);
+        } catch (RepositoryException e) {
+            cleanUp();
+            throw e;
+        }
+    }
 
      /**
       * Test if Node.isCheckedOut() returns true, if the versionable node has

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/FrozenNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/FrozenNodeTest.java?rev=803514&r1=803513&r2=803514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/FrozenNodeTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/FrozenNodeTest.java
Wed Aug 12 13:57:57 2009
@@ -37,9 +37,14 @@
     protected void setUp() throws Exception {
         super.setUp();
 
-        VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
-        String path = versionableNode.getPath();
-        versionManager.checkout(path);
+        try {
+            VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
+            String path = versionableNode.getPath();
+            versionManager.checkout(path);
+        } catch (RepositoryException e) {
+            cleanUp();
+            throw e;
+        }
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/RestoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/RestoreTest.java?rev=803514&r1=803513&r2=803514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/RestoreTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/RestoreTest.java
Wed Aug 12 13:57:57 2009
@@ -60,19 +60,24 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-        versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
-        String path = versionableNode.getPath();
-        propertyValue1 = getProperty("propertyValue1");
-        propertyValue2 = getProperty("propertyValue2");
-        versionableNode.setProperty(propertyName1, propertyValue1);
-        versionableNode.getSession().save();
-        version = versionManager.checkin(path);
-        versionManager.checkout(path);
-        versionableNode.setProperty(propertyName1, propertyValue2);
-        versionableNode.getSession().save();
-        version2 = versionManager.checkin(path);
-        versionManager.checkout(path);
-        rootVersion = versionManager.getVersionHistory(path).getRootVersion();
+        try {
+            versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
+            String path = versionableNode.getPath();
+            propertyValue1 = getProperty("propertyValue1");
+            propertyValue2 = getProperty("propertyValue2");
+            versionableNode.setProperty(propertyName1, propertyValue1);
+            versionableNode.getSession().save();
+            version = versionManager.checkin(path);
+            versionManager.checkout(path);
+            versionableNode.setProperty(propertyName1, propertyValue2);
+            versionableNode.getSession().save();
+            version2 = versionManager.checkin(path);
+            versionManager.checkout(path);
+            rootVersion = versionManager.getVersionHistory(path).getRootVersion();
+        } catch (RepositoryException e) {
+            cleanUp();
+            fail("Failed to setup test: " + e.getMessage());
+        }
 
         // build a second versionable node below the testroot
         try {

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/BinaryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/BinaryTest.java?rev=803514&r1=803513&r2=803514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/BinaryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/BinaryTest.java
Wed Aug 12 13:57:57 2009
@@ -32,7 +32,7 @@
 public class BinaryTest extends AbstractJCRTest {
 
     public void testStreamBinary() throws Exception {
-        byte[] data = new byte[10 * 1024 * 1024];
+        byte[] data = new byte[1024 * 1024];
         new Random().nextBytes(data);
         Node test = testRootNode.addNode("test");
         Property p = test.setProperty("prop", new ByteArrayInputStream(data));

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/MandatoryItemTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/MandatoryItemTest.java?rev=803514&r1=803513&r2=803514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/MandatoryItemTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/MandatoryItemTest.java
Wed Aug 12 13:57:57 2009
@@ -56,6 +56,7 @@
             }
         }
         if (childPropDef == null && childNodeDef == null) {
+            cleanUp();
             throw new NotExecutableException();
         }
     }

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImplTest.java?rev=803514&r1=803513&r2=803514&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImplTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImplTest.java
Wed Aug 12 13:57:57 2009
@@ -41,12 +41,14 @@
         if (nt instanceof NodeTypeImpl) {
             nodeType = (NodeTypeImpl) nt;
         } else {
+            cleanUp();
             throw new NotExecutableException("NodeTypeImpl expected.");
         }
 
         if (superuser instanceof NameResolver) {
             resolver = (NameResolver) superuser;
         } else {
+            cleanUp();
              throw new NotExecutableException();
         }
     }



Mime
View raw message