Search in sources :

Example 6 with Condition

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

the class DocumentStoreStatsIT method removeConditional.

@Test
public void removeConditional() throws Exception {
    Revision r = Revision.newRevision(1);
    Key modified = new Key(MODIFIED_IN_SECS, null);
    Condition c = newEqualsCondition(getModifiedInSecs(r.getTimestamp()));
    Map<String, Map<Key, Condition>> ids = Maps.newHashMap();
    for (int i = 0; i < 10; i++) {
        String id = testName.getMethodName() + "-" + i;
        ids.put(id, singletonMap(modified, c));
        UpdateOp up = new UpdateOp(id, true);
        NodeDocument.setModified(up, r);
        ds.create(Collection.NODES, singletonList(up));
        removeMe.add(id);
    }
    DocumentStoreStatsCollector coll = mock(DocumentStoreStatsCollector.class);
    configureStatsCollector(coll);
    ds.remove(Collection.NODES, ids);
    verify(coll).doneRemove(anyLong(), eq(Collection.NODES), eq(10));
}
Also used : Condition.newEqualsCondition(org.apache.jackrabbit.oak.plugins.document.UpdateOp.Condition.newEqualsCondition) Condition(org.apache.jackrabbit.oak.plugins.document.UpdateOp.Condition) Map(java.util.Map) Collections.singletonMap(java.util.Collections.singletonMap) Key(org.apache.jackrabbit.oak.plugins.document.UpdateOp.Key) Test(org.junit.Test)

Aggregations

Condition (org.apache.jackrabbit.oak.plugins.document.UpdateOp.Condition)6 Key (org.apache.jackrabbit.oak.plugins.document.UpdateOp.Key)6 Map (java.util.Map)5 HashMap (java.util.HashMap)3 TreeMap (java.util.TreeMap)3 DocumentStoreException (org.apache.jackrabbit.oak.plugins.document.DocumentStoreException)3 Stopwatch (com.google.common.base.Stopwatch)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 QueryBuilder (com.mongodb.QueryBuilder)2 IOException (java.io.IOException)2 LinkedHashMap (java.util.LinkedHashMap)2 Entry (java.util.Map.Entry)2 ExecutionException (java.util.concurrent.ExecutionException)2 UncheckedExecutionException (com.google.common.util.concurrent.UncheckedExecutionException)1 BasicDBObject (com.mongodb.BasicDBObject)1 BulkWriteException (com.mongodb.BulkWriteException)1 DBCollection (com.mongodb.DBCollection)1 DBObject (com.mongodb.DBObject)1 MongoException (com.mongodb.MongoException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1