SystemConfig extends MapConfig { public List<String> getSystemNames() { Config subConf = subset(SYSTEMS_PREFIX, true); ArrayList<String> systemNames = new ArrayList<>(); for (Map.Entry<String, String> entry : subConf.entrySet()) { String key = entry.getKey(); if (key.endsWith(SYSTEM_FACTORY_SUFFIX)) { systemNames.add(key.replace(SYSTEM_FACTORY_SUFFIX, EMPTY)); } } return systemNames; } 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 testGetSystemNames() { Map<String, String> map = new HashMap<>(); map.put(MOCK_SYSTEM_FACTORY_NAME1, MOCK_SYSTEM_FACTORY_CLASSNAME1); map.put(MOCK_SYSTEM_FACTORY_NAME2, MOCK_SYSTEM_FACTORY_CLASSNAME2); SystemConfig systemConfig = new SystemConfig(new MapConfig(map)); assertEquals(2, systemConfig.getSystemNames().size()); assertTrue(systemConfig.getSystemNames().contains(MOCK_SYSTEM_NAME1)); assertTrue(systemConfig.getSystemNames().contains(MOCK_SYSTEM_NAME2)); }