You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2009/05/04 15:32:34 UTC

svn commit: r771300 - in /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test: AbstractJCRTest.java api/ShareableNodeTest.java

Author: jukka
Date: Mon May  4 13:32:34 2009
New Revision: 771300

URL: http://svn.apache.org/viewvc?rev=771300&view=rev
Log:
JCR-2085: test case (TCK) maintenance for JCR 2.0

Add a ensureSupportsFeature() method for testing whether the repository declares support for a given feature.

Use this method to avoid doing shareable node tests on repositories that don't claim to support that feature, even if the mix:shareable node type is available.

Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ShareableNodeTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java?rev=771300&r1=771299&r2=771300&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java Mon May  4 13:32:34 2009
@@ -652,6 +652,24 @@
     }
 
     /**
+     * Checks that the repository supports the named feature. The given
+     * feature name must be the key of a boolean-valued repository descriptor.
+     * A {@link NotExecutableException} is thrown if the descriptor does not
+     * exists or is not <code>true</code>.
+     *
+     * @param feature descriptor key
+     * @throws NotExecutableException if the named feature is not supported
+     */
+    protected void ensureSupportsFeature(String feature)
+            throws NotExecutableException {
+        String value = superuser.getRepository().getDescriptor(feature);
+        if (!Boolean.parseBoolean(value)) {
+            throw new NotExecutableException(
+                    "Repository feature not supported: " + feature);
+        }
+    }
+
+    /**
      * Checks that the repository can set the property to the required type, otherwise aborts with
      * {@link NotExecutableException}.
      * @throws NotExecutableException when setting the property to the required

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=771300&r1=771299&r2=771300&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 Mon May  4 13:32:34 2009
@@ -27,6 +27,7 @@
 import javax.jcr.Item;
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
+import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
@@ -45,6 +46,7 @@
     
     protected void setUp() throws Exception {
         super.setUp();
+        ensureSupportsFeature(Repository.OPTION_SHAREABLE_NODES_SUPPORTED);
         ensureKnowsNodeType(superuser, "mix:shareable");
     }