Merge "Bug 1236 - Documented Binding-aware RPC services of MD-SAL"
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / modification / MutableCompositeModificationTest.java
1 package org.opendaylight.controller.cluster.datastore.modification;
2
3 import com.google.common.base.Optional;
4 import junit.framework.Assert;
5 import org.junit.Test;
6 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
7 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
8 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
9 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
10
11 public class MutableCompositeModificationTest extends AbstractModificationTest {
12
13   @Test
14   public void testApply() throws Exception {
15
16     MutableCompositeModification compositeModification = new MutableCompositeModification();
17     compositeModification.addModification(new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME)));
18
19     DOMStoreReadWriteTransaction transaction = store.newReadWriteTransaction();
20     compositeModification.apply(transaction);
21     commitTransaction(transaction);
22
23     Optional<NormalizedNode<?,?>> data = readData(TestModel.TEST_PATH);
24
25     Assert.assertNotNull(data.get());
26     Assert.assertEquals(TestModel.TEST_QNAME, data.get().getNodeType());
27   }
28 }