Remove deprecated persisted raft payloads 34/55134/3
authorTom Pantelis <tompantelis@gmail.com>
Tue, 18 Apr 2017 07:27:55 +0000 (03:27 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Tue, 18 Apr 2017 15:29:26 +0000 (15:29 +0000)
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 <tompantelis@gmail.com>
23 files changed:
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoverySupport.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntry.java [deleted file]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ServerConfigurationPayload.java [deleted file]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplyJournalEntries.java [deleted file]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/DeleteEntries.java [deleted file]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/UpdateElectionTerm.java [deleted file]
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ApplyJournalEntries.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/DeleteEntries.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ServerConfigurationPayload.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/SimpleReplicatedLogEntry.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/UpdateElectionTerm.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MigratedMessagesTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImplEntryTest.java [deleted file]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ServerConfigurationPayloadTest.java [deleted file]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/SnapshotTest.java [deleted file]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/base/messages/DeleteEntriesTest.java [deleted file]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/base/messages/UpdateElectionTermTest.java [deleted file]
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/ApplyJournalEntriesTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/DeleteEntriesTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/ServerConfigurationPayloadTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/SimpleReplicatedLogEntryTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/UpdateElectionTermTest.java
opendaylight/md-sal/sal-cluster-admin-impl/src/test/java/org/opendaylight/controller/cluster/datastore/admin/ClusterAdminRpcServiceTest.java

index 17e3343804886b8ea9227d303cc6d75a25e59d06..a31bf4bf41002311c28352cfac8bdfa2dd768c55 100644 (file)
@@ -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 (file)
index c8ee634..0000000
+++ /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 (file)
index 8655947..0000000
+++ /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<ServerInfo> serverConfig;
-    private transient int serializedSize = -1;
-
-    public ServerConfigurationPayload(@Nonnull List<ServerInfo> serverConfig) {
-        this.serverConfig = Preconditions.checkNotNull(serverConfig);
-    }
-
-    @Nonnull
-    public List<ServerInfo> 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 (file)
index 4b90979..0000000
+++ /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 (file)
index 059361a..0000000
+++ /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 (file)
index 9fac37e..0000000
+++ /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();
-    }
-}
index cad23a93980aa816363ab2f03c5f3ec229ee3088..604542706542007c09ba61ea3d90a989c653f0d6 100644 (file)
@@ -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 + "]";
index 138ea0cfcf5de810a1ac0375125b76b42448397b..70ad119b5a77872903c6b7526476ba24974af9c3 100644 (file)
@@ -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 + "]";
index 7138b634f4b49307e034d041709b082e154b1997..82c049d7cfd54ccae50fa1ad9048c02b550ba8ac 100644 (file)
@@ -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<ServerInfo> serverConfig;
-    private final boolean migrated;
     private int serializedSize = -1;
 
-    private ServerConfigurationPayload(@Nonnull final List<ServerInfo> serverConfig, boolean migrated) {
-        this.serverConfig = ImmutableList.copyOf(serverConfig);
-        this.migrated = migrated;
-    }
-
     public ServerConfigurationPayload(@Nonnull final List<ServerInfo> serverConfig) {
-        this(serverConfig, false);
-    }
-
-    @Deprecated
-    public static ServerConfigurationPayload createMigrated(@Nonnull final List<ServerInfo> 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);
     }
 }
index 5edd2ed5358dd19a7137d522cdbb67a6989c5717..85fa51e93f0b4fc8e5ce95eb2a3925671a050e2e 100644 (file)
@@ -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);
     }
 
index 55096d677e60019cfd86378a0f5fda71b8e61fdb..939d893a2ec505538f918a1f30ad5c927c56666a 100644 (file)
@@ -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 + "]";
index 460dd4a445a8306731499e205b1207c563e1e110..70f45045b71bf859ed50eff880b0ee07acc365d0 100644 (file)
@@ -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<MockRaftActor> 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<MockRaftActor> 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<MockRaftActor> 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 (file)
index 085861f..0000000
+++ /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 (file)
index 01bcac5..0000000
+++ /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 (file)
index b4a8c27..0000000
+++ /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<ReplicatedLogEntry> 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 (file)
index 393b7ab..0000000
+++ /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 (file)
index 94a15a8..0000000
+++ /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());
-    }
-}
index 4ba6c47d7192d49127f87dec118322aa3a215c9a..b7f152574bcbb478bf7951b1ef8f64aea12198db 100644 (file)
@@ -25,6 +25,5 @@ public class ApplyJournalEntriesTest {
         ApplyJournalEntries cloned = (ApplyJournalEntries) SerializationUtils.clone(expected);
 
         assertEquals("getFromIndex", expected.getToIndex(), cloned.getToIndex());
-        assertEquals("isMigrated", false, cloned.isMigrated());
     }
 }
index 1796e8254e6457bc9bfed0b5e5369e495ba94770..8334296ead188fd2263e855aeaeb164f36af839b 100644 (file)
@@ -25,6 +25,5 @@ public class DeleteEntriesTest {
         DeleteEntries cloned = (DeleteEntries) SerializationUtils.clone(expected);
 
         assertEquals("getFromIndex", expected.getFromIndex(), cloned.getFromIndex());
-        assertEquals("isMigrated", false, cloned.isMigrated());
     }
 }
index 28f59a1b54c0fb386249204b8a0d8871f4ad5811..aa2fe90884540760fcd0dbd99b3f754dfa3f9412 100644 (file)
@@ -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
index 93c313aee93cb569e7f0fdb814c13e7877af1af3..ec4a3689b2a4a109bb2c28d81aecbab214fe225f 100644 (file)
@@ -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());
     }
 }
index d64c712138a4e118d106a3464adb74979bc92943..de95125966405f1fb3af8d4357cae6218afb2032 100644 (file)
@@ -26,6 +26,5 @@ public class UpdateElectionTermTest {
 
         assertEquals("getCurrentTerm", expected.getCurrentTerm(), cloned.getCurrentTerm());
         assertEquals("getVotedFor", expected.getVotedFor(), cloned.getVotedFor());
-        assertEquals("isMigrated", false, cloned.isMigrated());
     }
 }
index 6fc9940dd3085f881a7d7ecf16f58fec3ab2ae8f..59ec58cedb7ee2e5e194578788411ae0d487578c 100644 (file)
@@ -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)));
             }
         }