Make private methods static
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / IntegrationTestKit.java
index 2b2729c9598921cccdbb356b1bfd68c0f9bd87b4..1a7bbb21b3867134e50e163ee429392b1da12fde 100644 (file)
@@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit;
 import org.opendaylight.controller.cluster.datastore.DatastoreContext.Builder;
 import org.opendaylight.controller.cluster.datastore.config.Configuration;
 import org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl;
-import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
 import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
@@ -32,29 +31,35 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-class IntegrationTestKit extends ShardTestKit {
+public class IntegrationTestKit extends ShardTestKit {
 
     DatastoreContext.Builder datastoreContextBuilder;
 
-    IntegrationTestKit(ActorSystem actorSystem, Builder datastoreContextBuilder) {
+    public IntegrationTestKit(ActorSystem actorSystem, Builder datastoreContextBuilder) {
         super(actorSystem);
         this.datastoreContextBuilder = datastoreContextBuilder;
     }
 
-    DistributedDataStore setupDistributedDataStore(String typeName, String... shardNames) {
-        return setupDistributedDataStore(typeName, true, shardNames);
+    public DistributedDataStore setupDistributedDataStore(String typeName, String... shardNames) {
+        return setupDistributedDataStore(typeName, "module-shards.conf", true, SchemaContextHelper.full(), shardNames);
     }
 
-    DistributedDataStore setupDistributedDataStore(String typeName, boolean waitUntilLeader,
+    public DistributedDataStore setupDistributedDataStore(String typeName, boolean waitUntilLeader,
             String... shardNames) {
-        return setupDistributedDataStore(typeName, "module-shards.conf", waitUntilLeader, shardNames);
+        return setupDistributedDataStore(typeName, "module-shards.conf", waitUntilLeader,
+                SchemaContextHelper.full(), shardNames);
     }
 
-    DistributedDataStore setupDistributedDataStore(String typeName, String moduleShardsConfig, boolean waitUntilLeader,
-            String... shardNames) {
+    public DistributedDataStore setupDistributedDataStore(String typeName, String moduleShardsConfig,
+            boolean waitUntilLeader, String... shardNames) {
+        return setupDistributedDataStore(typeName, moduleShardsConfig, waitUntilLeader,
+                SchemaContextHelper.full(), shardNames);
+    }
+
+    public DistributedDataStore setupDistributedDataStore(String typeName, String moduleShardsConfig,
+            boolean waitUntilLeader, SchemaContext schemaContext, String... shardNames) {
         ClusterWrapper cluster = new ClusterWrapperImpl(getSystem());
         Configuration config = new ConfigurationImpl(moduleShardsConfig, "modules.conf");
-        ShardStrategyFactory.setConfiguration(config);
 
         datastoreContextBuilder.dataStoreType(typeName);
 
@@ -62,7 +67,6 @@ class IntegrationTestKit extends ShardTestKit {
 
         DistributedDataStore dataStore = new DistributedDataStore(getSystem(), cluster, config, datastoreContext);
 
-        SchemaContext schemaContext = SchemaContextHelper.full();
         dataStore.onGlobalContextUpdated(schemaContext);
 
         if(waitUntilLeader) {
@@ -72,7 +76,7 @@ class IntegrationTestKit extends ShardTestKit {
         return dataStore;
     }
 
-    void waitUntilLeader(ActorContext actorContext, String... shardNames) {
+    public void waitUntilLeader(ActorContext actorContext, String... shardNames) {
         for(String shardName: shardNames) {
             ActorRef shard = findLocalShard(actorContext, shardName);
 
@@ -82,7 +86,7 @@ class IntegrationTestKit extends ShardTestKit {
         }
     }
 
-    void waitUntilNoLeader(ActorContext actorContext, String... shardNames) {
+    public void waitUntilNoLeader(ActorContext actorContext, String... shardNames) {
         for(String shardName: shardNames) {
             ActorRef shard = findLocalShard(actorContext, shardName);
             assertNotNull("No local shard found", shard);
@@ -91,7 +95,7 @@ class IntegrationTestKit extends ShardTestKit {
         }
     }
 
-    private ActorRef findLocalShard(ActorContext actorContext, String shardName) {
+    private static ActorRef findLocalShard(ActorContext actorContext, String shardName) {
         ActorRef shard = null;
         for(int i = 0; i < 20 * 5 && shard == null; i++) {
             Uninterruptibles.sleepUninterruptibly(50, TimeUnit.MILLISECONDS);