BUG-5626: make CloseTransactionChain implement Identifiable 70/39470/33
authorRobert Varga <rovarga@cisco.com>
Wed, 25 May 2016 16:26:09 +0000 (18:26 +0200)
committerTom Pantelis <tpanteli@brocade.com>
Wed, 15 Jun 2016 03:16:18 +0000 (03:16 +0000)
This message is really tied to a particular LocalHistoryIdentifier,
express that by implementing Identifiable<LocalHistoryIdentifier>.

Change-Id: Ibc2c64656c55106b36873b168d348e2a1304ea74
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChain.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/CloseTransactionChainTest.java

index 77584eb..b6b7ae1 100644 (file)
@@ -595,7 +595,7 @@ public class Shard extends RaftActor {
     }
 
     private void closeTransactionChain(final CloseTransactionChain closeTransactionChain) {
-        store.closeTransactionChain(closeTransactionChain.getTransactionChainId());
+        store.closeTransactionChain(closeTransactionChain.getIdentifier());
     }
 
     private void createTransaction(CreateTransaction createTransaction) {
index 4fc725b..24c0c5c 100644 (file)
@@ -13,8 +13,9 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
+import org.opendaylight.yangtools.concepts.Identifiable;
 
-public class CloseTransactionChain extends VersionedExternalizableMessage {
+public class CloseTransactionChain extends VersionedExternalizableMessage implements Identifiable<LocalHistoryIdentifier> {
     private static final long serialVersionUID = 1L;
 
     private LocalHistoryIdentifier transactionChainId;
@@ -27,7 +28,8 @@ public class CloseTransactionChain extends VersionedExternalizableMessage {
         this.transactionChainId = Preconditions.checkNotNull(transactionChainId);
     }
 
-    public LocalHistoryIdentifier getTransactionChainId() {
+    @Override
+    public LocalHistoryIdentifier getIdentifier() {
         return transactionChainId;
     }
 
index 6ef0c88..385a167 100644 (file)
@@ -30,7 +30,7 @@ public class CloseTransactionChainTest extends AbstractTest {
 
         CloseTransactionChain actual = CloseTransactionChain.fromSerializable(
                 SerializationUtils.clone((Serializable) serialized));
-        assertEquals("getTransactionChainId", expected.getTransactionChainId(), actual.getTransactionChainId());
+        assertEquals("getIdentifier", expected.getIdentifier(), actual.getIdentifier());
         assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, actual.getVersion());
     }