/** * Get {@link SystemFactory} instances for all the systems defined in this config. * * @return a map from system name to {@link SystemFactory} */ public Map<String, SystemFactory> getSystemFactories() { Map<String, SystemFactory> systemFactories = getSystemNames().stream().collect(Collectors.toMap( systemName -> systemName, systemName -> { String systemFactoryClassName = getSystemFactory(systemName); if (systemFactoryClassName == null) { throw new SamzaException( String.format("A stream uses system %s, which is missing from the configuration.", systemName)); } return Util.getObj(systemFactoryClassName, SystemFactory.class); })); return systemFactories; }
/** * Get {@link SystemFactory} instances for all the systems defined in this config. * * @return a map from system name to {@link SystemFactory} */ public Map<String, SystemFactory> getSystemFactories() { Map<String, SystemFactory> systemFactories = getSystemNames().stream().collect(Collectors.toMap( systemName -> systemName, systemName -> { String systemFactoryClassName = getSystemFactory(systemName); if (systemFactoryClassName == null) { throw new SamzaException( String.format("A stream uses system %s, which is missing from the configuration.", systemName)); } return Util.getObj(systemFactoryClassName, SystemFactory.class); })); return systemFactories; }
/** * Get {@link SystemFactory} instances for all the systems defined in this config. * * @return a map from system name to {@link SystemFactory} */ public Map<String, SystemFactory> getSystemFactories() { Map<String, SystemFactory> systemFactories = getSystemNames().stream().collect(Collectors.toMap( systemName -> systemName, systemName -> { String systemFactoryClassName = getSystemFactory(systemName); if (systemFactoryClassName == null) { throw new SamzaException( String.format("A stream uses system %s, which is missing from the configuration.", systemName)); } return Util.getObj(systemFactoryClassName, SystemFactory.class); })); return systemFactories; }
/** * Get {@link SystemFactory} instances for all the systems defined in this config. * * @return a map from system name to {@link SystemFactory} */ public Map<String, SystemFactory> getSystemFactories() { Map<String, SystemFactory> systemFactories = getSystemNames().stream().collect(Collectors.toMap( systemName -> systemName, systemName -> { String systemFactoryClassName = getSystemFactory(systemName); if (systemFactoryClassName == null) { throw new SamzaException( String.format("A stream uses system %s, which is missing from the configuration.", systemName)); } return Util.getObj(systemFactoryClassName, SystemFactory.class); })); return systemFactories; }
/** * Get {@link SystemFactory} instances for all the systems defined in this config. * * @return a map from system name to {@link SystemFactory} */ public Map<String, SystemFactory> getSystemFactories() { Map<String, SystemFactory> systemFactories = getSystemNames().stream().collect(Collectors.toMap( systemName -> systemName, systemName -> { String systemFactoryClassName = getSystemFactory(systemName); if (systemFactoryClassName == null) { throw new SamzaException( String.format("A stream uses system %s, which is missing from the configuration.", systemName)); } return Util.getObj(systemFactoryClassName, SystemFactory.class); })); return systemFactories; }
@Test public void testGetSystemNames() { Map<String, String> map = new HashMap<String, String>(); map.put(MOCK_SYSTEM_FACTORY_NAME1, MOCK_SYSTEM_FACTORY_CLASSNAME1); map.put(MOCK_SYSTEM_FACTORY_NAME2, MOCK_SYSTEM_FACTORY_CLASSNAME2); JavaSystemConfig systemConfig = new JavaSystemConfig(new MapConfig(map)); assertEquals(2, systemConfig.getSystemNames().size()); assertTrue(systemConfig.getSystemNames().contains(MOCK_SYSTEM_NAME1)); assertTrue(systemConfig.getSystemNames().contains(MOCK_SYSTEM_NAME2)); } }