Bug 8301: Fix some issues with testProducerRegistrations
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / IntegrationTestKit.java
index 01678ad..1c4bfcf 100644 (file)
@@ -128,7 +128,7 @@ public class IntegrationTestKit extends ShardTestKit {
         final ClusterWrapper cluster = new ClusterWrapperImpl(getSystem());
         final Configuration config = new ConfigurationImpl(moduleShardsConfig, modulesConfig);
 
-        datastoreContextBuilder.dataStoreName(typeName);
+        setDataStoreName(typeName);
 
         final DatastoreContext datastoreContext = datastoreContextBuilder.build();
         final DatastoreContextFactory mockContextFactory = Mockito.mock(DatastoreContextFactory.class);
@@ -152,12 +152,22 @@ public class IntegrationTestKit extends ShardTestKit {
         return dataStore;
     }
 
+    private void setDataStoreName(String typeName) {
+        if ("config".equals(typeName)) {
+            datastoreContextBuilder.logicalStoreType(LogicalDatastoreType.CONFIGURATION);
+        } else if ("operational".equals(typeName)) {
+            datastoreContextBuilder.logicalStoreType(LogicalDatastoreType.OPERATIONAL);
+        } else {
+            datastoreContextBuilder.dataStoreName(typeName);
+        }
+    }
+
     public DistributedDataStore setupDistributedDataStoreWithoutConfig(final String typeName,
                                                                        final SchemaContext schemaContext) {
         final ClusterWrapper cluster = new ClusterWrapperImpl(getSystem());
         final ConfigurationImpl configuration = new ConfigurationImpl(new EmptyModuleShardConfigProvider());
 
-        getDatastoreContextBuilder().dataStoreName(typeName);
+        setDataStoreName(typeName);
 
         final DatastoreContext datastoreContext = getDatastoreContextBuilder().build();
 
@@ -180,7 +190,7 @@ public class IntegrationTestKit extends ShardTestKit {
         final ClusterWrapper cluster = new ClusterWrapperImpl(getSystem());
         final ConfigurationImpl configuration = new ConfigurationImpl(new EmptyModuleShardConfigProvider());
 
-        getDatastoreContextBuilder().dataStoreName(typeName);
+        setDataStoreName(typeName);
 
         final DatastoreContext datastoreContext =
                 getDatastoreContextBuilder().logicalStoreType(storeType).build();

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.