2 * Copyright (c) 2019 Pantheon Technologies, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.impl.schema.tree;
10 import static org.hamcrest.CoreMatchers.instanceOf;
11 import static org.junit.Assert.assertThat;
12 import static org.junit.Assert.assertTrue;
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
16 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
17 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration;
18 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
20 public class MapEntryRootTest extends AbstractTestModelTest {
23 public void testMapEntryRoot() {
24 final DataTreeConfiguration treeConfig = DataTreeConfiguration.builder(TreeType.OPERATIONAL).setRootPath(
25 TestModel.TEST_PATH.node(TestModel.OUTER_LIST_QNAME).node(
26 new NodeIdentifierWithPredicates(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, (short) 12))).build();
27 final DataTree dataTree = new InMemoryDataTreeFactory().create(treeConfig, SCHEMA_CONTEXT);
28 assertTrue(dataTree instanceof InMemoryDataTree);
30 final InMemoryDataTree imdt = (InMemoryDataTree) dataTree;
31 final InMemoryDataTreeModification mod = imdt.takeSnapshot().newModification();
32 final ModificationApplyOperation strategy = mod.getStrategy();
33 assertThat(strategy, instanceOf(ListEntryModificationStrategy.class));