use of org.onosproject.store.Timestamp in project onos by opennetworkinglab.
the class IntentCleanupTestMock method corruptPoll.
/**
* Trigger resubmit of intent in CORRUPT during periodic poll.
*/
@Test
public void corruptPoll() {
IntentStoreDelegate mockDelegate = new IntentStoreDelegate() {
@Override
public void process(IntentData intentData) {
intentData.setState(CORRUPT);
store.write(intentData);
}
@Override
public void notify(IntentEvent 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.submit(intent);
expectLastCall().once();
replay(service);
cleanup.run();
verify(service);
reset(service);
}
use of org.onosproject.store.Timestamp in project onos by opennetworkinglab.
the class IntentCleanupTestMock method pendingPoll.
/**
* Trigger resubmit of intent in INSTALL_REQ for too long.
*/
@Test
public void pendingPoll() {
IntentStoreDelegate mockDelegate = new IntentStoreDelegate() {
@Override
public void process(IntentData 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(isA(IntentData.class));
expectLastCall().once();
replay(service);
cleanup.run();
verify(service);
reset(service);
}
use of org.onosproject.store.Timestamp in project onos by opennetworkinglab.
the class EventuallyConsistentMapImplTest method generatePutMessage.
private List<UpdateEntry<String, String>> generatePutMessage(String key1, String value1, String key2, String value2) {
List<UpdateEntry<String, String>> list = new ArrayList<>();
Timestamp timestamp1 = clockService.peek(1);
Timestamp timestamp2 = clockService.peek(2);
list.add(generatePutMessage(key1, value1, timestamp1));
list.add(generatePutMessage(key2, value2, timestamp2));
return list;
}
use of org.onosproject.store.Timestamp in project onos by opennetworkinglab.
the class MapValueTest method testComparison.
@SuppressWarnings("SelfComparison")
@Test
public void testComparison() {
Timestamp ts1 = new LogicalTimestamp(9);
Timestamp ts2 = new LogicalTimestamp(10);
Timestamp ts3 = new LogicalTimestamp(11);
MapValue<String> mv1 = new MapValue<>("foo", ts1);
MapValue<String> mv2 = new MapValue<>("foo", ts2);
MapValue<String> mv3 = new MapValue<>("foo", ts3);
assertTrue(mv2.isNewerThan(mv1));
assertFalse(mv1.isNewerThan(mv3));
assertTrue(mv3.isNewerThan(ts2));
assertFalse(mv1.isNewerThan(ts2));
assertTrue(mv1.compareTo(mv2) < 0);
assertTrue(mv1.compareTo(mv1) == 0);
assertTrue(mv3.compareTo(mv2) > 0);
}
use of org.onosproject.store.Timestamp in project onos by opennetworkinglab.
the class MapValueTest method testTombstone.
@Test
public void testTombstone() {
Timestamp ts1 = new LogicalTimestamp(9);
MapValue<String> mv = MapValue.tombstone(ts1);
assertTrue(mv.isTombstone());
assertFalse(mv.isAlive());
assertNull(mv.get());
assertEquals(ts1, mv.timestamp());
}
Aggregations