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%2FMockRaftActorContext.java;h=d92f0729f207c077f7b38a1427d62a535e49cd0f;hp=cdcaadf8151999f8df9a5a9961285b36944daaa6;hb=2faf656bf68dd3843fd59520b27a7ec2abbdcc68;hpb=d04b71990a802071a786fe8f0df57bc4adbdec3f diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java index cdcaadf815..d92f0729f2 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActorContext.java @@ -14,12 +14,17 @@ import akka.actor.ActorSystem; import akka.actor.Props; import akka.japi.Procedure; import com.google.common.base.Throwables; +import com.google.common.io.ByteSource; +import java.io.IOException; +import java.io.OutputStream; import java.io.Serializable; import java.util.HashMap; import java.util.Map; import org.opendaylight.controller.cluster.NonPersistentDataProvider; import org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior; +import org.opendaylight.controller.cluster.raft.persisted.ByteState; import org.opendaylight.controller.cluster.raft.persisted.SimpleReplicatedLogEntry; +import org.opendaylight.controller.cluster.raft.persisted.Snapshot.State; import org.opendaylight.controller.cluster.raft.policy.RaftPolicy; import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload; import org.slf4j.Logger; @@ -120,7 +125,23 @@ public class MockRaftActorContext extends RaftActorContextImpl { @Override public SnapshotManager getSnapshotManager() { SnapshotManager snapshotManager = super.getSnapshotManager(); - snapshotManager.setCreateSnapshotRunnable(() -> { }); + snapshotManager.setCreateSnapshotConsumer(out -> { }); + + snapshotManager.setSnapshotCohort(new RaftActorSnapshotCohort() { + @Override + public State deserializeSnapshot(ByteSource snapshotBytes) throws IOException { + return ByteState.of(snapshotBytes.read()); + } + + @Override + public void createSnapshot(ActorRef actorRef, java.util.Optional installSnapshotStream) { + } + + @Override + public void applySnapshot(State snapshotState) { + } + }); + return snapshotManager; }