Search in sources :

Example 6 with Revision

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);
    }
}
Also used : Revision(com.cinchapi.concourse.server.storage.db.Revision) Position(com.cinchapi.concourse.server.model.Position) Text(com.cinchapi.concourse.server.model.Text) OffHeapMemory(com.cinchapi.lib.offheap.memory.OffHeapMemory) Test(org.junit.Test)

Aggregations

Revision (com.cinchapi.concourse.server.storage.db.Revision)6 Test (org.junit.Test)5 Position (com.cinchapi.concourse.server.model.Position)3 Text (com.cinchapi.concourse.server.model.Text)3 ConcourseBaseTest (com.cinchapi.concourse.test.ConcourseBaseTest)3 Identifier (com.cinchapi.concourse.server.model.Identifier)2 Value (com.cinchapi.concourse.server.model.Value)2 OffHeapMemory (com.cinchapi.lib.offheap.memory.OffHeapMemory)2 Action (com.cinchapi.concourse.server.storage.Action)1 Range (com.cinchapi.concourse.server.storage.db.kernel.Manifest.Range)1 Write (com.cinchapi.concourse.server.storage.temp.Write)1 TObject (com.cinchapi.concourse.thrift.TObject)1 ByteBuffer (java.nio.ByteBuffer)1