Specify initial serialization buffer capacity for Payloads
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / IntegrationTestKit.java
index a7b9ae8e7eeb71dffaf54c868815fe06d9b44fce..dc78e031354f586484251bd2c63d5adc3f12f63b 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.cluster.datastore;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import akka.actor.ActorRef;
@@ -50,7 +51,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import scala.concurrent.Await;
 import scala.concurrent.Future;
-import scala.concurrent.duration.Duration;
+import scala.concurrent.duration.FiniteDuration;
 
 public class IntegrationTestKit extends ShardTestKit {
 
@@ -276,7 +277,7 @@ public class IntegrationTestKit extends ShardTestKit {
         ActorContext actorContext = datastore.getActorContext();
 
         Future<ActorRef> future = actorContext.findLocalShardAsync(shardName);
-        ActorRef shardActor = Await.result(future, Duration.create(10, TimeUnit.SECONDS));
+        ActorRef shardActor = Await.result(future, FiniteDuration.create(10, TimeUnit.SECONDS));
 
         AssertionError lastError = null;
         Stopwatch sw = Stopwatch.createStarted();
@@ -301,7 +302,7 @@ public class IntegrationTestKit extends ShardTestKit {
         ActorContext actorContext = datastore.getActorContext();
 
         Future<ActorRef> future = actorContext.findLocalShardAsync(shardName);
-        ActorRef shardActor = Await.result(future, Duration.create(10, TimeUnit.SECONDS));
+        ActorRef shardActor = Await.result(future, FiniteDuration.create(10, TimeUnit.SECONDS));
 
         AssertionError lastError = null;
         Stopwatch sw = Stopwatch.createStarted();
@@ -346,13 +347,13 @@ public class IntegrationTestKit extends ShardTestKit {
         DOMStoreReadTransaction readTx = dataStore.newReadOnlyTransaction();
 
         Optional<NormalizedNode<?, ?>> optional = readTx.read(nodePath).get(5, TimeUnit.SECONDS);
-        assertEquals("isPresent", true, optional.isPresent());
+        assertTrue("isPresent", optional.isPresent());
         assertEquals("Data node", nodeToWrite, optional.get());
     }
 
     public void doCommit(final DOMStoreThreePhaseCommitCohort cohort) throws Exception {
         Boolean canCommit = cohort.canCommit().get(commitTimeout, TimeUnit.SECONDS);
-        assertEquals("canCommit", true, canCommit);
+        assertEquals("canCommit", Boolean.TRUE, canCommit);
         cohort.preCommit().get(5, TimeUnit.SECONDS);
         cohort.commit().get(5, TimeUnit.SECONDS);
     }
@@ -360,14 +361,13 @@ public class IntegrationTestKit extends ShardTestKit {
     void doCommit(final ListenableFuture<Boolean> canCommitFuture, final DOMStoreThreePhaseCommitCohort cohort)
             throws Exception {
         Boolean canCommit = canCommitFuture.get(commitTimeout, TimeUnit.SECONDS);
-        assertEquals("canCommit", true, canCommit);
+        assertEquals("canCommit", Boolean.TRUE, canCommit);
         cohort.preCommit().get(5, TimeUnit.SECONDS);
         cohort.commit().get(5, TimeUnit.SECONDS);
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
-    void assertExceptionOnCall(final Callable<Void> callable, final Class<? extends Exception> expType)
-            throws Exception {
+    void assertExceptionOnCall(final Callable<Void> callable, final Class<? extends Exception> expType) {
         try {
             callable.call();
             fail("Expected " + expType.getSimpleName());
@@ -377,7 +377,7 @@ public class IntegrationTestKit extends ShardTestKit {
     }
 
     void assertExceptionOnTxChainCreates(final DOMStoreTransactionChain txChain,
-            final Class<? extends Exception> expType) throws Exception {
+            final Class<? extends Exception> expType) {
         assertExceptionOnCall(() -> {
             txChain.newWriteOnlyTransaction();
             return null;