use of org.apache.jackrabbit.oak.segment.memory.MemoryStore in project jackrabbit-oak by apache.
the class MutableSegmentReferencesTest method referencesShouldBeIncrementing.
@Test
public void referencesShouldBeIncrementing() throws Exception {
MemoryStore store = new MemoryStore();
SegmentId first = store.getSegmentIdProvider().newDataSegmentId();
SegmentId second = store.getSegmentIdProvider().newDataSegmentId();
MutableSegmentReferences table = new MutableSegmentReferences();
int firstReference = table.addOrReference(first);
int secondReference = table.addOrReference(second);
assertEquals(firstReference + 1, secondReference);
}
use of org.apache.jackrabbit.oak.segment.memory.MemoryStore in project jackrabbit-oak by apache.
the class MutableSegmentReferencesTest method shouldMaintainSize.
@Test
public void shouldMaintainSize() throws Exception {
MemoryStore store = new MemoryStore();
SegmentId id = store.getSegmentIdProvider().newDataSegmentId();
MutableSegmentReferences table = new MutableSegmentReferences();
assertEquals(0, table.size());
table.addOrReference(id);
assertEquals(1, table.size());
}
use of org.apache.jackrabbit.oak.segment.memory.MemoryStore in project jackrabbit-oak by apache.
the class MutableSegmentReferencesTest method shouldIterateInInsertionOrder.
@Test
public void shouldIterateInInsertionOrder() throws Exception {
MemoryStore store = new MemoryStore();
SegmentId first = store.getSegmentIdProvider().newDataSegmentId();
SegmentId second = store.getSegmentIdProvider().newDataSegmentId();
List<SegmentId> ids = newArrayList(first, second);
MutableSegmentReferences table = new MutableSegmentReferences();
table.addOrReference(first);
table.addOrReference(second);
assertTrue(elementsEqual(ids, table));
}
Aggregations