Search in sources :

Example 1 with TEnum

use of org.janusgraph.graphdb.serializer.attributes.TEnum in project janusgraph by JanusGraph.

the class SerializerTestCommon method objectWriteRead.

protected void objectWriteRead() {
    TClass1 t1 = new TClass1(3245234223423433123L, 0.333f);
    TClass2 t2 = new TClass2("This is a test", 4234234);
    TEnum t3 = TEnum.THREE;
    TEnum t4 = TEnum.TWO;
    DataOutput out = serialize.getDataOutput(128);
    out.writeObjectNotNull(t1);
    out.writeClassAndObject(t2);
    out.writeObject(t3, TEnum.class);
    out.writeClassAndObject(t4);
    ReadBuffer b = out.getStaticBuffer().asReadBuffer();
    assertEquals(t1, serialize.readObjectNotNull(b, TClass1.class));
    assertEquals(t2, serialize.readClassAndObject(b));
    assertEquals(t3, serialize.readObject(b, TEnum.class));
    assertEquals(t4, serialize.readClassAndObject(b));
    assertFalse(b.hasRemaining());
}
Also used : TClass2(org.janusgraph.graphdb.serializer.attributes.TClass2) DataOutput(org.janusgraph.graphdb.database.serialize.DataOutput) ReadBuffer(org.janusgraph.diskstorage.ReadBuffer) TClass1(org.janusgraph.graphdb.serializer.attributes.TClass1) TEnum(org.janusgraph.graphdb.serializer.attributes.TEnum)

Aggregations

ReadBuffer (org.janusgraph.diskstorage.ReadBuffer)1 DataOutput (org.janusgraph.graphdb.database.serialize.DataOutput)1 TClass1 (org.janusgraph.graphdb.serializer.attributes.TClass1)1 TClass2 (org.janusgraph.graphdb.serializer.attributes.TClass2)1 TEnum (org.janusgraph.graphdb.serializer.attributes.TEnum)1