Search in sources :

Example 16 with RevisionVector

use of org.apache.jackrabbit.oak.plugins.document.RevisionVector in project jackrabbit-oak by apache.

the class UtilsTest method getMinTimestampForDiff.

@Test
public void getMinTimestampForDiff() {
    RevisionVector from = new RevisionVector(new Revision(17, 0, 1));
    RevisionVector to = new RevisionVector(new Revision(19, 0, 1));
    assertEquals(17, Utils.getMinTimestampForDiff(from, to, new RevisionVector()));
    assertEquals(17, Utils.getMinTimestampForDiff(to, from, new RevisionVector()));
    RevisionVector minRevs = new RevisionVector(new Revision(7, 0, 1), new Revision(4, 0, 2));
    assertEquals(17, Utils.getMinTimestampForDiff(from, to, minRevs));
    assertEquals(17, Utils.getMinTimestampForDiff(to, from, minRevs));
    to = to.update(new Revision(15, 0, 2));
    // must return min revision of clusterId 2
    assertEquals(4, Utils.getMinTimestampForDiff(from, to, minRevs));
    assertEquals(4, Utils.getMinTimestampForDiff(to, from, minRevs));
}
Also used : Revision(org.apache.jackrabbit.oak.plugins.document.Revision) RevisionVector(org.apache.jackrabbit.oak.plugins.document.RevisionVector) Test(org.junit.Test)

Aggregations

RevisionVector (org.apache.jackrabbit.oak.plugins.document.RevisionVector)16 Revision (org.apache.jackrabbit.oak.plugins.document.Revision)13 Test (org.junit.Test)8 File (java.io.File)3 AbstractDocumentNodeState (org.apache.jackrabbit.oak.plugins.document.AbstractDocumentNodeState)3 PathRev (org.apache.jackrabbit.oak.plugins.document.PathRev)3 StringValue (org.apache.jackrabbit.oak.plugins.document.util.StringValue)3 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)3 ArrayList (java.util.ArrayList)2 PathFilter (org.apache.jackrabbit.oak.plugins.index.PathFilter)2 BasicDBObject (com.mongodb.BasicDBObject)1 DBCollection (com.mongodb.DBCollection)1 DBObject (com.mongodb.DBObject)1 ReadPreference (com.mongodb.ReadPreference)1 FileOutputStream (java.io.FileOutputStream)1 HashSet (java.util.HashSet)1 AbstractMongoConnectionTest (org.apache.jackrabbit.oak.plugins.document.AbstractMongoConnectionTest)1 DocumentNodeState (org.apache.jackrabbit.oak.plugins.document.DocumentNodeState)1 DocumentReadPreference (org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentStore.DocumentReadPreference)1 LocalChanges (org.apache.jackrabbit.oak.plugins.document.mongo.replica.LocalChanges)1