@Test public void testReadStrategies() { final Map<Object, Object> props = new java.util.HashMap<>(); props.put("entity.type.test", "org.opendaylight.controller.cluster.entityownership.selectionstrategy.LastCandidateSelectionStrategy,100"); final EntityOwnerSelectionStrategyConfig config = EntityOwnerSelectionStrategyConfigReader .loadStrategyWithConfig(props); assertTrue(config.isStrategyConfigured("test")); final EntityOwnerSelectionStrategy strategy = config.createStrategy("test", Collections.<String, Long>emptyMap()); assertTrue(strategy.toString(), strategy instanceof LastCandidateSelectionStrategy); assertEquals(100L, strategy.getSelectionDelayInMillis()); final EntityOwnerSelectionStrategy strategy1 = config.createStrategy("test", Collections.emptyMap()); assertEquals(strategy, strategy1); config.clearStrategies(); final EntityOwnerSelectionStrategy strategy2 = config.createStrategy("test", Collections.emptyMap()); assertNotEquals(strategy1, strategy2); }
@SuppressWarnings("checkstyle:IllegalCatch") public static EntityOwnerSelectionStrategyConfig loadStrategyWithConfig(final Map<Object, Object> props) { final EntityOwnerSelectionStrategyConfig.Builder builder = EntityOwnerSelectionStrategyConfig.newBuilder(); if (props != null && !props.isEmpty()) { parseConfiguration(builder, props); } else { if (props == null) { LOG.debug("Could not read strategy configuration file, will use default configuration."); } else { LOG.debug("Configuration file is empty, will use default configuration."); } } return builder.build(); }
EntityOwnerSelectionStrategyConfigReader { @SuppressWarnings("checkstyle:IllegalCatch") public static EntityOwnerSelectionStrategyConfig loadStrategyWithConfig(final Map<Object, Object> props) { final EntityOwnerSelectionStrategyConfig.Builder builder = EntityOwnerSelectionStrategyConfig.newBuilder(); if (props != null && !props.isEmpty()) { parseConfiguration(builder, props); } else { if (props == null) { LOG.debug("Could not read strategy configuration file, will use default configuration."); } else { LOG.debug("Configuration file is empty, will use default configuration."); } } return builder.build(); } }
EntityOwnerSelectionStrategyConfigReader { @SuppressWarnings("checkstyle:IllegalCatch") public static EntityOwnerSelectionStrategyConfig loadStrategyWithConfig(final Map<Object, Object> props) { final EntityOwnerSelectionStrategyConfig.Builder builder = EntityOwnerSelectionStrategyConfig.newBuilder(); if (props != null && !props.isEmpty()) { parseConfiguration(builder, props); } else { if (props == null) { LOG.debug("Could not read strategy configuration file, will use default configuration."); } else { LOG.debug("Configuration file is empty, will use default configuration."); } } return builder.build(); } private  EntityOwnerSelectionStrategyConfigReader(); }
EntityOwnerSelectionStrategyConfigReader { @SuppressWarnings("checkstyle:IllegalCatch") public static EntityOwnerSelectionStrategyConfig loadStrategyWithConfig(final Map<Object, Object> props) { final EntityOwnerSelectionStrategyConfig.Builder builder = EntityOwnerSelectionStrategyConfig.newBuilder(); if (props != null && !props.isEmpty()) { parseConfiguration(builder, props); } else { if (props == null) { LOG.debug("Could not read strategy configuration file, will use default configuration."); } else { LOG.debug("Configuration file is empty, will use default configuration."); } } return builder.build(); } private  EntityOwnerSelectionStrategyConfigReader(); @SuppressWarnings("checkstyle:IllegalCatch") static EntityOwnerSelectionStrategyConfig loadStrategyWithConfig(final Map<Object, Object> props); }
EntityOwnerSelectionStrategyConfigReader { @SuppressWarnings("checkstyle:IllegalCatch") public static EntityOwnerSelectionStrategyConfig loadStrategyWithConfig(final Map<Object, Object> props) { final EntityOwnerSelectionStrategyConfig.Builder builder = EntityOwnerSelectionStrategyConfig.newBuilder(); if (props != null && !props.isEmpty()) { parseConfiguration(builder, props); } else { if (props == null) { LOG.debug("Could not read strategy configuration file, will use default configuration."); } else { LOG.debug("Configuration file is empty, will use default configuration."); } } return builder.build(); } private  EntityOwnerSelectionStrategyConfigReader(); @SuppressWarnings("checkstyle:IllegalCatch") static EntityOwnerSelectionStrategyConfig loadStrategyWithConfig(final Map<Object, Object> props);  }