SystemConfig extends MapConfig { public Config getDefaultStreamProperties(String systemName) { return subset(String.format(SYSTEM_DEFAULT_STREAMS_PREFIX_FORMAT, systemName), true); } SystemConfig(Config config); Optional<String> getSystemFactory(String systemName); List<String> getSystemNames(); Map<String, SystemAdmin> getSystemAdmins(String adminLabel); Map<String, SystemAdmin> getSystemAdmins(); SystemAdmin getSystemAdmin(String systemName, String adminLabel); SystemAdmin getSystemAdmin(String systemName); Map<String, SystemFactory> getSystemFactories(); Config getDefaultStreamProperties(String systemName); String getSystemOffsetDefault(String systemName); Optional<String> getSystemKeySerde(String systemName); Optional<String> getSystemMsgSerde(String systemName); boolean deleteCommittedMessages(String systemName); static final String SYSTEM_ID_PREFIX; static final String SYSTEM_FACTORY_FORMAT; static final String SYSTEM_DEFAULT_STREAMS_PREFIX_FORMAT; }
@Test public void testGetDefaultStreamProperties() { String defaultStreamPrefix = buildDefaultStreamPropertiesPrefix(MOCK_SYSTEM_NAME1); String system1ConfigKey = "config1-key"; String system1ConfigValue = "config1-value"; String system2ConfigKey = "config2-key"; String system2ConfigValue = "config2-value"; Config config = new MapConfig(ImmutableMap.of(defaultStreamPrefix + system1ConfigKey, system1ConfigValue, defaultStreamPrefix + system2ConfigKey, system2ConfigValue)); Config expected = new MapConfig(ImmutableMap.of(system1ConfigKey, system1ConfigValue, system2ConfigKey, system2ConfigValue)); SystemConfig systemConfig = new SystemConfig(config); assertEquals(expected, systemConfig.getDefaultStreamProperties(MOCK_SYSTEM_NAME1)); assertEquals(new MapConfig(), systemConfig.getDefaultStreamProperties(MOCK_SYSTEM_NAME2)); }