use of org.apache.jackrabbit.oak.spi.state.NodeState in project jackrabbit-oak by apache.
the class SecureNodeBuilderTest method testGetNodeStateNonAccessible.
@Test
public void testGetNodeStateNonAccessible() {
NodeState ns = secureNodeBuilder.getChildNode(NAME_NON_ACCESSIBLE).getNodeState();
assertTrue(ns instanceof SecureNodeState);
}
use of org.apache.jackrabbit.oak.spi.state.NodeState in project jackrabbit-oak by apache.
the class SecureNodeBuilderTest method testGetBaseStateNonAccessible.
@Test
public void testGetBaseStateNonAccessible() {
NodeState ns = secureNodeBuilder.getChildNode(NAME_NON_ACCESSIBLE).getBaseState();
assertTrue(ns instanceof SecureNodeState);
}
use of org.apache.jackrabbit.oak.spi.state.NodeState in project jackrabbit-oak by apache.
the class SecureNodeBuilderTest method testGetBaseState.
@Test
public void testGetBaseState() {
NodeState ns = secureNodeBuilder.getBaseState();
assertTrue(ns instanceof SecureNodeState);
}
use of org.apache.jackrabbit.oak.spi.state.NodeState in project jackrabbit-oak by apache.
the class CheckpointsTest method crossClusterNodeCheckpoint.
@Test
public void crossClusterNodeCheckpoint() throws Exception {
// use an async delay to ensure DocumentNodeStore.suspendUntil() works
// but set it to a high value and control background ops manually in
// this test
final int asyncDelay = (int) TimeUnit.MINUTES.toMillis(1);
DocumentStore store = new MemoryDocumentStore();
final DocumentNodeStore ns1 = builderProvider.newBuilder().setClusterId(1).setDocumentStore(store).setAsyncDelay(asyncDelay).getNodeStore();
final DocumentNodeStore ns2 = builderProvider.newBuilder().setClusterId(2).setDocumentStore(store).setAsyncDelay(asyncDelay).getNodeStore();
// create node on ns1
NodeBuilder builder = ns1.getRoot().builder();
builder.child("foo");
ns1.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
// make visible on ns2
ns1.runBackgroundOperations();
ns2.runBackgroundOperations();
// create checkpoint on ns1
String cp1 = ns1.checkpoint(Long.MAX_VALUE);
// retrieve checkpoint on ns2
NodeState root = ns2.retrieve(cp1);
assertNotNull(root);
assertTrue(root.hasChildNode("foo"));
ns2.release(cp1);
// create node on ns1
builder = ns1.getRoot().builder();
builder.child("bar");
ns1.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
// create checkpoint when 'bar' is not yet visible to ns2
final String cp2 = ns1.checkpoint(Long.MAX_VALUE);
// retrieve checkpoint on ns2
final NodeState[] state = new NodeState[1];
Thread t = new Thread(new Runnable() {
@Override
public void run() {
state[0] = ns2.retrieve(cp2);
}
});
t.start();
ns1.runBackgroundOperations();
ns2.runBackgroundOperations();
t.join();
assertNotNull(state[0]);
assertTrue(state[0].hasChildNode("bar"));
}
use of org.apache.jackrabbit.oak.spi.state.NodeState in project jackrabbit-oak by apache.
the class AtomicCounterEditorTest method notCluster.
@Test
public void notCluster() throws CommitFailedException {
NodeBuilder builder;
NodeState before, after;
builder = EMPTY_NODE.builder();
before = builder.getNodeState();
builder = setMixin(builder);
builder = incrementBy(builder, INCREMENT_BY_1);
after = builder.getNodeState();
builder = HOOK_NO_CLUSTER.processCommit(before, after, EMPTY).builder();
assertCounterNodeState(builder, ImmutableSet.of(PREFIX_PROP_COUNTER, PREFIX_PROP_REVISION), 1);
before = builder.getNodeState();
builder = incrementBy(builder, INCREMENT_BY_2);
after = builder.getNodeState();
builder = HOOK_NO_CLUSTER.processCommit(before, after, EMPTY).builder();
assertCounterNodeState(builder, ImmutableSet.of(PREFIX_PROP_COUNTER, PREFIX_PROP_REVISION), 3);
}
Aggregations