Search in sources :

Example 1 with TEnumSerializer

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

the class SerializerTest method objectWriteReadTest.

@Test
public void objectWriteReadTest() {
    serialize.registerClass(2, TClass1.class, new TClass1Serializer());
    serialize.registerClass(80342, TClass2.class, new TClass2Serializer());
    serialize.registerClass(999, TEnum.class, new TEnumSerializer());
    objectWriteRead();
}
Also used : TClass2Serializer(org.janusgraph.graphdb.serializer.attributes.TClass2Serializer) TEnumSerializer(org.janusgraph.graphdb.serializer.attributes.TEnumSerializer) TClass1Serializer(org.janusgraph.graphdb.serializer.attributes.TClass1Serializer) Test(org.junit.jupiter.api.Test)

Example 2 with TEnumSerializer

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

the class SerializerTest method enumSerializeTest.

@Test
public void enumSerializeTest() {
    serialize.registerClass(1, TEnum.class, new TEnumSerializer());
    DataOutput out = serialize.getDataOutput(128);
    out.writeObjectNotNull(TEnum.TWO);
    out.writeObjectNotNull(TEnum.THREE);
    ReadBuffer b = out.getStaticBuffer().asReadBuffer();
    if (printStats)
        log.debug(bufferStats(b));
    assertEquals(TEnum.TWO, serialize.readObjectNotNull(b, TEnum.class));
    assertEquals(TEnum.THREE, serialize.readObjectNotNull(b, TEnum.class));
    assertFalse(b.hasRemaining());
}
Also used : DataOutput(org.janusgraph.graphdb.database.serialize.DataOutput) ReadBuffer(org.janusgraph.diskstorage.ReadBuffer) TEnum(org.janusgraph.graphdb.serializer.attributes.TEnum) TEnumSerializer(org.janusgraph.graphdb.serializer.attributes.TEnumSerializer) Test(org.junit.jupiter.api.Test)

Example 3 with TEnumSerializer

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

the class SerializerSpeedTest method performanceTestObjectSerialization.

@RepeatedTest(10)
public void performanceTestObjectSerialization() {
    serialize.registerClass(2, TClass1.class, new TClass1Serializer());
    serialize.registerClass(80342, TClass2.class, new TClass2Serializer());
    serialize.registerClass(999, TEnum.class, new TEnumSerializer());
    int runs = 1000000;
    for (int i = 0; i < runs; i++) {
        objectWriteRead();
    }
}
Also used : TClass2Serializer(org.janusgraph.graphdb.serializer.attributes.TClass2Serializer) TEnumSerializer(org.janusgraph.graphdb.serializer.attributes.TEnumSerializer) TClass1Serializer(org.janusgraph.graphdb.serializer.attributes.TClass1Serializer) RepeatedTest(org.junit.jupiter.api.RepeatedTest)

Aggregations

TEnumSerializer (org.janusgraph.graphdb.serializer.attributes.TEnumSerializer)3 TClass1Serializer (org.janusgraph.graphdb.serializer.attributes.TClass1Serializer)2 TClass2Serializer (org.janusgraph.graphdb.serializer.attributes.TClass2Serializer)2 Test (org.junit.jupiter.api.Test)2 ReadBuffer (org.janusgraph.diskstorage.ReadBuffer)1 DataOutput (org.janusgraph.graphdb.database.serialize.DataOutput)1 TEnum (org.janusgraph.graphdb.serializer.attributes.TEnum)1 RepeatedTest (org.junit.jupiter.api.RepeatedTest)1