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 77584eb63b90ed738cc9ad41edbf4068e8680b04..b6b7ae12c8d9eaac33f4e5bdadaf5dc483a13f39 100644 (file)
@@ -595,7 +595,7 @@ public class Shard extends RaftActor {
     }
 
     private void closeTransactionChain(final CloseTransactionChain closeTransactionChain) {
     }
 
     private void closeTransactionChain(final CloseTransactionChain closeTransactionChain) {
-        store.closeTransactionChain(closeTransactionChain.getTransactionChainId());
+        store.closeTransactionChain(closeTransactionChain.getIdentifier());
     }
 
     private void createTransaction(CreateTransaction createTransaction) {
     }
 
     private void createTransaction(CreateTransaction createTransaction) {
index 4fc725bd0ac8be3d24928924d52baf59229e2528..24c0c5cab100ebb04851bc3be14aac547cf51894 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 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;
     private static final long serialVersionUID = 1L;
 
     private LocalHistoryIdentifier transactionChainId;
@@ -27,7 +28,8 @@ public class CloseTransactionChain extends VersionedExternalizableMessage {
         this.transactionChainId = Preconditions.checkNotNull(transactionChainId);
     }
 
         this.transactionChainId = Preconditions.checkNotNull(transactionChainId);
     }
 
-    public LocalHistoryIdentifier getTransactionChainId() {
+    @Override
+    public LocalHistoryIdentifier getIdentifier() {
         return transactionChainId;
     }
 
         return transactionChainId;
     }
 
index 6ef0c887d8d90a117f57c0b427ef0bd9e2b45e8e..385a167b59b8e5e8e2e2b082bfd3d1353cc394e9 100644 (file)
@@ -30,7 +30,7 @@ public class CloseTransactionChainTest extends AbstractTest {
 
         CloseTransactionChain actual = CloseTransactionChain.fromSerializable(
                 SerializationUtils.clone((Serializable) serialized));
 
         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());
     }
 
         assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, actual.getVersion());
     }