use of org.opendaylight.controller.md.sal.dom.store.impl.DOMImmutableDataChangeEvent in project controller by opendaylight.
the class DataChangedTest method testSerialization.
@Test
public void testSerialization() {
DOMImmutableDataChangeEvent change = DOMImmutableDataChangeEvent.builder(DataChangeScope.SUBTREE).addCreated(TestModel.TEST_PATH, ImmutableContainerNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME)).withChild(ImmutableNodes.leafNode(TestModel.DESC_QNAME, "foo")).build()).addUpdated(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), ImmutableContainerNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME)).withChild(ImmutableNodes.leafNode(TestModel.NAME_QNAME, "bar")).build()).addRemoved(TestModel.OUTER_LIST_PATH, ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build()).setBefore(ImmutableNodes.containerNode(TestModel.TEST_QNAME)).setAfter(ImmutableContainerNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME)).withChild(ImmutableNodes.leafNode(TestModel.DESC_QNAME, "foo")).withChild(ImmutableNodes.leafNode(TestModel.NAME_QNAME, "bar")).build()).build();
DataChanged expected = new DataChanged(change);
DataChanged actual = (DataChanged) SerializationUtils.clone(expected);
assertEquals("getCreatedData", change.getCreatedData(), actual.getChange().getCreatedData());
assertEquals("getOriginalData", change.getOriginalData(), actual.getChange().getOriginalData());
assertEquals("getOriginalSubtree", change.getOriginalSubtree(), actual.getChange().getOriginalSubtree());
assertEquals("getRemovedPaths", change.getRemovedPaths(), actual.getChange().getRemovedPaths());
assertEquals("getUpdatedData", change.getUpdatedData(), actual.getChange().getUpdatedData());
assertEquals("getUpdatedSubtree", change.getUpdatedSubtree(), actual.getChange().getUpdatedSubtree());
}
use of org.opendaylight.controller.md.sal.dom.store.impl.DOMImmutableDataChangeEvent in project controller by opendaylight.
the class DefaultShardDataChangeListenerPublisher method submitNotifications.
@Override
public void submitNotifications(final DataChangeListenerRegistration<?> listener, final Iterable<DOMImmutableDataChangeEvent> notifications) {
final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> instance = listener.getInstance();
LOG.debug("{}: Notifying listener {} about {}", logContext, instance, notifications);
for (DOMImmutableDataChangeEvent n : notifications) {
instance.onDataChanged(n);
}
}
Aggregations