use of org.onosproject.net.intent.IntentStoreDelegate in project onos by opennetworkinglab.
the class IntentCleanupTest 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);
cleanup.run();
assertEquals("Expect number of submits incorrect", 1, service.pendingCounter());
}
use of org.onosproject.net.intent.IntentStoreDelegate in project onos by opennetworkinglab.
the class IntentCleanupTest method skipPoll.
/**
* Only submit one of two intents because one is too new.
*/
@Test
public void skipPoll() {
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);
IntentData data = new IntentData(intent, INSTALL_REQ, null);
store.addPending(data);
Intent intent2 = new MockIntent(2L);
Timestamp version = new SystemClockTimestamp(1L);
data = new IntentData(intent2, INSTALL_REQ, version);
store.addPending(data);
cleanup.run();
assertEquals("Expect number of submits incorrect", 1, service.submitCounter());
}
use of org.onosproject.net.intent.IntentStoreDelegate in project onos by opennetworkinglab.
the class IntentCleanupTest 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);
// FIXME broken?
cleanup.run();
assertEquals("Expect number of submits incorrect", 1, service.submitCounter());
}
use of org.onosproject.net.intent.IntentStoreDelegate in project onos by opennetworkinglab.
the class IntentCleanupTest method corruptEvent.
/**
* Verify resubmit in response to CORRUPT event.
*/
@Test
public void corruptEvent() {
IntentStoreDelegate mockDelegate = new IntentStoreDelegate() {
@Override
public void process(IntentData intentData) {
intentData.setState(CORRUPT);
store.write(intentData);
}
@Override
public void notify(IntentEvent event) {
cleanup.event(event);
}
};
store.setDelegate(mockDelegate);
Intent intent = new MockIntent(1L);
IntentData data = new IntentData(intent, INSTALL_REQ, null);
store.addPending(data);
assertEquals("Expect number of submits incorrect", 1, service.submitCounter());
}
use of org.onosproject.net.intent.IntentStoreDelegate 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);
}
Aggregations