jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r428405 - in /jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query: AbstractQueryLevel2Test.java XPathQueryLevel2Test.java
Date Thu, 03 Aug 2006 13:57:24 GMT
Author: mreutegg
Date: Thu Aug  3 06:57:23 2006
New Revision: 428405

URL: http://svn.apache.org/viewvc?rev=428405&view=rev
Log:
JCR-526: TCK: XPathQueryLevel2Test uses optional column specifier syntax

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

Modified: jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/AbstractQueryLevel2Test.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/AbstractQueryLevel2Test.java?rev=428405&r1=428404&r2=428405&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/AbstractQueryLevel2Test.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/AbstractQueryLevel2Test.java
Thu Aug  3 06:57:23 2006
@@ -24,6 +24,7 @@
 import javax.jcr.Value;
 import javax.jcr.RepositoryException;
 import javax.jcr.Node;
+import javax.jcr.NodeIterator;
 
 /**
  * Implements common setup methods for level 2 queries.
@@ -111,6 +112,27 @@
             if (value == null) {
                 fail("Search Test: fails result does not contain value for selected property");
             }
+            assertEquals("Value in query result row does not match expected value",
+                    expectedValue, value.getString());
+        }
+    }
+
+    /**
+     * Checks if all nodes in <code>itr</code> have a property with name
+     * <code>propertyName</code> and have the <code>expectedValue</code>.
+     *
+     * @param itr           the nodes to check.
+     * @param propertyName  the name of the property.
+     * @param expectedValue the exected value of the property.
+     * @throws RepositoryException if an error occurs.
+     */
+    protected void checkValue(NodeIterator itr,
+                              String propertyName,
+                              String expectedValue) throws RepositoryException {
+        while (itr.hasNext()) {
+            Node node = itr.nextNode();
+            // check fullText
+            Value value = node.getProperty(propertyName).getValue();
             assertEquals("Value in query result row does not match expected value",
                     expectedValue, value.getString());
         }

Modified: jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/XPathQueryLevel2Test.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/XPathQueryLevel2Test.java?rev=428405&r1=428404&r2=428405&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/XPathQueryLevel2Test.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/query/XPathQueryLevel2Test.java
Thu Aug  3 06:57:23 2006
@@ -21,6 +21,7 @@
 import javax.jcr.query.RowIterator;
 import javax.jcr.query.Row;
 import javax.jcr.Value;
+import javax.jcr.NodeIterator;
 
 /**
  * Tests XPath queries on content written to the workspace by the test itself.
@@ -59,10 +60,9 @@
         checkResult(result, 1);
 
         // evaluate result
-        RowIterator itr = result.getRows();
+        NodeIterator itr = result.getNodes();
         while (itr.hasNext()) {
-            Row row = itr.nextRow();
-            Value value = row.getValue(propertyName1);
+            Value value = itr.nextNode().getProperty(propertyName1).getValue();
             if (value != null) {
                 String fullText = value.getString();
                 if (fullText.indexOf("cat") > 0) {
@@ -85,7 +85,7 @@
         checkResult(result, 1);
 
         // evaluate result
-        checkValue(result.getRows(), propertyName1, "b");
+        checkValue(result.getNodes(), propertyName1, "b");
     }
 
     /**
@@ -101,7 +101,7 @@
         checkResult(result, 1);
 
         // evaluate result
-        checkValue(result.getRows(), propertyName1, "existence");
+        checkValue(result.getNodes(), propertyName1, "existence");
     }
 
     /**
@@ -134,7 +134,6 @@
         tmp.append(jcrRoot).append(testRoot);
         tmp.append("/*[").append(jcrContains);
         tmp.append("(., \"'quick brown' -cat\")]");
-        tmp.append("/@").append(propertyName1);
         return new Statement(tmp.toString(), Query.XPATH);
     }
 
@@ -147,7 +146,6 @@
         tmp.append(jcrRoot).append(testRoot);
         tmp.append("/*[@").append(propertyName2).append(" = 'two'");
         tmp.append(" and @").append(propertyName1).append(" = 'existence']");
-        tmp.append("/@").append(propertyName1);
         return new Statement(tmp.toString(), Query.XPATH);
     }
 
@@ -161,7 +159,7 @@
         tmp.append(propertyName1);
         tmp.append(" <= 'b' and @");
         tmp.append(propertyName1);
-        tmp.append(" > 'a']/@").append(propertyName1);
+        tmp.append(" > 'a']");
         return new Statement(tmp.toString(), Query.XPATH);
     }
 }



Mime
View raw message