import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModificationCursor;
}
@Test
- public void testWriteRootNode() throws Exception{
- ShardDataTree shardDataTree = new ShardDataTree(SCHEMA_CONTEXT, TreeType.CONFIGURATION);
- DataTreeModification mod = shardDataTree.newModification();
+ public void testWriteRootNode() throws Exception {
+ final DataTree localDataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
+ localDataTree.setSchemaContext(SCHEMA_CONTEXT);
+ DataTreeModification mod = localDataTree.takeSnapshot().newModification();
mod.write(CarsModel.BASE_PATH, CarsModel.create());
- shardDataTree.commit(mod);
+ mod.ready();
+ localDataTree.validate(mod);
+ localDataTree.commit(localDataTree.prepare(mod));
- NormalizedNode<?, ?> normalizedNode = shardDataTree.readNode(YangInstanceIdentifier.EMPTY).get();
+ NormalizedNode<?, ?> normalizedNode = dataTree.takeSnapshot().readNode(YangInstanceIdentifier.EMPTY).get();
pruningDataTreeModification.write(YangInstanceIdentifier.EMPTY, normalizedNode);
dataTree.commit(getCandidate());
Optional<NormalizedNode<?, ?>> actual = dataTree.takeSnapshot().readNode(YangInstanceIdentifier.EMPTY);
assertEquals("Root present", true, actual.isPresent());
assertEquals("Root node", normalizedNode, actual.get());
-
}
@Test
DataTreeCandidateTip candidate = dataTree.prepare(mod);
return candidate;
}
-}
\ No newline at end of file
+}