Bump yangtools to 13.0.0
[mdsal.git] / dom / mdsal-dom-broker / src / test / java / org / opendaylight / mdsal / dom / broker / DOMTransactionChainTest.java
index 28a5539956793b89e8088135da06ca30f6b0eb94..d0076646454aafa9f2a82a1dcc322776388b1fab 100644 (file)
@@ -29,7 +29,6 @@ import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadTransaction;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
 import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
-import org.opendaylight.mdsal.dom.broker.util.TestModel;
 import org.opendaylight.mdsal.dom.spi.store.DOMStore;
 import org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@ -46,8 +45,8 @@ public class DOMTransactionChainTest extends AbstractDatastoreTest {
         final InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG",
                 MoreExecutors.newDirectExecutorService());
 
-        operStore.onGlobalContextUpdated(SCHEMA_CONTEXT);
-        configStore.onGlobalContextUpdated(SCHEMA_CONTEXT);
+        operStore.onModelContextUpdated(SCHEMA_CONTEXT);
+        configStore.onModelContextUpdated(SCHEMA_CONTEXT);
 
         final ImmutableMap<LogicalDatastoreType, DOMStore> stores =
                 ImmutableMap.<LogicalDatastoreType, DOMStore>builder()
@@ -67,7 +66,7 @@ public class DOMTransactionChainTest extends AbstractDatastoreTest {
         assertNotNull(txChain);
 
         /**
-         * We alocate new read-write transaction and write /test.
+         * We allocate new read-write transaction and write /test.
          */
         final DOMDataTreeWriteTransaction firstTx = allocateAndWrite(txChain);
 
@@ -78,7 +77,7 @@ public class DOMTransactionChainTest extends AbstractDatastoreTest {
         final ListenableFuture<? extends CommitInfo> firstWriteTxFuture = firstTx.commit();
 
         /**
-         * We alocate chained transaction - read transaction.
+         * We allocate chained transaction - read transaction.
          */
         final DOMDataTreeReadTransaction secondReadTx = txChain.newReadOnlyTransaction();
 
@@ -92,7 +91,7 @@ public class DOMTransactionChainTest extends AbstractDatastoreTest {
         assertTestContainerExists(secondReadTx);
 
         /**
-         * We alocate next transaction, which is still based on first one, but
+         * We allocate next transaction, which is still based on first one, but
          * is read-write.
          *
          */
@@ -111,13 +110,13 @@ public class DOMTransactionChainTest extends AbstractDatastoreTest {
         final DOMDataTreeReadTransaction storeReadTx = domBroker.newReadOnlyTransaction();
 
         /**
-         * We verify transaction is commited to store, container should exists
+         * We verify transaction is committed to store, container should exist
          * in datastore.
          */
         assertTestContainerExists(storeReadTx);
 
         /**
-         * third transaction is sealed and commited.
+         * third transaction is sealed and committed.
          */
         assertCommitSuccessful(thirdDeleteTx.commit());
 
@@ -137,17 +136,17 @@ public class DOMTransactionChainTest extends AbstractDatastoreTest {
         assertNotNull(txChain);
 
         /**
-         * We alocate new read-write transaction and write /test
+         * We allocate new read-write transaction and write /test
          */
         allocateAndWrite(txChain);
 
         /**
-         * We alocate chained transaction - read transaction, note first one is
-         * still not commited to datastore, so this allocation should fail with
+         * We allocate chained transaction - read transaction, note first one is
+         * still not committed to datastore, so this allocation should fail with
          * IllegalStateException.
          */
         try {
-            txChain.newReadOnlyTransaction();
+            allocateAndWrite(txChain); // actual backing tx allocation happens on put
             fail("Allocation of secondReadTx should fail with IllegalStateException");
         } catch (final Exception e) {
             assertTrue(e instanceof IllegalStateException);
@@ -178,9 +177,8 @@ public class DOMTransactionChainTest extends AbstractDatastoreTest {
 
     private static void assertTestContainerExists(final DOMDataTreeReadTransaction readTx)
             throws InterruptedException, ExecutionException {
-        final ListenableFuture<Optional<NormalizedNode<?, ?>>> readFuture =
-                readTx.read(OPERATIONAL, TestModel.TEST_PATH);
-        final Optional<NormalizedNode<?, ?>> readedData = readFuture.get();
+        final ListenableFuture<Optional<NormalizedNode>> readFuture = readTx.read(OPERATIONAL, TestModel.TEST_PATH);
+        final Optional<NormalizedNode> readedData = readFuture.get();
         assertTrue(readedData.isPresent());
     }