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