use of org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore in project jackrabbit-oak by apache.
the class ClusterPermissionsTest method before.
@Before
public void before() throws Exception {
MemoryDocumentStore ds = new MemoryDocumentStore();
MemoryBlobStore bs = new MemoryBlobStore();
DocumentMK.Builder builder;
builder = new DocumentMK.Builder();
builder.setDocumentStore(ds).setBlobStore(bs).setAsyncDelay(0);
ns1 = builder.setClusterId(1).getNodeStore();
builder = new DocumentMK.Builder();
builder.setDocumentStore(ds).setBlobStore(bs).setAsyncDelay(0);
ns2 = builder.setClusterId(2).getNodeStore();
Oak oak = new Oak(ns1).with(new InitialContent()).with(new ReferenceEditorProvider()).with(new ReferenceIndexProvider()).with(new PropertyIndexEditorProvider()).with(new PropertyIndexProvider()).with(new TypeEditorProvider()).with(securityProvider1 = new SecurityProviderImpl(getSecurityConfigParameters()));
contentRepository1 = oak.createContentRepository();
adminSession1 = login1(getAdminCredentials());
root1 = adminSession1.getLatestRoot();
userManager1 = securityProvider1.getConfiguration(UserConfiguration.class).getUserManager(root1, namePathMapper);
aclMgr1 = securityProvider1.getConfiguration(AuthorizationConfiguration.class).getAccessControlManager(root1, namePathMapper);
// make sure initial content is visible to ns2
syncClusterNodes();
oak = new Oak(ns2).with(new InitialContent()).with(new ReferenceEditorProvider()).with(new ReferenceIndexProvider()).with(new PropertyIndexEditorProvider()).with(new PropertyIndexProvider()).with(new TypeEditorProvider()).with(securityProvider2 = new SecurityProviderImpl(getSecurityConfigParameters()));
contentRepository2 = oak.createContentRepository();
adminSession2 = login2(getAdminCredentials());
root2 = adminSession2.getLatestRoot();
userManager2 = securityProvider2.getConfiguration(UserConfiguration.class).getUserManager(root2, namePathMapper);
aclMgr2 = securityProvider2.getConfiguration(AuthorizationConfiguration.class).getAccessControlManager(root2, namePathMapper);
}
use of org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore in project jackrabbit-oak by apache.
the class DocumentDiscoveryLiteServiceCrashTest method setup.
@Before
public void setup() throws Exception {
clock = new Clock.Virtual();
clock.waitUntil(System.currentTimeMillis());
ClusterNodeInfo.setClock(clock);
store = new MemoryDocumentStore();
wd1 = UUID.randomUUID().toString();
wd2 = UUID.randomUUID().toString();
}
use of org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore in project jackrabbit-oak by apache.
the class ClusterBranchCommitTest method before.
@Before
public void before() {
DocumentStore store = new MemoryDocumentStore();
ns1 = builderProvider.newBuilder().setDocumentStore(store).setAsyncDelay(0).setClusterId(1).getNodeStore();
ns2 = builderProvider.newBuilder().setDocumentStore(store).setAsyncDelay(0).setClusterId(2).getNodeStore();
}
use of org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore in project jackrabbit-oak by apache.
the class ClusterConflictTest method setUp.
@Before
public void setUp() {
MemoryDocumentStore store = new MemoryDocumentStore();
ns1 = newDocumentNodeStore(store, 1);
ns2 = newDocumentNodeStore(store, 2);
}
use of org.apache.jackrabbit.oak.plugins.document.memory.MemoryDocumentStore in project jackrabbit-oak by apache.
the class ClusterInfoTest method useAbandoned.
@Test
public void useAbandoned() throws InterruptedException {
Clock clock = new Clock.Virtual();
clock.waitUntil(System.currentTimeMillis());
ClusterNodeInfo.setClock(clock);
MemoryDocumentStore mem = new MemoryDocumentStore();
DocumentNodeStore ns1 = new DocumentMK.Builder().setDocumentStore(mem).clock(clock).setAsyncDelay(0).setLeaseCheck(false).getNodeStore();
DocumentStore ds = ns1.getDocumentStore();
int cid = ns1.getClusterId();
ClusterNodeInfoDocument cnid = ds.find(Collection.CLUSTER_NODES, "" + cid);
assertNotNull(cnid);
assertEquals(ClusterNodeState.ACTIVE.toString(), cnid.get(ClusterNodeInfo.STATE));
ns1.dispose();
long waitFor = 2000;
// modify record to indicate "active" with a lease end in the future
UpdateOp up = new UpdateOp("" + cid, false);
up.set(ClusterNodeInfo.STATE, ClusterNodeState.ACTIVE.toString());
long now = clock.getTime();
up.set(ClusterNodeInfo.LEASE_END_KEY, now + waitFor);
ds.findAndUpdate(Collection.CLUSTER_NODES, up);
// try restart
ns1 = new DocumentMK.Builder().setDocumentStore(mem).clock(clock).setAsyncDelay(0).setLeaseCheck(false).getNodeStore();
assertEquals("should have re-used existing cluster id", cid, ns1.getClusterId());
ns1.dispose();
}
Aggregations