Execute the ShardedDOMDataTreeTransaction.submit() async.
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / test / java / org / opendaylight / mdsal / dom / store / inmemory / ModificationContextNodeBuilderTest.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.store.inmemory;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12 import static org.opendaylight.mdsal.dom.store.inmemory.TestUtils.DOM_DATA_TREE_IDENTIFIER;
13 import static org.opendaylight.mdsal.dom.store.inmemory.TestUtils.DOM_DATA_TREE_SHARD_PRODUCER;
14 import static org.opendaylight.mdsal.dom.store.inmemory.TestUtils.PATH_ARGUMENT;
15 import static org.opendaylight.mdsal.dom.store.inmemory.TestUtils.WRITEABLE_MODIFICATION_NODE;
16
17 import java.util.Map;
18 import org.junit.Test;
19
20 public class ModificationContextNodeBuilderTest extends ModificationContextNodeBuilder {
21
22     @Test
23     public void basicTest() throws Exception {
24         final ForeignShardModificationContext foreignShardModificationContext =
25                 new ForeignShardModificationContext(DOM_DATA_TREE_IDENTIFIER, DOM_DATA_TREE_SHARD_PRODUCER);
26         final WriteableSubshardBoundaryNode writeableSubshardBoundaryNode =
27                 WriteableSubshardBoundaryNode.from(foreignShardModificationContext);
28         super.addBoundary(PATH_ARGUMENT, writeableSubshardBoundaryNode);
29
30         assertNotNull(super.getInterior(PATH_ARGUMENT));
31         assertEquals(WRITEABLE_MODIFICATION_NODE, super.build());
32     }
33
34     @Override
35     WriteableModificationNode build(Map children) {
36         return WRITEABLE_MODIFICATION_NODE;
37     }
38 }