X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fshardstrategy%2FShardStrategyFactoryTest.java;h=e7b70e8c1e84171f63328d2050d1ecae86bcbc03;hp=ab74ba811a6348c4969a2408644b0e48502af076;hb=c1336f9b497bc6867536a24f629c3f0b002ccb2f;hpb=6d73d16b194435ea1ea783a37d1b51fc1f558a1f 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 ab74ba811a..e7b70e8c1e 100644 --- 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,39 +1,48 @@ +/* + * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + package org.opendaylight.controller.cluster.datastore.shardstrategy; -import org.junit.BeforeClass; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.opendaylight.controller.cluster.datastore.ConfigurationImpl; +import org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl; import org.opendaylight.controller.md.cluster.datastore.model.CarsModel; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; - public class ShardStrategyFactoryTest { + ShardStrategyFactory factory; + @Rule public ExpectedException expectedEx = ExpectedException.none(); - @BeforeClass - public static void setUpClass(){ - ShardStrategyFactory.setConfiguration(new ConfigurationImpl("module-shards.conf", "modules.conf")); + @Before + public void setUp() { + factory = new ShardStrategyFactory( + new ConfigurationImpl("module-shards.conf", "modules.conf"), LogicalDatastoreType.CONFIGURATION); } @Test public void testGetStrategy() { - ShardStrategy strategy = - ShardStrategyFactory.getStrategy(TestModel.TEST_PATH); + ShardStrategy strategy = factory.getStrategy(TestModel.TEST_PATH); assertNotNull(strategy); } @Test public void testGetStrategyForKnownModuleName() { - ShardStrategy strategy = - ShardStrategyFactory.getStrategy( - YangInstanceIdentifier.of(CarsModel.BASE_QNAME)); + ShardStrategy strategy = factory.getStrategy(YangInstanceIdentifier.of(CarsModel.BASE_QNAME)); assertTrue(strategy instanceof ModuleShardStrategy); } @@ -43,7 +52,6 @@ public class ShardStrategyFactoryTest { expectedEx.expect(NullPointerException.class); expectedEx.expectMessage("path should not be null"); - ShardStrategyFactory.getStrategy(null); + factory.getStrategy(null); } - }