- protected ConnectionContext buildMockConnectionContext(final short ofpVersion) {
- when(mockFeatures.getVersion()).thenReturn(ofpVersion);
- when(outboundQueueProvider.reserveEntry()).thenReturn(43L);
- Mockito.doAnswer(new Answer<Void>() {
- @Override
- public Void answer(final InvocationOnMock invocation) throws Throwable {
- final FutureCallback<OfHeader> callBack = (FutureCallback<OfHeader>) invocation.getArguments()[2];
- callBack.onSuccess(null);
- return null;
- }
- })
- .when(outboundQueueProvider)
- .commitEntry(Matchers.anyLong(), Matchers.<MultipartRequestInput>any(), Matchers.<FutureCallback<OfHeader>>any());
-
- when(mockedConnectionAdapter.registerOutboundQueueHandler(Matchers.<OutboundQueueHandler>any(), Matchers.anyInt(), Matchers.anyLong()))
- .thenAnswer(new Answer<OutboundQueueHandlerRegistration<OutboundQueueHandler>>() {
- @Override
- public OutboundQueueHandlerRegistration<OutboundQueueHandler> answer(final InvocationOnMock invocation) throws Throwable {
- final OutboundQueueHandler handler = (OutboundQueueHandler) invocation.getArguments()[0];
- handler.onConnectionQueueChanged(outboundQueueProvider);
- return null;
- }
- });
-
- when(mockConnectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider);
- return mockConnectionContext;
+ @Test
+ public void sendNodeAddedNotification() throws Exception {
+ deviceManager.sendNodeAddedNotification(DUMMY_IDENTIFIER);
+ deviceManager.sendNodeAddedNotification(DUMMY_IDENTIFIER);
+ verify(notificationPublishService).offerNotification(new NodeUpdatedBuilder()
+ .setId(DUMMY_NODE_ID)
+ .setNodeRef(new NodeRef(DUMMY_IDENTIFIER))
+ .build());