/** * Process the event. * * @param abstractEvent@see org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher */ @Override public void processEvent(AbstractEvent abstractEvent) { if (!(abstractEvent instanceof NorthboundEvent)) { logger.error("Unable to process abstract event " + abstractEvent); return; } NorthboundEvent ev = (NorthboundEvent) abstractEvent; switch (ev.getAction()) { // TODO: add handling of events here, once callbacks do something // other than logging. default: logger.warn("Unable to process event action " + ev.getAction()); break; } }
@Test public void testProcessEvent() { NorthboundEvent ev = mock(NorthboundEvent.class); when(ev.getAction()).thenReturn(Action.UPDATE); when(ev.getRouter()).thenReturn(mock(NeutronRouter.class)); when(ev.getRouterInterface()).thenReturn(null).thenReturn(mock(NeutronRouter_Interface.class)); routerHandler.processEvent(ev); verify(neutronL3Adapter, times(1)).handleNeutronRouterEvent(ev.getRouter(), Action.UPDATE); routerHandler.processEvent(ev); verify(neutronL3Adapter, times(1)) .handleNeutronRouterInterfaceEvent(ev.getRouter(), ev.getRouterInterface(), Action.UPDATE); }