Adjust for Binding RPC codegen changes
[controller.git] / opendaylight / md-sal / sal-inmemory-datastore / src / test / java / org / opendaylight / controller / md / sal / dom / store / impl / DefaultDataChangeListenerTestSuite.java
index 54d2043dc76a6df85cafdfe468f1bf7ff5b989f3..74014493fa217cdad17643e964c0e364eb0d72c7 100644 (file)
@@ -7,20 +7,24 @@
  */
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
-import java.util.concurrent.ExecutionException;
-
 import org.junit.Test;
-import org.opendaylight.controller.md.sal.dom.store.impl.DatastoreTestTask.WriteTransactionCustomizer;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
 
+/**
+ * Base template for a test suite for testing DataChangeListener functionality.
+ */
 public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataChangeListenerTest {
 
     protected static final String FOO_SIBLING = "foo-sibling";
 
-    abstract protected void customizeTask(DatastoreTestTask task);
+    /**
+     * Callback invoked when the test suite can modify task parameters.
+     *
+     * @param task Update task configuration as needed
+     */
+    protected abstract void customizeTask(DatastoreTestTask task);
 
     @Test
-    public final void putTopLevelOneNested() throws InterruptedException, ExecutionException {
+    public final void putTopLevelOneNested() throws Exception {
 
         DatastoreTestTask task = newTestTask().test(writeOneTopMultipleNested(FOO, BAR));
         customizeTask(task);
@@ -28,62 +32,47 @@ public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataCha
         putTopLevelOneNested(task);
     }
 
+    protected abstract void putTopLevelOneNested(DatastoreTestTask task) throws Exception;
+
     @Test
-    public final void existingTopWriteSibling() throws InterruptedException, ExecutionException {
+    public final void existingTopWriteSibling() throws Exception {
         DatastoreTestTask task = newTestTask().setup(writeOneTopMultipleNested(FOO)).test(
-                new WriteTransactionCustomizer() {
-                    @Override
-                    public void customize(final DOMStoreReadWriteTransaction tx) {
-                        tx.write(path(FOO_SIBLING), topLevelList(FOO_SIBLING).build());
-                    }
-                });
+            tx -> tx.write(path(FOO_SIBLING), topLevelList(FOO_SIBLING).build()));
         customizeTask(task);
         task.run();
         existingTopWriteSibling(task);
     }
 
-    protected abstract void existingTopWriteSibling(DatastoreTestTask task) throws InterruptedException, ExecutionException;
-
+    protected abstract void existingTopWriteSibling(DatastoreTestTask task) throws Exception;
 
     @Test
-    public final void existingTopWriteTwoNested() throws InterruptedException, ExecutionException {
+    public final void existingTopWriteTwoNested() throws Exception {
         DatastoreTestTask task = newTestTask().setup(writeOneTopMultipleNested(FOO)).test(
-                new WriteTransactionCustomizer() {
-                    @Override
-                    public void customize(final DOMStoreReadWriteTransaction tx) {
-                        tx.write(path(FOO,BAR), nestedList(BAR).build());
-                        tx.write(path(FOO,BAZ), nestedList(BAZ).build());
-                    }
-                });
+            tx -> {
+                tx.write(path(FOO,BAR), nestedList(BAR).build());
+                tx.write(path(FOO,BAZ), nestedList(BAZ).build());
+            });
         customizeTask(task);
         task.run();
         existingTopWriteTwoNested(task);
     }
 
-    protected abstract void existingTopWriteTwoNested(DatastoreTestTask task) throws InterruptedException, ExecutionException;
+    protected abstract void existingTopWriteTwoNested(DatastoreTestTask task) throws Exception;
 
 
     @Test
-    public final void existingOneNestedWriteAdditionalNested() throws InterruptedException, ExecutionException {
+    public final void existingOneNestedWriteAdditionalNested() throws Exception {
         DatastoreTestTask task = newTestTask().setup(writeOneTopMultipleNested(FOO, BAR)).test(
-                new WriteTransactionCustomizer() {
-                    @Override
-                    public void customize(final DOMStoreReadWriteTransaction tx) {
-                        tx.write(path(FOO,BAZ), nestedList(BAZ).build());
-                    }
-                });
+            tx -> tx.write(path(FOO,BAZ), nestedList(BAZ).build()));
         customizeTask(task);
         task.run();
         existingOneNestedWriteAdditionalNested(task);
     }
 
-    protected abstract void existingOneNestedWriteAdditionalNested(DatastoreTestTask task) throws InterruptedException, ExecutionException;
-
-    protected abstract void putTopLevelOneNested(DatastoreTestTask task) throws InterruptedException,
-            ExecutionException;
+    protected abstract void existingOneNestedWriteAdditionalNested(DatastoreTestTask task) throws Exception;
 
     @Test
-    public final void replaceTopLevelNestedChanged() throws InterruptedException, ExecutionException {
+    public final void replaceTopLevelNestedChanged() throws Exception {
         DatastoreTestTask task = newTestTask().setup(writeOneTopMultipleNested(FOO, BAR)).test(
                 writeOneTopMultipleNested(FOO, BAZ));
         customizeTask(task);
@@ -91,11 +80,10 @@ public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataCha
         replaceTopLevelNestedChanged(task);
     }
 
-    protected abstract void replaceTopLevelNestedChanged(DatastoreTestTask task) throws InterruptedException,
-            ExecutionException;
+    protected abstract void replaceTopLevelNestedChanged(DatastoreTestTask task) throws Exception;
 
     @Test
-    public final void putTopLevelWithTwoNested() throws InterruptedException, ExecutionException {
+    public final void putTopLevelWithTwoNested() throws Exception {
 
         DatastoreTestTask task = newTestTask().test(writeOneTopMultipleNested(FOO, BAR, BAZ));
         customizeTask(task);
@@ -103,11 +91,10 @@ public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataCha
         putTopLevelWithTwoNested(task);
     }
 
-    protected abstract void putTopLevelWithTwoNested(DatastoreTestTask task) throws InterruptedException,
-            ExecutionException;
+    protected abstract void putTopLevelWithTwoNested(DatastoreTestTask task) throws Exception;
 
     @Test
-    public final void twoNestedExistsOneIsDeleted() throws InterruptedException, ExecutionException {
+    public final void twoNestedExistsOneIsDeleted() throws Exception {
 
         DatastoreTestTask task = newTestTask().setup(writeOneTopMultipleNested(FOO, BAR, BAZ)).test(
                 deleteNested(FOO, BAZ));
@@ -116,11 +103,10 @@ public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataCha
         twoNestedExistsOneIsDeleted(task);
     }
 
-    protected abstract void twoNestedExistsOneIsDeleted(DatastoreTestTask task) throws InterruptedException,
-            ExecutionException;
+    protected abstract void twoNestedExistsOneIsDeleted(DatastoreTestTask task) throws Exception;
 
     @Test
-    public final void nestedListExistsRootDeleted() throws InterruptedException, ExecutionException {
+    public final void nestedListExistsRootDeleted() throws Exception {
 
         DatastoreTestTask task = newTestTask().cleanup(null).setup(writeOneTopMultipleNested(FOO, BAR, BAZ))
                 .test(DatastoreTestTask.simpleDelete(TOP_LEVEL));
@@ -129,6 +115,5 @@ public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataCha
         nestedListExistsRootDeleted(task);
     }
 
-    protected abstract void nestedListExistsRootDeleted(DatastoreTestTask task) throws InterruptedException,
-            ExecutionException;
+    protected abstract void nestedListExistsRootDeleted(DatastoreTestTask task) throws Exception;
 }