2 * Copyright (c) 2016 Cisco Systems, Inc. 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.junit.Assert.assertEquals;
11 import static org.junit.Assert.fail;
13 import com.google.common.collect.ImmutableMap;
14 import org.junit.AfterClass;
15 import org.junit.BeforeClass;
16 import org.junit.Test;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
20 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
21 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
22 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
23 import org.opendaylight.yangtools.yang.data.api.schema.SystemMapNode;
24 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
25 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
26 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration;
27 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
28 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
29 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
30 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
31 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
32 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
33 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
35 public class Bug5968MergeTest {
36 private static final String NS = "bug5968";
37 private static final String REV = "2016-07-28";
38 private static final QName ROOT = QName.create(NS, REV, "root");
39 private static final QName MY_LIST = QName.create(NS, REV, "my-list");
40 private static final QName LIST_ID = QName.create(NS, REV, "list-id");
41 private static final QName MANDATORY_LEAF = QName.create(NS, REV, "mandatory-leaf");
42 private static final QName COMMON_LEAF = QName.create(NS, REV, "common-leaf");
43 private static EffectiveModelContext SCHEMA_CONTEXT;
46 public static void beforeClass() {
47 SCHEMA_CONTEXT = TestModel.createTestContext("/bug5968.yang");
51 public static void afterClass() {
52 SCHEMA_CONTEXT = null;
55 private static DataTree initDataTree(final EffectiveModelContext schemaContext, final boolean withMapNode)
56 throws DataValidationFailedException {
57 final DataTree inMemoryDataTree = new InMemoryDataTreeFactory().create(
58 DataTreeConfiguration.DEFAULT_CONFIGURATION, schemaContext);
60 final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> root = Builders.containerBuilder()
61 .withNodeIdentifier(new NodeIdentifier(ROOT));
62 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
63 modificationTree.merge(
64 YangInstanceIdentifier.of(ROOT),
65 withMapNode ? root.withChild(
66 Builders.mapBuilder().withNodeIdentifier(new NodeIdentifier(MY_LIST)).build()).build() : root
68 modificationTree.ready();
70 inMemoryDataTree.validate(modificationTree);
71 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
72 inMemoryDataTree.commit(prepare);
74 return inMemoryDataTree;
77 private static DataTree emptyDataTree(final EffectiveModelContext schemaContext)
78 throws DataValidationFailedException {
79 return new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_CONFIGURATION, schemaContext);
83 public void mergeInvalidContainerTest() throws DataValidationFailedException {
84 final DataTree inMemoryDataTree = emptyDataTree(SCHEMA_CONTEXT);
86 final SystemMapNode myList = createMap(true);
87 final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> root = Builders.containerBuilder()
88 .withNodeIdentifier(new NodeIdentifier(ROOT)).withChild(myList);
90 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
91 modificationTree.merge(YangInstanceIdentifier.of(ROOT), root.build());
94 modificationTree.ready();
95 inMemoryDataTree.validate(modificationTree);
96 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
97 inMemoryDataTree.commit(prepare);
98 fail("Should fail due to missing mandatory leaf.");
99 } catch (final IllegalArgumentException e) {
100 assertEquals("Node (bug5968?revision=2016-07-28)my-list[{(bug5968?revision=2016-07-28)list-id=1}] is "
101 + "missing mandatory descendant /(bug5968?revision=2016-07-28)mandatory-leaf", e.getMessage());
106 public void mergeInvalidMapTest() throws DataValidationFailedException {
107 final DataTree inMemoryDataTree = emptyDataTree(SCHEMA_CONTEXT);
108 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
109 mergeMap(modificationTree, true);
112 modificationTree.ready();
113 inMemoryDataTree.validate(modificationTree);
114 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
115 inMemoryDataTree.commit(prepare);
116 fail("Should fail due to missing mandatory leaf.");
117 } catch (final IllegalArgumentException e) {
118 assertEquals("Node (bug5968?revision=2016-07-28)my-list[{(bug5968?revision=2016-07-28)list-id=1}] is "
119 + "missing mandatory descendant /(bug5968?revision=2016-07-28)mandatory-leaf", e.getMessage());
124 public void mergeInvalidMapEntryTest() throws DataValidationFailedException {
125 final DataTree inMemoryDataTree = initDataTree(SCHEMA_CONTEXT, true);
126 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
128 mergeMapEntry(modificationTree, "1", null, "common-value");
131 modificationTree.ready();
132 inMemoryDataTree.validate(modificationTree);
133 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
134 inMemoryDataTree.commit(prepare);
135 fail("Should fail due to missing mandatory leaf.");
136 } catch (final IllegalArgumentException e) {
137 assertEquals("Node (bug5968?revision=2016-07-28)my-list[{(bug5968?revision=2016-07-28)list-id=1}] is "
138 + "missing mandatory descendant /(bug5968?revision=2016-07-28)mandatory-leaf", e.getMessage());
142 private static void mergeMap(final DataTreeModification modificationTree,
143 final boolean mandatoryDataMissing) throws DataValidationFailedException {
144 modificationTree.merge(YangInstanceIdentifier.of(ROOT).node(MY_LIST), createMap(mandatoryDataMissing));
147 private static SystemMapNode createMap(final boolean mandatoryDataMissing) throws DataValidationFailedException {
148 return Builders.mapBuilder()
149 .withNodeIdentifier(new NodeIdentifier(MY_LIST))
150 .withChild(mandatoryDataMissing ? createMapEntry("1", "common-value")
151 : createMapEntry("1", "mandatory-value", "common-value"))
155 private static void mergeMapEntry(final DataTreeModification modificationTree, final Object listIdValue,
156 final Object mandatoryLeafValue, final Object commonLeafValue) throws DataValidationFailedException {
157 final MapEntryNode taskEntryNode = mandatoryLeafValue == null ? createMapEntry(listIdValue, commonLeafValue)
158 : createMapEntry(listIdValue, mandatoryLeafValue, commonLeafValue);
160 modificationTree.merge(
161 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
162 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, listIdValue))),
166 private static MapEntryNode createMapEntry(final Object listIdValue, final Object mandatoryLeafValue,
167 final Object commonLeafValue) throws DataValidationFailedException {
168 return Builders.mapEntryBuilder()
169 .withNodeIdentifier(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, listIdValue)))
170 .withChild(ImmutableNodes.leafNode(LIST_ID, listIdValue))
171 .withChild(ImmutableNodes.leafNode(MANDATORY_LEAF, mandatoryLeafValue))
172 .withChild(ImmutableNodes.leafNode(COMMON_LEAF, commonLeafValue)).build();
175 private static MapEntryNode createMapEntry(final Object listIdValue, final Object commonLeafValue)
176 throws DataValidationFailedException {
177 return Builders.mapEntryBuilder()
178 .withNodeIdentifier(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, listIdValue)))
179 .withChild(ImmutableNodes.leafNode(LIST_ID, listIdValue))
180 .withChild(ImmutableNodes.leafNode(COMMON_LEAF, commonLeafValue)).build();
183 private static MapEntryNode createMapEntryM(final Object listIdValue, final Object mandatoryLeafValue)
184 throws DataValidationFailedException {
185 return Builders.mapEntryBuilder()
186 .withNodeIdentifier(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, listIdValue)))
187 .withChild(ImmutableNodes.leafNode(LIST_ID, listIdValue))
188 .withChild(ImmutableNodes.leafNode(MANDATORY_LEAF, mandatoryLeafValue)).build();
192 public void mergeValidContainerTest() throws DataValidationFailedException {
193 final DataTree inMemoryDataTree = emptyDataTree(SCHEMA_CONTEXT);
195 final SystemMapNode myList = createMap(false);
196 final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> root = Builders.containerBuilder()
197 .withNodeIdentifier(new NodeIdentifier(ROOT)).withChild(myList);
199 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
200 modificationTree.merge(YangInstanceIdentifier.of(ROOT), root.build());
201 modificationTree.ready();
202 inMemoryDataTree.validate(modificationTree);
203 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
204 inMemoryDataTree.commit(prepare);
208 public void mergeValidMapTest() throws DataValidationFailedException {
209 final DataTree inMemoryDataTree = emptyDataTree(SCHEMA_CONTEXT);
210 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
211 mergeMap(modificationTree, false);
213 modificationTree.ready();
214 inMemoryDataTree.validate(modificationTree);
215 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
216 inMemoryDataTree.commit(prepare);
220 public void mergeValidMapEntryTest() throws DataValidationFailedException {
221 final DataTree inMemoryDataTree = initDataTree(SCHEMA_CONTEXT, true);
222 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
224 mergeMapEntry(modificationTree, "1", "mandatory-value", "common-value");
226 modificationTree.ready();
227 inMemoryDataTree.validate(modificationTree);
228 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
229 inMemoryDataTree.commit(prepare);
233 public void validMultiStepsMergeTest() throws DataValidationFailedException {
234 final DataTree inMemoryDataTree = emptyDataTree(SCHEMA_CONTEXT);
235 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
237 modificationTree.merge(YangInstanceIdentifier.of(ROOT), createContainerBuilder().build());
238 modificationTree.merge(YangInstanceIdentifier.of(ROOT).node(MY_LIST), createMapBuilder().build());
239 modificationTree.merge(
240 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
241 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
242 createEmptyMapEntryBuilder("1").build());
243 modificationTree.merge(
244 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
245 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
246 createMapEntry("1", "mandatory-value", "common-value"));
248 modificationTree.ready();
249 inMemoryDataTree.validate(modificationTree);
250 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
251 inMemoryDataTree.commit(prepare);
255 public void invalidMultiStepsMergeTest() throws DataValidationFailedException {
256 final DataTree inMemoryDataTree = emptyDataTree(SCHEMA_CONTEXT);
257 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
259 modificationTree.merge(YangInstanceIdentifier.of(ROOT), createContainerBuilder().build());
260 modificationTree.merge(YangInstanceIdentifier.of(ROOT).node(MY_LIST), createMapBuilder().build());
261 modificationTree.merge(
262 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
263 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
264 createEmptyMapEntryBuilder("1").build());
265 modificationTree.merge(
266 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
267 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
268 createMapEntry("1", "common-value"));
271 modificationTree.ready();
272 inMemoryDataTree.validate(modificationTree);
273 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
274 inMemoryDataTree.commit(prepare);
275 fail("Should fail due to missing mandatory leaf.");
276 } catch (final IllegalArgumentException e) {
277 assertEquals("Node (bug5968?revision=2016-07-28)my-list[{(bug5968?revision=2016-07-28)list-id=1}] is "
278 + "missing mandatory descendant /(bug5968?revision=2016-07-28)mandatory-leaf", e.getMessage());
282 private static DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> createEmptyMapEntryBuilder(
283 final Object listIdValue) throws DataValidationFailedException {
284 return Builders.mapEntryBuilder()
285 .withNodeIdentifier(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, listIdValue)))
286 .withChild(ImmutableNodes.leafNode(LIST_ID, listIdValue));
289 private static CollectionNodeBuilder<MapEntryNode, SystemMapNode> createMapBuilder() {
290 return Builders.mapBuilder().withNodeIdentifier(new NodeIdentifier(MY_LIST));
293 private static DataContainerNodeBuilder<NodeIdentifier, ContainerNode> createContainerBuilder() {
294 return Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(ROOT));
298 public void validMultiStepsWriteAndMergeTest() throws DataValidationFailedException {
299 final DataTree inMemoryDataTree = emptyDataTree(SCHEMA_CONTEXT);
300 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
302 modificationTree.write(YangInstanceIdentifier.of(ROOT), createContainerBuilder().build());
303 modificationTree.merge(YangInstanceIdentifier.of(ROOT).node(MY_LIST), createMapBuilder().build());
304 modificationTree.merge(
305 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
306 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
307 createEmptyMapEntryBuilder("1").build());
308 modificationTree.merge(
309 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
310 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
311 createMapEntry("1", "mandatory-value", "common-value"));
313 modificationTree.ready();
314 inMemoryDataTree.validate(modificationTree);
315 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
316 inMemoryDataTree.commit(prepare);
320 public void invalidMultiStepsWriteAndMergeTest() throws DataValidationFailedException {
321 final DataTree inMemoryDataTree = emptyDataTree(SCHEMA_CONTEXT);
322 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
324 modificationTree.write(YangInstanceIdentifier.of(ROOT), createContainerBuilder().build());
325 modificationTree.merge(YangInstanceIdentifier.of(ROOT).node(MY_LIST), createMapBuilder().build());
326 modificationTree.merge(
327 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
328 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
329 createEmptyMapEntryBuilder("1").build());
330 modificationTree.merge(
331 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
332 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
333 createMapEntry("1", "common-value"));
336 modificationTree.ready();
337 inMemoryDataTree.validate(modificationTree);
338 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
339 inMemoryDataTree.commit(prepare);
340 fail("Should fail due to missing mandatory leaf.");
341 } catch (final IllegalArgumentException e) {
342 assertEquals("Node (bug5968?revision=2016-07-28)my-list[{(bug5968?revision=2016-07-28)list-id=1}] is "
343 + "missing mandatory descendant /(bug5968?revision=2016-07-28)mandatory-leaf", e.getMessage());
348 public void validMapEntryMultiCommitMergeTest() throws DataValidationFailedException {
349 final DataTree inMemoryDataTree = emptyDataTree(SCHEMA_CONTEXT);
350 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
352 modificationTree.write(YangInstanceIdentifier.of(ROOT), createContainerBuilder().build());
353 modificationTree.merge(YangInstanceIdentifier.of(ROOT).node(MY_LIST), createMapBuilder().build());
354 modificationTree.merge(
355 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
356 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
357 createEmptyMapEntryBuilder("1").build());
358 modificationTree.merge(
359 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
360 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
361 createMapEntryM("1", "mandatory-value"));
363 modificationTree.ready();
364 inMemoryDataTree.validate(modificationTree);
365 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
366 inMemoryDataTree.commit(prepare);
368 final DataTreeModification modificationTree2 = inMemoryDataTree.takeSnapshot().newModification();
369 modificationTree2.merge(
370 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
371 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
372 createMapEntry("1", "common-value"));
373 modificationTree2.ready();
374 inMemoryDataTree.validate(modificationTree2);
375 final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
376 inMemoryDataTree.commit(prepare2);
380 public void invalidMapEntryMultiCommitMergeTest() throws DataValidationFailedException {
381 final DataTree inMemoryDataTree = emptyDataTree(SCHEMA_CONTEXT);
382 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
384 modificationTree.write(YangInstanceIdentifier.of(ROOT), createContainerBuilder().build());
385 modificationTree.merge(YangInstanceIdentifier.of(ROOT).node(MY_LIST), createMapBuilder().build());
386 modificationTree.merge(
387 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
388 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
389 createEmptyMapEntryBuilder("1").build());
390 modificationTree.merge(
391 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
392 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
393 createMapEntryM("1", "mandatory-value"));
395 modificationTree.ready();
396 inMemoryDataTree.validate(modificationTree);
397 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
398 inMemoryDataTree.commit(prepare);
400 final DataTreeModification modificationTree2 = inMemoryDataTree.takeSnapshot().newModification();
401 modificationTree2.write(
402 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
403 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
404 createMapEntry("1", "common-value"));
405 modificationTree2.merge(
406 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
407 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
408 createMapEntryM("1", "mandatory-value"));
409 modificationTree2.merge(
410 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
411 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "2"))),
412 createMapEntry("2", "common-value"));
414 modificationTree2.ready();
415 inMemoryDataTree.validate(modificationTree2);
416 final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
417 inMemoryDataTree.commit(prepare2);
418 fail("Should fail due to missing mandatory leaf.");
419 } catch (final IllegalArgumentException e) {
420 assertEquals("Node (bug5968?revision=2016-07-28)my-list[{(bug5968?revision=2016-07-28)list-id=2}] is "
421 + "missing mandatory descendant /(bug5968?revision=2016-07-28)mandatory-leaf", e.getMessage());
426 * This test consists of two transactions (i.e. data tree modifications) on
427 * empty data tree. The first one writes mandatory data and second one
428 * writes common data without any mandatory data.
431 public void validMapEntryMultiCommitMergeTest2() throws DataValidationFailedException {
432 final DataTree inMemoryDataTree = emptyDataTree(SCHEMA_CONTEXT);
433 final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
434 final DataTreeModification modificationTree2 = inMemoryDataTree.takeSnapshot().newModification();
436 modificationTree.write(YangInstanceIdentifier.of(ROOT), createContainerBuilder().build());
437 modificationTree.merge(YangInstanceIdentifier.of(ROOT).node(MY_LIST), createMapBuilder().build());
438 modificationTree.merge(
439 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
440 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
441 createEmptyMapEntryBuilder("1").build());
442 modificationTree.merge(
443 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
444 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
445 createMapEntryM("1", "mandatory-value"));
447 modificationTree.ready();
448 inMemoryDataTree.validate(modificationTree);
449 final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
450 inMemoryDataTree.commit(prepare);
452 modificationTree2.merge(
453 YangInstanceIdentifier.of(ROOT).node(MY_LIST)
454 .node(NodeIdentifierWithPredicates.of(MY_LIST, ImmutableMap.of(LIST_ID, "1"))),
455 createMapEntry("1", "common-value"));
456 modificationTree2.ready();
457 inMemoryDataTree.validate(modificationTree2);
458 final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
459 inMemoryDataTree.commit(prepare2);