SystemPropertyRepositoryLoader implements RepositoryLoader { @Override public List<Repository> load(Logger logger) throws LifecycleExecutionException { List<Repository> repositoryList = new ArrayList<>(); String coordinates = System.getProperty(ExtensionSettings.REPOSITORIES_SETTING_KEY, ""); if (coordinates.length() > 0) { for (String scalar : coordinates.split(",")) { String[] config = scalar.split("="); if (config.length == 2) { repositoryList.add(build(config[0], config[1], logger)); } } if (!repositoryList.isEmpty()) { logger.info(String.format("Add %s repositories found in system properties", repositoryList.size())); } } return repositoryList; }  @Override List<Repository> load(Logger logger);  }
@Test public void shouldLoadFromSystemProperties() throws LifecycleExecutionException { System.setProperty(ExtensionSettings.REPOSITORIES_SETTING_KEY, "central=https: List<Repository> repositoryList = loader.load(logger); TestHelper.verifyRepositories(repositoryList); }
@Test public void shouldHandleNonExistingSystemProperty() throws LifecycleExecutionException { System.setProperty(ExtensionSettings.REPOSITORIES_SETTING_KEY, ""); List<Repository> repositoryList = loader.load(logger); Assertions.assertThat(repositoryList).isEmpty(); }