use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.
the class FailoverIPRangeIT method createTestWithConfig.
private void createTestWithConfig(String host, String[] ipRanges, boolean expectedToWork) throws Exception {
FileStore storeS = serverFileStore.fileStore();
FileStore storeC = clientFileStore.fileStore();
NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), storeS, ipRanges);
StandbyClientSync clientSync = new StandbyClientSync(host, serverPort.getPort(), storeC, false, getClientTimeout(), false)) {
serverSync.start();
addTestContent(store, "server");
// this speeds up the test a little bit...
storeS.flush();
clientSync.run();
if (expectedToWork) {
assertEquals(storeS.getHead(), storeC.getHead());
} else {
assertFalse("stores are equal but shouldn't!", storeS.getHead().equals(storeC.getHead()));
}
}
}
use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.
the class FailoverMultipleClientsTestIT method testMultipleClients.
@Test
public void testMultipleClients() throws Exception {
FileStore storeS = serverFileStore.fileStore();
FileStore storeC = clientFileStore1.fileStore();
FileStore storeC2 = clientFileStore2.fileStore();
NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), storeS);
StandbyClientSync cl1 = newStandbyClientSync(storeC, serverPort.getPort());
StandbyClientSync cl2 = newStandbyClientSync(storeC2, serverPort.getPort())) {
serverSync.start();
SegmentTestUtils.addTestContent(store, "server");
// this speeds up the test a little bit...
storeS.flush();
assertFalse("first client has invalid initial store!", storeS.getHead().equals(storeC.getHead()));
assertFalse("second client has invalid initial store!", storeS.getHead().equals(storeC2.getHead()));
assertEquals(storeC.getHead(), storeC2.getHead());
cl1.run();
cl2.run();
assertEquals(storeS.getHead(), storeC.getHead());
assertEquals(storeS.getHead(), storeC2.getHead());
cl1.stop();
SegmentTestUtils.addTestContent(store, "test");
storeS.flush();
cl1.run();
cl2.run();
assertEquals(storeS.getHead(), storeC2.getHead());
assertFalse("first client updated in stopped state!", storeS.getHead().equals(storeC.getHead()));
cl1.start();
cl1.run();
assertEquals(storeS.getHead(), storeC.getHead());
}
}
use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.
the class FailoverSslTestIT method synchronizeAndCompareHead.
private boolean synchronizeAndCompareHead(StandbyServerSync serverSync, StandbyClientSync clientSync) throws Exception {
FileStore storeS = serverFileStore.fileStore();
FileStore storeC = clientFileStore.fileStore();
NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
serverSync.start();
addTestContent(store, "server");
// this speeds up the test a little bit...
storeS.flush();
clientSync.run();
return storeS.getHead().equals(storeC.getHead());
}
use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.
the class RecoverTestIT method testLocalChanges.
@Test
public void testLocalChanges() throws Exception {
FileStore storeS = serverFileStore.fileStore();
FileStore storeC = clientFileStore.fileStore();
NodeStore store = SegmentNodeStoreBuilders.builder(storeC).build();
addTestContent(store, "client");
try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), storeS);
StandbyClientSync cl = newStandbyClientSync(storeC, serverPort.getPort())) {
serverSync.start();
store = SegmentNodeStoreBuilders.builder(storeS).build();
addTestContent(store, "server");
storeS.flush();
assertFalse("stores are not expected to be equal", storeS.getHead().equals(storeC.getHead()));
cl.run();
assertEquals(storeS.getHead(), storeC.getHead());
}
}
use of org.apache.jackrabbit.oak.spi.state.NodeStore in project jackrabbit-oak by apache.
the class CopyVersionHistoryTest method performCopy.
protected Session performCopy(VersionCopySetup setup) throws RepositoryException, IOException {
final RepositoryConfig sourceConfig = RepositoryConfig.create(source);
final RepositoryContext sourceContext = RepositoryContext.create(sourceConfig);
final NodeStore targetNodeStore = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
try {
final RepositoryUpgrade upgrade = new RepositoryUpgrade(sourceContext, targetNodeStore);
setup.setup(upgrade.versionCopyConfiguration);
upgrade.setEarlyShutdown(true);
upgrade.copy(null);
} finally {
sourceContext.getRepository().shutdown();
}
repository = (RepositoryImpl) new Jcr(new Oak(targetNodeStore)).createRepository();
Session s = repository.login(AbstractRepositoryUpgradeTest.CREDENTIALS);
sessions.add(s);
return s;
}
Aggregations