+
+ @Override
+ public byte[] getRestoreFromSnapshot() {
+ return restoreFromSnapshot;
+ }
+
+ public static Props props(final String id, final Map<String, String> peerAddresses,
+ ConfigParams config){
+ return builder().id(id).peerAddresses(peerAddresses).config(config).props();
+ }
+
+ public static Props props(final String id, final Map<String, String> peerAddresses,
+ ConfigParams config, DataPersistenceProvider dataPersistenceProvider){
+ return builder().id(id).peerAddresses(peerAddresses).config(config).
+ dataPersistenceProvider(dataPersistenceProvider).props();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+ private Map<String, String> peerAddresses = Collections.emptyMap();
+ private String id;
+ private ConfigParams config;
+ private DataPersistenceProvider dataPersistenceProvider;
+ private ActorRef roleChangeNotifier;
+ private RaftActorSnapshotMessageSupport snapshotMessageSupport;
+ private byte[] restoreFromSnapshot;
+ private Optional<Boolean> persistent = Optional.absent();
+
+ public Builder id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ public Builder peerAddresses(Map<String, String> peerAddresses) {
+ this.peerAddresses = peerAddresses;
+ return this;
+ }
+
+ public Builder config(ConfigParams config) {
+ this.config = config;
+ return this;
+ }
+
+ public Builder dataPersistenceProvider(DataPersistenceProvider dataPersistenceProvider) {
+ this.dataPersistenceProvider = dataPersistenceProvider;
+ return this;
+ }
+
+ public Builder roleChangeNotifier(ActorRef roleChangeNotifier) {
+ this.roleChangeNotifier = roleChangeNotifier;
+ return this;
+ }
+
+ public Builder snapshotMessageSupport(RaftActorSnapshotMessageSupport snapshotMessageSupport) {
+ this.snapshotMessageSupport = snapshotMessageSupport;
+ return this;
+ }
+
+ public Builder restoreFromSnapshot(byte[] restoreFromSnapshot) {
+ this.restoreFromSnapshot = restoreFromSnapshot;
+ return this;
+ }
+
+ public Builder persistent(Optional<Boolean> persistent) {
+ this.persistent = persistent;
+ return this;
+ }
+
+ public Props props() {
+ return Props.create(MockRaftActor.class, this);
+ }
+ }