Search in sources :

Example 6 with NotificationPublishService

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;
}
Also used : Notification(org.opendaylight.yangtools.yang.binding.Notification) NotificationPublishService(org.opendaylight.controller.md.sal.binding.api.NotificationPublishService)

Example 7 with NotificationPublishService

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));
}
Also used : ListenableFuture(com.google.common.util.concurrent.ListenableFuture) PacketReceived(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived) PacketInMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage) NotificationPublishService(org.opendaylight.controller.md.sal.binding.api.NotificationPublishService) Test(org.junit.Test)

Aggregations

NotificationPublishService (org.opendaylight.controller.md.sal.binding.api.NotificationPublishService)7 Test (org.junit.Test)4 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)2 Before (org.junit.Before)2 PacketInMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage)2 PacketReceived (org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived)2 NotificationService (org.opendaylight.controller.md.sal.binding.api.NotificationService)1 HeliumNotificationProviderServiceAdapter (org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceAdapter)1 MessageTypeKey (org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey)1 DeviceInfo (org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo)1 FlowDescriptor (org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor)1 FlowRegistryKey (org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKey)1 ConvertorMessageFromOFJava (org.opendaylight.openflowplugin.extension.api.ConvertorMessageFromOFJava)1 ExtensionConverterProvider (org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider)1 ExperimenterMessageFromDev (org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.ExperimenterMessageFromDev)1 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)1 Table (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table)1 TableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey)1 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)1 FlowKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey)1