X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDatastoreContextIntrospectorTest.java;h=e397d1bb4e816296bc5676c122b71a95a9fe6cf5;hb=149feb98f151186975fe42bab5853e05aafd4b51;hp=2bd2e61296daec3f41d9264b78d8652d3159c762;hpb=c2d1b9207fe82d36db83501e1baaffe7bc7da9ae;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DatastoreContextIntrospectorTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DatastoreContextIntrospectorTest.java index 2bd2e61296..e397d1bb4e 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DatastoreContextIntrospectorTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DatastoreContextIntrospectorTest.java @@ -14,9 +14,11 @@ import static org.opendaylight.controller.cluster.datastore.DatastoreContext.DEF import static org.opendaylight.controller.cluster.datastore.DatastoreContext.DEFAULT_SHARD_SNAPSHOT_DATA_THRESHOLD_PERCENTAGE; import static org.opendaylight.controller.cluster.datastore.DatastoreContext.DEFAULT_SHARD_TRANSACTION_IDLE_TIMEOUT; import static org.opendaylight.controller.cluster.datastore.DatastoreContext.DEFAULT_SHARD_TX_COMMIT_TIMEOUT_IN_SECONDS; + import java.util.Dictionary; import java.util.Hashtable; import org.junit.Test; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreConfigProperties; /** @@ -28,8 +30,9 @@ public class DatastoreContextIntrospectorTest { @Test public void testUpdate() { - DatastoreContext context = DatastoreContext.newBuilder().dataStoreType("operational").build(); - DatastoreContextIntrospector introspector = new DatastoreContextIntrospector(context ); + DatastoreContext context = DatastoreContext.newBuilder() + .logicalStoreType(LogicalDatastoreType.OPERATIONAL).build(); + DatastoreContextIntrospector introspector = new DatastoreContextIntrospector(context); Dictionary properties = new Hashtable<>(); properties.put("shard-transaction-idle-timeout-in-minutes", "31"); @@ -110,15 +113,16 @@ public class DatastoreContextIntrospectorTest { updated = introspector.update(null); assertEquals("updated", false, updated); - updated = introspector.update(new Hashtable()); + updated = introspector.update(new Hashtable<>()); assertEquals("updated", false, updated); } @Test public void testUpdateWithInvalidValues() { - DatastoreContext context = DatastoreContext.newBuilder().dataStoreType("operational").build(); - DatastoreContextIntrospector introspector = new DatastoreContextIntrospector(context ); + DatastoreContext context = DatastoreContext.newBuilder() + .logicalStoreType(LogicalDatastoreType.OPERATIONAL).build(); + DatastoreContextIntrospector introspector = new DatastoreContextIntrospector(context); Dictionary properties = new Hashtable<>(); properties.put("shard-transaction-idle-timeout-in-minutes", "0"); // bad - must be > 0 @@ -142,7 +146,8 @@ public class DatastoreContextIntrospectorTest { assertEquals(DEFAULT_SHARD_TX_COMMIT_TIMEOUT_IN_SECONDS, context.getShardTransactionCommitTimeoutInSeconds()); assertEquals(212, context.getShardRaftConfig().getSnapshotBatchCount()); assertEquals(DEFAULT_OPERATION_TIMEOUT_IN_MS, context.getOperationTimeoutInMillis()); - assertEquals(DEFAULT_HEARTBEAT_INTERVAL_IN_MILLIS, context.getShardRaftConfig().getHeartBeatInterval().length()); + assertEquals(DEFAULT_HEARTBEAT_INTERVAL_IN_MILLIS, + context.getShardRaftConfig().getHeartBeatInterval().length()); assertEquals(567, context.getShardTransactionCommitQueueCapacity()); assertEquals(DEFAULT_SHARD_SNAPSHOT_DATA_THRESHOLD_PERCENTAGE, context.getShardRaftConfig().getSnapshotDataThresholdPercentage()); @@ -165,7 +170,8 @@ public class DatastoreContextIntrospectorTest { properties.put("persistent", "false"); // global setting properties.put("operational.Persistent", "true"); // operational override - DatastoreContext operContext = DatastoreContext.newBuilder().dataStoreType("operational").build(); + DatastoreContext operContext = DatastoreContext.newBuilder() + .logicalStoreType(LogicalDatastoreType.OPERATIONAL).build(); DatastoreContextIntrospector operIntrospector = new DatastoreContextIntrospector(operContext); boolean updated = operIntrospector.update(properties); assertEquals("updated", true, updated); @@ -175,7 +181,8 @@ public class DatastoreContextIntrospectorTest { assertEquals(true, operContext.isPersistent()); assertEquals(333, operContext.getDataStoreProperties().getMaxDataChangeExecutorPoolSize()); - DatastoreContext configContext = DatastoreContext.newBuilder().dataStoreType("config").build(); + DatastoreContext configContext = DatastoreContext.newBuilder() + .logicalStoreType(LogicalDatastoreType.CONFIGURATION).build(); DatastoreContextIntrospector configIntrospector = new DatastoreContextIntrospector(configContext); updated = configIntrospector.update(properties); assertEquals("updated", true, updated); @@ -194,7 +201,8 @@ public class DatastoreContextIntrospectorTest { properties.put("config.shard-transaction-idle-timeout-in-minutes", "44"); // config override properties.put("topology.shard-transaction-idle-timeout-in-minutes", "55"); // global shard override - DatastoreContext operContext = DatastoreContext.newBuilder().dataStoreType("operational").build(); + DatastoreContext operContext = DatastoreContext.newBuilder() + .logicalStoreType(LogicalDatastoreType.OPERATIONAL).build(); DatastoreContextIntrospector operIntrospector = new DatastoreContextIntrospector(operContext); DatastoreContext shardContext = operIntrospector.newContextFactory().getShardDatastoreContext("topology"); @@ -207,7 +215,8 @@ public class DatastoreContextIntrospectorTest { shardContext = operIntrospector.newContextFactory().getShardDatastoreContext("topology"); assertEquals(55, shardContext.getShardTransactionIdleTimeout().toMinutes()); - DatastoreContext configContext = DatastoreContext.newBuilder().dataStoreType("config").build(); + DatastoreContext configContext = DatastoreContext.newBuilder() + .logicalStoreType(LogicalDatastoreType.CONFIGURATION).build(); DatastoreContextIntrospector configIntrospector = new DatastoreContextIntrospector(configContext); configIntrospector.update(properties); configContext = configIntrospector.getContext(); @@ -216,8 +225,10 @@ public class DatastoreContextIntrospectorTest { shardContext = configIntrospector.newContextFactory().getShardDatastoreContext("topology"); assertEquals(55, shardContext.getShardTransactionIdleTimeout().toMinutes()); - properties.put("operational.topology.shard-transaction-idle-timeout-in-minutes", "66"); // operational shard override - properties.put("config.topology.shard-transaction-idle-timeout-in-minutes", "77"); // config shard override + // operational shard override + properties.put("operational.topology.shard-transaction-idle-timeout-in-minutes", "66"); + // config shard override + properties.put("config.topology.shard-transaction-idle-timeout-in-minutes", "77"); operIntrospector.update(properties); shardContext = operIntrospector.newContextFactory().getShardDatastoreContext("topology");