use of com.cinchapi.concourse.server.storage.db.Revision in project concourse by cinchapi.
the class CorpusChunkTest method testShiftExisting.
@SuppressWarnings("unchecked")
@Test
@Override
public void testShiftExisting() {
int count = TestData.getScaleCount();
CorpusChunk corpus = (CorpusChunk) chunk;
for (int i = 0; i < count; ++i) {
corpus.insert(Text.wrap(TestData.getString()), Value.wrap(Convert.javaToThrift(TestData.getString())), Identifier.of(Time.now()), Time.now(), Action.ADD);
}
Iterator<Revision<Text, Text, Position>> expected = ((Iterable<Revision<Text, Text, Position>>) Reflection.get("revisions", chunk)).iterator();
OffHeapMemory memory = OffHeapMemory.allocateDirect(count * 3 * Write.MINIMUM_SIZE);
chunk.shift(memory);
Iterator<Revision<Text, Text, Position>> actual = chunk.iterator();
while (expected.hasNext()) {
Revision<Text, Text, Position> a = expected.next();
Revision<Text, Text, Position> b = actual.next();
Assert.assertEquals(a, b);
}
}
Aggregations