use of org.onosproject.net.intent.IntentTestsMocks.MockIntent in project onos by opennetworkinglab.
the class IntentAccumulatorTest method setUp.
/**
* Creates mock intents used by the test.
*/
@Before
public void setUp() {
super.setUp();
intent1 = new MockIntent(1L);
intent2 = new MockIntent(2L);
intent3 = new MockIntent(3L);
}
use of org.onosproject.net.intent.IntentTestsMocks.MockIntent in project onos by opennetworkinglab.
the class IntentCleanupTestMock 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);
service.submit(intent);
expectLastCall().once();
service.submit(intent2);
expectLastCall().once();
replay(service);
cleanup.run();
verify(service);
reset(service);
}
use of org.onosproject.net.intent.IntentTestsMocks.MockIntent 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.net.intent.IntentTestsMocks.MockIntent in project onos by opennetworkinglab.
the class IntentCleanupTestMock 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);
service.submit(intent);
expectLastCall().once();
replay(service);
store.addPending(data);
verify(service);
reset(service);
}
use of org.onosproject.net.intent.IntentTestsMocks.MockIntent in project onos by opennetworkinglab.
the class IntentCleanupTest 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);
cleanup.run();
assertEquals("Expect number of submits incorrect", 1, service.pendingCounter());
}
Aggregations