@SuppressWarnings("unchecked") @Test public void onDataTreeChangedTest() { InstanceIdentifier<Node> instanceIdentifierMock = mock(InstanceIdentifier.class); DataTreeModification<Node> mockDataTreeModification = mock(DataTreeModification.class); DataObjectModification<Node> mockModification = mock(DataObjectModification.class); doReturn(mockModification).when(mockDataTreeModification).getRootNode(); doReturn(DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, instanceIdentifierMock)) .when(mockDataTreeModification).getRootPath(); doReturn(DataObjectModification.ModificationType.WRITE).when(mockModification).getModificationType(); Node dataObjectNodeMock = mock(Node.class); doReturn(getNodeKey("testNodeId01")).when(dataObjectNodeMock).key(); NodeId nodeIdMock = mock(NodeId.class); doReturn(nodeIdMock).when(dataObjectNodeMock).getNodeId(); doReturn("nodeIdPattern1").when(nodeIdMock).getValue(); doReturn(dataObjectNodeMock).when(mockModification).getDataAfter(); eventSourceTopic.onDataTreeChanged(Collections.singletonList(mockDataTreeModification)); verify(dataObjectNodeMock).getNodeId(); verify(nodeIdMock).getValue(); }
@Override public void onDataTreeChanged(final Collection<DataTreeModification<Node>> changes) { for (DataTreeModification<Node> change: changes) { final DataObjectModification<Node> rootNode = change.getRootNode(); switch (rootNode.getModificationType()) { case WRITE: case SUBTREE_MODIFIED: final Node node = rootNode.getDataAfter(); if (getNodeIdRegexPattern().matcher(node.getNodeId().getValue()).matches()) { notifyNode(change.getRootPath().getRootIdentifier()); } break; default: break; } } }
EventSourceTopic implements DataTreeChangeListener<Node>, AutoCloseable { @Override public void onDataTreeChanged(final Collection<DataTreeModification<Node>> changes) { for (DataTreeModification<Node> change: changes) { final DataObjectModification<Node> rootNode = change.getRootNode(); switch (rootNode.getModificationType()) { case WRITE: case SUBTREE_MODIFIED: final Node node = rootNode.getDataAfter(); if (getNodeIdRegexPattern().matcher(node.getNodeId().getValue()).matches()) { notifyNode(change.getRootPath().getRootIdentifier()); } break; default: break; } } } }
EventSourceTopic implements DataTreeChangeListener<Node>, AutoCloseable { @Override public void onDataTreeChanged(final Collection<DataTreeModification<Node>> changes) { for (DataTreeModification<Node> change: changes) { final DataObjectModification<Node> rootNode = change.getRootNode(); switch (rootNode.getModificationType()) { case WRITE: case SUBTREE_MODIFIED: final Node node = rootNode.getDataAfter(); if (getNodeIdRegexPattern().matcher(node.getNodeId().getValue()).matches()) { notifyNode(change.getRootPath().getRootIdentifier()); } break; default: break; } } } private  EventSourceTopic(final NotificationPattern notificationPattern, final String nodeIdRegexPattern,
            final EventSourceService sourceService); }
EventSourceTopic implements DataTreeChangeListener<Node>, AutoCloseable { @Override public void onDataTreeChanged(final Collection<DataTreeModification<Node>> changes) { for (DataTreeModification<Node> change: changes) { final DataObjectModification<Node> rootNode = change.getRootNode(); switch (rootNode.getModificationType()) { case WRITE: case SUBTREE_MODIFIED: final Node node = rootNode.getDataAfter(); if (getNodeIdRegexPattern().matcher(node.getNodeId().getValue()).matches()) { notifyNode(change.getRootPath().getRootIdentifier()); } break; default: break; } } } private  EventSourceTopic(final NotificationPattern notificationPattern, final String nodeIdRegexPattern,
            final EventSourceService sourceService); static EventSourceTopic create(final NotificationPattern notificationPattern,
            final String nodeIdRegexPattern, final EventSourceTopology eventSourceTopology); TopicId getTopicId(); @Override void onDataTreeChanged(final Collection<DataTreeModification<Node>> changes); void notifyNode(final InstanceIdentifier<?> nodeId); Pattern getNodeIdRegexPattern(); @Override void close(); }
EventSourceTopic implements DataTreeChangeListener<Node>, AutoCloseable { @Override public void onDataTreeChanged(final Collection<DataTreeModification<Node>> changes) { for (DataTreeModification<Node> change: changes) { final DataObjectModification<Node> rootNode = change.getRootNode(); switch (rootNode.getModificationType()) { case WRITE: case SUBTREE_MODIFIED: final Node node = rootNode.getDataAfter(); if (getNodeIdRegexPattern().matcher(node.getNodeId().getValue()).matches()) { notifyNode(change.getRootPath().getRootIdentifier()); } break; default: break; } } } private  EventSourceTopic(final NotificationPattern notificationPattern, final String nodeIdRegexPattern,
            final EventSourceService sourceService); static EventSourceTopic create(final NotificationPattern notificationPattern,
            final String nodeIdRegexPattern, final EventSourceTopology eventSourceTopology); TopicId getTopicId(); @Override void onDataTreeChanged(final Collection<DataTreeModification<Node>> changes); void notifyNode(final InstanceIdentifier<?> nodeId); Pattern getNodeIdRegexPattern(); @Override void close();  }