X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fmessages%2FReadyLocalTransactionSerializerTest.java;h=fc09965ccc027b43b74f5b4cf84af987c5711c69;hb=f9ee2cce797cf12402dd55c406f3e270d7d2e20d;hp=5a585bcd372733d9a807e61ffd965e257128517f;hpb=c64b1e26da272928abe57648757d578c2ac33869;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/ReadyLocalTransactionSerializerTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/ReadyLocalTransactionSerializerTest.java index 5a585bcd37..fc09965ccc 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/ReadyLocalTransactionSerializerTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/messages/ReadyLocalTransactionSerializerTest.java @@ -9,11 +9,15 @@ package org.opendaylight.controller.cluster.datastore.messages; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import akka.actor.ExtendedActorSystem; -import akka.testkit.JavaTestKit; +import akka.testkit.javadsl.TestKit; +import com.google.common.collect.ImmutableSortedSet; import java.io.NotSerializableException; import java.util.List; +import java.util.Optional; +import java.util.SortedSet; import org.junit.Test; import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; import org.opendaylight.controller.cluster.datastore.AbstractTest; @@ -48,8 +52,10 @@ public class ReadyLocalTransactionSerializerTest extends AbstractTest { MapNode mergeData = ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build(); new MergeModification(TestModel.OUTER_LIST_PATH, mergeData).apply(modification); + final SortedSet shardNames = ImmutableSortedSet.of("one", "two"); TransactionIdentifier txId = nextTransactionId(); - ReadyLocalTransaction readyMessage = new ReadyLocalTransaction(txId, modification, true); + ReadyLocalTransaction readyMessage = new ReadyLocalTransaction(txId, modification, true, + Optional.of(shardNames)); final ExtendedActorSystem system = (ExtendedActorSystem) ExtendedActorSystem.create("test"); final Object deserialized; @@ -58,7 +64,7 @@ public class ReadyLocalTransactionSerializerTest extends AbstractTest { final byte[] bytes = serializer.toBinary(readyMessage); deserialized = serializer.fromBinary(bytes, ReadyLocalTransaction.class); } finally { - JavaTestKit.shutdownActorSystem(system); + TestKit.shutdownActorSystem(system); } assertNotNull("fromBinary returned null", deserialized); @@ -66,6 +72,10 @@ public class ReadyLocalTransactionSerializerTest extends AbstractTest { BatchedModifications batched = (BatchedModifications)deserialized; assertEquals("getTransactionID", txId, batched.getTransactionId()); assertEquals("getVersion", DataStoreVersions.CURRENT_VERSION, batched.getVersion()); + assertTrue("isReady", batched.isReady()); + assertTrue("isDoCommitOnReady", batched.isDoCommitOnReady()); + assertTrue("participatingShardNames present", batched.getParticipatingShardNames().isPresent()); + assertEquals("participatingShardNames", shardNames, batched.getParticipatingShardNames().get()); List batchedMods = batched.getModifications(); assertEquals("getModifications size", 2, batchedMods.size());