Search in sources :

Example 11 with ReadOnlyFileStore

use of org.apache.jackrabbit.oak.segment.file.ReadOnlyFileStore in project jackrabbit-oak by apache.

the class SegmentBufferWriterTest method dirtyBuffersShouldBeFlushed.

@Test
public void dirtyBuffersShouldBeFlushed() throws Exception {
    List<SegmentId> before;
    try (FileStore store = openFileStore()) {
    // init
    }
    try (ReadOnlyFileStore store = openReadOnlyFileStore()) {
        before = newArrayList(store.getSegmentIds());
    }
    try (FileStore store = openFileStore()) {
        SegmentWriter writer = segmentWriterBuilder("t").build(store);
        writer.writeString("test");
        writer.flush();
    }
    List<SegmentId> after;
    try (ReadOnlyFileStore store = openReadOnlyFileStore()) {
        after = newArrayList(store.getSegmentIds());
    }
    assertNotEquals(before, after);
}
Also used : ReadOnlyFileStore(org.apache.jackrabbit.oak.segment.file.ReadOnlyFileStore) FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) ReadOnlyFileStore(org.apache.jackrabbit.oak.segment.file.ReadOnlyFileStore) Test(org.junit.Test)

Aggregations

ReadOnlyFileStore (org.apache.jackrabbit.oak.segment.file.ReadOnlyFileStore)11 FileStore (org.apache.jackrabbit.oak.segment.file.FileStore)5 Test (org.junit.Test)5 File (java.io.File)4 ImmutableSet (com.google.common.collect.ImmutableSet)3 Multiset (com.google.common.collect.Multiset)3 Sets.newHashSet (com.google.common.collect.Sets.newHashSet)3 Set (java.util.Set)3 FileStoreBuilder (org.apache.jackrabbit.oak.segment.file.FileStoreBuilder)3 IOException (java.io.IOException)2 UUID (java.util.UUID)2 InvalidFileStoreVersionException (org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException)2 Stopwatch (com.google.common.base.Stopwatch)1 PrintWriter (java.io.PrintWriter)1 Compactor (org.apache.jackrabbit.oak.segment.Compactor)1 RecordId (org.apache.jackrabbit.oak.segment.RecordId)1 RecordId.fromString (org.apache.jackrabbit.oak.segment.RecordId.fromString)1 RecordType (org.apache.jackrabbit.oak.segment.RecordType)1 Segment (org.apache.jackrabbit.oak.segment.Segment)1 SegmentBufferWriter (org.apache.jackrabbit.oak.segment.SegmentBufferWriter)1