jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r521728 - in /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test: AbstractJCRTest.java api/NodeTest.java
Date Fri, 23 Mar 2007 14:01:35 GMT
Author: reschke
Date: Fri Mar 23 07:01:30 2007
New Revision: 521728

URL: http://svn.apache.org/viewvc?view=rev&rev=521728
Log:
JCR-801: throw NotExecutableException for workspace related tests when repository only supports
a single workspace

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/NodeTest.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?view=diff&rev=521728&r1=521727&r2=521728
==============================================================================
--- 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
Fri Mar 23 07:01:30 2007
@@ -518,6 +518,20 @@
     protected boolean isSupported(String descriptorKey) throws RepositoryException {
         return "true".equals(helper.getRepository().getDescriptor(descriptorKey));
     }
+    
+    /**
+     * Checks that the repository supports multiple workspace, otherwise aborts with
+     * {@link NotExecutableException}.
+     * @throws NotExecutableException when the repository only supports a single
+     * workspace
+     */
+    protected void ensureMultipleWorkspacesSupported() throws RepositoryException, NotExecutableException
{
+        String workspacenames[] = superuser.getWorkspace().getAccessibleWorkspaceNames();
+        if (workspacenames == null || workspacenames.length < 2) {
+            throw new NotExecutableException("This repository does not seem to support multiple
workspaces.");
+        }
+    }
+    
 
     /**
      * Reverts any pending changes made by <code>s</code> and deletes any nodes

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeTest.java?view=diff&rev=521728&r1=521727&r2=521728
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeTest.java
Fri Mar 23 07:01:30 2007
@@ -103,7 +103,11 @@
      * Calls {@link javax.jcr.Node#getCorrespondingNodePath(String)} on  a node
      * that has no corresponding node in second workspace
      */
-    public void testGetCorrespondingNodePathItemNotFoundException() throws RepositoryException
{
+    public void testGetCorrespondingNodePathItemNotFoundException() throws RepositoryException,
NotExecutableException {
+      
+        // make sure the repository supports multiple workspaces
+        super.ensureMultipleWorkspacesSupported();
+      
         // get default workspace test root node using superuser session
         Node defaultRootNode = (Node) superuser.getItem(testRootNode.getPath());
 
@@ -126,7 +130,10 @@
      * Creates a node with same path in both workspaces to check if {@link
      * javax.jcr.Node#getCorrespondingNodePath(String)} works properly.
      */
-    public void testGetCorrespondingNodePath() throws RepositoryException {
+    public void testGetCorrespondingNodePath() throws RepositoryException, NotExecutableException
{
+      
+        // make sure the repository supports multiple workspaces
+        super.ensureMultipleWorkspacesSupported();
 
         // get default workspace test root node using superuser session
         Node defaultRootNode = (Node) superuser.getItem(testRootNode.getPath());
@@ -160,7 +167,10 @@
      * a String property that can be modified in <code>javax.jcr.tck.nodetype</code>
      * for testing</li> </ul>
      */
-    public void testUpdateInvalidItemStateException() throws RepositoryException {
+    public void testUpdateInvalidItemStateException() throws RepositoryException, NotExecutableException
{
+
+        // make sure the repository supports multiple workspaces
+        super.ensureMultipleWorkspacesSupported();
 
         // get default workspace test root node using superuser session
         Node defaultRootNode = (Node) superuser.getItem(testRootNode.getPath());
@@ -254,7 +264,11 @@
      * name of a String property that can be modified in
      * <code>javax.jcr.tck.nodetype</code> for testing</li> </ul>
      */
-    public void testUpdate() throws RepositoryException {
+    public void testUpdate() throws RepositoryException, NotExecutableException {
+
+        // make sure the repository supports multiple workspaces
+        super.ensureMultipleWorkspacesSupported();
+
         // get default workspace test root node using superuser session
         Node defaultRootNode = (Node) superuser.getItem(testRootNode.getPath());
 



Mime
View raw message