Search in sources :

Example 1 with ReadArrayBuffer

use of org.janusgraph.diskstorage.util.ReadArrayBuffer in project janusgraph by JanusGraph.

the class UUIDSerializerTest method testRoundTrip.

@Test
public void testRoundTrip() {
    // Write the UUID
    UUIDSerializer serializer = new UUIDSerializer();
    UUID uuid1 = UUID.randomUUID();
    WriteByteBuffer buffer = new WriteByteBuffer();
    serializer.write(buffer, uuid1);
    // And read it in again
    ReadArrayBuffer readBuffer = new ReadArrayBuffer(buffer.getStaticBuffer().getBytes(0, 16));
    UUID uuid2 = serializer.read(readBuffer);
    Assert.assertEquals(uuid1, uuid2);
}
Also used : ReadArrayBuffer(org.janusgraph.diskstorage.util.ReadArrayBuffer) WriteByteBuffer(org.janusgraph.diskstorage.util.WriteByteBuffer) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

UUID (java.util.UUID)1 ReadArrayBuffer (org.janusgraph.diskstorage.util.ReadArrayBuffer)1 WriteByteBuffer (org.janusgraph.diskstorage.util.WriteByteBuffer)1 Test (org.junit.Test)1