Merge "BUG 2317 : StatisticsManager does not unregister from yang notifications on...
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / shardstrategy / ModuleShardStrategyTest.java
index 88753e4b0a56165ed6cba8e2433f9bbc0089e8dc..b895b75fcde1ee7421b324492319c59d0bfc6d93 100644 (file)
@@ -1,6 +1,6 @@
 package org.opendaylight.controller.cluster.datastore.shardstrategy;
 
-import junit.framework.Assert;
+import static org.junit.Assert.assertEquals;
 import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
@@ -8,6 +8,8 @@ import org.junit.rules.ExpectedException;
 import org.opendaylight.controller.cluster.datastore.Configuration;
 import org.opendaylight.controller.cluster.datastore.ConfigurationImpl;
 import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 public class ModuleShardStrategyTest {
     @Rule
@@ -28,6 +30,23 @@ public class ModuleShardStrategyTest {
 
         String shard = moduleShardStrategy.findShard(CarsModel.BASE_PATH);
 
-        Assert.assertEquals("cars-1", shard);
+        assertEquals("cars-1", shard);
+    }
+
+    @Test
+    public void testFindShardWhenModuleConfigurationPresentInModulesButMissingInModuleShards() {
+
+        final QName BASE_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:missing", "2014-03-13",
+            "missing");
+
+        final YangInstanceIdentifier BASE_PATH = YangInstanceIdentifier.of(BASE_QNAME);
+
+        ModuleShardStrategy moduleShardStrategy =
+            new ModuleShardStrategy("missing", configuration);
+
+        String shard = moduleShardStrategy.findShard(BASE_PATH);
+
+        assertEquals(DefaultShardStrategy.DEFAULT_SHARD, shard);
+
     }
 }