X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-inmemory-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fstore%2Fimpl%2FDefaultDataChangeListenerTestSuite.java;h=74014493fa217cdad17643e964c0e364eb0d72c7;hp=af58f63331d3377104797864bd3c37804fa6abec;hb=258d8039ac144aeee2efa7943228c0fc6cdaf651;hpb=54916d10764a5234881040e9a68ae35d63b3dac9 diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DefaultDataChangeListenerTestSuite.java b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DefaultDataChangeListenerTestSuite.java index af58f63331..74014493fa 100644 --- a/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DefaultDataChangeListenerTestSuite.java +++ b/opendaylight/md-sal/sal-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/DefaultDataChangeListenerTestSuite.java @@ -7,11 +7,7 @@ */ 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. @@ -25,7 +21,7 @@ public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataCha * * @param task Update task configuration as needed */ - abstract protected void customizeTask(DatastoreTestTask task); + protected abstract void customizeTask(DatastoreTestTask task); @Test public final void putTopLevelOneNested() throws Exception { @@ -36,58 +32,44 @@ public abstract class DefaultDataChangeListenerTestSuite extends AbstractDataCha putTopLevelOneNested(task); } + protected abstract void putTopLevelOneNested(DatastoreTestTask task) throws Exception; + @Test 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 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 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 Exception; + protected abstract void existingOneNestedWriteAdditionalNested(DatastoreTestTask task) throws Exception; @Test public final void replaceTopLevelNestedChanged() throws Exception { @@ -98,8 +80,7 @@ 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 Exception { @@ -110,8 +91,7 @@ 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 Exception { @@ -123,8 +103,7 @@ 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 Exception { @@ -136,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; }