jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r428408 - /jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java
Date Thu, 03 Aug 2006 14:08:55 GMT
Author: mreutegg
Date: Thu Aug  3 07:08:54 2006
New Revision: 428408

URL: http://svn.apache.org/viewvc?rev=428408&view=rev
Log:
JCR-527: TCK: DerefQueryLevel1Test requires support for optional jcr:deref function

Modified:
    jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java

Modified: jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java?rev=428408&r1=428407&r2=428408&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java
Thu Aug  3 07:08:54 2006
@@ -74,7 +74,7 @@
         }
         Node target = refProp.getNode();
         String xpath = createStatement(refProp, target.getName());
-        executeXPathQuery(session, xpath, new Node[]{target});
+        executeDerefQuery(session, xpath, new Node[]{target});
     }
 
     /**
@@ -91,7 +91,7 @@
         }
         Node target = refProp.getNode();
         String xpath = createStatement(refProp, "*");
-        executeXPathQuery(session, xpath, new Node[]{target});
+        executeDerefQuery(session, xpath, new Node[]{target});
     }
 
     /**
@@ -122,7 +122,7 @@
         }
         targetNodes = (Node[]) resultNodes.toArray(new Node[resultNodes.size()]);
         String xpath = createStatement(refProp, nodeName);
-        executeXPathQuery(session, xpath, targetNodes);
+        executeDerefQuery(session, xpath, targetNodes);
     }
 
     /**
@@ -145,7 +145,7 @@
             throw new NotExecutableException("Reference property does not contain a value");
         }
         String xpath = createStatement(refProp, "*");
-        executeXPathQuery(session, xpath, targetNodes);
+        executeDerefQuery(session, xpath, targetNodes);
     }
 
     //----------------------------< internal >----------------------------------
@@ -164,5 +164,26 @@
         stmt.append(refProperty.getName()).append(", '");
         stmt.append(nameTest).append("')");
         return stmt.toString();
+    }
+
+    /**
+     * Executes the <code>xpath</code> query and checks the results against the
+     * specified <code>nodes</code>.
+     *
+     * @param session the session to use for the query.
+     * @param xpath   the xpath query.
+     * @param nodes   the expected result nodes.
+     * @throws NotExecutableException if this repository does not support the
+     *                                jcr:deref() function.
+     */
+    private void executeDerefQuery(Session session,
+                                   String xpath,
+                                   Node[] nodes) throws NotExecutableException {
+        try {
+            executeXPathQuery(session, xpath, nodes);
+        } catch (RepositoryException e) {
+            // assume jcr:deref() is not supported
+            throw new NotExecutableException(e.getMessage());
+        }
     }
 }



Mime
View raw message