KinesisConfig extends MapConfig { public Set<String> getKinesisStreams(String system) { Config streamsConfig = subset(String.format("systems.%s.streams.", system), true); Set<String> streams = new HashSet<>(); streamsConfig.keySet().forEach(key -> { String[] parts = key.split("\\.", 2); if (parts.length != 2) { throw new IllegalArgumentException("Ill-formatted stream config: " + key); } streams.add(parts[0]); }); return streams; } KinesisConfig(Config config); Set<String> getKinesisStreams(String system); KinesisClientLibConfiguration getKinesisClientLibConfig(String system, String stream, String appName); static final String CONFIG_SYSTEM_REGION; static final String CONFIG_STREAM_REGION; static final String CONFIG_STREAM_ACCESS_KEY; static final String CONFIG_STREAM_SECRET_KEY; static final String CONFIG_AWS_CLIENT_CONFIG; static final String CONFIG_PROXY_HOST; static final String DEFAULT_CONFIG_PROXY_HOST; static final String CONFIG_PROXY_PORT; static final int DEFAULT_CONFIG_PROXY_PORT; static final String CONFIG_SYSTEM_KINESIS_CLIENT_LIB_CONFIG; static final String CONFIG_STREAM_KINESIS_CLIENT_LIB_CONFIG; }
@Test public void testGetKinesisStreams() { Map<String, String> kv = new HashMap<>(); kv.put("systems.kinesis.streams.kinesis-stream1.prop1", "value1"); kv.put("systems.kinesis.streams.kinesis-stream1.prop2", "value2"); kv.put("systems.kinesis.streams.kinesis-stream2.prop1", "value3"); Config config = new MapConfig(kv); KinesisConfig kConfig = new KinesisConfig(config); Set<String> streams = kConfig.getKinesisStreams("kinesis"); assertEquals(2, streams.size()); }