From: Tom Pantelis Date: Tue, 18 Apr 2017 07:27:55 +0000 (-0400) Subject: Remove deprecated persisted raft payloads X-Git-Tag: release/nitrogen~331 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=e7512222d7d9e3149feb6a90eeb726e9391887fa Remove deprecated persisted raft payloads Removed the deprecated payload classes that were deprecated as Carbon will trigger a snapshot when it encounters any of them on recovery: ServerConfigurationPayload ApplyJournalEntries DeleteEntries UpdateElectionTerm ReplicatedLogImplEntry Also removed the implemented MigratedSerializable interface from the current classes. Change-Id: I942584022ece0783c73b2596e9ad928a28dfdda2 Signed-off-by: Tom Pantelis --- diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupport.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupport.java index 17e3343804..a31bf4bf41 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupport.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupport.java @@ -157,10 +157,6 @@ class RaftActorRecoverySupport { if (snapshot.getServerConfiguration() != null) { context.updatePeerIds(snapshot.getServerConfiguration()); - - if (isMigratedSerializable(snapshot.getServerConfiguration())) { - hasMigratedDataRecovered = true; - } } timer.stop(); diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntry.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntry.java deleted file mode 100644 index c8ee634e79..0000000000 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntry.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.cluster.raft; - -import com.google.common.base.Preconditions; -import java.io.Serializable; -import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload; - -/** - * A {@link ReplicatedLogEntry} implementation. - * - * @deprecated Use {@link org.opendaylight.controller.cluster.raft.persisted.SimpleReplicatedLogEntry} instead. - */ -@Deprecated -public class ReplicatedLogImplEntry implements ReplicatedLogEntry, Serializable { - private static final long serialVersionUID = -9085798014576489130L; - - private final long index; - private final long term; - private final Payload payload; - private transient boolean persistencePending = false; - - /** - * Constructs an instance. - * - * @param index the index - * @param term the term - * @param payload the payload - */ - public ReplicatedLogImplEntry(final long index, final long term, final Payload payload) { - this.index = index; - this.term = term; - this.payload = Preconditions.checkNotNull(payload); - } - - @Override - public Payload getData() { - return payload; - } - - @Override - public long getTerm() { - return term; - } - - @Override - public long getIndex() { - return index; - } - - @Override - public int size() { - return getData().size(); - } - - private Object readResolve() { - return org.opendaylight.controller.cluster.raft.persisted.SimpleReplicatedLogEntry.createMigrated( - index, term, payload); - } - - @Override - public boolean isPersistencePending() { - return persistencePending; - } - - @Override - public void setPersistencePending(boolean pending) { - persistencePending = pending; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + payload.hashCode(); - result = prime * result + (int) (index ^ index >>> 32); - result = prime * result + (int) (term ^ term >>> 32); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - - if (obj == null) { - return false; - } - - if (getClass() != obj.getClass()) { - return false; - } - - ReplicatedLogImplEntry other = (ReplicatedLogImplEntry) obj; - if (payload == null) { - if (other.payload != null) { - return false; - } - } else if (!payload.equals(other.payload)) { - return false; - } - - if (index != other.index) { - return false; - } - - if (term != other.term) { - return false; - } - - return true; - } - - @Override - public String toString() { - return "Entry{index=" + index + ", term=" + term + '}'; - } -} diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ServerConfigurationPayload.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ServerConfigurationPayload.java deleted file mode 100644 index 865594715d..0000000000 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ServerConfigurationPayload.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.cluster.raft; - -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.List; -import javax.annotation.Nonnull; -import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload; -import org.opendaylight.controller.cluster.raft.protobuff.client.messages.PersistentPayload; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Payload data for server configuration log entries. - * - * @author Thomas Pantelis - * - * @deprecated Use {@link org.opendaylight.controller.cluster.raft.persisted.ServerConfigurationPayload} instead. - */ -@Deprecated -public class ServerConfigurationPayload extends Payload implements PersistentPayload, Serializable { - private static final long serialVersionUID = 1L; - - private static final Logger LOG = LoggerFactory.getLogger(ServerConfigurationPayload.class); - - private final List serverConfig; - private transient int serializedSize = -1; - - public ServerConfigurationPayload(@Nonnull List serverConfig) { - this.serverConfig = Preconditions.checkNotNull(serverConfig); - } - - @Nonnull - public List getServerConfig() { - return serverConfig; - } - - @Override - public int size() { - if (serializedSize < 0) { - try { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(bos); - out.writeObject(serverConfig); - out.close(); - - serializedSize = bos.toByteArray().length; - } catch (IOException e) { - serializedSize = 0; - LOG.error("Error serializing", e); - } - } - - return serializedSize; - } - - @Override - public String toString() { - return "ServerConfigurationPayload [serverConfig=" + serverConfig + "]"; - } - - private Object readResolve() { - return org.opendaylight.controller.cluster.raft.persisted.ServerConfigurationPayload.createMigrated( - Lists.transform(serverConfig, t -> new org.opendaylight.controller.cluster.raft.persisted.ServerInfo( - t.getId(), t.isVoting))); - } - - public static class ServerInfo implements Serializable { - private static final long serialVersionUID = 1L; - - private final String id; - private final boolean isVoting; - - public ServerInfo(@Nonnull String id, boolean isVoting) { - this.id = Preconditions.checkNotNull(id); - this.isVoting = isVoting; - } - - @Nonnull - public String getId() { - return id; - } - - public boolean isVoting() { - return isVoting; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + Boolean.hashCode(isVoting); - result = prime * result + id.hashCode(); - return result; - } - - @Override - public boolean equals(Object obj) { - if (obj == null || getClass() != obj.getClass()) { - return false; - } - - ServerInfo other = (ServerInfo) obj; - return isVoting == other.isVoting && id.equals(other.id); - } - - @Override - public String toString() { - return "ServerInfo [id=" + id + ", isVoting=" + isVoting + "]"; - } - } -} diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplyJournalEntries.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplyJournalEntries.java deleted file mode 100644 index 4b90979bc6..0000000000 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplyJournalEntries.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.cluster.raft.base.messages; - -import java.io.Serializable; - -/** - * This is an internal message that is stored in the akka's persistent journal. During recovery, this - * message is used to apply recovered journal entries to the state whose indexes range from the context's - * current lastApplied index to "toIndex" contained in the message. This message is sent internally from a - * behavior to the RaftActor to persist. - * - * @author Thomas Pantelis - * - * @deprecated Use {@link org.opendaylight.controller.cluster.raft.persisted.ApplyJournalEntries} instead. - */ -@Deprecated -public class ApplyJournalEntries implements Serializable { - private static final long serialVersionUID = 1L; - - private final long toIndex; - - public ApplyJournalEntries(long toIndex) { - this.toIndex = toIndex; - } - - public long getToIndex() { - return toIndex; - } - - private Object readResolve() { - return org.opendaylight.controller.cluster.raft.persisted.ApplyJournalEntries.createMigrated(toIndex); - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("ApplyJournalEntries [toIndex=").append(toIndex).append("]"); - return builder.toString(); - } -} diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/DeleteEntries.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/DeleteEntries.java deleted file mode 100644 index 059361ab9e..0000000000 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/DeleteEntries.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.cluster.raft.base.messages; - -import java.io.Serializable; - -/** - * Internal message that is stored in the akka's persistent journal to delete journal entries. - * - * @author Thomas Pantelis - * - * @deprecated Use {@link org.opendaylight.controller.cluster.raft.persisted.DeleteEntries} instead. - */ -@Deprecated -public class DeleteEntries implements Serializable { - private static final long serialVersionUID = 1L; - - private final long fromIndex; - - public DeleteEntries(long fromIndex) { - this.fromIndex = fromIndex; - } - - public long getFromIndex() { - return fromIndex; - } - - private Object readResolve() { - return org.opendaylight.controller.cluster.raft.persisted.DeleteEntries.createMigrated(fromIndex); - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("DeleteEntries [fromIndex=").append(fromIndex).append("]"); - return builder.toString(); - } -} diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/UpdateElectionTerm.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/UpdateElectionTerm.java deleted file mode 100644 index 9fac37e6a0..0000000000 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/UpdateElectionTerm.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.cluster.raft.base.messages; - -import java.io.Serializable; - -/** - * Message class to persist election term information. - * - * @deprecated Use {@link org.opendaylight.controller.cluster.raft.persisted.UpdateElectionTerm} instead. - */ -@Deprecated -public class UpdateElectionTerm implements Serializable { - private static final long serialVersionUID = 1L; - - private final long currentTerm; - private final String votedFor; - - public UpdateElectionTerm(long currentTerm, String votedFor) { - this.currentTerm = currentTerm; - this.votedFor = votedFor; - } - - public long getCurrentTerm() { - return currentTerm; - } - - public String getVotedFor() { - return votedFor; - } - - private Object readResolve() { - return org.opendaylight.controller.cluster.raft.persisted.UpdateElectionTerm.createMigrated( - currentTerm, votedFor); - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("UpdateElectionTerm [currentTerm=").append(currentTerm).append(", votedFor=").append(votedFor) - .append("]"); - return builder.toString(); - } -} diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ApplyJournalEntries.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ApplyJournalEntries.java index cad23a9398..6045427065 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ApplyJournalEntries.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ApplyJournalEntries.java @@ -21,7 +21,7 @@ import java.io.Serializable; * * @author Thomas Pantelis */ -public class ApplyJournalEntries implements Serializable, MigratedSerializable { +public class ApplyJournalEntries implements Serializable { private static final class Proxy implements Externalizable { private static final long serialVersionUID = 1L; @@ -56,36 +56,19 @@ public class ApplyJournalEntries implements Serializable, MigratedSerializable { private static final long serialVersionUID = 1L; private final long toIndex; - private final boolean migrated; - - private ApplyJournalEntries(final long toIndex, final boolean migrated) { - this.toIndex = toIndex; - this.migrated = migrated; - } public ApplyJournalEntries(final long toIndex) { - this(toIndex, false); + this.toIndex = toIndex; } public long getToIndex() { return toIndex; } - @Override - public boolean isMigrated() { - return migrated; - } - - @Override - public Object writeReplace() { + private Object writeReplace() { return new Proxy(this); } - @Deprecated - public static ApplyJournalEntries createMigrated(final long fromIndex) { - return new ApplyJournalEntries(fromIndex, true); - } - @Override public String toString() { return "ApplyJournalEntries [toIndex=" + toIndex + "]"; diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/DeleteEntries.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/DeleteEntries.java index 138ea0cfcf..70ad119b5a 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/DeleteEntries.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/DeleteEntries.java @@ -18,7 +18,7 @@ import java.io.Serializable; * * @author Thomas Pantelis */ -public class DeleteEntries implements Serializable, MigratedSerializable { +public class DeleteEntries implements Serializable { private static final class Proxy implements Externalizable { private static final long serialVersionUID = 1L; @@ -53,36 +53,19 @@ public class DeleteEntries implements Serializable, MigratedSerializable { private static final long serialVersionUID = 1L; private final long fromIndex; - private final boolean migrated; - - private DeleteEntries(final long fromIndex, final boolean migrated) { - this.fromIndex = fromIndex; - this.migrated = migrated; - } public DeleteEntries(final long fromIndex) { - this(fromIndex, false); + this.fromIndex = fromIndex; } public long getFromIndex() { return fromIndex; } - @Override - public boolean isMigrated() { - return migrated; - } - - @Override - public Object writeReplace() { + private Object writeReplace() { return new Proxy(this); } - @Deprecated - public static DeleteEntries createMigrated(final long fromIndex) { - return new DeleteEntries(fromIndex, true); - } - @Override public String toString() { return "DeleteEntries [fromIndex=" + fromIndex + "]"; diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ServerConfigurationPayload.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ServerConfigurationPayload.java index 7138b634f4..82c049d7cf 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ServerConfigurationPayload.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ServerConfigurationPayload.java @@ -15,6 +15,7 @@ import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.ObjectOutputStream; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.annotation.Nonnull; @@ -28,7 +29,7 @@ import org.slf4j.LoggerFactory; * * @author Thomas Pantelis */ -public final class ServerConfigurationPayload extends Payload implements PersistentPayload, MigratedSerializable { +public final class ServerConfigurationPayload extends Payload implements PersistentPayload, Serializable { private static final class Proxy implements Externalizable { private static final long serialVersionUID = 1L; @@ -77,27 +78,10 @@ public final class ServerConfigurationPayload extends Payload implements Persist + "implements writeReplace to delegate serialization to a Proxy class and thus instances of this class " + "aren't serialized. FindBugs does not recognize this.") private final List serverConfig; - private final boolean migrated; private int serializedSize = -1; - private ServerConfigurationPayload(@Nonnull final List serverConfig, boolean migrated) { - this.serverConfig = ImmutableList.copyOf(serverConfig); - this.migrated = migrated; - } - public ServerConfigurationPayload(@Nonnull final List serverConfig) { - this(serverConfig, false); - } - - @Deprecated - public static ServerConfigurationPayload createMigrated(@Nonnull final List serverConfig) { - return new ServerConfigurationPayload(serverConfig, true); - } - - @Deprecated - @Override - public boolean isMigrated() { - return migrated; + this.serverConfig = ImmutableList.copyOf(serverConfig); } @Nonnull @@ -128,8 +112,7 @@ public final class ServerConfigurationPayload extends Payload implements Persist return "ServerConfigurationPayload [serverConfig=" + serverConfig + "]"; } - @Override - public Object writeReplace() { + private Object writeReplace() { return new Proxy(this); } } diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/SimpleReplicatedLogEntry.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/SimpleReplicatedLogEntry.java index 5edd2ed535..85fa51e93f 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/SimpleReplicatedLogEntry.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/SimpleReplicatedLogEntry.java @@ -13,6 +13,7 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; +import java.io.Serializable; import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry; import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload; @@ -21,7 +22,7 @@ import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payloa * * @author Thomas Pantelis */ -public final class SimpleReplicatedLogEntry implements ReplicatedLogEntry, MigratedSerializable { +public final class SimpleReplicatedLogEntry implements ReplicatedLogEntry, Serializable { private static final class Proxy implements Externalizable { private static final long serialVersionUID = 1L; @@ -61,14 +62,6 @@ public final class SimpleReplicatedLogEntry implements ReplicatedLogEntry, Migra private final long term; private final Payload payload; private boolean persistencePending; - private final boolean migrated; - - private SimpleReplicatedLogEntry(long index, long term, Payload payload, boolean migrated) { - this.index = index; - this.term = term; - this.payload = Preconditions.checkNotNull(payload); - this.migrated = migrated; - } /** * Constructs an instance. @@ -77,13 +70,10 @@ public final class SimpleReplicatedLogEntry implements ReplicatedLogEntry, Migra * @param term the term * @param payload the payload */ - public SimpleReplicatedLogEntry(final long index, final long term, final Payload payload) { - this(index, term, payload, false); - } - - @Deprecated - public static ReplicatedLogEntry createMigrated(final long index, final long term, final Payload payload) { - return new SimpleReplicatedLogEntry(index, term, payload, true); + public SimpleReplicatedLogEntry(long index, long term, Payload payload) { + this.index = index; + this.term = term; + this.payload = Preconditions.checkNotNull(payload); } @Override @@ -116,13 +106,7 @@ public final class SimpleReplicatedLogEntry implements ReplicatedLogEntry, Migra persistencePending = pending; } - @Override - public boolean isMigrated() { - return migrated; - } - - @Override - public Object writeReplace() { + private Object writeReplace() { return new Proxy(this); } diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/UpdateElectionTerm.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/UpdateElectionTerm.java index 55096d677e..939d893a2e 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/UpdateElectionTerm.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/UpdateElectionTerm.java @@ -16,7 +16,7 @@ import java.io.Serializable; /** * Message class to persist election term information. */ -public class UpdateElectionTerm implements Serializable, MigratedSerializable { +public class UpdateElectionTerm implements Serializable { private static final class Proxy implements Externalizable { private static final long serialVersionUID = 1L; @@ -53,16 +53,10 @@ public class UpdateElectionTerm implements Serializable, MigratedSerializable { private final long currentTerm; private final String votedFor; - private final boolean migrated; - private UpdateElectionTerm(final long currentTerm, final String votedFor, final boolean migrated) { + public UpdateElectionTerm(final long currentTerm, final String votedFor) { this.currentTerm = currentTerm; this.votedFor = votedFor; - this.migrated = migrated; - } - - public UpdateElectionTerm(final long currentTerm, final String votedFor) { - this(currentTerm, votedFor, false); } public long getCurrentTerm() { @@ -73,21 +67,10 @@ public class UpdateElectionTerm implements Serializable, MigratedSerializable { return votedFor; } - @Override - public boolean isMigrated() { - return migrated; - } - - @Override - public Object writeReplace() { + private Object writeReplace() { return new Proxy(this); } - @Deprecated - public static UpdateElectionTerm createMigrated(final long currentTerm, final String votedFor) { - return new UpdateElectionTerm(currentTerm, votedFor, true); - } - @Override public String toString() { return "UpdateElectionTerm [currentTerm=" + currentTerm + ", votedFor=" + votedFor + "]"; diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MigratedMessagesTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MigratedMessagesTest.java index 460dd4a445..70f45045b7 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MigratedMessagesTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MigratedMessagesTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import akka.actor.ActorRef; import akka.dispatch.Dispatchers; -import akka.testkit.JavaTestKit; import akka.testkit.TestActorRef; import com.google.common.base.Optional; import com.google.common.collect.ImmutableMap; @@ -21,7 +20,6 @@ import com.google.common.util.concurrent.Uninterruptibles; import java.io.OutputStream; import java.io.Serializable; import java.util.Arrays; -import java.util.HashSet; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; @@ -68,98 +66,6 @@ public class MigratedMessagesTest extends AbstractActorTest { InMemorySnapshotStore.clear(); } - @Test - public void testSnapshotAfterStartupWithMigratedServerConfigPayloadAndPersistenceEnabled() { - TEST_LOG.info("testSnapshotAfterStartupWithMigratedServerConfigPayloadAndPersistenceEnabled starting"); - doTestSnapshotAfterStartupWithMigratedServerConfigPayload(true); - TEST_LOG.info("testSnapshotAfterStartupWithMigratedServerConfigPayloadAndPersistenceEnabled ending"); - } - - @Test - public void testSnapshotAfterStartupWithMigratedServerConfigPayloadAndPersistenceDisabled() { - TEST_LOG.info("testSnapshotAfterStartupWithMigratedServerConfigPayloadAndPersistenceDisabled starting"); - - TestActorRef actor = doTestSnapshotAfterStartupWithMigratedServerConfigPayload(false); - MockRaftActor mockRaftActor = actor.underlyingActor(); - String id = mockRaftActor.persistenceId(); - ConfigParams config = mockRaftActor.getRaftActorContext().getConfigParams(); - - factory.killActor(actor, new JavaTestKit(getSystem())); - - actor = factory.createTestActor(MockRaftActor.builder().id(id).config(config) - .persistent(Optional.of(false)).props().withDispatcher(Dispatchers.DefaultDispatcherId()), id); - mockRaftActor = actor.underlyingActor(); - mockRaftActor.waitForRecoveryComplete(); - - assertEquals("electionTerm", 1, - mockRaftActor.getRaftActorContext().getTermInformation().getCurrentTerm()); - assertEquals("votedFor", id, - mockRaftActor.getRaftActorContext().getTermInformation().getVotedFor()); - - TEST_LOG.info("testSnapshotAfterStartupWithMigratedServerConfigPayloadAndPersistenceDisabled ending"); - } - - @Test - public void testSnapshotAfterStartupWithMigratedUpdateElectionTermAndPersistenceEnabled() { - TEST_LOG.info("testSnapshotAfterStartupWithMigratedUpdateElectionTermAndPersistenceEnabled starting"); - - String persistenceId = factory.generateActorId("test-actor-"); - - org.opendaylight.controller.cluster.raft.base.messages.UpdateElectionTerm updateElectionTerm = - new org.opendaylight.controller.cluster.raft.base.messages.UpdateElectionTerm(5, persistenceId); - - InMemoryJournal.addEntry(persistenceId, 1, updateElectionTerm); - - doTestSnapshotAfterStartupWithMigratedMessage(persistenceId, true, snapshot -> { - assertEquals("getElectionVotedFor", persistenceId, snapshot.getElectionVotedFor()); - assertEquals("getElectionTerm", 5, snapshot.getElectionTerm()); - }, ByteState.empty()); - - TEST_LOG.info("testSnapshotAfterStartupWithMigratedUpdateElectionTermAndPersistenceEnabled ending"); - } - - @Test - public void testSnapshotAfterStartupWithMigratedUpdateElectionTermAndPersistenceDisabled() { - TEST_LOG.info("testSnapshotAfterStartupWithMigratedUpdateElectionTermAndPersistenceDisabled starting"); - - String persistenceId = factory.generateActorId("test-actor-"); - - org.opendaylight.controller.cluster.raft.base.messages.UpdateElectionTerm updateElectionTerm = - new org.opendaylight.controller.cluster.raft.base.messages.UpdateElectionTerm(5, persistenceId); - - InMemoryJournal.addEntry(persistenceId, 1, updateElectionTerm); - - doTestSnapshotAfterStartupWithMigratedMessage(persistenceId, false, snapshot -> { - assertEquals("getElectionVotedFor", persistenceId, snapshot.getElectionVotedFor()); - assertEquals("getElectionTerm", 5, snapshot.getElectionTerm()); - }, ByteState.empty()); - - TEST_LOG.info("testSnapshotAfterStartupWithMigratedUpdateElectionTermAndPersistenceDisabled ending"); - } - - @Test - public void testSnapshotAfterStartupWithMigratedApplyJournalEntries() { - TEST_LOG.info("testSnapshotAfterStartupWithMigratedApplyJournalEntries starting"); - - String persistenceId = factory.generateActorId("test-actor-"); - - InMemoryJournal.addEntry(persistenceId, 1, new UpdateElectionTerm(1, persistenceId)); - InMemoryJournal.addEntry(persistenceId, 2, new SimpleReplicatedLogEntry(0, 1, - new MockRaftActorContext.MockPayload("A"))); - InMemoryJournal.addEntry(persistenceId, 3, - new org.opendaylight.controller.cluster.raft.base.messages.ApplyJournalEntries(0)); - - - doTestSnapshotAfterStartupWithMigratedMessage(persistenceId, true, snapshot -> { - assertEquals("getLastAppliedIndex", 0, snapshot.getLastAppliedIndex()); - assertEquals("getLastAppliedTerm", 1, snapshot.getLastAppliedTerm()); - assertEquals("getLastIndex", 0, snapshot.getLastIndex()); - assertEquals("getLastTerm", 1, snapshot.getLastTerm()); - }, ByteState.empty()); - - TEST_LOG.info("testSnapshotAfterStartupWithMigratedApplyJournalEntries ending"); - } - @Test public void testNoSnapshotAfterStartupWithNoMigratedMessages() { TEST_LOG.info("testNoSnapshotAfterStartupWithNoMigratedMessages starting"); @@ -203,54 +109,6 @@ public class MigratedMessagesTest extends AbstractActorTest { TEST_LOG.info("testNoSnapshotAfterStartupWithNoMigratedMessages ending"); } - @Test - public void testSnapshotAfterStartupWithMigratedReplicatedLogEntry() { - TEST_LOG.info("testSnapshotAfterStartupWithMigratedReplicatedLogEntry starting"); - - String persistenceId = factory.generateActorId("test-actor-"); - - InMemoryJournal.addEntry(persistenceId, 1, new UpdateElectionTerm(1, persistenceId)); - MockRaftActorContext.MockPayload expPayload = new MockRaftActorContext.MockPayload("A"); - InMemoryJournal.addEntry(persistenceId, 2, new org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry( - 0, 1, expPayload)); - - doTestSnapshotAfterStartupWithMigratedMessage(persistenceId, true, snapshot -> { - assertEquals("Unapplied entries size", 1, snapshot.getUnAppliedEntries().size()); - assertEquals("Unapplied entry term", 1, snapshot.getUnAppliedEntries().get(0).getTerm()); - assertEquals("Unapplied entry index", 0, snapshot.getUnAppliedEntries().get(0).getIndex()); - assertEquals("Unapplied entry data", expPayload, snapshot.getUnAppliedEntries().get(0).getData()); - }, ByteState.empty()); - - TEST_LOG.info("testSnapshotAfterStartupWithMigratedReplicatedLogEntry ending"); - } - - private TestActorRef doTestSnapshotAfterStartupWithMigratedServerConfigPayload(boolean persistent) { - String persistenceId = factory.generateActorId("test-actor-"); - - org.opendaylight.controller.cluster.raft.ServerConfigurationPayload persistedServerConfig = - new org.opendaylight.controller.cluster.raft.ServerConfigurationPayload(Arrays.asList( - new org.opendaylight.controller.cluster.raft.ServerConfigurationPayload.ServerInfo( - persistenceId, true), - new org.opendaylight.controller.cluster.raft.ServerConfigurationPayload.ServerInfo( - "downNode", true))); - - ServerConfigurationPayload expectedServerConfig = new ServerConfigurationPayload(Arrays.asList( - new ServerInfo(persistenceId, true), new ServerInfo("downNode", true))); - - InMemoryJournal.addEntry(persistenceId, 1, new UpdateElectionTerm(1, persistenceId)); - InMemoryJournal.addEntry(persistenceId, 3, new SimpleReplicatedLogEntry(0, 1, persistedServerConfig)); - - TestActorRef actor = doTestSnapshotAfterStartupWithMigratedMessage(persistenceId, - persistent, snapshot -> { - assertEquals("getElectionVotedFor", persistenceId, snapshot.getElectionVotedFor()); - assertEquals("getElectionTerm", 1, snapshot.getElectionTerm()); - assertEquals("getServerConfiguration", new HashSet<>(expectedServerConfig.getServerConfig()), - new HashSet<>(snapshot.getServerConfiguration().getServerConfig())); - }, ByteState.empty()); - - return actor; - } - @Test public void testSnapshotAfterStartupWithMigratedSnapshot() throws Exception { TEST_LOG.info("testSnapshotAfterStartupWithMigratedSnapshot starting"); diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntryTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntryTest.java deleted file mode 100644 index 085861ffae..0000000000 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntryTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.cluster.raft; - -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import org.junit.Assert; -import org.junit.Test; -import org.opendaylight.controller.cluster.raft.persisted.SimpleReplicatedLogEntry; - -/** - * Unit tests for ReplicatedLogImplEntry. - * - * @author Thomas Pantelis - */ -@Deprecated -public class ReplicatedLogImplEntryTest { - - @Test - public void testBackwardsCompatibleDeserializationFromHelium() throws Exception { - String expPayloadData = "This is a test"; - int expIndex = 1; - int expTerm = 2; - - try (FileInputStream fis = new FileInputStream("src/test/resources/helium-serialized-ReplicatedLogImplEntry")) { - ObjectInputStream ois = new ObjectInputStream(fis); - - SimpleReplicatedLogEntry entry = (SimpleReplicatedLogEntry) ois.readObject(); - ois.close(); - - Assert.assertEquals("getIndex", expIndex, entry.getIndex()); - Assert.assertEquals("getTerm", expTerm, entry.getTerm()); - - MockRaftActorContext.MockPayload payload = (MockRaftActorContext.MockPayload) entry.getData(); - Assert.assertEquals("data", expPayloadData, payload.toString()); - } - } - - /** - * Use this method to generate a file with a serialized ReplicatedLogImplEntry instance to be - * used in tests that verify backwards compatible de-serialization. - */ - @SuppressWarnings("unused") - private static void generateSerializedFile() throws IOException { - String expPayloadData = "This is a test"; - int expIndex = 1; - int expTerm = 2; - - ReplicatedLogImplEntry entry = new ReplicatedLogImplEntry(expIndex, expTerm, - new MockRaftActorContext.MockPayload(expPayloadData)); - FileOutputStream fos = new FileOutputStream("src/test/resources/serialized-ReplicatedLogImplEntry"); - ObjectOutputStream oos = new ObjectOutputStream(fos); - oos.writeObject(entry); - fos.close(); - } -} diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ServerConfigurationPayloadTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ServerConfigurationPayloadTest.java deleted file mode 100644 index 01bcac5363..0000000000 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ServerConfigurationPayloadTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.cluster.raft; - -import static org.junit.Assert.assertEquals; - -import com.google.common.collect.ImmutableSet; -import java.util.Arrays; -import org.apache.commons.lang.SerializationUtils; -import org.junit.Test; - -/** - * Unit tests for ServerConfigurationPayload. - * - * @author Thomas Pantelis - */ -@Deprecated -public class ServerConfigurationPayloadTest { - - @Test - public void testSerialization() { - ServerConfigurationPayload expected = new ServerConfigurationPayload(Arrays.asList( - new ServerConfigurationPayload.ServerInfo("1", true), - new ServerConfigurationPayload.ServerInfo("2", false))); - org.opendaylight.controller.cluster.raft.persisted.ServerConfigurationPayload cloned = - (org.opendaylight.controller.cluster.raft.persisted.ServerConfigurationPayload) - SerializationUtils.clone(expected); - - assertEquals("getServerConfig", ImmutableSet.of( - new org.opendaylight.controller.cluster.raft.persisted.ServerInfo("1", true), - new org.opendaylight.controller.cluster.raft.persisted.ServerInfo("2", false)), - ImmutableSet.copyOf(cloned.getServerConfig())); - assertEquals("isMigrated", true, cloned.isMigrated()); - } -} diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/SnapshotTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/SnapshotTest.java deleted file mode 100644 index b4a8c27b7c..0000000000 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/SnapshotTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.cluster.raft; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; - -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.ArrayList; -import java.util.List; -import org.junit.Test; -import org.opendaylight.controller.cluster.raft.MockRaftActorContext.MockPayload; - -/** - * Unit tests for Snapshot. - * - * @author Thomas Pantelis - */ -@Deprecated -public class SnapshotTest { - - @Test - public void testBackwardsCompatibleDeserializationFromLithium() throws Exception { - Snapshot expSnapshot = newLithiumSnapshot(); - try (FileInputStream fis = new FileInputStream("src/test/resources/lithium-serialized-Snapshot")) { - ObjectInputStream ois = new ObjectInputStream(fis); - - Snapshot snapshot = (Snapshot) ois.readObject(); - ois.close(); - - assertEquals("lastIndex", expSnapshot.getLastIndex(), snapshot.getLastIndex()); - assertEquals("lastTerm", expSnapshot.getLastTerm(), snapshot.getLastTerm()); - assertEquals("lastAppliedIndex", expSnapshot.getLastAppliedIndex(), snapshot.getLastAppliedIndex()); - assertEquals("lastAppliedTerm", expSnapshot.getLastAppliedTerm(), snapshot.getLastAppliedTerm()); - assertEquals("unAppliedEntries size", expSnapshot.getUnAppliedEntries().size(), - snapshot.getUnAppliedEntries().size()); - assertArrayEquals("state", expSnapshot.getState(), snapshot.getState()); - assertEquals("electionTerm", 0, snapshot.getElectionTerm()); - assertEquals("electionVotedFor", null, snapshot.getElectionVotedFor()); - } - } - - private static Snapshot newLithiumSnapshot() { - byte[] state = {1, 2, 3, 4, 5}; - List entries = new ArrayList<>(); - entries.add(new org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry( - 6, 2, new MockPayload("payload"))); - long lastIndex = 6; - long lastTerm = 2; - long lastAppliedIndex = 5; - long lastAppliedTerm = 1; - - return Snapshot.create(state, entries, lastIndex, lastTerm, lastAppliedIndex, lastAppliedTerm); - } - - /** - * Use this method to generate a file with a serialized Snapshot instance to be - * used in tests that verify backwards compatible de-serialization. - */ - @SuppressWarnings("unused") - private static void generateSerializedFile(Snapshot snapshot, String fileName) throws IOException { - FileOutputStream fos = new FileOutputStream("src/test/resources/" + fileName); - ObjectOutputStream oos = new ObjectOutputStream(fos); - oos.writeObject(snapshot); - fos.close(); - } -} diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/base/messages/DeleteEntriesTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/base/messages/DeleteEntriesTest.java deleted file mode 100644 index 393b7ab7b3..0000000000 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/base/messages/DeleteEntriesTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.cluster.raft.base.messages; - -import org.apache.commons.lang.SerializationUtils; -import org.junit.Assert; -import org.junit.Test; - -/** - * Unit tests for DeleteEntries. - * - * @author Thomas Pantelis - */ -@Deprecated -public class DeleteEntriesTest { - - @Test - public void testSerialization() { - DeleteEntries deleteEntries = new DeleteEntries(11); - org.opendaylight.controller.cluster.raft.persisted.DeleteEntries clone = - (org.opendaylight.controller.cluster.raft.persisted.DeleteEntries) - SerializationUtils.clone(deleteEntries); - - Assert.assertEquals("getFromIndex", 11, clone.getFromIndex()); - Assert.assertEquals("isMigrated", true, clone.isMigrated()); - } -} diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/base/messages/UpdateElectionTermTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/base/messages/UpdateElectionTermTest.java deleted file mode 100644 index 94a15a8cea..0000000000 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/base/messages/UpdateElectionTermTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.cluster.raft.base.messages; - -import org.apache.commons.lang.SerializationUtils; -import org.junit.Assert; -import org.junit.Test; - -/** - * Unit tests for UpdateElectionTerm. - * - * @author Thomas Pantelis - */ -@Deprecated -public class UpdateElectionTermTest { - - @Test - public void testSerialization() { - UpdateElectionTerm expected = new UpdateElectionTerm(5, "member1"); - org.opendaylight.controller.cluster.raft.persisted.UpdateElectionTerm clone = - (org.opendaylight.controller.cluster.raft.persisted.UpdateElectionTerm) - SerializationUtils.clone(expected); - - Assert.assertEquals("getCurrentTerm", 5, clone.getCurrentTerm()); - Assert.assertEquals("getVotedFor", "member1", clone.getVotedFor()); - Assert.assertEquals("isMigrated", true, clone.isMigrated()); - } -} diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/ApplyJournalEntriesTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/ApplyJournalEntriesTest.java index 4ba6c47d71..b7f152574b 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/ApplyJournalEntriesTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/ApplyJournalEntriesTest.java @@ -25,6 +25,5 @@ public class ApplyJournalEntriesTest { ApplyJournalEntries cloned = (ApplyJournalEntries) SerializationUtils.clone(expected); assertEquals("getFromIndex", expected.getToIndex(), cloned.getToIndex()); - assertEquals("isMigrated", false, cloned.isMigrated()); } } diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/DeleteEntriesTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/DeleteEntriesTest.java index 1796e8254e..8334296ead 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/DeleteEntriesTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/DeleteEntriesTest.java @@ -25,6 +25,5 @@ public class DeleteEntriesTest { DeleteEntries cloned = (DeleteEntries) SerializationUtils.clone(expected); assertEquals("getFromIndex", expected.getFromIndex(), cloned.getFromIndex()); - assertEquals("isMigrated", false, cloned.isMigrated()); } } diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/ServerConfigurationPayloadTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/ServerConfigurationPayloadTest.java index 28f59a1b54..aa2fe90884 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/ServerConfigurationPayloadTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/ServerConfigurationPayloadTest.java @@ -28,7 +28,6 @@ public class ServerConfigurationPayloadTest { ServerConfigurationPayload cloned = (ServerConfigurationPayload) SerializationUtils.clone(expected); assertEquals("getServerConfig", expected.getServerConfig(), cloned.getServerConfig()); - assertEquals("isMigrated", false, cloned.isMigrated()); } @Test diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/SimpleReplicatedLogEntryTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/SimpleReplicatedLogEntryTest.java index 93c313aee9..ec4a3689b2 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/SimpleReplicatedLogEntryTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/SimpleReplicatedLogEntryTest.java @@ -29,6 +29,5 @@ public class SimpleReplicatedLogEntryTest { assertEquals("getTerm", expected.getTerm(), cloned.getTerm()); assertEquals("getIndex", expected.getIndex(), cloned.getIndex()); assertEquals("getData", expected.getData(), cloned.getData()); - assertEquals("isMigrated", false, cloned.isMigrated()); } } diff --git a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/UpdateElectionTermTest.java b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/UpdateElectionTermTest.java index d64c712138..de95125966 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/UpdateElectionTermTest.java +++ b/opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/UpdateElectionTermTest.java @@ -26,6 +26,5 @@ public class UpdateElectionTermTest { assertEquals("getCurrentTerm", expected.getCurrentTerm(), cloned.getCurrentTerm()); assertEquals("getVotedFor", expected.getVotedFor(), cloned.getVotedFor()); - assertEquals("isMigrated", false, cloned.isMigrated()); } } diff --git a/opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java b/opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java index 6fc9940dd3..59ec58cedb 100644 --- a/opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java +++ b/opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java @@ -64,9 +64,9 @@ import org.opendaylight.controller.cluster.datastore.messages.CreateShard; import org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot; import org.opendaylight.controller.cluster.datastore.utils.ClusterUtils; import org.opendaylight.controller.cluster.raft.RaftState; -import org.opendaylight.controller.cluster.raft.ReplicatedLogImplEntry; import org.opendaylight.controller.cluster.raft.persisted.ServerConfigurationPayload; import org.opendaylight.controller.cluster.raft.persisted.ServerInfo; +import org.opendaylight.controller.cluster.raft.persisted.SimpleReplicatedLogEntry; import org.opendaylight.controller.cluster.raft.persisted.UpdateElectionTerm; import org.opendaylight.controller.cluster.raft.utils.InMemoryJournal; import org.opendaylight.controller.cluster.raft.utils.InMemorySnapshotStore; @@ -1045,7 +1045,7 @@ public class ClusterAdminRpcServiceTest { String shardID = ShardIdentifier.create(shard, MemberName.forName(member), type + datastoreTypeSuffix).toString(); InMemoryJournal.addEntry(shardID, 1, new UpdateElectionTerm(1, null)); - InMemoryJournal.addEntry(shardID, 2, new ReplicatedLogImplEntry(0, 1, + InMemoryJournal.addEntry(shardID, 2, new SimpleReplicatedLogEntry(0, 1, new ServerConfigurationPayload(newServerInfo))); } }