Search in sources :

Example 1 with ReadArrayBuffer

use of com.thinkaurelius.titan.diskstorage.util.ReadArrayBuffer in project titan by thinkaurelius.

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(com.thinkaurelius.titan.diskstorage.util.ReadArrayBuffer) WriteByteBuffer(com.thinkaurelius.titan.diskstorage.util.WriteByteBuffer) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

ReadArrayBuffer (com.thinkaurelius.titan.diskstorage.util.ReadArrayBuffer)1 WriteByteBuffer (com.thinkaurelius.titan.diskstorage.util.WriteByteBuffer)1 UUID (java.util.UUID)1 Test (org.junit.Test)1