use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.
the class BrokenNetworkIT method testProxySSL.
@Test
public void testProxySSL() throws Exception {
FileStore storeS = serverFileStore.fileStore();
FileStore storeC = clientFileStore1.fileStore();
NodeStore store = SegmentNodeStoreBuilders.builder(storeS).build();
addTestContent(store, "server");
storeS.flush();
try (StandbyServerSync serverSync = new StandbyServerSync(serverPort.getPort(), storeS, MB, true);
StandbyClientSync clientSync = new StandbyClientSync(getServerHost(), serverPort.getPort(), storeC, true, getClientTimeout(), false, folder.newFolder())) {
serverSync.start();
clientSync.run();
}
assertEquals(storeS.getHead(), storeC.getHead());
}
use of org.apache.jackrabbit.oak.segment.file.FileStore 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, MB, ipRanges);
StandbyClientSync clientSync = new StandbyClientSync(host, serverPort.getPort(), storeC, false, getClientTimeout(), false, folder.newFolder())) {
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.segment.file.FileStore in project jackrabbit-oak by apache.
the class IOTracerRunner method collectBreadthFirstTrace.
public void collectBreadthFirstTrace(@Nonnull String segmentStore, boolean mmap, int segmentCacheSize, @Nonnull String path, int depth, @Nonnull String output) throws IOException, InvalidFileStoreVersionException {
checkNotNull(segmentStore);
checkNotNull(path);
checkNotNull(output);
try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(output, true)))) {
Function<IOMonitor, FileStore> factory = ioMonitor -> newFileStore(fileStoreBuilder(new File(segmentStore)).withMemoryMapping(mmap).withSegmentCacheSize(segmentCacheSize).withIOMonitor(ioMonitor));
IOTracer ioTracer = newIOTracer(factory, out, BreadthFirstTrace.CONTEXT_SPEC);
ioTracer.collectTrace(new BreadthFirstTrace(depth, path, ioTracer::setContext));
}
}
use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.
the class DefaultStandbyReferenceReaderTest method shouldReturnReferences.
@Test
public void shouldReturnReferences() throws Exception {
try (FileStore store = newFileStore()) {
SegmentWriter writer = defaultSegmentWriterBuilder("test").build(store);
RecordId a = writer.writeNode(EmptyNodeState.EMPTY_NODE);
writer.flush();
NodeBuilder builder = EmptyNodeState.EMPTY_NODE.builder();
builder.setChildNode("reference", store.getReader().readNode(a));
RecordId b = writer.writeNode(builder.getNodeState());
writer.flush();
DefaultStandbyReferencesReader reader = new DefaultStandbyReferencesReader(store);
Iterator<String> i = reader.readReferences(b.getSegmentId().asUUID().toString()).iterator();
assertTrue(i.hasNext());
assertEquals(a.getSegmentId().asUUID().toString(), i.next());
assertFalse(i.hasNext());
}
}
use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.
the class IOTracerTest method collectDepthFirstTrace.
@Test
public void collectDepthFirstTrace() throws IOException, InvalidFileStoreVersionException {
try (StringWriter out = new StringWriter()) {
Function<IOMonitor, FileStore> factory = this::createFileStore;
IOTracer ioTracer = newIOTracer(factory, out, DepthFirstTrace.CONTEXT_SPEC);
ioTracer.collectTrace(new DepthFirstTrace(2, "/", ioTracer::setContext));
try (BufferedReader reader = new BufferedReader(new StringReader(out.toString()))) {
Optional<String> header = reader.lines().findFirst();
List<String[]> entries = reader.lines().map(line -> line.split(",")).collect(toList());
assertTrue(header.isPresent());
assertEquals("timestamp,file,segmentId,length,elapsed,depth,count,path", header.get());
long now = currentTimeMillis();
assertTrue("The timestamps of all entries must be in the past", entries.stream().map(// ts
row -> parseLong(row[0])).allMatch(ts -> ts <= now));
assertEquals("Expected depths 0 and 1", ImmutableSet.of(0, 1), entries.stream().map(// depth
row -> parseInt(row[5])).distinct().collect(toSet()));
assertEquals("Expected max 10 nodes", Optional.of(true), entries.stream().map(// count
row -> parseInt(row[6])).max(Comparator.naturalOrder()).map(max -> max <= 10));
}
}
}
Aggregations