use of org.onosproject.store.Timestamp in project onos by opennetworkinglab.
the class IntentCleanupTestMock method installingPoll.
/**
* Trigger resubmit of intent in INSTALLING for too long.
*/
@Test
@Ignore("The implementation is dependent on the SimpleStore")
public void installingPoll() {
IntentStoreDelegate mockDelegate = new IntentStoreDelegate() {
@Override
public void process(IntentData intentData) {
intentData.setState(INSTALLING);
store.write(intentData);
}
@Override
public void notify(IntentEvent event) {
cleanup.event(event);
}
};
store.setDelegate(mockDelegate);
Intent intent = new MockIntent(1L);
Timestamp version = new SystemClockTimestamp(1L);
IntentData data = new IntentData(intent, INSTALL_REQ, version);
store.addPending(data);
service.addPending(data);
expectLastCall().once();
replay(service);
cleanup.run();
verify(service);
reset(service);
}
use of org.onosproject.store.Timestamp 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();
}
use of org.onosproject.store.Timestamp in project onos by opennetworkinglab.
the class EventuallyConsistentMapImplTest method generateRemoveMessage.
private List<UpdateEntry<String, String>> generateRemoveMessage(String key1, String key2) {
List<UpdateEntry<String, String>> list = new ArrayList<>();
Timestamp timestamp1 = clockService.peek(1);
Timestamp timestamp2 = clockService.peek(2);
list.add(generateRemoveMessage(key1, timestamp1));
list.add(generateRemoveMessage(key2, timestamp2));
return list;
}
use of org.onosproject.store.Timestamp in project onos by opennetworkinglab.
the class MapValueTest method testConstruction.
@Test
public void testConstruction() {
Timestamp ts = new LogicalTimestamp(10);
MapValue<String> mv = new MapValue<>("foo", ts);
assertEquals("foo", mv.get());
assertEquals(ts, mv.timestamp());
assertTrue(mv.isAlive());
}
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();
}
Aggregations