Search in sources :

Example 31 with Timestamp

use of org.onosproject.store.Timestamp in project onos by opennetworkinglab.

the class InternalDeviceStatusChangeEventSerializer method read.

@Override
public InternalDeviceStatusChangeEvent read(Kryo kryo, Input input, Class<InternalDeviceStatusChangeEvent> type) {
    DeviceId deviceId = kryo.readObject(input, DeviceId.class, deviceIdSerializer());
    Timestamp timestamp = (Timestamp) kryo.readClassAndObject(input);
    Boolean available = (Boolean) kryo.readClassAndObject(input);
    return new InternalDeviceStatusChangeEvent(deviceId, timestamp, available);
}
Also used : DeviceId(org.onosproject.net.DeviceId) Timestamp(org.onosproject.store.Timestamp)

Example 32 with Timestamp

use of org.onosproject.store.Timestamp in project onos by opennetworkinglab.

the class MastershipBasedTimestampTest method testKryoSerializable.

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

Aggregations

Timestamp (org.onosproject.store.Timestamp)32 Test (org.junit.Test)15 WallClockTimestamp (org.onosproject.store.service.WallClockTimestamp)14 MastershipBasedTimestamp (org.onosproject.store.impl.MastershipBasedTimestamp)13 MultiValuedTimestamp (org.onosproject.store.service.MultiValuedTimestamp)13 ProviderId (org.onosproject.net.provider.ProviderId)9 DeviceEvent (org.onosproject.net.device.DeviceEvent)8 AbstractIntentTest (org.onosproject.net.intent.AbstractIntentTest)8 Intent (org.onosproject.net.intent.Intent)8 IntentData (org.onosproject.net.intent.IntentData)8 IntentEvent (org.onosproject.net.intent.IntentEvent)8 IntentStoreDelegate (org.onosproject.net.intent.IntentStoreDelegate)8 MockIntent (org.onosproject.net.intent.IntentTestsMocks.MockIntent)8 SystemClockTimestamp (org.onosproject.store.trivial.SystemClockTimestamp)8 DeviceId (org.onosproject.net.DeviceId)6 ArrayList (java.util.ArrayList)5 ControllerNodeToNodeId.toNodeId (org.onosproject.cluster.ControllerNodeToNodeId.toNodeId)5 NodeId (org.onosproject.cluster.NodeId)5 DefaultDevice (org.onosproject.net.DefaultDevice)5 Device (org.onosproject.net.Device)5