Rename ActorContext to ActorUtils
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / databroker / actors / dds / LocalReadOnlyProxyTransactionTest.java
index 68e106a3ff980dcb763dbad53f047e008258cb00..7a4fb742038a5ed6d15305b5437f1fe6565d1a20 100644 (file)
@@ -11,7 +11,9 @@ import static org.mockito.Mockito.when;
 import static org.opendaylight.controller.cluster.databroker.actors.dds.TestUtils.assertOperationThrowsException;
 
 import akka.testkit.TestProbe;
+import com.google.common.base.Ticker;
 import com.google.common.base.VerifyException;
+import java.util.Optional;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.access.commands.AbortLocalTransactionRequest;
@@ -25,11 +27,12 @@ public class LocalReadOnlyProxyTransactionTest extends LocalProxyTransactionTest
     private DataTreeSnapshot snapshot;
 
     @Override
+    @SuppressWarnings("checkstyle:hiddenField")
     protected LocalReadOnlyProxyTransaction createTransaction(final ProxyHistory parent,
                                                               final TransactionIdentifier id,
                                                               final DataTreeSnapshot snapshot) {
-        when(snapshot.readNode(PATH_1)).thenReturn(com.google.common.base.Optional.of(DATA_1));
-        when(snapshot.readNode(PATH_3)).thenReturn(com.google.common.base.Optional.absent());
+        when(snapshot.readNode(PATH_1)).thenReturn(Optional.of(DATA_1));
+        when(snapshot.readNode(PATH_3)).thenReturn(Optional.empty());
         this.snapshot = snapshot;
         return new LocalReadOnlyProxyTransaction(parent, id, this.snapshot);
     }
@@ -46,25 +49,25 @@ public class LocalReadOnlyProxyTransactionTest extends LocalProxyTransactionTest
 
     @Override
     @Test(expected = UnsupportedOperationException.class)
-    public void testDirectCommit() throws Exception {
+    public void testDirectCommit() {
         transaction.directCommit();
     }
 
     @Override
     @Test(expected = UnsupportedOperationException.class)
-    public void testCanCommit() throws Exception {
+    public void testCanCommit() {
         transaction.canCommit(new VotingFuture<>(new Object(), 1));
     }
 
     @Override
     @Test(expected = UnsupportedOperationException.class)
-    public void testPreCommit() throws Exception {
+    public void testPreCommit() {
         transaction.preCommit(new VotingFuture<>(new Object(), 1));
     }
 
     @Override
     @Test(expected = UnsupportedOperationException.class)
-    public void testDoCommit() throws Exception {
+    public void testDoCommit() {
         transaction.doCommit(new VotingFuture<>(new Object(), 1));
     }
 
@@ -107,14 +110,14 @@ public class LocalReadOnlyProxyTransactionTest extends LocalProxyTransactionTest
     }
 
     @Test
-    public void testApplyModifyTransactionRequest() throws Exception {
+    public void testApplyModifyTransactionRequest() {
         final TestProbe probe = createProbe();
         final ModifyTransactionRequestBuilder builder =
                 new ModifyTransactionRequestBuilder(TRANSACTION_ID, probe.ref());
         builder.setSequence(0);
         builder.setAbort();
         final ModifyTransactionRequest request = builder.build();
-        transaction.applyModifyTransactionRequest(request, createCallbackMock());
+        transaction.replayModifyTransactionRequest(request, createCallbackMock(), Ticker.systemTicker().read());
         getTester().expectTransactionRequest(AbortLocalTransactionRequest.class);
     }
 
@@ -126,8 +129,7 @@ public class LocalReadOnlyProxyTransactionTest extends LocalProxyTransactionTest
         builder.setSequence(0);
         builder.setReady();
         final ModifyTransactionRequest request = builder.build();
-        assertOperationThrowsException(() -> transaction.applyModifyTransactionRequest(request, createCallbackMock()),
-                VerifyException.class);
+        assertOperationThrowsException(() -> transaction.replayModifyTransactionRequest(request, createCallbackMock(),
+            Ticker.systemTicker().read()), VerifyException.class);
     }
-
-}
\ No newline at end of file
+}