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 ch...@apache.org on 2017/02/23 13:59:36 UTC
svn commit: r1784132 -
/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
Author: chetanm
Date: Thu Feb 23 13:59:36 2017
New Revision: 1784132
URL: http://svn.apache.org/viewvc?rev=1784132&view=rev
Log:
OAK-5788 - Perform update of single node in one remote call if possible
Add ignored test
Modified:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java?rev=1784132&r1=1784131&r2=1784132&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java Thu Feb 23 13:59:36 2017
@@ -2887,6 +2887,52 @@ public class DocumentNodeStoreTest {
assertTrue("Two added paths should have forced flush", numChangedPaths == 0);
}
+ @Ignore("OAK-5788")
+ @Test
+ public void commitRootSameAsModifiedPath() throws Exception{
+ final AtomicInteger count = new AtomicInteger();
+ DocumentStore ds = new MemoryDocumentStore(){
+ @Override
+ public <T extends Document> T createOrUpdate(Collection<T> collection, UpdateOp update) {
+ incrementCounter(collection);
+ return super.createOrUpdate(collection, update);
+ }
+
+ @Override
+ public <T extends Document> List<T> createOrUpdate(Collection<T> collection, List<UpdateOp> updateOps) {
+ if (updateOps.size() != 1) { //For size == 1 previous method gets called internally which inflates the count
+ incrementCounter(collection);
+ }
+ return super.createOrUpdate(collection, updateOps);
+ }
+
+ @Override
+ public <T extends Document> T findAndUpdate(Collection<T> collection, UpdateOp update) {
+ incrementCounter(collection);
+ return super.findAndUpdate(collection, update);
+ }
+
+ private <T extends Document> void incrementCounter(Collection<T> collection) {
+ if (collection == Collection.NODES) {
+ count.incrementAndGet();
+ }
+ }
+ };
+
+ DocumentNodeStore ns = builderProvider.newBuilder().setAsyncDelay(0).setDocumentStore(ds).getNodeStore();
+ NodeBuilder builder = ns.getRoot().builder();
+ builder.child("a").child("b");
+ merge(ns, builder);
+
+ count.set(0);
+
+ builder = ns.getRoot().builder();
+ builder.child("a").child("b").setProperty("foo", "bar");
+ merge(ns, builder);
+
+ assertEquals(1, count.get());
+ }
+
private static class TestException extends RuntimeException {
}