@Test public void testRecoverConfigurationValueDefault() throws ConnectionException { ConnectorClusterConfig connectorClusterConfig = new ConnectorClusterConfig(new ClusterName("CLUSTER_NAME"), Collections.EMPTY_MAP,Collections.EMPTY_MAP); ConfigurationManager configurationManager = new ConfigurationManager(connectorClusterConfig); String[] value = configurationManager.recoverConfigurationValue(ConfigurationOptions.HOST); assertEquals("The value must be one",1,value.length); assertEquals("The value must be the default value",ConfigurationOptions.HOST.getDefaultValue()[0],value[0]); }
public String[] recoverConfigurationValue( ConfigurationOptions configurationOption) throws ConnectionException { String[] optionValue = {}; try { Map<String, String> config = configuration.getClusterOptions(); if (config != null) { String strPorts = config.get(configurationOption.getOptionName()); if (strPorts != null) { optionValue = PropertyValueRecovered.recoveredValueASArray(String.class, strPorts); } else { optionValue = configurationOption.getDefaultValue(); } } else { optionValue = configurationOption.getDefaultValue(); } }catch(ExecutionException e){ String msg = String.format("Error recovering [%s] option ",configurationOption.getOptionName()); logger.error(msg); throw new ConnectionException(msg,e); } return optionValue; }
ConfigurationManager { public String[] recoverConfigurationValue( ConfigurationOptions configurationOption) throws ConnectionException { String[] optionValue = {}; try { Map<String, String> config = configuration.getClusterOptions(); if (config != null) { String strPorts = config.get(configurationOption.getOptionName()); if (strPorts != null) { optionValue = PropertyValueRecovered.recoveredValueASArray(String.class, strPorts); } else { optionValue = configurationOption.getDefaultValue(); } } else { optionValue = configurationOption.getDefaultValue(); } }catch(ExecutionException e){ String msg = String.format("Error recovering [%s] option ",configurationOption.getOptionName()); logger.error(msg); throw new ConnectionException(msg,e); } return optionValue; } }
ConfigurationManager { public String[] recoverConfigurationValue( ConfigurationOptions configurationOption) throws ConnectionException { String[] optionValue = {}; try { Map<String, String> config = configuration.getClusterOptions(); if (config != null) { String strPorts = config.get(configurationOption.getOptionName()); if (strPorts != null) { optionValue = PropertyValueRecovered.recoveredValueASArray(String.class, strPorts); } else { optionValue = configurationOption.getDefaultValue(); } } else { optionValue = configurationOption.getDefaultValue(); } }catch(ExecutionException e){ String msg = String.format("Error recovering [%s] option ",configurationOption.getOptionName()); logger.error(msg); throw new ConnectionException(msg,e); } return optionValue; } ConfigurationManager(ConnectorClusterConfig configuration); }
ConfigurationManager { public String[] recoverConfigurationValue( ConfigurationOptions configurationOption) throws ConnectionException { String[] optionValue = {}; try { Map<String, String> config = configuration.getClusterOptions(); if (config != null) { String strPorts = config.get(configurationOption.getOptionName()); if (strPorts != null) { optionValue = PropertyValueRecovered.recoveredValueASArray(String.class, strPorts); } else { optionValue = configurationOption.getDefaultValue(); } } else { optionValue = configurationOption.getDefaultValue(); } }catch(ExecutionException e){ String msg = String.format("Error recovering [%s] option ",configurationOption.getOptionName()); logger.error(msg); throw new ConnectionException(msg,e); } return optionValue; } ConfigurationManager(ConnectorClusterConfig configuration); String[] recoverConfigurationValue( ConfigurationOptions configurationOption); }
ConfigurationManager { public String[] recoverConfigurationValue( ConfigurationOptions configurationOption) throws ConnectionException { String[] optionValue = {}; try { Map<String, String> config = configuration.getClusterOptions(); if (config != null) { String strPorts = config.get(configurationOption.getOptionName()); if (strPorts != null) { optionValue = PropertyValueRecovered.recoveredValueASArray(String.class, strPorts); } else { optionValue = configurationOption.getDefaultValue(); } } else { optionValue = configurationOption.getDefaultValue(); } }catch(ExecutionException e){ String msg = String.format("Error recovering [%s] option ",configurationOption.getOptionName()); logger.error(msg); throw new ConnectionException(msg,e); } return optionValue; } ConfigurationManager(ConnectorClusterConfig configuration); String[] recoverConfigurationValue( ConfigurationOptions configurationOption);  }