X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FAbstractRaftActorIntegrationTest.java;h=9d275e7f310bc0e3d18c74b7574595aaf99a86e5;hb=6dbf8f82cfa9fe8c35e4085213a55cb887cc3aee;hp=eb5c9e5e91974e7b042e44867a9fbc69ec18bd47;hpb=2faf656bf68dd3843fd59520b27a7ec2abbdcc68;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractRaftActorIntegrationTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractRaftActorIntegrationTest.java index eb5c9e5e91..9d275e7f31 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractRaftActorIntegrationTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/AbstractRaftActorIntegrationTest.java @@ -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 collectorActor; + private final ActorRef collectorActor; private final Map, 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 { - private TestActorRef collectorActor; + private ActorRef collectorActor; - public Builder collectorActor(TestActorRef 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 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 newTestRaftActor(String id, TestRaftActor.Builder builder) { - builder.collectorActor(factory.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 {