use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventsource.rev141202.EventSourceService in project controller by opendaylight.
the class EventSourceTopology method register.
public void register(final EventSource eventSource) {
final NodeKey nodeKey = eventSource.getSourceNodeKey();
final KeyedInstanceIdentifier<Node, NodeKey> sourcePath = EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, nodeKey);
final RoutedRpcRegistration<EventSourceService> reg = rpcRegistry.addRoutedRpcImplementation(EventSourceService.class, eventSource);
reg.registerPath(NodeContext.class, sourcePath);
routedRpcRegistrations.put(nodeKey, reg);
insert(sourcePath);
}
use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventsource.rev141202.EventSourceService in project controller by opendaylight.
the class EventSourceTopology method unRegister.
public void unRegister(final EventSource eventSource) {
final NodeKey nodeKey = eventSource.getSourceNodeKey();
final KeyedInstanceIdentifier<Node, NodeKey> sourcePath = EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, nodeKey);
final RoutedRpcRegistration<EventSourceService> removeRegistration = routedRpcRegistrations.remove(nodeKey);
if (removeRegistration != null) {
removeRegistration.close();
remove(sourcePath);
}
}
use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventsource.rev141202.EventSourceService in project controller by opendaylight.
the class EventSourceTopologyTest method unregisterTest.
@Test
public void unregisterTest() throws Exception {
topicTestHelper();
EventSource eventSourceMock = mock(EventSource.class);
NodeId nodeId = new NodeId("nodeIdValue1");
nodeKey = new NodeKey(nodeId);
Map<NodeKey, BindingAwareBroker.RoutedRpcRegistration<EventSourceService>> localMap = getRoutedRpcRegistrations();
NodeKey nodeKeyMock = mock(NodeKey.class);
doReturn(nodeKeyMock).when(eventSourceMock).getSourceNodeKey();
BindingAwareBroker.RoutedRpcRegistration<EventSourceService> routedRpcRegistrationMock = mock(BindingAwareBroker.RoutedRpcRegistration.class);
localMap.put(nodeKeyMock, routedRpcRegistrationMock);
eventSourceTopology.unRegister(eventSourceMock);
verify(routedRpcRegistrationMock, times(1)).close();
}
use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventsource.rev141202.EventSourceService in project controller by opendaylight.
the class EventSourceTopologyTest method constructorTestHelper.
private void constructorTestHelper() {
aggregatorRpcReg = mock(RpcRegistration.class);
EventSourceService eventSourceService = mock(EventSourceService.class);
doReturn(aggregatorRpcReg).when(rpcProviderRegistryMock).addRpcImplementation(eq(EventAggregatorService.class), any(EventSourceTopology.class));
doReturn(eventSourceService).when(rpcProviderRegistryMock).getRpcService(EventSourceService.class);
WriteTransaction writeTransactionMock = mock(WriteTransaction.class);
doReturn(writeTransactionMock).when(dataBrokerMock).newWriteOnlyTransaction();
doNothing().when(writeTransactionMock).put(any(LogicalDatastoreType.class), any(InstanceIdentifier.class), any(DataObject.class), eq(true));
CheckedFuture checkedFutureMock = mock(CheckedFuture.class);
doReturn(checkedFutureMock).when(writeTransactionMock).submit();
}
Aggregations