1 package org.opendaylight.controller.cluster.datastore.shardstrategy;
3 import static org.junit.Assert.assertNotNull;
4 import static org.junit.Assert.assertTrue;
5 import org.junit.BeforeClass;
8 import org.junit.rules.ExpectedException;
9 import org.opendaylight.controller.cluster.datastore.ConfigurationImpl;
10 import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
11 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
14 public class ShardStrategyFactoryTest {
17 public ExpectedException expectedEx = ExpectedException.none();
20 public static void setUpClass(){
21 ShardStrategyFactory.setConfiguration(new ConfigurationImpl("module-shards.conf", "modules.conf"));
25 public void testGetStrategy() {
26 ShardStrategy strategy =
27 ShardStrategyFactory.getStrategy(TestModel.TEST_PATH);
28 assertNotNull(strategy);
32 public void testGetStrategyForKnownModuleName() {
33 ShardStrategy strategy =
34 ShardStrategyFactory.getStrategy(
35 YangInstanceIdentifier.of(CarsModel.BASE_QNAME));
36 assertTrue(strategy instanceof ModuleShardStrategy);
41 public void testGetStrategyNullPointerExceptionWhenPathIsNull() {
42 expectedEx.expect(NullPointerException.class);
43 expectedEx.expectMessage("path should not be null");
45 ShardStrategyFactory.getStrategy(null);