HAConfiguration { public static List<String> getServerInstances(Configuration configuration) { String[] serverIds = configuration.getStringArray(ATLAS_SERVER_IDS); List<String> serverInstances = new ArrayList<>(serverIds.length); for (String serverId : serverIds) { serverInstances.add(getBoundAddressForId(configuration, serverId)); } return serverInstances; } private  HAConfiguration(); static boolean isHAEnabled(Configuration configuration); static String getBoundAddressForId(Configuration configuration, String serverId); static List<String> getServerInstances(Configuration configuration); static ZookeeperProperties getZookeeperProperties(Configuration configuration); static final String ATLAS_SERVER_ZK_ROOT_DEFAULT; static final String ATLAS_SERVER_HA_PREFIX; static final String ZOOKEEPER_PREFIX; static final String ATLAS_SERVER_HA_ZK_ROOT_KEY; static final String ATLAS_SERVER_HA_ENABLED_KEY; static final String ATLAS_SERVER_ADDRESS_PREFIX; static final String ATLAS_SERVER_IDS; static final String HA_ZOOKEEPER_CONNECT; static final int DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS; static final String HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS; static final String HA_ZOOKEEPER_NUM_RETRIES; static final int DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES; static final String HA_ZOOKEEPER_SESSION_TIMEOUT_MS; static final int DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS; static final String HA_ZOOKEEPER_ACL; static final String HA_ZOOKEEPER_AUTH; }
@Test public void testShouldReturnListOfAddressesInConfig() { when(configuration.getStringArray(HAConfiguration.ATLAS_SERVER_IDS)).thenReturn(TEST_ATLAS_SERVER_IDS_HA); when(configuration.getString(HAConfiguration.ATLAS_SERVER_ADDRESS_PREFIX +"id1")).thenReturn("127.0.0.1:21000"); when(configuration.getString(HAConfiguration.ATLAS_SERVER_ADDRESS_PREFIX +"id2")).thenReturn("127.0.0.1:31000"); List<String> serverInstances = HAConfiguration.getServerInstances(configuration); assertEquals(serverInstances.size(), 2); assertTrue(serverInstances.contains("http: assertTrue(serverInstances.contains("http: }