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%2FDatastoreContextIntrospectorTest.java;h=e397d1bb4e816296bc5676c122b71a95a9fe6cf5;hp=9ae1e0a9a884b501ccae6487f232f310a66eaf7f;hb=cd3a0e09db5a1def00c46a4be245dbdf648b539c;hpb=88f763ec4ec2bcc1e0fd414ccb2f105f7490b8e9 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 9ae1e0a9a8..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,6 +14,7 @@ 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; @@ -29,9 +30,9 @@ public class DatastoreContextIntrospectorTest { @Test public void testUpdate() { - DatastoreContext context = DatastoreContext.newBuilder(). - logicalStoreType(LogicalDatastoreType.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"); @@ -112,16 +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(). - logicalStoreType(LogicalDatastoreType.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 @@ -145,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()); @@ -168,8 +170,8 @@ public class DatastoreContextIntrospectorTest { properties.put("persistent", "false"); // global setting properties.put("operational.Persistent", "true"); // operational override - DatastoreContext operContext = DatastoreContext.newBuilder(). - logicalStoreType(LogicalDatastoreType.OPERATIONAL).build(); + DatastoreContext operContext = DatastoreContext.newBuilder() + .logicalStoreType(LogicalDatastoreType.OPERATIONAL).build(); DatastoreContextIntrospector operIntrospector = new DatastoreContextIntrospector(operContext); boolean updated = operIntrospector.update(properties); assertEquals("updated", true, updated); @@ -199,8 +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(). - logicalStoreType(LogicalDatastoreType.OPERATIONAL).build(); + DatastoreContext operContext = DatastoreContext.newBuilder() + .logicalStoreType(LogicalDatastoreType.OPERATIONAL).build(); DatastoreContextIntrospector operIntrospector = new DatastoreContextIntrospector(operContext); DatastoreContext shardContext = operIntrospector.newContextFactory().getShardDatastoreContext("topology"); @@ -213,8 +215,8 @@ public class DatastoreContextIntrospectorTest { shardContext = operIntrospector.newContextFactory().getShardDatastoreContext("topology"); assertEquals(55, shardContext.getShardTransactionIdleTimeout().toMinutes()); - DatastoreContext configContext = DatastoreContext.newBuilder(). - logicalStoreType(LogicalDatastoreType.CONFIGURATION).build(); + DatastoreContext configContext = DatastoreContext.newBuilder() + .logicalStoreType(LogicalDatastoreType.CONFIGURATION).build(); DatastoreContextIntrospector configIntrospector = new DatastoreContextIntrospector(configContext); configIntrospector.update(properties); configContext = configIntrospector.getContext(); @@ -223,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");