Fix Checkstyle problems (red in Eclipse, missed in build)
[mdsal.git] / dom / mdsal-dom-broker / src / test / java / org / opendaylight / mdsal / dom / broker / ShardedDOMDataTreeTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.dom.broker;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertTrue;
13 import static org.junit.Assert.fail;
14 import static org.mockito.Matchers.any;
15 import static org.mockito.Matchers.anyCollection;
16 import static org.mockito.Matchers.anyMap;
17 import static org.mockito.Mockito.doNothing;
18 import static org.mockito.Mockito.mock;
19 import static org.mockito.Mockito.timeout;
20 import static org.mockito.Mockito.times;
21 import static org.mockito.Mockito.verify;
22 import static org.mockito.Mockito.verifyNoMoreInteractions;
23
24 import com.google.common.util.concurrent.CheckedFuture;
25 import java.util.ArrayList;
26 import java.util.Collection;
27 import java.util.Collections;
28 import java.util.List;
29 import java.util.Map;
30 import java.util.concurrent.ExecutorService;
31 import java.util.concurrent.Executors;
32 import org.junit.Before;
33 import org.junit.Test;
34 import org.mockito.ArgumentCaptor;
35 import org.mockito.Captor;
36 import org.mockito.MockitoAnnotations;
37 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
38 import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
39 import org.opendaylight.mdsal.dom.api.DOMDataTreeCursorAwareTransaction;
40 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
41 import org.opendaylight.mdsal.dom.api.DOMDataTreeListener;
42 import org.opendaylight.mdsal.dom.api.DOMDataTreeProducer;
43 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
44 import org.opendaylight.mdsal.dom.broker.util.TestModel;
45 import org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataTreeShard;
46 import org.opendaylight.yangtools.concepts.ListenerRegistration;
47 import org.opendaylight.yangtools.yang.common.QName;
48 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
49 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
50 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
51 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
52 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
53 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
54 import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
55 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
56 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
57 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
58 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
59 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder;
60 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder;
61 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
62 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
63 import org.slf4j.Logger;
64 import org.slf4j.LoggerFactory;
65
66 public class ShardedDOMDataTreeTest {
67
68     private static final Logger LOG = LoggerFactory.getLogger(ShardedDOMDataTreeProducerMultiShardTest.class);
69
70     private static SchemaContext schemaContext = null;
71
72     static {
73         try {
74             schemaContext = TestModel.createTestContext();
75         } catch (final ReactorException e) {
76             LOG.error("Unable to create schema context for TestModel", e);
77         }
78     }
79
80     private static final DOMDataTreeIdentifier ROOT_ID =
81             new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY);
82     private static final DOMDataTreeIdentifier TEST_ID =
83             new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH);
84
85     private static final DOMDataTreeIdentifier INNER_CONTAINER_ID =
86             new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, TestModel.INNER_CONTAINER_PATH);
87
88     private static final YangInstanceIdentifier OUTER_LIST_YID = TestModel.OUTER_LIST_PATH.node(
89             new NodeIdentifierWithPredicates(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1));
90     private static final DOMDataTreeIdentifier OUTER_LIST_ID =
91             new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, OUTER_LIST_YID);
92
93     private InMemoryDOMDataTreeShard rootShard;
94
95     private ShardedDOMDataTree dataTreeService;
96     private ListenerRegistration<InMemoryDOMDataTreeShard> rootShardReg;
97
98     private final ExecutorService executor = Executors.newSingleThreadExecutor();
99
100     @Captor
101     private ArgumentCaptor<Collection<DataTreeCandidate>> captorForChanges;
102     @Captor
103     private ArgumentCaptor<Map<DOMDataTreeIdentifier, NormalizedNode<?, ?>>> captorForSubtrees;
104
105     private final ContainerNode crossShardContainer = createCrossShardContainer();
106
107     @Before
108     public void setUp() throws Exception {
109         MockitoAnnotations.initMocks(this);
110
111         rootShard = InMemoryDOMDataTreeShard.create(ROOT_ID, executor, 1);
112         rootShard.onGlobalContextUpdated(schemaContext);
113
114         final ShardedDOMDataTree dataTree = new ShardedDOMDataTree();
115         final DOMDataTreeProducer shardRegProducer = dataTree.createProducer(Collections.singletonList(ROOT_ID));
116         rootShardReg = dataTree.registerDataTreeShard(ROOT_ID, rootShard, shardRegProducer);
117         shardRegProducer.close();
118
119         dataTreeService = dataTree;
120     }
121
122     @Test(expected = IllegalArgumentException.class)
123     public void testProducerPathContention() throws Exception {
124         dataTreeService.createProducer(Collections.singletonList(ROOT_ID));
125         dataTreeService.createProducer(Collections.singletonList(TEST_ID));
126     }
127
128     @Test
129     public void testShardRegistrationClose() throws Exception {
130         rootShardReg.close();
131
132         final InMemoryDOMDataTreeShard newRootShard = InMemoryDOMDataTreeShard.create(ROOT_ID, executor, 1);
133         newRootShard.onGlobalContextUpdated(schemaContext);
134         final DOMDataTreeProducer shardRegProducer = dataTreeService.createProducer(Collections.singletonList(ROOT_ID));
135
136         final ListenerRegistration<InMemoryDOMDataTreeShard> newRootShardReg =
137                 dataTreeService.registerDataTreeShard(ROOT_ID, rootShard, shardRegProducer);
138         shardRegProducer.close();
139
140         final InMemoryDOMDataTreeShard innerShard = InMemoryDOMDataTreeShard.create(INNER_CONTAINER_ID, executor, 1);
141         innerShard.onGlobalContextUpdated(schemaContext);
142         final DOMDataTreeProducer shardRegProducer2 =
143                 dataTreeService.createProducer(Collections.singletonList(INNER_CONTAINER_ID));
144         ListenerRegistration<InMemoryDOMDataTreeShard> innerShardReg =
145                 dataTreeService.registerDataTreeShard(INNER_CONTAINER_ID, innerShard, shardRegProducer2);
146
147         innerShardReg.close();
148         // try to register the shard again
149         innerShardReg = dataTreeService.registerDataTreeShard(INNER_CONTAINER_ID, innerShard, shardRegProducer2);
150         final DOMDataTreeCursorAwareTransaction tx = shardRegProducer2.createTransaction(false);
151         final DOMDataTreeWriteCursor cursor = tx.createCursor(INNER_CONTAINER_ID);
152         assertNotNull(cursor);
153
154         cursor.close();
155         tx.cancel();
156         shardRegProducer2.close();
157
158         innerShardReg.close();
159         newRootShardReg.close();
160     }
161
162     @Test(expected = IllegalStateException.class)
163     public void testEmptyShardMapProducer() throws Exception {
164         final ShardedDOMDataTree dataTree = new ShardedDOMDataTree();
165         final DOMDataTreeProducer producer = dataTree.createProducer(Collections.singletonList(ROOT_ID));
166         producer.createTransaction(false);
167     }
168
169     @Test
170     public void testSingleShardWrite() throws Exception {
171         final DOMDataTreeListener mockedDataTreeListener = mock(DOMDataTreeListener.class);
172         doNothing().when(mockedDataTreeListener).onDataTreeChanged(anyCollection(), anyMap());
173
174         dataTreeService.registerListener(mockedDataTreeListener, Collections.singletonList(INNER_CONTAINER_ID),
175                 true, Collections.emptyList());
176
177         final DOMDataTreeProducer producer = dataTreeService.createProducer(Collections.singletonList(ROOT_ID));
178         DOMDataTreeCursorAwareTransaction tx = producer.createTransaction(false);
179         DOMDataTreeWriteCursor cursor = tx.createCursor(ROOT_ID);
180         assertNotNull(cursor);
181
182         cursor.write(TEST_ID.getRootIdentifier().getLastPathArgument(), crossShardContainer);
183
184         try {
185             tx.submit().checkedGet();
186             fail("There's still an open cursor");
187         } catch (final IllegalStateException e) {
188             assertTrue(e.getMessage().contains("cursor open"));
189         }
190
191         cursor.close();
192         tx.submit().checkedGet();
193
194         tx = producer.createTransaction(false);
195         cursor = tx.createCursor(TEST_ID);
196         assertNotNull(cursor);
197
198         cursor.delete(TestModel.INNER_CONTAINER_PATH.getLastPathArgument());
199         cursor.close();
200         tx.submit().checkedGet();
201
202         verify(mockedDataTreeListener, timeout(1000).times(3)).onDataTreeChanged(captorForChanges.capture(),
203                 captorForSubtrees.capture());
204         final List<Collection<DataTreeCandidate>> capturedValue = captorForChanges.getAllValues();
205         assertTrue(capturedValue.size() == 3);
206
207         final ContainerNode capturedChange =
208                 (ContainerNode) capturedValue.get(1).iterator().next().getRootNode().getDataAfter().get();
209         final ContainerNode innerContainerVerify = (ContainerNode) crossShardContainer.getChild(
210                 TestModel.INNER_CONTAINER_PATH.getLastPathArgument()).get();
211         assertEquals(innerContainerVerify, capturedChange);
212
213         verifyNoMoreInteractions(mockedDataTreeListener);
214     }
215
216     @Test
217     // TODO extract common logic from testSingleSubshardWrite and
218     // testSingleShardWrite tests
219     public void testSingleSubshardWrite() throws Exception {
220         final DOMDataTreeListener mockedDataTreeListener = mock(DOMDataTreeListener.class);
221         doNothing().when(mockedDataTreeListener).onDataTreeChanged(anyCollection(), anyMap());
222
223         InMemoryDOMDataTreeShard testShard = InMemoryDOMDataTreeShard.create(TEST_ID, executor, 1);
224         testShard.onGlobalContextUpdated(schemaContext);
225
226         final DOMDataTreeProducer regProducer = dataTreeService.createProducer(Collections.singleton(TEST_ID));
227         dataTreeService.registerDataTreeShard(TEST_ID, testShard, regProducer);
228         regProducer.close();
229
230         dataTreeService.registerListener(mockedDataTreeListener, Collections.singletonList(TEST_ID),
231                 true, Collections.emptyList());
232
233         final DOMDataTreeProducer producer = dataTreeService.createProducer(Collections.singletonList(ROOT_ID));
234         DOMDataTreeCursorAwareTransaction tx = producer.createTransaction(false);
235         DOMDataTreeWriteCursor cursor = tx.createCursor(ROOT_ID);
236         assertNotNull(cursor);
237
238         cursor.write(TEST_ID.getRootIdentifier().getLastPathArgument(), crossShardContainer);
239
240         cursor.close();
241         tx.submit().checkedGet();
242
243         tx = producer.createTransaction(false);
244         cursor = tx.createCursor(TEST_ID);
245         assertNotNull(cursor);
246
247         cursor.delete(TestModel.INNER_CONTAINER_PATH.getLastPathArgument());
248         cursor.close();
249         tx.submit().checkedGet();
250
251         verify(mockedDataTreeListener, timeout(5000).times(3)).onDataTreeChanged(captorForChanges.capture(),
252                 captorForSubtrees.capture());
253
254         final List<Collection<DataTreeCandidate>> capturedValue = captorForChanges.getAllValues();
255         final ContainerNode capturedChange =
256                 (ContainerNode) capturedValue.get(1).iterator().next().getRootNode().getDataAfter().get();
257         final ContainerNode innerContainerVerify = crossShardContainer;
258         assertEquals(innerContainerVerify, capturedChange);
259     }
260
261     @Test
262     public void testMultipleWritesIntoSingleMapEntry() throws Exception {
263
264         final YangInstanceIdentifier oid1 = TestModel.OUTER_LIST_PATH.node(new NodeIdentifierWithPredicates(
265                 TestModel.OUTER_LIST_QNAME, QName.create(TestModel.OUTER_LIST_QNAME, "id"), 0));
266         final DOMDataTreeIdentifier outerListPath = new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, oid1);
267
268         final DOMDataTreeProducer shardProducer = dataTreeService.createProducer(
269                 Collections.singletonList(outerListPath));
270         final InMemoryDOMDataTreeShard outerListShard = InMemoryDOMDataTreeShard.create(outerListPath, executor, 1000);
271         outerListShard.onGlobalContextUpdated(schemaContext);
272
273         final ListenerRegistration<InMemoryDOMDataTreeShard> oid1ShardRegistration =
274                 dataTreeService.registerDataTreeShard(outerListPath, outerListShard, shardProducer);
275
276         final DOMDataTreeCursorAwareTransaction tx = shardProducer.createTransaction(false);
277         final DOMDataTreeWriteCursor cursor =
278                 tx.createCursor(new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, oid1));
279         assertNotNull(cursor);
280
281         MapNode innerList = ImmutableMapNodeBuilder
282                 .create()
283                 .withNodeIdentifier(new NodeIdentifier(TestModel.INNER_LIST_QNAME))
284                 .build();
285
286         cursor.write(new NodeIdentifier(TestModel.INNER_LIST_QNAME), innerList);
287         cursor.close();
288         tx.submit().checkedGet();
289
290         final ArrayList<CheckedFuture<Void, TransactionCommitFailedException>> futures = new ArrayList<>();
291         for (int i = 0; i < 1000; i++) {
292             final Collection<MapEntryNode> innerListMapEntries = createInnerListMapEntries(1000, "run-" + i);
293             for (final MapEntryNode innerListMapEntry : innerListMapEntries) {
294                 final DOMDataTreeCursorAwareTransaction tx1 = shardProducer.createTransaction(false);
295                 final DOMDataTreeWriteCursor cursor1 = tx1.createCursor(
296                         new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION,
297                                 oid1.node(new NodeIdentifier(TestModel.INNER_LIST_QNAME))));
298                 cursor1.write(innerListMapEntry.getIdentifier(), innerListMapEntry);
299                 cursor1.close();
300                 futures.add(tx1.submit());
301             }
302         }
303
304         futures.get(futures.size() - 1).checkedGet();
305
306     }
307
308     private static Collection<MapEntryNode> createInnerListMapEntries(final int amount, final String valuePrefix) {
309         final Collection<MapEntryNode> ret = new ArrayList<>();
310         for (int i = 0; i < amount; i++) {
311             ret.add(ImmutableNodes.mapEntryBuilder()
312                     .withNodeIdentifier(new NodeIdentifierWithPredicates(TestModel.INNER_LIST_QNAME,
313                             QName.create(TestModel.OUTER_LIST_QNAME, "name"), Integer.toString(i)))
314                     .withChild(ImmutableNodes
315                             .leafNode(QName.create(TestModel.INNER_LIST_QNAME, "name"), Integer.toString(i)))
316                     .withChild(ImmutableNodes
317                             .leafNode(QName.create(TestModel.INNER_LIST_QNAME, "value"), valuePrefix + "-" + i))
318                     .build());
319         }
320
321         return ret;
322     }
323
324     @Test
325     public void testMultipleProducerCursorCreation() throws Exception {
326
327         final DOMDataTreeProducer rootProducer = dataTreeService.createProducer(Collections.singletonList(ROOT_ID));
328         DOMDataTreeCursorAwareTransaction rootTx = rootProducer.createTransaction(false);
329         //check if we can create cursor where the new producer will be
330         DOMDataTreeWriteCursor rootTxCursor = rootTx.createCursor(INNER_CONTAINER_ID);
331         assertNotNull(rootTxCursor);
332         rootTxCursor.close();
333
334         try {
335             rootProducer.createProducer(Collections.singletonList(INNER_CONTAINER_ID));
336             fail("Should've failed there is still a tx open");
337         } catch (final IllegalStateException e) {
338             assertTrue(e.getMessage().contains("open"));
339         }
340
341         assertTrue(rootTx.cancel());
342
343         final DOMDataTreeProducer innerContainerProducer = rootProducer.createProducer(
344                 Collections.singletonList(INNER_CONTAINER_ID));
345
346         rootTx = rootProducer.createTransaction(false);
347         try {
348             rootTx.createCursor(INNER_CONTAINER_ID);
349             fail("Subtree should not be available to this producer");
350         } catch (final IllegalArgumentException e) {
351             assertTrue(e.getMessage().contains("delegated to child producer"));
352         }
353
354         rootTxCursor = rootTx.createCursor(TEST_ID);
355         assertNotNull(rootTxCursor);
356         try {
357             rootTxCursor.enter(INNER_CONTAINER_ID.getRootIdentifier().getLastPathArgument());
358             fail("Cursor should not have this subtree available");
359         } catch (final IllegalArgumentException e) {
360             assertTrue(e.getMessage().contains("not available to this cursor"));
361         }
362
363         try {
364             rootTxCursor.write(TestModel.INNER_CONTAINER_PATH.getLastPathArgument(),
365                     ImmutableContainerNodeBuilder.create()
366                             .withNodeIdentifier(new NodeIdentifier(TestModel.INNER_CONTAINER))
367                             .build());
368             fail("Cursor should not have this subtree available");
369         } catch (final IllegalArgumentException e) {
370             assertTrue(e.getMessage().contains("not available to this cursor"));
371         }
372
373         final DOMDataTreeCursorAwareTransaction innerShardTx = innerContainerProducer.createTransaction(false);
374         final DOMDataTreeWriteCursor innerShardCursor = innerShardTx.createCursor(INNER_CONTAINER_ID);
375         assertNotNull(innerShardCursor);
376     }
377
378     private static ContainerNode createCrossShardContainer() {
379         final LeafNode<String> shardedValue1 =
380                 ImmutableLeafNodeBuilder.<String>create().withNodeIdentifier(new NodeIdentifier(
381                         TestModel.SHARDED_VALUE_1)).withValue("sharded value 1").build();
382         final LeafNode<String> shardedValue2 =
383                 ImmutableLeafNodeBuilder.<String>create().withNodeIdentifier(new NodeIdentifier(
384                         TestModel.SHARDED_VALUE_2)).withValue("sharded value 2").build();
385
386
387         final ContainerNode lowerShardContainer = ImmutableContainerNodeBuilder.create()
388                 .withNodeIdentifier(new NodeIdentifier(TestModel.ANOTHER_SHARD_CONTAINER))
389                 .withChild(ImmutableLeafNodeBuilder.create()
390                         .withNodeIdentifier(new NodeIdentifier(TestModel.ANOTHER_SHARD_VALUE))
391                         .withValue("testing-value")
392                         .build())
393                 .build();
394
395         final ContainerNode containerNode =
396                 ImmutableContainerNodeBuilder.create()
397                         .withNodeIdentifier(new NodeIdentifier(TestModel.INNER_CONTAINER))
398                         .withChild(shardedValue1)
399                         .withChild(shardedValue2)
400                         .withChild(lowerShardContainer)
401                         .build();
402
403         final ContainerNode testContainer = ImmutableContainerNodeBuilder.create()
404                 .withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME))
405                 .withChild(containerNode)
406                 .build();
407
408         return testContainer;
409     }
410
411     //test multiple vertical levels between the shards
412     @Test
413     public void testLargerSubshardSpace() throws Exception {
414
415         final InMemoryDOMDataTreeShard outerListShard = InMemoryDOMDataTreeShard.create(OUTER_LIST_ID, executor, 1, 1);
416         outerListShard.onGlobalContextUpdated(schemaContext);
417
418         try (DOMDataTreeProducer producer =
419                      dataTreeService.createProducer(Collections.singletonList(OUTER_LIST_ID))) {
420             dataTreeService.registerDataTreeShard(OUTER_LIST_ID, outerListShard, producer);
421         }
422
423         final DOMDataTreeProducer producer = dataTreeService.createProducer(Collections.singletonList(ROOT_ID));
424         final DOMDataTreeCursorAwareTransaction tx = producer.createTransaction(false);
425         final DOMDataTreeWriteCursor cursor = tx.createCursor(ROOT_ID);
426
427         assertNotNull(cursor);
428         cursor.write(TestModel.TEST_PATH.getLastPathArgument(), createCrossShardContainer2());
429         cursor.close();
430
431         tx.submit().checkedGet();
432
433         final DOMDataTreeListener listener = mock(DOMDataTreeListener.class);
434         doNothing().when(listener).onDataTreeChanged(any(), any());
435         dataTreeService.registerListener(listener,
436                 Collections.singletonList(
437                         new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY)),
438                 false, Collections.emptyList());
439
440         verify(listener, times(2)).onDataTreeChanged(any(), any());
441
442
443     }
444
445     private static ContainerNode createCrossShardContainer2() {
446
447         final MapEntryNode
448                 innerListEntry1 = ImmutableNodes
449                 .mapEntryBuilder(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, "name-1")
450                 .withChild(ImmutableNodes.leafNode(TestModel.NAME_QNAME, "name-1"))
451                 .withChild(ImmutableNodes.leafNode(TestModel.VALUE_QNAME, "value-1"))
452                 .build();
453         final MapEntryNode innerListEntry2 = ImmutableNodes
454                 .mapEntryBuilder(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, "name-2")
455                 .withChild(ImmutableNodes.leafNode(TestModel.NAME_QNAME, "name-2"))
456                 .withChild(ImmutableNodes.leafNode(TestModel.VALUE_QNAME, "value-2"))
457                 .build();
458
459         final MapNode innerList1 = ImmutableNodes
460                 .mapNodeBuilder(TestModel.INNER_LIST_QNAME).withChild(innerListEntry1).build();
461         final MapNode innerList2 = ImmutableNodes
462                 .mapNodeBuilder(TestModel.INNER_LIST_QNAME).withChild(innerListEntry2).build();
463
464         final MapEntryNode outerListEntry1 = ImmutableNodes
465                 .mapEntryBuilder(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1)
466                 .withChild(innerList1)
467                 .build();
468         final MapEntryNode outerListEntry2 = ImmutableNodes
469                 .mapEntryBuilder(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 2)
470                 .withChild(innerList2)
471                 .build();
472
473         final MapNode outerList = ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
474                 .withChild(outerListEntry1)
475                 .withChild(outerListEntry2)
476                 .build();
477
478         final ContainerNode testContainer = ImmutableContainerNodeBuilder.create()
479                 .withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME))
480                 .withChild(outerList)
481                 .build();
482
483         return testContainer;
484     }
485 }