You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by mr...@apache.org on 2016/06/21 09:22:29 UTC

svn commit: r1749476 - in /jackrabbit/oak/branches/1.4: ./ oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndInvalidateIT.java

Author: mreutegg
Date: Tue Jun 21 09:22:29 2016
New Revision: 1749476

URL: http://svn.apache.org/viewvc?rev=1749476&view=rev
Log:
OAK-4489: Improve test coverage on DocumentStore for concurrent query and invalidate

Merged revision 1749475 from trunk

Modified:
    jackrabbit/oak/branches/1.4/   (props changed)
    jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndInvalidateIT.java

Propchange: jackrabbit/oak/branches/1.4/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 21 09:22:29 2016
@@ -1,3 +1,3 @@
 /jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1733615,1733875,1733913,1733929,1734230,1734254,1734279,1734941,1735052,1735405,1735484,1735549,1735564,1735588,1735622,1735638,1735919,1735983,1736176,1737309-1737310,1737334,1737349,1737998,1738004,1738775,1738795,1738833,1738950,1738957,1738963,1739894,1740116,1740625-1740626,1740971,1741032,1741339,1741343,1742520,1742888,1742916,1743097,1743172,1743343,1744265,1744959,1745038,1745197,1745368,1746086,1746117,1746342,1746345,1746696,1746981,1747492,1748505,1748553,1748870,1749350,1749464
+/jackrabbit/oak/trunk:1733615,1733875,1733913,1733929,1734230,1734254,1734279,1734941,1735052,1735405,1735484,1735549,1735564,1735588,1735622,1735638,1735919,1735983,1736176,1737309-1737310,1737334,1737349,1737998,1738004,1738775,1738795,1738833,1738950,1738957,1738963,1739894,1740116,1740625-1740626,1740971,1741032,1741339,1741343,1742520,1742888,1742916,1743097,1743172,1743343,1744265,1744959,1745038,1745197,1745368,1746086,1746117,1746342,1746345,1746696,1746981,1747492,1748505,1748553,1748870,1749350,1749464,1749475
 /jackrabbit/trunk:1345480

Modified: jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndInvalidateIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndInvalidateIT.java?rev=1749476&r1=1749475&r2=1749476&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndInvalidateIT.java (original)
+++ jackrabbit/oak/branches/1.4/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndInvalidateIT.java Tue Jun 21 09:22:29 2016
@@ -43,16 +43,38 @@ public class ConcurrentQueryAndInvalidat
     private volatile long counter;
 
     @Test
-    public void cacheUpdate() throws Exception {
-        cacheUpdate(false);
+    public void cacheUpdateInvalidateWithIDs() throws Exception {
+        cacheUpdate(new Invalidate() {
+            @Override
+            public void perform(DocumentStore store, Iterable<String> ids) {
+                store.invalidateCache(ids);
+            }
+        });
     }
 
     @Test
     public void cacheUpdateInvalidateAll() throws Exception {
-        cacheUpdate(true);
+        cacheUpdate(new Invalidate() {
+            @Override
+            public void perform(DocumentStore store, Iterable<String> ids) {
+                store.invalidateCache();
+            }
+        });
     }
 
-    private void cacheUpdate(final boolean invalidateAll) throws Exception {
+    @Test
+    public void cacheUpdateInvalidateIndividual() throws Exception {
+        cacheUpdate(new Invalidate() {
+            @Override
+            public void perform(DocumentStore store, Iterable<String> ids) {
+                for (String id : ids) {
+                    store.invalidateCache(NODES, id);
+                }
+            }
+        });
+    }
+
+    private void cacheUpdate(final Invalidate inv) throws Exception {
         Revision r = newRevision();
         List<UpdateOp> ops = Lists.newArrayList();
         List<String> ids = Lists.newArrayList();
@@ -82,11 +104,7 @@ public class ConcurrentQueryAndInvalidat
                     // update docs on ds2
                     Iterable<String> ids = updateDocuments();
                     // invalidate docs on ds1
-                    if (invalidateAll) {
-                        ds1.invalidateCache();
-                    } else {
-                        ds1.invalidateCache(ids);
-                    }
+                    inv.perform(ds1, ids);
                 }
             });
             q.start();
@@ -120,4 +138,8 @@ public class ConcurrentQueryAndInvalidat
         ds2.update(NODES, ids, op);
         return ids;
     }
+
+    private interface Invalidate {
+        void perform(DocumentStore store, Iterable<String> ids);
+    }
 }