use of org.opendaylight.controller.md.sal.binding.api.NotificationPublishService in project bgpcep by opendaylight.
the class MockedNotificationServiceWrapper method getMockedNotificationService.
NotificationPublishService getMockedNotificationService() throws InterruptedException {
final NotificationPublishService mockedNotificationService = mock(NotificationPublishService.class);
doAnswer(invocation -> {
final Object notif = invocation.getArguments()[0];
assertTrue(Notification.class.isAssignableFrom(notif.getClass()));
MockedNotificationServiceWrapper.this.publishedNotifications.add((Notification) notif);
return null;
}).when(mockedNotificationService).putNotification(any(Notification.class));
return mockedNotificationService;
}
use of org.opendaylight.controller.md.sal.binding.api.NotificationPublishService in project openflowplugin by opendaylight.
the class DeviceContextImplTest method testProcessPacketInMessageFutureSuccess.
@Test
public void testProcessPacketInMessageFutureSuccess() {
final PacketInMessage mockedPacketInMessage = mock(PacketInMessage.class);
final NotificationPublishService mockedNotificationPublishService = mock(NotificationPublishService.class);
final ListenableFuture stringListenableFuture = Futures.immediateFuture("dummy value");
when(mockedNotificationPublishService.offerNotification(any(PacketReceived.class))).thenReturn(stringListenableFuture);
deviceContext.setNotificationPublishService(mockedNotificationPublishService);
deviceContext.processPacketInMessage(mockedPacketInMessage);
verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH));
verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS));
}
Aggregations