X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FAbstractRaftActorIntegrationTest.java;h=b910313b096015ad166c8be1178ac8f72ad12167;hp=dfaa8d55f6e913b7ce34559cc38d68a8343d71e1;hb=78527e81f8cc82140af5cb2649863a597f380291;hpb=8eaba1eb027b02f8b36480721055dc99c6700e85 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 dfaa8d55f6..b910313b09 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,7 +53,6 @@ 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) { @@ -74,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