jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1210826 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/query/lucene/ test/java/org/apache/jackrabbit/core/query/ test/java/org/apache/jackrabbit/core/query/lucene/
Date Tue, 06 Dec 2011 08:44:44 GMT
Author: alexparvulescu
Date: Tue Dec  6 08:44:43 2011
New Revision: 1210826

URL: http://svn.apache.org/viewvc?rev=1210826&view=rev
Log:
JCR-3160 Session#move doesn't trigger rebuild of parent node aggregation

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractQueryTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SQL2IndexingAggregateTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java?rev=1210826&r1=1210825&r2=1210826&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/SearchIndex.java
Tue Dec  6 08:44:43 2011
@@ -633,7 +633,6 @@ public class SearchIndex extends Abstrac
             if (state != null) {
                 NodeId id = state.getNodeId();
                 addedIds.add(id);
-                removedIds.remove(id);
                 retrieveAggregateRoot(state, aggregateRoots);
 
                 try {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractQueryTest.java?rev=1210826&r1=1210825&r2=1210826&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractQueryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/AbstractQueryTest.java
Tue Dec  6 08:44:43 2011
@@ -214,12 +214,12 @@ public class AbstractQueryTest extends A
         // check if all expected are in result
         for (Iterator<String> it = expectedPaths.iterator(); it.hasNext();) {
             String path = it.next();
-            assertTrue(path + " is not part of the result set", resultPaths.contains(path));
+            assertTrue(path + " is not part of the result set "+ expectedPaths, resultPaths.contains(path));
         }
         // check result does not contain more than expected
         for (Iterator<String> it = resultPaths.iterator(); it.hasNext();) {
             String path = it.next();
-            assertTrue(path + " is not expected to be part of the result set", expectedPaths.contains(path));
+            assertTrue(path + " is not expected to be part of the result set " + expectedPaths,
expectedPaths.contains(path));
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SQL2IndexingAggregateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SQL2IndexingAggregateTest.java?rev=1210826&r1=1210825&r2=1210826&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SQL2IndexingAggregateTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SQL2IndexingAggregateTest.java
Tue Dec  6 08:44:43 2011
@@ -219,6 +219,41 @@ public class SQL2IndexingAggregateTest e
     }
 
     /**
+     * JCR-3160 - Session#move doesn't trigger rebuild of parent node
+     * aggregation
+     */
+    public void testAggregateMove() throws Exception {
+
+        String sql = "SELECT * FROM [nt:folder] as f"
+                + " WHERE ISDESCENDANTNODE([" + testRoot + "])"
+                + " AND CONTAINS (f.*, 'dog')";
+
+        Node folderA = testRootNode.addNode("folderA", "nt:folder");
+        Node folderB = testRootNode.addNode("folderB", "nt:folder");
+
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        Writer writer = new OutputStreamWriter(out, "UTF-8");
+        writer.write("the quick brown fox jumps over the lazy dog.");
+        writer.flush();
+
+        Node file = folderA.addNode("myFile", "nt:file");
+        Node resource = file.addNode("jcr:content", "nt:resource");
+        resource.setProperty("jcr:lastModified", Calendar.getInstance());
+        resource.setProperty("jcr:encoding", "UTF-8");
+        resource.setProperty("jcr:mimeType", "text/plain");
+        resource.setProperty("jcr:data", session.getValueFactory()
+                .createBinary(new ByteArrayInputStream(out.toByteArray())));
+        
+        testRootNode.getSession().save();
+        executeSQL2Query(sql, new Node[] { folderA });
+
+        testRootNode.getSession().move(file.getPath(),
+                folderB.getPath() + "/myFile");
+        testRootNode.getSession().save();
+        executeSQL2Query(sql, new Node[] { folderB });
+    }
+
+    /**
      * By default, the recursive aggregation is turned off.
      * 
      * The aggregation hierarchy is defined in



Mime
View raw message