Remove DOMDataTreeProducer-related classes
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / databroker / actors / dds / ClientTransactionTest.java
index 7b10cefbe1890ef9be6e5234058da38d56bc2f97..486c07c8a85c3ee145f232e03667de67d06e0ec2 100644 (file)
@@ -7,23 +7,22 @@
  */
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
+import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.TRANSACTION_ID;
 import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.assertFutureEquals;
-import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.assertOperationThrowsException;
 import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.getWithTimeout;
 
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.ListenableFuture;
-import org.junit.Assert;
+import java.util.Optional;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.opendaylight.controller.cluster.access.commands.CommitLocalTransactionRequest;
 import org.opendaylight.controller.cluster.access.commands.TransactionCommitSuccess;
-import org.opendaylight.mdsal.common.api.ReadFailedException;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
 import org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -61,50 +60,36 @@ public class ClientTransactionTest extends AbstractClientHandleTest<ClientTransa
         transaction.read(PATH);
     }
 
-    @Test
-    public void testOpenCloseCursor() throws Exception {
-        final DOMDataTreeWriteCursor cursor = getHandle().openCursor();
-        getHandle().closeCursor(cursor);
-        getHandle().openCursor().delete(PATH.getLastPathArgument());
-        verify(modification).delete(PATH);
-    }
-
-    @Test
-    public void testOpenSecondCursor() throws Exception {
-        getHandle().openCursor();
-        assertOperationThrowsException(getHandle()::openCursor, IllegalStateException.class);
-    }
-
     @Test
     public void testExists() throws Exception {
-        final CheckedFuture<Boolean, ReadFailedException> exists = getHandle().exists(PATH);
+        final FluentFuture<Boolean> exists = getHandle().exists(PATH);
         verify(modification).readNode(PATH);
-        Assert.assertTrue(getWithTimeout(exists));
+        assertEquals(Boolean.TRUE, getWithTimeout(exists));
     }
 
     @Test
     public void testRead() throws Exception {
-        final CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> resultFuture = getHandle().read(PATH);
+        final FluentFuture<Optional<NormalizedNode<?, ?>>> resultFuture = getHandle().read(PATH);
         verify(modification).readNode(PATH);
         final Optional<NormalizedNode<?, ?>> result = getWithTimeout(resultFuture);
-        Assert.assertTrue(result.isPresent());
-        Assert.assertEquals(DATA, result.get());
+        assertTrue(result.isPresent());
+        assertEquals(DATA, result.get());
     }
 
     @Test
-    public void testDelete() throws Exception {
+    public void testDelete() {
         getHandle().delete(PATH);
         verify(modification).delete(PATH);
     }
 
     @Test
-    public void testMerge() throws Exception {
+    public void testMerge() {
         getHandle().merge(PATH, DATA);
         verify(modification).merge(PATH, DATA);
     }
 
     @Test
-    public void testWrite() throws Exception {
+    public void testWrite() {
         getHandle().write(PATH, DATA);
         verify(modification).write(PATH, DATA);
     }
@@ -112,7 +97,7 @@ public class ClientTransactionTest extends AbstractClientHandleTest<ClientTransa
     @Test
     public void testReadyEmpty() throws Exception {
         final DOMStoreThreePhaseCommitCohort cohort = getHandle().ready();
-        assertFutureEquals(true, cohort.canCommit());
+        assertFutureEquals(Boolean.TRUE, cohort.canCommit());
         assertFutureEquals(null, cohort.preCommit());
         assertFutureEquals(null, cohort.commit());
     }
@@ -125,8 +110,8 @@ public class ClientTransactionTest extends AbstractClientHandleTest<ClientTransa
         final ListenableFuture<Boolean> actual = cohort.canCommit();
         final CommitLocalTransactionRequest request =
                 backendRespondToRequest(CommitLocalTransactionRequest.class, response);
-        Assert.assertEquals(modification, request.getModification());
-        assertFutureEquals(true, actual);
+        assertEquals(modification, request.getModification());
+        assertFutureEquals(Boolean.TRUE, actual);
         assertFutureEquals(null, cohort.preCommit());
         assertFutureEquals(null, cohort.commit());
     }
@@ -137,4 +122,4 @@ public class ClientTransactionTest extends AbstractClientHandleTest<ClientTransa
         checkClosed();
     }
 
-}
\ No newline at end of file
+}