use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.NotificationPattern in project controller by opendaylight.
the class EventSourceTopologyTest method closeTest.
@Test
public void closeTest() throws Exception {
constructorTestHelper();
topicTestHelper();
Map<TopicId, EventSourceTopic> localMap = getEventSourceTopicMap();
TopicId topicIdMock = mock(TopicId.class);
EventSourceTopic eventSourceTopic = EventSourceTopic.create(new NotificationPattern("foo"), "pattern", eventSourceTopology);
localMap.put(topicIdMock, eventSourceTopic);
eventSourceTopology.close();
verify(aggregatorRpcReg, times(1)).close();
verify(listenerRegistrationMock, times(1)).close();
}
use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.NotificationPattern in project controller by opendaylight.
the class EventSourceTopologyTest method destroyTopicTest.
@Test
public void destroyTopicTest() throws Exception {
topicTestHelper();
TopicId topicId = new TopicId("topic-id-007");
Map<TopicId, EventSourceTopic> localMap = getEventSourceTopicMap();
EventSourceTopic eventSourceTopic = EventSourceTopic.create(new NotificationPattern("foo"), "pattern", eventSourceTopology);
localMap.put(topicId, eventSourceTopic);
DestroyTopicInput input = new DestroyTopicInputBuilder().setTopicId(topicId).build();
eventSourceTopology.destroyTopic(input);
verify(listenerRegistrationMock, times(1)).close();
}
use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.NotificationPattern in project controller by opendaylight.
the class EventSourceTopic method getJoinTopicInputArgument.
private JoinTopicInput getJoinTopicInputArgument(final InstanceIdentifier<?> path) {
final NodeRef nodeRef = new NodeRef(path);
final JoinTopicInput jti = new JoinTopicInputBuilder().setNode(nodeRef.getValue()).setTopicId(topicId).setNotificationPattern(notificationPattern).build();
return jti;
}
use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.NotificationPattern in project controller by opendaylight.
the class EventSourceTopology method createTopic.
@Override
public Future<RpcResult<CreateTopicOutput>> createTopic(final CreateTopicInput input) {
LOG.debug("Received Topic creation request: NotificationPattern -> {}, NodeIdPattern -> {}", input.getNotificationPattern(), input.getNodeIdPattern());
final NotificationPattern notificationPattern = new NotificationPattern(input.getNotificationPattern());
// FIXME: do not use Util.wildcardToRegex - NodeIdPatter should be regex
final String nodeIdPattern = input.getNodeIdPattern().getValue();
final EventSourceTopic eventSourceTopic = EventSourceTopic.create(notificationPattern, nodeIdPattern, this);
eventSourceTopicMap.put(eventSourceTopic.getTopicId(), eventSourceTopic);
final CreateTopicOutput cto = new CreateTopicOutputBuilder().setTopicId(eventSourceTopic.getTopicId()).build();
LOG.info("Topic has been created: NotificationPattern -> {}, NodeIdPattern -> {}", input.getNotificationPattern(), input.getNodeIdPattern());
return Util.resultRpcSuccessFor(cto);
}
use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.NotificationPattern in project controller by opendaylight.
the class EventSourceTopicTest method setUp.
@Before
public void setUp() throws Exception {
final NotificationPattern notificationPattern = new NotificationPattern("value1");
eventSourceServiceMock = mock(EventSourceService.class);
doReturn(RpcResultBuilder.success(new JoinTopicOutputBuilder().setStatus(JoinTopicStatus.Up).build()).buildFuture()).when(eventSourceServiceMock).joinTopic(any(JoinTopicInput.class));
eventSourceTopologyMock = mock(EventSourceTopology.class);
dataBrokerMock = mock(DataBroker.class);
doReturn(eventSourceServiceMock).when(eventSourceTopologyMock).getEventSourceService();
doReturn(dataBrokerMock).when(eventSourceTopologyMock).getDataBroker();
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 checkedFutureWriteMock = mock(CheckedFuture.class);
doReturn(checkedFutureWriteMock).when(writeTransactionMock).submit();
ReadOnlyTransaction readOnlyTransactionMock = mock(ReadOnlyTransaction.class);
doReturn(readOnlyTransactionMock).when(dataBrokerMock).newReadOnlyTransaction();
CheckedFuture checkedFutureReadMock = mock(CheckedFuture.class);
doReturn(checkedFutureReadMock).when(readOnlyTransactionMock).read(LogicalDatastoreType.OPERATIONAL, EventSourceTopology.EVENT_SOURCE_TOPOLOGY_PATH);
eventSourceTopic = EventSourceTopic.create(notificationPattern, "nodeIdPattern1", eventSourceTopologyMock);
}
Aggregations