jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r700143 - in /jackrabbit/branches/1.4/jackrabbit-core: ./ src/main/java/org/apache/jackrabbit/core/query/ src/test/java/org/apache/jackrabbit/core/query/
Date Mon, 29 Sep 2008 14:52:13 GMT
Author: jukka
Date: Mon Sep 29 07:52:12 2008
New Revision: 700143

URL: http://svn.apache.org/viewvc?rev=700143&view=rev
Log:
1.4: Merged revision 668086 to the 1.4 branch (JCR-1650)

Modified:
    jackrabbit/branches/1.4/jackrabbit-core/   (props changed)
    jackrabbit/branches/1.4/jackrabbit-core/RELEASE-NOTES.txt
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/
  (props changed)
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/NAryQueryNode.java
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DerefTest.java

Propchange: jackrabbit/branches/1.4/jackrabbit-core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 29 07:52:12 2008
@@ -1 +1 @@
-/jackrabbit/trunk/jackrabbit-core:653417,654078,654514,655917,656240,656655,656664,658583,668147,672125,678788,679389,680135,681031,681287,682409,686688,691181,691550,694164,698200,698209
+/jackrabbit/trunk/jackrabbit-core:653417,654078,654514,655917,656240,656655,656664,658583,668086,668147,672125,678788,679389,680135,681031,681287,682409,686688,691181,691550,694164,698200,698209

Modified: jackrabbit/branches/1.4/jackrabbit-core/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/RELEASE-NOTES.txt?rev=700143&r1=700142&r2=700143&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/RELEASE-NOTES.txt (original)
+++ jackrabbit/branches/1.4/jackrabbit-core/RELEASE-NOTES.txt Mon Sep 29 07:52:12 2008
@@ -53,6 +53,7 @@
   [JCR-1362] DatabaseJournal improperly finds tables in external schemas ...
   [JCR-1632] Mixin type loss
   [JCR-1644] make NamespaceContext#getPrefix(java.lang.String) iterative ...
+  [JCR-1650] XPathQueryBuilder may not handle multiple jcr:deref correctly
   [JCR-1651] Node.addNode(String, String) doesn't prevent use of mixin ...
   [JCR-1657] Cluster revision entries should be retrieved in order
   [JCR-1664] JNDI Referencable Issues
@@ -118,7 +119,6 @@
   [JCR-1634] In XA transaction session.addLockToken() does not have effect
   [JCR-1637] The GarbageCollector ignores InterruptedException and so ...
   [JCR-1648] Database reconnect during shutdown
-  [JCR-1650] XPathQueryBuilder may not handle multiple jcr:deref correctly
   [JCR-1660] Consistency check / fix skips system nodes
   [JCR-1666] After transaction rollback session may become 'corrupt'
   [JCR-1668] After RepositoryImpl instance has been created and shut ...

Propchange: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Sep 29 07:52:12 2008
@@ -0,0 +1,2 @@
+/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query:653417,654078,654514,655917,656240,656655,656664,658583,668086,668147,672125,678788,679389,680135,681031,681287,682409,686688,691181,691550,694164,698200,698209
+/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query:668086

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/NAryQueryNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/NAryQueryNode.java?rev=700143&r1=700142&r2=700143&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/NAryQueryNode.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/NAryQueryNode.java
Mon Sep 29 07:52:12 2008
@@ -85,7 +85,15 @@
         if (operands == null) {
             return false;
         }
-        return operands.remove(operand);
+        // JCR-1650 search the operand without relying on Object#equals(Object)
+        Iterator it = operands.iterator();
+        while (it.hasNext()) {
+            if (it.next() == operand) {
+                it.remove();
+                return true;
+            }
+        }
+        return false;
     }
 
     /**

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DerefTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DerefTest.java?rev=700143&r1=700142&r2=700143&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DerefTest.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DerefTest.java
Mon Sep 29 07:52:12 2008
@@ -50,9 +50,9 @@
      *            + eric (worksfor -> company/sun)
      *      + frank (worksfor -> company/microsoft)
      *   + company
-     *      + sun
-     *      + microsoft
-     *      + ibm
+     *      + sun (eotm -> andrew)
+     *      + microsoft (eotm -> carl)
+     *      + ibm (eotm -> daren)
      * </pre>
      */
     protected void setUp() throws Exception {
@@ -72,18 +72,26 @@
         ibm.setProperty("ceo", "Palmisano");
 
         andrew = people.addNode("andrew");
+        andrew.addMixin(mixReferenceable);
         andrew.setProperty("worksfor", sun);
         bill = andrew.addNode("bill");
         bill.setProperty("worksfor", ibm);
         carl = people.addNode("carl");
+        carl.addMixin(mixReferenceable);
         carl.setProperty("worksfor", microsoft);
         daren = carl.addNode("daren");
+        daren.addMixin(mixReferenceable);
         daren.setProperty("worksfor", ibm);
         eric = daren.addNode("eric");
         eric.setProperty("worksfor", sun);
         frank = people.addNode("frank");
         frank.setProperty("worksfor", microsoft);
 
+        // Employees of the month
+        sun.setProperty("eotm", andrew);
+        microsoft.setProperty("eotm", carl);
+        ibm.setProperty("eotm", daren);
+
         testRootNode.save();
     }
 
@@ -155,4 +163,27 @@
             assertTrue(node.getProperty("jcr:frozenUuid").getString().equals(referenced.getUUID()));
         }
     }
+
+    /**
+     * Tests various XPath queries with multiple jcr:deref() function.
+     */
+    public void testMultipleDeref() throws RepositoryException {
+        executeXPathQuery(testPath + "/people/frank/jcr:deref(@worksfor, '*')/jcr:deref(@eotm,
'*')",
+                new Node[]{carl});
+        executeXPathQuery(testPath + "/people/frank/jcr:deref(@worksfor, '*')/jcr:deref(@eotm,
'*')[@jcr:uuid]",
+                new Node[]{carl});
+        executeXPathQuery(testPath + "/people/frank/jcr:deref(@worksfor, '*')[@jcr:uuid]/jcr:deref(@eotm,
'*')[@jcr:uuid]",
+                new Node[]{carl});
+        executeXPathQuery(testPath + "/people/frank/jcr:deref(@worksfor, '*')[@jcr:uuid]/jcr:deref(@eotm,
'*')",
+                new Node[]{carl});
+
+        executeXPathQuery(testPath + "/people//jcr:deref(@worksfor, '*')/jcr:deref(@eotm,
'*')",
+                new Node[]{andrew, carl, daren});
+        executeXPathQuery(testPath + "/people//jcr:deref(@worksfor, '*')/jcr:deref(@eotm,
'*')[@jcr:uuid]",
+                new Node[]{andrew, carl, daren});
+        executeXPathQuery(testPath + "/people//jcr:deref(@worksfor, '*')[@jcr:uuid]/jcr:deref(@eotm,
'*')[@jcr:uuid]",
+                new Node[]{andrew, carl, daren});
+        executeXPathQuery(testPath + "/people//jcr:deref(@worksfor, '*')[@jcr:uuid]/jcr:deref(@eotm,
'*')",
+                new Node[]{andrew, carl, daren});
+    }
 }



Mime
View raw message