X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fbroker%2Fimpl%2FDOMTransactionChainTest.java;h=6f313e1588a4bf2f97c79e1db26ccc7e6b9c9101;hp=aba78f755912275c1cf001e8225fe02ac7b9b0f6;hb=3ec97cd0a86ad1b79f6854dc6924eb7b06e359a3;hpb=403c7ed29113f802ae1f937437618b2994d840f0 diff --git a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMTransactionChainTest.java b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMTransactionChainTest.java index aba78f7559..6f313e1588 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMTransactionChainTest.java +++ b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMTransactionChainTest.java @@ -12,6 +12,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION; import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.OPERATIONAL; + import com.google.common.base.Optional; import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.ListenableFuture; @@ -34,6 +35,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; import org.opendaylight.yangtools.yang.model.api.SchemaContext; +@Deprecated public class DOMTransactionChainTest { private SchemaContext schemaContext; @@ -48,7 +50,7 @@ public class DOMTransactionChainTest { operStore.onGlobalContextUpdated(schemaContext); configStore.onGlobalContextUpdated(schemaContext); - ImmutableMap stores = ImmutableMap. builder() // + ImmutableMap stores = ImmutableMap.builder() // .put(CONFIGURATION, configStore) // .put(OPERATIONAL, operStore) // .build(); @@ -64,17 +66,15 @@ public class DOMTransactionChainTest { assertNotNull(txChain); /** - * We alocate new read-write transaction and write /test - * - * + * We alocate new read-write transaction and write /test. */ DOMDataReadWriteTransaction firstTx = allocateAndWrite(txChain); /** * First transaction is marked as ready, we are able to allocate chained - * transactions + * transactions. */ - ListenableFuture firstWriteTxFuture = firstTx.submit(); + ListenableFuture firstWriteTxFuture = firstTx.commit(); /** * We alocate chained transaction - read transaction. @@ -85,13 +85,10 @@ public class DOMTransactionChainTest { * * We test if we are able to read data from tx, read should not fail * since we are using chained transaction. - * - * */ assertTestContainerExists(secondReadTx); /** - * * We alocate next transaction, which is still based on first one, but * is read-write. * @@ -99,15 +96,13 @@ public class DOMTransactionChainTest { DOMDataReadWriteTransaction thirdDeleteTx = allocateAndDelete(txChain); /** - * We commit first transaction + * We commit first transaction. * */ assertCommitSuccessful(firstWriteTxFuture); /** - * * Allocates transaction from data store. - * */ DOMDataReadTransaction storeReadTx = domBroker.newReadOnlyTransaction(); @@ -118,9 +113,9 @@ public class DOMTransactionChainTest { assertTestContainerExists(storeReadTx); /** - * third transaction is sealed and commited + * third transaction is sealed and commited. */ - ListenableFuture thirdDeleteTxFuture = thirdDeleteTx.submit(); + ListenableFuture thirdDeleteTxFuture = thirdDeleteTx.commit(); assertCommitSuccessful(thirdDeleteTxFuture); /** @@ -132,15 +127,14 @@ public class DOMTransactionChainTest { } @Test - public void testTransactionChainNotSealed() throws InterruptedException, ExecutionException, TimeoutException { + @SuppressWarnings("checkstyle:IllegalCatch") + public void testTransactionChainNotSealed() throws InterruptedException, ExecutionException { BlockingTransactionChainListener listener = new BlockingTransactionChainListener(); DOMTransactionChain txChain = domBroker.createTransactionChain(listener); assertNotNull(txChain); /** * We alocate new read-write transaction and write /test - * - * */ allocateAndWrite(txChain); @@ -157,8 +151,8 @@ public class DOMTransactionChainTest { } } - private static DOMDataReadWriteTransaction allocateAndDelete(final DOMTransactionChain txChain) - throws InterruptedException, ExecutionException { + private static DOMDataReadWriteTransaction allocateAndDelete( + final DOMTransactionChain txChain) throws InterruptedException, ExecutionException { DOMDataReadWriteTransaction tx = txChain.newReadWriteTransaction(); /** @@ -182,20 +176,20 @@ public class DOMTransactionChainTest { return tx; } - private static void assertCommitSuccessful(final ListenableFuture future) + private static void assertCommitSuccessful(final ListenableFuture future) throws InterruptedException, ExecutionException { future.get(); } - private static void assertTestContainerExists(final DOMDataReadTransaction readTx) throws InterruptedException, - ExecutionException { + private static void assertTestContainerExists(final DOMDataReadTransaction readTx) + throws InterruptedException, ExecutionException { ListenableFuture>> readFuture = readTx.read(OPERATIONAL, TestModel.TEST_PATH); Optional> readedData = readFuture.get(); assertTrue(readedData.isPresent()); } - private static void assertTestContainerWrite(final DOMDataReadWriteTransaction tx) throws InterruptedException, - ExecutionException { + private static void assertTestContainerWrite(final DOMDataReadWriteTransaction tx) + throws InterruptedException, ExecutionException { tx.put(OPERATIONAL, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME)); assertTestContainerExists(tx); }