Search in sources :

Example 1 with MastershipBasedTimestampSerializer

use of org.onosproject.store.serializers.custom.MastershipBasedTimestampSerializer in project onos by opennetworkinglab.

the class MastershipBasedTimestampTest method testKryoSerializableWithHandcraftedSerializer.

@Test
public final void testKryoSerializableWithHandcraftedSerializer() {
    final ByteBuffer buffer = ByteBuffer.allocate(1 * 1024 * 1024);
    final KryoNamespace kryos = KryoNamespace.newBuilder().register(new MastershipBasedTimestampSerializer(), MastershipBasedTimestamp.class).build();
    kryos.serialize(TS_1_2, buffer);
    buffer.flip();
    Timestamp copy = kryos.deserialize(buffer);
    new EqualsTester().addEqualityGroup(TS_1_2, copy).testEquals();
}
Also used : EqualsTester(com.google.common.testing.EqualsTester) KryoNamespace(org.onlab.util.KryoNamespace) MastershipBasedTimestampSerializer(org.onosproject.store.serializers.custom.MastershipBasedTimestampSerializer) ByteBuffer(java.nio.ByteBuffer) Timestamp(org.onosproject.store.Timestamp) Test(org.junit.Test)

Aggregations

EqualsTester (com.google.common.testing.EqualsTester)1 ByteBuffer (java.nio.ByteBuffer)1 Test (org.junit.Test)1 KryoNamespace (org.onlab.util.KryoNamespace)1 Timestamp (org.onosproject.store.Timestamp)1 MastershipBasedTimestampSerializer (org.onosproject.store.serializers.custom.MastershipBasedTimestampSerializer)1