import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
public class DataTreeCandidatesTest {
- private static final Logger LOG = LoggerFactory.getLogger(DataTreeCandidates.class);
+ private static final Logger LOG = LoggerFactory.getLogger(DataTreeCandidatesTest.class);
private static final SchemaContext SCHEMA_CONTEXT = TestModel.createTestContext();
@Before
public void setUp() throws Exception {
- dataTree = InMemoryDataTreeFactory.getInstance().create(DataTreeConfiguration.DEFAULT_OPERATIONAL);
- dataTree.setSchemaContext(SCHEMA_CONTEXT);
+ dataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL, SCHEMA_CONTEXT);
final ContainerNode testContainer = ImmutableContainerNodeBuilder.create()
.withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME))
final InMemoryDataTreeModification modification = (InMemoryDataTreeModification) dataTree.takeSnapshot()
.newModification();
- final DataTreeModificationCursor cursor = modification.createCursor(YangInstanceIdentifier.EMPTY);
+ final DataTreeModificationCursor cursor = modification.openCursor();
cursor.write(TestModel.TEST_PATH.getLastPathArgument(), testContainer);
modification.ready();
@Test
public void testRootedCandidate() throws DataValidationFailedException {
- final DataTree innerDataTree = InMemoryDataTreeFactory.getInstance().create(
+ final DataTree innerDataTree = new InMemoryDataTreeFactory().create(
new DataTreeConfiguration.Builder(TreeType.OPERATIONAL)
.setMandatoryNodesValidation(true)
.setRootPath(TestModel.INNER_CONTAINER_PATH)
final LeafNode<?> readLeaf = (LeafNode<?>) newModification.readNode(TestModel.INNER_VALUE_PATH).get();
assertEquals(readLeaf, leaf);
}
-}
\ No newline at end of file
+}