1 package org.opendaylight.controller.cluster.datastore;
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;
15 public class DistributedDataStoreTest {
17 private DistributedDataStore distributedDataStore;
20 public void setUp() throws Exception {
21 distributedDataStore = new DistributedDataStore();
25 public void tearDown() throws Exception {
30 public void testRegisterChangeListener() throws Exception {
31 ListenerRegistration registration =
32 distributedDataStore.registerChangeListener(InstanceIdentifier.builder().build(), new AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>() {
34 public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
35 throw new UnsupportedOperationException("onDataChanged");
37 }, AsyncDataBroker.DataChangeScope.BASE);
39 Assert.assertNotNull(registration);
43 public void testCreateTransactionChain() throws Exception {
44 final DOMStoreTransactionChain transactionChain = distributedDataStore.createTransactionChain();
45 Assert.assertNotNull(transactionChain);
49 public void testNewReadOnlyTransaction() throws Exception {
50 final DOMStoreReadTransaction transaction = distributedDataStore.newReadOnlyTransaction();
51 Assert.assertNotNull(transaction);
55 public void testNewWriteOnlyTransaction() throws Exception {
56 final DOMStoreWriteTransaction transaction = distributedDataStore.newWriteOnlyTransaction();
57 Assert.assertNotNull(transaction);
61 public void testNewReadWriteTransaction() throws Exception {
62 final DOMStoreReadWriteTransaction transaction = distributedDataStore.newReadWriteTransaction();
63 Assert.assertNotNull(transaction);