Merge "Add some unimplemented proxy classes related to DOMStore"
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / DistributedDataStoreTest.java
1 package org.opendaylight.controller.cluster.datastore;
2
3 import junit.framework.Assert;
4 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
5 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
6 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
7 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
8 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
9 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
10 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
11 import org.opendaylight.yangtools.concepts.ListenerRegistration;
12 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
14
15 public class DistributedDataStoreTest {
16
17     private DistributedDataStore distributedDataStore;
18
19     @org.junit.Before
20     public void setUp() throws Exception {
21         distributedDataStore = new DistributedDataStore();
22     }
23
24     @org.junit.After
25     public void tearDown() throws Exception {
26
27     }
28
29     @org.junit.Test
30     public void testRegisterChangeListener() throws Exception {
31         ListenerRegistration registration =
32                 distributedDataStore.registerChangeListener(InstanceIdentifier.builder().build(), new AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>() {
33             @Override
34             public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
35                 throw new UnsupportedOperationException("onDataChanged");
36             }
37         }, AsyncDataBroker.DataChangeScope.BASE);
38
39         Assert.assertNotNull(registration);
40     }
41
42     @org.junit.Test
43     public void testCreateTransactionChain() throws Exception {
44         final DOMStoreTransactionChain transactionChain = distributedDataStore.createTransactionChain();
45         Assert.assertNotNull(transactionChain);
46     }
47
48     @org.junit.Test
49     public void testNewReadOnlyTransaction() throws Exception {
50         final DOMStoreReadTransaction transaction = distributedDataStore.newReadOnlyTransaction();
51         Assert.assertNotNull(transaction);
52     }
53
54     @org.junit.Test
55     public void testNewWriteOnlyTransaction() throws Exception {
56         final DOMStoreWriteTransaction transaction = distributedDataStore.newWriteOnlyTransaction();
57         Assert.assertNotNull(transaction);
58     }
59
60     @org.junit.Test
61     public void testNewReadWriteTransaction() throws Exception {
62         final DOMStoreReadWriteTransaction transaction = distributedDataStore.newReadWriteTransaction();
63         Assert.assertNotNull(transaction);
64     }
65 }