From bd4f0b8a037ce953cd3c6aad5abc7d2c7be01c69 Mon Sep 17 00:00:00 2001 From: Tom Pantelis Date: Mon, 15 Jun 2015 21:11:19 -0400 Subject: [PATCH] Fix CDS unit test failures Manually cherry-picked from stable/lithium patch https://git.opendaylight.org/gerrit/#/c/22659/ Change-Id: Id075cdff80dbee236067f4786f2dcf904ad8b800 Signed-off-by: Tom Pantelis --- .../datastore/compat/PreLithiumShardTest.java | 20 +++++++++++-------- .../md/cluster/datastore/model/TestModel.java | 1 - .../test/resources/odl-datastore-test.yang | 8 ++++++++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumShardTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumShardTest.java index 07b7f0e334..f5de8a129c 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumShardTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumShardTest.java @@ -133,20 +133,24 @@ public class PreLithiumShardTest extends AbstractShardTest { @Test public void testHelium2VersionApplyStateLegacy() throws Exception { + new ShardTestKit(getSystem()) {{ + TestActorRef shard = TestActorRef.create(getSystem(), newShardProps(), + "testHelium2VersionApplyStateLegacy"); - TestActorRef shard = TestActorRef.create(getSystem(), newShardProps(), "testHelium2VersionApplyStateLegacy"); + waitUntilLeader(shard); - NormalizedNode node = ImmutableNodes.containerNode(TestModel.TEST_QNAME); + NormalizedNode node = ImmutableNodes.containerNode(TestModel.TEST_QNAME); - ApplyState applyState = new ApplyState(null, "test", new ReplicatedLogImplEntry(1, 2, - newLegacyByteStringPayload(new WriteModification(TestModel.TEST_PATH, node)))); + ApplyState applyState = new ApplyState(null, "test", new ReplicatedLogImplEntry(1, 2, + newLegacyByteStringPayload(new WriteModification(TestModel.TEST_PATH, node)))); - shard.underlyingActor().onReceiveCommand(applyState); + shard.underlyingActor().onReceiveCommand(applyState); - NormalizedNode actual = readStore(shard, TestModel.TEST_PATH); - assertEquals("Applied state", node, actual); + NormalizedNode actual = readStore(shard, TestModel.TEST_PATH); + assertEquals("Applied state", node, actual); - shard.tell(PoisonPill.getInstance(), ActorRef.noSender()); + shard.tell(PoisonPill.getInstance(), ActorRef.noSender()); + }}; } @Test diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java index 07e9b29942..c4fb9a11dd 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/TestModel.java @@ -35,7 +35,6 @@ public class TestModel { public static final QName ID_QNAME = QName.create(TEST_QNAME, "id"); public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name"); public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc"); - public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value"); private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang"; public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-test.yang b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-test.yang index e36f38ea96..98c7bb453d 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-test.yang +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/resources/odl-datastore-test.yang @@ -8,6 +8,14 @@ module odl-datastore-test { } container test { + leaf name { + type string; + } + + leaf desc { + type string; + } + list outer-list { key id; leaf id { -- 2.36.6