1 package org.opendaylight.controller.cluster.datastore;
3 import junit.framework.Assert;
4 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
5 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
6 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
7 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
8 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
9 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
10 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
11 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
12 import org.opendaylight.yangtools.concepts.ListenerRegistration;
13 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16 public class DistributedDataStoreTest extends AbstractActorTest{
18 private DistributedDataStore distributedDataStore;
21 public void setUp() throws Exception {
22 distributedDataStore = new DistributedDataStore(getSystem(), "config");
23 distributedDataStore.onGlobalContextUpdated(TestModel.createTestContext());
27 public void tearDown() throws Exception {
32 public void testRegisterChangeListener() throws Exception {
33 ListenerRegistration registration =
34 distributedDataStore.registerChangeListener(TestModel.TEST_PATH, new AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>() {
36 public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
37 throw new UnsupportedOperationException("onDataChanged");
39 }, AsyncDataBroker.DataChangeScope.BASE);
41 Assert.assertNotNull(registration);
45 public void testCreateTransactionChain() throws Exception {
46 final DOMStoreTransactionChain transactionChain = distributedDataStore.createTransactionChain();
47 Assert.assertNotNull(transactionChain);
51 public void testNewReadOnlyTransaction() throws Exception {
52 final DOMStoreReadTransaction transaction = distributedDataStore.newReadOnlyTransaction();
53 Assert.assertNotNull(transaction);
57 public void testNewWriteOnlyTransaction() throws Exception {
58 final DOMStoreWriteTransaction transaction = distributedDataStore.newWriteOnlyTransaction();
59 Assert.assertNotNull(transaction);
63 public void testNewReadWriteTransaction() throws Exception {
64 final DOMStoreReadWriteTransaction transaction = distributedDataStore.newReadWriteTransaction();
65 Assert.assertNotNull(transaction);