@Test public void testGlobalConfigDefaultLocationNotSet() { System.clearProperty(DEFAULT_CONFIG_VARIABLE); GlobalConfig.instance = null; try { GlobalConfig config = GlobalConfig.getInstance(); fail(DEFAULT_CONFIG_VARIABLE + " is not set so should throw an exception"); } catch (Exception e) { assertTrue(e instanceof EtiqetException); assertEquals("Could not find system property " + DEFAULT_CONFIG_VARIABLE + " to create global" + " configuration with", e.getMessage()); } }
public static GlobalConfig getInstance() throws EtiqetException { if (instance == null) { if (!Environment.isEnvVarSet(DEFAULT_CONFIG_VARIABLE)) { throw new EtiqetException( "Could not find system property " + DEFAULT_CONFIG_VARIABLE + " to create global" + " configuration with"); } LOG.debug("Creating default GlobalConfig from file {}", System.getProperty(DEFAULT_CONFIG_VARIABLE)); instance = new GlobalConfig(Environment.resolveEnvVars(System.getProperty(DEFAULT_CONFIG_VARIABLE))); } return instance; }
GlobalConfig { public static GlobalConfig getInstance() throws EtiqetException { if (instance == null) { if (!Environment.isEnvVarSet(DEFAULT_CONFIG_VARIABLE)) { throw new EtiqetException( "Could not find system property " + DEFAULT_CONFIG_VARIABLE + " to create global" + " configuration with"); } LOG.debug("Creating default GlobalConfig from file {}", System.getProperty(DEFAULT_CONFIG_VARIABLE)); instance = new GlobalConfig(Environment.resolveEnvVars(System.getProperty(DEFAULT_CONFIG_VARIABLE))); } return instance; } }
GlobalConfig { public static GlobalConfig getInstance() throws EtiqetException { if (instance == null) { if (!Environment.isEnvVarSet(DEFAULT_CONFIG_VARIABLE)) { throw new EtiqetException( "Could not find system property " + DEFAULT_CONFIG_VARIABLE + " to create global" + " configuration with"); } LOG.debug("Creating default GlobalConfig from file {}", System.getProperty(DEFAULT_CONFIG_VARIABLE)); instance = new GlobalConfig(Environment.resolveEnvVars(System.getProperty(DEFAULT_CONFIG_VARIABLE))); } return instance; } private  GlobalConfig(final String path); private  GlobalConfig(final Class<?> config); }
GlobalConfig { public static GlobalConfig getInstance() throws EtiqetException { if (instance == null) { if (!Environment.isEnvVarSet(DEFAULT_CONFIG_VARIABLE)) { throw new EtiqetException( "Could not find system property " + DEFAULT_CONFIG_VARIABLE + " to create global" + " configuration with"); } LOG.debug("Creating default GlobalConfig from file {}", System.getProperty(DEFAULT_CONFIG_VARIABLE)); instance = new GlobalConfig(Environment.resolveEnvVars(System.getProperty(DEFAULT_CONFIG_VARIABLE))); } return instance; } private  GlobalConfig(final String path); private  GlobalConfig(final Class<?> config); static GlobalConfig getInstance(); static GlobalConfig getInstance(String configPath); static GlobalConfig getInstance(Class<?> configurationClass); ProtocolConfig getProtocol(String name); Map<String, ProtocolConfig> getProtocols(); Client getClient(String name); Map<String, Client> getClients(); Server getServer(String name); Map<String, Server> getServers(); EtiqetConfiguration getConfig(); void setConfig(EtiqetConfiguration config); String getConfigPath(); Class<?> getConfigClass(); }
GlobalConfig { public static GlobalConfig getInstance() throws EtiqetException { if (instance == null) { if (!Environment.isEnvVarSet(DEFAULT_CONFIG_VARIABLE)) { throw new EtiqetException( "Could not find system property " + DEFAULT_CONFIG_VARIABLE + " to create global" + " configuration with"); } LOG.debug("Creating default GlobalConfig from file {}", System.getProperty(DEFAULT_CONFIG_VARIABLE)); instance = new GlobalConfig(Environment.resolveEnvVars(System.getProperty(DEFAULT_CONFIG_VARIABLE))); } return instance; } private  GlobalConfig(final String path); private  GlobalConfig(final Class<?> config); static GlobalConfig getInstance(); static GlobalConfig getInstance(String configPath); static GlobalConfig getInstance(Class<?> configurationClass); ProtocolConfig getProtocol(String name); Map<String, ProtocolConfig> getProtocols(); Client getClient(String name); Map<String, Client> getClients(); Server getServer(String name); Map<String, Server> getServers(); EtiqetConfiguration getConfig(); void setConfig(EtiqetConfiguration config); String getConfigPath(); Class<?> getConfigClass();  }