Implementation of ModuleShardStrategy
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / shardstrategy / ModuleShardStrategyTest.java
1 package org.opendaylight.controller.cluster.datastore.shardstrategy;
2
3 import junit.framework.Assert;
4 import org.junit.BeforeClass;
5 import org.junit.Rule;
6 import org.junit.Test;
7 import org.junit.rules.ExpectedException;
8 import org.opendaylight.controller.cluster.datastore.Configuration;
9 import org.opendaylight.controller.cluster.datastore.ConfigurationImpl;
10 import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
11
12 public class ModuleShardStrategyTest {
13     @Rule
14     public ExpectedException expectedEx = ExpectedException.none();
15
16     private static Configuration configuration;
17
18     @BeforeClass
19     public static void setUpClass(){
20         configuration = new ConfigurationImpl("module-shards.conf", "modules.conf");
21     }
22
23
24     @Test
25     public void testFindShard() throws Exception {
26         ModuleShardStrategy moduleShardStrategy =
27             new ModuleShardStrategy("cars", configuration);
28
29         String shard = moduleShardStrategy.findShard(CarsModel.BASE_PATH);
30
31         Assert.assertEquals("cars-1", shard);
32     }
33 }