use of org.opendaylight.controller.md.sal.binding.api.NotificationPublishService in project controller by opendaylight.
the class BackwardsCompatibleNotificationBrokerTest method initTest.
@Before
public void initTest() {
final NotificationService notificationService = getNotificationService();
final NotificationPublishService notificationPublishService = getNotificationPublishService();
notificationProviderService = new HeliumNotificationProviderServiceAdapter(notificationPublishService, notificationService);
}
use of org.opendaylight.controller.md.sal.binding.api.NotificationPublishService in project controller by opendaylight.
the class OpenDaylightToasterTest method setupToaster.
@Before
public void setupToaster() {
toaster = new OpendaylightToaster();
toaster.setDataBroker(getDataBroker());
toaster.init();
// We'll mock the NotificationProviderService.
NotificationPublishService mockNotification = mock(NotificationPublishService.class);
toaster.setNotificationProvider(mockNotification);
}
use of org.opendaylight.controller.md.sal.binding.api.NotificationPublishService in project openflowplugin by opendaylight.
the class DeviceContextImplTest method testProcessFlowRemovedMessage.
@Test
public void testProcessFlowRemovedMessage() throws Exception {
// prepare translation result
final FlowRemovedBuilder flowRemovedMdsalBld = new FlowRemovedBuilder().setTableId((short) 0).setPriority(42).setCookie(new FlowCookie(BigInteger.ONE)).setMatch(new MatchBuilder().build());
final NotificationPublishService mockedNotificationPublishService = mock(NotificationPublishService.class);
Mockito.when(messageTranslatorFlowRemoved.translate(any(Object.class), any(DeviceInfo.class), any(Object.class))).thenReturn(flowRemovedMdsalBld.build());
// insert flow+flowId into local registry
final FlowRegistryKey flowRegKey = FlowRegistryKeyFactory.create(deviceInfo.getVersion(), flowRemovedMdsalBld.build());
final FlowDescriptor flowDescriptor = FlowDescriptorFactory.create((short) 0, new FlowId("ut-ofp:f456"));
deviceContext.getDeviceFlowRegistry().storeDescriptor(flowRegKey, flowDescriptor);
// prepare empty input message
final FlowRemovedMessageBuilder flowRemovedBld = new FlowRemovedMessageBuilder();
// prepare path to flow to be removed
final KeyedInstanceIdentifier<Flow, FlowKey> flowToBeRemovedPath = nodeKeyIdent.augmentation(FlowCapableNode.class).child(Table.class, new TableKey((short) 0)).child(Flow.class, new FlowKey(new FlowId("ut-ofp:f456")));
deviceContext.setNotificationPublishService(mockedNotificationPublishService);
deviceContext.processFlowRemovedMessage(flowRemovedBld.build());
}
use of org.opendaylight.controller.md.sal.binding.api.NotificationPublishService in project openflowplugin by opendaylight.
the class DeviceContextImplTest method testProcessPacketInMessageFutureFailure.
@Test
public void testProcessPacketInMessageFutureFailure() {
final PacketInMessage mockedPacketInMessage = mock(PacketInMessage.class);
final NotificationPublishService mockedNotificationPublishService = mock(NotificationPublishService.class);
final ListenableFuture dummyFuture = Futures.immediateFailedFuture(new IllegalStateException());
when(mockedNotificationPublishService.offerNotification(any(PacketReceived.class))).thenReturn(dummyFuture);
deviceContext.setNotificationPublishService(mockedNotificationPublishService);
deviceContext.processPacketInMessage(mockedPacketInMessage);
verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_NOTIFICATION_REJECTED));
}
use of org.opendaylight.controller.md.sal.binding.api.NotificationPublishService in project openflowplugin by opendaylight.
the class DeviceContextImplTest method testProcessExperimenterMessage.
@Test
public void testProcessExperimenterMessage() {
final ConvertorMessageFromOFJava mockedMessageConverter = mock(ConvertorMessageFromOFJava.class);
final ExtensionConverterProvider mockedExtensionConverterProvider = mock(ExtensionConverterProvider.class);
when(mockedExtensionConverterProvider.getMessageConverter(any(MessageTypeKey.class))).thenReturn(mockedMessageConverter);
final ExperimenterDataOfChoice mockedExperimenterDataOfChoice = mock(ExperimenterDataOfChoice.class);
final ExperimenterMessage experimenterMessage = new ExperimenterMessageBuilder().setExperimenterDataOfChoice(mockedExperimenterDataOfChoice).build();
final NotificationPublishService mockedNotificationPublishService = mock(NotificationPublishService.class);
deviceContext.setNotificationPublishService(mockedNotificationPublishService);
((DeviceContextImpl) deviceContext).setExtensionConverterProvider(mockedExtensionConverterProvider);
deviceContext.processExperimenterMessage(experimenterMessage);
verify(mockedNotificationPublishService).offerNotification(any(ExperimenterMessageFromDev.class));
}
Aggregations