HAConfiguration { public static ZookeeperProperties getZookeeperProperties(Configuration configuration) { String zookeeperConnectString = configuration.getString("atlas.kafka." + ZOOKEEPER_PREFIX + "connect"); if (configuration.containsKey(HA_ZOOKEEPER_CONNECT)) { zookeeperConnectString = configuration.getString(HA_ZOOKEEPER_CONNECT); } String zkRoot = configuration.getString(ATLAS_SERVER_HA_ZK_ROOT_KEY, ATLAS_SERVER_ZK_ROOT_DEFAULT); int retriesSleepTimeMillis = configuration.getInt(HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS, DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS); int numRetries = configuration.getInt(HA_ZOOKEEPER_NUM_RETRIES, DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES); int sessionTimeout = configuration.getInt(HA_ZOOKEEPER_SESSION_TIMEOUT_MS, DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS); String acl = configuration.getString(HA_ZOOKEEPER_ACL); String auth = configuration.getString(HA_ZOOKEEPER_AUTH); return new ZookeeperProperties(zookeeperConnectString, zkRoot, retriesSleepTimeMillis, numRetries, sessionTimeout, acl, auth); } 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 testShouldGetZookeeperAcl() { when(configuration.getString(HAConfiguration.HA_ZOOKEEPER_ACL)).thenReturn("sasl:myclient@EXAMPLE.COM"); HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration); assertTrue(zookeeperProperties.hasAcl()); }
@Test public void testShouldGetZookeeperAuth() { when(configuration.getString(HAConfiguration.HA_ZOOKEEPER_AUTH)).thenReturn("sasl:myclient@EXAMPLE.COM"); HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration); assertTrue(zookeeperProperties.hasAuth()); }