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=45fd26c930736dd0d17ff706154b6252246bdd0e;hb=ebaf3d71465066033d5882c61cdd2ec63b29d980;hp=13445b0b26bb54f2794446647ab494ffb794fd26;hpb=994dbb10de67c0d9fd5f78a216ea372326609a49;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 13445b0b26..45fd26c930 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 @@ -18,6 +18,7 @@ import akka.testkit.JavaTestKit; import akka.testkit.TestActorRef; import com.google.common.base.Optional; import com.google.common.base.Predicate; +import com.google.common.base.Supplier; import com.google.common.collect.ImmutableMap; import java.util.Collections; import java.util.List; @@ -52,12 +53,10 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest private final TestActorRef collectorActor; private final Map, Boolean> dropMessages = new ConcurrentHashMap<>(); private volatile byte[] snapshot; - private volatile long mockTotalMemory; private TestRaftActor(String id, Map peerAddresses, ConfigParams config, TestActorRef collectorActor) { super(id, peerAddresses, Optional.of(config), null); - dataPersistenceProvider = new PersistentDataProvider(); this.collectorActor = collectorActor; } @@ -75,13 +74,18 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest dropMessages.remove(msgClass); } - void setMockTotalMemory(long mockTotalMemory) { - this.mockTotalMemory = mockTotalMemory; - } + void setMockTotalMemory(final long mockTotalMemory) { + if(mockTotalMemory > 0) { + getRaftActorContext().setTotalMemoryRetriever(new Supplier() { + @Override + public Long get() { + return mockTotalMemory; + } - @Override - protected long getTotalMemory() { - return mockTotalMemory > 0 ? mockTotalMemory : super.getTotalMemory(); + }); + } else { + getRaftActorContext().setTotalMemoryRetriever(null); + } } @Override @@ -115,7 +119,7 @@ public abstract class AbstractRaftActorIntegrationTest extends AbstractActorTest } @Override - protected void applyRecoverySnapshot(byte[] bytes) { + public void applyRecoverySnapshot(byte[] bytes) { } void setSnapshot(byte[] snapshot) {