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.Before;
8 import org.junit.rules.ExpectedException;
9 import org.opendaylight.controller.cluster.datastore.config.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 {
16 ShardStrategyFactory factory;
19 public ExpectedException expectedEx = ExpectedException.none();
23 factory = new ShardStrategyFactory(new ConfigurationImpl("module-shards.conf", "modules.conf"));
27 public void testGetStrategy() {
28 ShardStrategy strategy = factory.getStrategy(TestModel.TEST_PATH);
29 assertNotNull(strategy);
33 public void testGetStrategyForKnownModuleName() {
34 ShardStrategy strategy = factory.getStrategy(YangInstanceIdentifier.of(CarsModel.BASE_QNAME));
35 assertTrue(strategy instanceof ModuleShardStrategy);
40 public void testGetStrategyNullPointerExceptionWhenPathIsNull() {
41 expectedEx.expect(NullPointerException.class);
42 expectedEx.expectMessage("path should not be null");
44 factory.getStrategy(null);