Search in sources :

Example 1 with SegmentReader

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

the class StandbyTestUtils method mockSegment.

public static Segment mockSegment(UUID uuid, byte[] buffer) {
    SegmentStore store = mock(SegmentStore.class);
    SegmentIdProvider idProvider = mock(SegmentIdProvider.class);
    SegmentReader reader = mock(SegmentReader.class);
    long msb = uuid.getMostSignificantBits();
    long lsb = uuid.getLeastSignificantBits();
    SegmentId id = new SegmentId(store, msb, lsb);
    ByteBuffer data = ByteBuffer.wrap(buffer);
    return new Segment(idProvider, reader, id, data);
}
Also used : SegmentId(org.apache.jackrabbit.oak.segment.SegmentId) SegmentIdProvider(org.apache.jackrabbit.oak.segment.SegmentIdProvider) ByteBuffer(java.nio.ByteBuffer) SegmentReader(org.apache.jackrabbit.oak.segment.SegmentReader) Segment(org.apache.jackrabbit.oak.segment.Segment) SegmentStore(org.apache.jackrabbit.oak.segment.SegmentStore)

Aggregations

ByteBuffer (java.nio.ByteBuffer)1 Segment (org.apache.jackrabbit.oak.segment.Segment)1 SegmentId (org.apache.jackrabbit.oak.segment.SegmentId)1 SegmentIdProvider (org.apache.jackrabbit.oak.segment.SegmentIdProvider)1 SegmentReader (org.apache.jackrabbit.oak.segment.SegmentReader)1 SegmentStore (org.apache.jackrabbit.oak.segment.SegmentStore)1