EventSourceTopology implements EventAggregatorService, EventSourceRegistry { 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 Registration reg = rpcRegistry.registerRpcImplementation(EventSourceService.class, eventSource, Collections.singleton(sourcePath)); routedRpcRegistrations.put(nodeKey, reg); insert(sourcePath); } EventSourceTopology(final DataBroker dataBroker, final RpcProviderService providerService,
            RpcConsumerRegistry rpcService); @Override ListenableFuture<RpcResult<CreateTopicOutput>> createTopic(final CreateTopicInput input); @Override ListenableFuture<RpcResult<DestroyTopicOutput>> destroyTopic(final DestroyTopicInput input); @Override void close(); void register(final EventSource eventSource); void unRegister(final EventSource eventSource); @Override EventSourceRegistration<T> registerEventSource(final T eventSource);  }
@Test public void registerTest() throws Exception { topicTestHelper(); Node nodeMock = mock(Node.class); EventSource eventSourceMock = mock(EventSource.class); NodeId nodeId = new NodeId("nodeIdValue1"); NodeKey nodeKey = new NodeKey(nodeId); doReturn(nodeKey).when(nodeMock).key(); doReturn(nodeKey).when(eventSourceMock).getSourceNodeKey(); ObjectRegistration routedRpcRegistrationMock = mock(ObjectRegistration.class); doReturn(routedRpcRegistrationMock).when(rpcProviderRegistryMock).registerRpcImplementation( eq(EventSourceService.class), eq(eventSourceMock), any(Set.class)); eventSourceTopology.register(eventSourceMock); verify(rpcProviderRegistryMock, times(1)).registerRpcImplementation(eq(EventSourceService.class), eq(eventSourceMock), any(Set.class)); }