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 re...@apache.org on 2015/06/01 15:59:11 UTC
svn commit: r1682904 -
/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MultiDocumentStoreTest.java
Author: reschke
Date: Mon Jun 1 13:59:10 2015
New Revision: 1682904
URL: http://svn.apache.org/r1682904
Log:
OAK-2916 - RDBDocumentStore: use of "GREATEST" in SQL apparently doesn't have test coverage in unit tests
Modified:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MultiDocumentStoreTest.java
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MultiDocumentStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MultiDocumentStoreTest.java?rev=1682904&r1=1682903&r2=1682904&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MultiDocumentStoreTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/MultiDocumentStoreTest.java Mon Jun 1 13:59:10 2015
@@ -77,6 +77,7 @@ public class MultiDocumentStoreTest exte
UpdateOp up = new UpdateOp(id, true);
up.set("_id", id);
+ up.set("_modified", 1L);
assertTrue(super.ds1.create(Collection.NODES, Collections.singletonList(up)));
nd1 = super.ds1.find(Collection.NODES, id, 0);
Number n = nd1.getModCount();
@@ -92,6 +93,7 @@ public class MultiDocumentStoreTest exte
UpdateOp upds1 = new UpdateOp(id, true);
upds1.set("_id", id);
upds1.set("foo", "bar");
+ upds1.set("_modified", 2L);
super.ds1.update(Collection.NODES, Collections.singletonList(id), upds1);
nd1 = super.ds1.find(Collection.NODES, id);
int oldn1 = n1;
@@ -103,6 +105,7 @@ public class MultiDocumentStoreTest exte
UpdateOp upds2 = new UpdateOp(id, true);
upds2.set("_id", id);
upds2.set("foo", "qux");
+ upds2.set("_modified", 3L);
super.ds2.update(Collection.NODES, Collections.singletonList(id), upds2);
nd2 = super.ds2.find(Collection.NODES, id);
n2 = nd2.getModCount().intValue();
@@ -113,10 +116,16 @@ public class MultiDocumentStoreTest exte
upds1 = new UpdateOp(id, true);
upds1.set("_id", id);
upds1.set("foo", "barbar");
+ upds1.max("_modified", 0L);
NodeDocument prev = super.ds1.findAndUpdate(Collection.NODES, upds1);
// prev document should contain mod from DS2
assertEquals("qux", prev.get("foo"));
assertEquals(oldn1 + 2, prev.getModCount().intValue());
+ assertEquals(3L, prev.getModified().intValue());
+
+ // the new document must not have a _modified time smaller than before the update
+ nd1 = super.ds1.find(Collection.NODES, id, 0);
+ assertEquals(super.dsname + ": _modified value must never ever get smaller", 3L, nd1.getModified().intValue());
}
}