X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=dom%2Fmdsal-dom-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fdom%2Fbroker%2FDOMTransactionChainTest.java;h=f957bab004690d58fe0c02f25be2be42103afb77;hb=c37d38386002ed12b279938051813f99a4de70ff;hp=44f746c761110f776d1e3e92f9e1a04229935ae3;hpb=093b38a5c2a4f6ed8b015916e4765be29e3d51e2;p=mdsal.git diff --git a/dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/DOMTransactionChainTest.java b/dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/DOMTransactionChainTest.java index 44f746c761..f957bab004 100644 --- a/dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/DOMTransactionChainTest.java +++ b/dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/DOMTransactionChainTest.java @@ -41,20 +41,24 @@ public class DOMTransactionChainTest { private AbstractDOMDataBroker domBroker; @Before - public void setupStore() throws Exception{ - final InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER", MoreExecutors.newDirectExecutorService()); - final InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG", MoreExecutors.newDirectExecutorService()); + public void setupStore() throws Exception { + final InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER", + MoreExecutors.newDirectExecutorService()); + final InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG", + MoreExecutors.newDirectExecutorService()); schemaContext = TestModel.createTestContext(); operStore.onGlobalContextUpdated(schemaContext); configStore.onGlobalContextUpdated(schemaContext); - final ImmutableMap stores = ImmutableMap. builder() // - .put(CONFIGURATION, configStore) // - .put(OPERATIONAL, operStore) // + final ImmutableMap stores = + ImmutableMap.builder() + .put(CONFIGURATION, configStore) + .put(OPERATIONAL, operStore) .build(); - final ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()); + final ListeningExecutorService executor = MoreExecutors.listeningDecorator( + Executors.newSingleThreadExecutor()); domBroker = new SerializedDOMDataBroker(stores, executor); } @@ -65,15 +69,13 @@ public class DOMTransactionChainTest { assertNotNull(txChain); /** - * We alocate new read-write transaction and write /test - * - * + * We alocate new read-write transaction and write /test. */ final DOMDataTreeWriteTransaction firstTx = allocateAndWrite(txChain); /** * First transaction is marked as ready, we are able to allocate chained - * transactions + * transactions. */ final ListenableFuture firstWriteTxFuture = firstTx.submit(); @@ -92,7 +94,6 @@ public class DOMTransactionChainTest { assertTestContainerExists(secondReadTx); /** - * * We alocate next transaction, which is still based on first one, but * is read-write. * @@ -106,7 +107,6 @@ public class DOMTransactionChainTest { assertCommitSuccessful(firstWriteTxFuture); /** - * * Allocates transaction from data store. * */ @@ -119,7 +119,7 @@ public class DOMTransactionChainTest { assertTestContainerExists(storeReadTx); /** - * third transaction is sealed and commited + * third transaction is sealed and commited. */ final ListenableFuture thirdDeleteTxFuture = thirdDeleteTx.submit(); assertCommitSuccessful(thirdDeleteTxFuture); @@ -132,6 +132,7 @@ public class DOMTransactionChainTest { listener.getSuccessFuture().get(1000, TimeUnit.MILLISECONDS); } + @SuppressWarnings("checkstyle:IllegalCatch") @Test public void testTransactionChainNotSealed() throws InterruptedException, ExecutionException, TimeoutException { final BlockingTransactionChainListener listener = new BlockingTransactionChainListener(); @@ -140,8 +141,6 @@ public class DOMTransactionChainTest { /** * We alocate new read-write transaction and write /test - * - * */ allocateAndWrite(txChain); @@ -180,9 +179,10 @@ public class DOMTransactionChainTest { future.get(); } - private static void assertTestContainerExists(final DOMDataTreeReadTransaction readTx) throws InterruptedException, - ExecutionException { - final ListenableFuture>> readFuture = readTx.read(OPERATIONAL, TestModel.TEST_PATH); + private static void assertTestContainerExists(final DOMDataTreeReadTransaction readTx) + throws InterruptedException, ExecutionException { + final ListenableFuture>> readFuture = + readTx.read(OPERATIONAL, TestModel.TEST_PATH); final Optional> readedData = readFuture.get(); assertTrue(readedData.isPresent()); }