Search in sources :

Example 31 with Clock

use of org.apache.jackrabbit.oak.stats.Clock in project jackrabbit-oak by apache.

the class MissingLastRevSeekerTest method before.

@Before
public void before() throws Exception {
    clock = new Clock.Virtual();
    clock.waitUntil(System.currentTimeMillis());
    Revision.setClock(clock);
    ClusterNodeInfo.setClock(clock);
    store = new MemoryDocumentStore();
    seeker = new MissingLastRevSeeker(store, clock);
}
Also used : MemoryDocumentStore(org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore) Clock(org.apache.jackrabbit.oak.stats.Clock) Before(org.junit.Before)

Example 32 with Clock

use of org.apache.jackrabbit.oak.stats.Clock in project jackrabbit-oak by apache.

the class LastRevRecoveryRandomizedIT method setUp.

@Before
public void setUp() throws Exception {
    LOG.info("Running " + getClass().getSimpleName() + " with seed " + SEED);
    clock = new Clock.Virtual();
    Revision.setClock(clock);
    ClusterNodeInfo.setClock(clock);
    random.setSeed(SEED);
    store = new MemoryDocumentStore();
    ns = new DocumentMK.Builder().setDocumentStore(store).setLeaseCheck(false).clock(clock).setAsyncDelay(0).getNodeStore();
    builder = newBuilder(ns);
    builder.child("root");
    merge(ns, builder);
    currentState.put("/root", ns.getRoot().getChildNode("root"));
    builder = newBuilder(ns);
}
Also used : MemoryDocumentStore(org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Clock(org.apache.jackrabbit.oak.stats.Clock) Before(org.junit.Before)

Example 33 with Clock

use of org.apache.jackrabbit.oak.stats.Clock in project jackrabbit-oak by apache.

the class VersionGCQueryTest method before.

@Before
public void before() throws Exception {
    clock = new Clock.Virtual();
    clock.waitUntil(System.currentTimeMillis());
    Revision.setClock(clock);
    store = new MemoryDocumentStore() {

        @Override
        public <T extends Document> T find(Collection<T> collection, String key) {
            if (collection == Collection.NODES && Utils.isPreviousDocId(key)) {
                prevDocIds.add(key);
            }
            return super.find(collection, key);
        }
    };
    ns = provider.newBuilder().setDocumentStore(store).setAsyncDelay(0).clock(clock).getNodeStore();
}
Also used : MemoryDocumentStore(org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore) Clock(org.apache.jackrabbit.oak.stats.Clock) Before(org.junit.Before)

Example 34 with Clock

use of org.apache.jackrabbit.oak.stats.Clock in project jackrabbit-oak by apache.

the class VersionGCTest method setUp.

@Before
public void setUp() throws Exception {
    execService = Executors.newCachedThreadPool();
    Clock clock = new Clock.Virtual();
    clock.waitUntil(System.currentTimeMillis());
    Revision.setClock(clock);
    ns = builderProvider.newBuilder().clock(clock).setLeaseCheck(false).setDocumentStore(store).setAsyncDelay(0).getNodeStore();
    // create test content
    createNode("foo");
    removeNode("foo");
    // wait one hour
    clock.waitUntil(clock.getTime() + HOURS.toMillis(1));
    gc = ns.getVersionGarbageCollector();
}
Also used : Clock(org.apache.jackrabbit.oak.stats.Clock) Before(org.junit.Before)

Example 35 with Clock

use of org.apache.jackrabbit.oak.stats.Clock in project jackrabbit-oak by apache.

the class ReadPreferenceIT method setUpConnection.

@Override
public void setUpConnection() throws Exception {
    clock = new Clock.Virtual();
    setRevisionClock(clock);
    setClusterNodeInfoClock(clock);
    mongoConnection = connectionFactory.getConnection();
    MongoUtils.dropCollections(mongoConnection.getDB());
    replica = ReplicaSetInfoMock.create(clock);
    mk = new DocumentMK.Builder().clock(clock).setClusterId(1).setMongoDB(mongoConnection.getDB()).setLeaseCheck(false).open();
    mongoDS = (MongoDocumentStore) mk.getDocumentStore();
    // use a separate connection for cluster node 2
    MongoConnection mongoConnection2 = connectionFactory.getConnection();
    mk2 = new DocumentMK.Builder().clock(clock).setClusterId(2).setMongoDB(mongoConnection2.getDB()).setLeaseCheck(false).open();
}
Also used : NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Clock(org.apache.jackrabbit.oak.stats.Clock) MongoConnection(org.apache.jackrabbit.oak.plugins.document.util.MongoConnection)

Aggregations

Clock (org.apache.jackrabbit.oak.stats.Clock)39 Test (org.junit.Test)24 MemoryDocumentStore (org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore)21 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)19 Before (org.junit.Before)8 ChildNodeEntry (org.apache.jackrabbit.oak.spi.state.ChildNodeEntry)3 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)3 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)2 BlobStore (org.apache.jackrabbit.oak.spi.blob.BlobStore)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 IOException (java.io.IOException)1 Calendar (java.util.Calendar)1 Map (java.util.Map)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 InitialContent (org.apache.jackrabbit.oak.InitialContent)1 Oak (org.apache.jackrabbit.oak.Oak)1 CommitFailedException (org.apache.jackrabbit.oak.api.CommitFailedException)1 CONSTRAINT (org.apache.jackrabbit.oak.api.CommitFailedException.CONSTRAINT)1