Bug 6186 - fix testCandidateSerialization() 91/41691/5
authorIsaku Yamahata <isaku.yamahata@intel.com>
Tue, 12 Jul 2016 04:15:53 +0000 (21:15 -0700)
committerTom Pantelis <tpanteli@brocade.com>
Fri, 15 Jul 2016 15:46:04 +0000 (15:46 +0000)
The changeset of 97ff7dff8e58531065833736d5788808ca9e0396 make
LocalHistoryIdentifier#write() use WritableObjects#writeLongs()
instead of WritableObjects#writeLong(). In some situations, the
header length of object may be shorter.
As a result CommitTransactionPayloadTest#testCandidateSerialization()
failes. This patch fixes it by setting transaction id,
history transaction id to known value when setting up test.

Change-Id: I7fbd912564a25c92bc29f7e10bdae8ce1be52b8f
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/persisted/CommitTransactionPayloadTest.java

index 66a4127..5dc04f2 100644 (file)
@@ -26,6 +26,11 @@ public abstract class AbstractTest {
     private static final AtomicLong HISTORY_COUNTER = new AtomicLong();
     private static final AtomicLong TX_COUNTER = new AtomicLong();
 
+    protected static void setUpStatic() {
+        HISTORY_COUNTER.set(1L);
+        TX_COUNTER.set(1L);
+    }
+
     protected static TransactionIdentifier nextTransactionId() {
         return new TransactionIdentifier(HISTORY_ID, TX_COUNTER.getAndIncrement());
     }
index 3f47e28..0b440c6 100644 (file)
@@ -103,6 +103,7 @@ public class CommitTransactionPayloadTest extends AbstractTest {
 
     @Before
     public void setUp() {
+        setUpStatic();
         final YangInstanceIdentifier writePath = TestModel.TEST_PATH;
         final NormalizedNode<?, ?> writeData = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
                 new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME)).