Remove explicit default super-constructor calls
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / test / java / org / opendaylight / controller / cluster / raft / AbstractRaftActorIntegrationTest.java
index eb5c9e5e91974e7b042e44867a9fbc69ec18bd47..9d275e7f310bc0e3d18c74b7574595aaf99a86e5 100644 (file)
@@ -16,6 +16,7 @@ import akka.actor.InvalidActorNameException;
 import akka.actor.PoisonPill;
 import akka.actor.Terminated;
 import akka.dispatch.Dispatchers;
+import akka.dispatch.Mailboxes;
 import akka.testkit.JavaTestKit;
 import akka.testkit.TestActorRef;
 import akka.util.Timeout;
@@ -91,7 +92,7 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
 
     public static class TestRaftActor extends MockRaftActor {
 
-        private final TestActorRef<MessageCollectorActor> collectorActor;
+        private final ActorRef collectorActor;
         private final Map<Class<?>, Predicate<?>> dropMessages = new ConcurrentHashMap<>();
 
         private TestRaftActor(Builder builder) {
@@ -130,7 +131,7 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
             }
 
             if (message instanceof SetPeerAddress) {
-                setPeerAddress(((SetPeerAddress) message).getPeerId().toString(),
+                setPeerAddress(((SetPeerAddress) message).getPeerId(),
                         ((SetPeerAddress) message).getPeerAddress());
                 return;
             }
@@ -171,9 +172,9 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
         }
 
         public static class Builder extends AbstractBuilder<Builder, TestRaftActor> {
-            private TestActorRef<MessageCollectorActor> collectorActor;
+            private ActorRef collectorActor;
 
-            public Builder collectorActor(TestActorRef<MessageCollectorActor> newCollectorActor) {
+            public Builder collectorActor(ActorRef newCollectorActor) {
                 this.collectorActor = newCollectorActor;
                 return this;
             }
@@ -215,6 +216,7 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
     protected long currentTerm;
 
     protected int snapshotBatchCount = 4;
+    protected int snapshotChunkSize = SNAPSHOT_CHUNK_SIZE;
 
     protected List<MockPayload> expSnapshotState = new ArrayList<>();
 
@@ -232,7 +234,7 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
         configParams.setSnapshotBatchCount(snapshotBatchCount);
         configParams.setSnapshotDataThresholdPercentage(70);
         configParams.setIsolatedLeaderCheckInterval(new FiniteDuration(1, TimeUnit.DAYS));
-        configParams.setSnapshotChunkSize(SNAPSHOT_CHUNK_SIZE);
+        configParams.setSnapshotChunkSize(snapshotChunkSize);
         return configParams;
     }
 
@@ -254,14 +256,14 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
     }
 
     protected TestActorRef<TestRaftActor> newTestRaftActor(String id, TestRaftActor.Builder builder) {
-        builder.collectorActor(factory.<MessageCollectorActor>createTestActor(
-                MessageCollectorActor.props().withDispatcher(Dispatchers.DefaultDispatcherId()),
-                        factory.generateActorId(id + "-collector"))).id(id);
+        builder.collectorActor(factory.createActor(
+                MessageCollectorActor.props(), factory.generateActorId(id + "-collector"))).id(id);
 
         InvalidActorNameException lastEx = null;
         for (int i = 0; i < 10; i++) {
             try {
-                return factory.createTestActor(builder.props().withDispatcher(Dispatchers.DefaultDispatcherId()), id);
+                return factory.createTestActor(builder.props().withDispatcher(Dispatchers.DefaultDispatcherId())
+                        .withMailbox(Mailboxes.DefaultMailboxId()), id);
             } catch (InvalidActorNameException e) {
                 lastEx = e;
                 Uninterruptibles.sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
@@ -287,7 +289,6 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest
             msg -> msg.getToIndex() == expIndex);
     }
 
-    @SuppressWarnings("unchecked")
     protected void verifySnapshot(String prefix, Snapshot snapshot, long lastAppliedTerm,
             long lastAppliedIndex, long lastTerm, long lastIndex)
                     throws Exception {