Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Implementation of ModuleShardStrategy"
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
datastore
/
shardstrategy
/
ShardStrategyFactoryTest.java
diff --git
a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java
b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java
index 2cff981b680f99de9855db40ed68bd49ed23a2fb..0b348403b91f50d6a28198531851585087203d81 100644
(file)
--- a/
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java
+++ b/
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java
@@
-1,29
+1,48
@@
package org.opendaylight.controller.cluster.datastore.shardstrategy;
package org.opendaylight.controller.cluster.datastore.shardstrategy;
+import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.opendaylight.controller.cluster.datastore.ConfigurationImpl;
+import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
public class ShardStrategyFactoryTest {
public class ShardStrategyFactoryTest {
- @Rule
- public ExpectedException expectedEx = ExpectedException.none();
+
@Rule
+
public ExpectedException expectedEx = ExpectedException.none();
- @Test
- public void testGetStrategy(){
- ShardStrategy strategy = ShardStrategyFactory.getStrategy(TestModel.TEST_PATH);
- assertNotNull(strategy);
- }
+ @BeforeClass
+ public static void setUpClass(){
+ ShardStrategyFactory.setConfiguration(new ConfigurationImpl("module-shards.conf", "modules.conf"));
+ }
- @Test
- public void testGetStrategyNullPointerExceptionWhenPathIsNull(){
- expectedEx.expect(NullPointerException.class);
- expectedEx.expectMessage("path should not be null");
+ @Test
+ public void testGetStrategy() {
+ ShardStrategy strategy =
+ ShardStrategyFactory.getStrategy(TestModel.TEST_PATH);
+ assertNotNull(strategy);
+ }
- ShardStrategyFactory.getStrategy(null);
- }
+ @Test
+ public void testGetStrategyForKnownModuleName() {
+ ShardStrategy strategy =
+ ShardStrategyFactory.getStrategy(InstanceIdentifier.of(CarsModel.BASE_QNAME));
+ assertTrue(strategy instanceof ModuleShardStrategy);
+ }
-}
\ No newline at end of file
+
+ @Test
+ public void testGetStrategyNullPointerExceptionWhenPathIsNull() {
+ expectedEx.expect(NullPointerException.class);
+ expectedEx.expectMessage("path should not be null");
+
+ ShardStrategyFactory.getStrategy(null);
+ }
+
+}