import java.util.Collection;
import java.util.List;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitDeadlockException;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBrokerExtension;
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService;
.build();
commitExecutor = new CommitExecutorService(Executors.newSingleThreadExecutor());
- futureExecutor = SpecialExecutors.newBlockingBoundedCachedThreadPool(1, 5, "FCB");
+ futureExecutor = SpecialExecutors.newBlockingBoundedCachedThreadPool(1, 5, "FCB",
+ DOMDataTreeListenerTest.class);
executor = new DeadlockDetectingListeningExecutorService(commitExecutor,
TransactionCommitDeadlockException
.DEADLOCK_EXCEPTION_SUPPLIER,
final DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
- writeTx.submit();
+ writeTx.commit();
latch.await(5, TimeUnit.SECONDS);
}
@Test
- public void replaceContainerContainerInTreeTest() throws InterruptedException, TransactionCommitFailedException {
+ public void replaceContainerContainerInTreeTest() throws InterruptedException, ExecutionException {
final CountDownLatch latch = new CountDownLatch(2);
DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
- writeTx.submit().checkedGet();
+ writeTx.commit().get();
final TestDataTreeListener listener = new TestDataTreeListener(latch);
final ListenerRegistration<TestDataTreeListener> listenerReg = dataTreeChangeService
.registerDataTreeChangeListener(ROOT_DATA_TREE_ID, listener);
writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER_2);
- writeTx.submit();
+ writeTx.commit();
latch.await(5, TimeUnit.SECONDS);
}
@Test
- public void deleteContainerContainerInTreeTest() throws InterruptedException, TransactionCommitFailedException {
+ public void deleteContainerContainerInTreeTest() throws InterruptedException, ExecutionException {
final CountDownLatch latch = new CountDownLatch(2);
DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
- writeTx.submit().checkedGet();
+ writeTx.commit().get();
final TestDataTreeListener listener = new TestDataTreeListener(latch);
final ListenerRegistration<TestDataTreeListener> listenerReg = dataTreeChangeService
writeTx = domBroker.newWriteOnlyTransaction();
writeTx.delete(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH);
- writeTx.submit();
+ writeTx.commit();
latch.await(5, TimeUnit.SECONDS);
}
@Test
- public void replaceChildListContainerInTreeTest() throws InterruptedException, TransactionCommitFailedException {
+ public void replaceChildListContainerInTreeTest() throws InterruptedException, ExecutionException {
final CountDownLatch latch = new CountDownLatch(2);
DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
- writeTx.submit().checkedGet();
+ writeTx.commit().get();
final TestDataTreeListener listener = new TestDataTreeListener(latch);
final ListenerRegistration<TestDataTreeListener> listenerReg = dataTreeChangeService
writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.OUTER_LIST_PATH, OUTER_LIST_2);
- writeTx.submit();
+ writeTx.commit();
latch.await(5, TimeUnit.SECONDS);
}
@Test
- public void rootModificationChildListenerTest() throws InterruptedException, TransactionCommitFailedException {
+ public void rootModificationChildListenerTest() throws InterruptedException, ExecutionException {
final CountDownLatch latch = new CountDownLatch(2);
DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
- writeTx.submit().checkedGet();
+ writeTx.commit().get();
final TestDataTreeListener listener = new TestDataTreeListener(latch);
final ListenerRegistration<TestDataTreeListener> listenerReg = dataTreeChangeService
writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER_2);
- writeTx.submit().checkedGet();
+ writeTx.commit().get();
latch.await(1, TimeUnit.SECONDS);
}
@Test
- public void listEntryChangeNonRootRegistrationTest() throws InterruptedException, TransactionCommitFailedException {
+ public void listEntryChangeNonRootRegistrationTest() throws InterruptedException, ExecutionException {
final CountDownLatch latch = new CountDownLatch(2);
DOMDataTreeChangeService dataTreeChangeService = getDOMDataTreeChangeService();
DOMDataWriteTransaction writeTx = domBroker.newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.TEST_PATH, TEST_CONTAINER);
- writeTx.submit().checkedGet();
+ writeTx.commit().get();
final TestDataTreeListener listener = new TestDataTreeListener(latch);
final ListenerRegistration<TestDataTreeListener> listenerReg = dataTreeChangeService
outerListEntry2);
writeTx.put(LogicalDatastoreType.CONFIGURATION, TestModel.OUTER_LIST_PATH.node(outerListEntryId3),
outerListEntry3);
- writeTx.submit();
+ writeTx.commit();
latch.await(5, TimeUnit.SECONDS);