use of org.onosproject.vpls.store.VplsStoreEvent in project onos by opennetworkinglab.
the class VplsManagerTest method testStoreDelegate.
/**
* Pass different VPLS store event to store delegate.
* Include these cases:
* <ul>
* <li>VPLS added</li>
* <li>VPLS updated</li>
* <li>VPLS state updated</li>
* <li>VPLS removed</li>
* </ul>
*/
@Test
public void testStoreDelegate() {
// Add
VplsData vplsData = vplsManager.createVpls(VPLS1, NONE);
VplsStoreEvent event = new VplsStoreEvent(VplsStoreEvent.Type.ADD, vplsData);
vplsStore.delegate().notify(event);
VplsOperation vplsOperation = vplsOperationService.operation();
assertEquals(vplsOperation.op(), VplsOperation.Operation.ADD);
assertEquals(vplsOperation.vpls(), vplsData);
vplsOperationService.clear();
// Update info
vplsData.encapsulationType(EncapsulationType.VLAN);
vplsData.state(UPDATING);
event = new VplsStoreEvent(VplsStoreEvent.Type.UPDATE, vplsData);
vplsStore.delegate().notify(event);
vplsOperation = vplsOperationService.operation();
assertEquals(vplsOperation.op(), VplsOperation.Operation.UPDATE);
assertEquals(vplsOperation.vpls(), vplsData);
vplsOperationService.clear();
// Update state (no operation)
vplsData.state(VplsData.VplsState.ADDED);
event = new VplsStoreEvent(VplsStoreEvent.Type.UPDATE, vplsData);
vplsStore.delegate().notify(event);
vplsOperation = vplsOperationService.operation();
assertNull(vplsOperation);
vplsOperationService.clear();
// Remove
event = new VplsStoreEvent(VplsStoreEvent.Type.REMOVE, vplsData);
vplsStore.delegate().notify(event);
vplsOperation = vplsOperationService.operation();
assertEquals(vplsOperation.op(), VplsOperation.Operation.REMOVE);
assertEquals(vplsOperation.vpls(), vplsData);
vplsOperationService.clear();
}
Aggregations