@Test void getRepositoriesWithInvalid() throws Exception { this.source.setProperty("extension.repositories", Arrays.asList("id:type:http: assertEquals( Arrays.asList(new DefaultExtensionRepositoryDescriptor("id", "type", new URI("http: new ArrayList<>(this.configuration.getExtensionRepositoryDescriptors())); assertEquals(1, this.logCapture.size()); assertEquals("Ignoring invalid repository configuration [invalid]. Root cause " + "[ExtensionManagerConfigurationException: Invalid repository configuration format for [invalid]. Should " + "have been matching [([^:]+):([^:]+):(.+)].]", this.logCapture.getMessage(0)); }
@Override public Collection<ExtensionRepositoryDescriptor> getExtensionRepositoryDescriptors() { Collection<ExtensionRepositoryDescriptor> repositories; List<String> repositoryStrings = this.configuration.get().getProperty(CK_PREFIX + "repositories", Collections.emptyList()); if (repositoryStrings.isEmpty()) { repositories = null; } else { Map<String, ExtensionRepositoryDescriptor> repositoriesMap = new LinkedHashMap<>(); for (String repositoryString : repositoryStrings) { if (StringUtils.isNotBlank(repositoryString)) { try { ExtensionRepositoryDescriptor extensionRepositoryId = parseRepository(repositoryString); if (repositoriesMap.containsKey(extensionRepositoryId.getId())) { this.logger.warn( "Duplicated repository id in [{}] first found in [{}]. The last one will be used.", extensionRepositoryId, repositoriesMap.get(extensionRepositoryId.getId())); } repositoriesMap.put(extensionRepositoryId.getId(), extensionRepositoryId); } catch (Exception e) { this.logger.warn("Ignoring invalid repository configuration [{}]. " + "Root cause [{}]", repositoryString, ExceptionUtils.getRootCauseMessage(e)); } } else { this.logger.debug("Empty repository id found in the configuration"); } } repositories = repositoriesMap.values(); for (ExtensionRepositoryDescriptor descriptor : repositories) { setRepositoryProperties((DefaultExtensionRepositoryDescriptor) descriptor); } } return repositories; }
DefaultExtensionManagerConfiguration implements ExtensionManagerConfiguration { @Override public Collection<ExtensionRepositoryDescriptor> getExtensionRepositoryDescriptors() { Collection<ExtensionRepositoryDescriptor> repositories; List<String> repositoryStrings = this.configuration.get().getProperty(CK_PREFIX + "repositories", Collections.emptyList()); if (repositoryStrings.isEmpty()) { repositories = null; } else { Map<String, ExtensionRepositoryDescriptor> repositoriesMap = new LinkedHashMap<>(); for (String repositoryString : repositoryStrings) { if (StringUtils.isNotBlank(repositoryString)) { try { ExtensionRepositoryDescriptor extensionRepositoryId = parseRepository(repositoryString); if (repositoriesMap.containsKey(extensionRepositoryId.getId())) { this.logger.warn( "Duplicated repository id in [{}] first found in [{}]. The last one will be used.", extensionRepositoryId, repositoriesMap.get(extensionRepositoryId.getId())); } repositoriesMap.put(extensionRepositoryId.getId(), extensionRepositoryId); } catch (Exception e) { this.logger.warn("Ignoring invalid repository configuration [{}]. " + "Root cause [{}]", repositoryString, ExceptionUtils.getRootCauseMessage(e)); } } else { this.logger.debug("Empty repository id found in the configuration"); } } repositories = repositoriesMap.values(); for (ExtensionRepositoryDescriptor descriptor : repositories) { setRepositoryProperties((DefaultExtensionRepositoryDescriptor) descriptor); } } return repositories; } }
DefaultExtensionManagerConfiguration implements ExtensionManagerConfiguration { @Override public Collection<ExtensionRepositoryDescriptor> getExtensionRepositoryDescriptors() { Collection<ExtensionRepositoryDescriptor> repositories; List<String> repositoryStrings = this.configuration.get().getProperty(CK_PREFIX + "repositories", Collections.emptyList()); if (repositoryStrings.isEmpty()) { repositories = null; } else { Map<String, ExtensionRepositoryDescriptor> repositoriesMap = new LinkedHashMap<>(); for (String repositoryString : repositoryStrings) { if (StringUtils.isNotBlank(repositoryString)) { try { ExtensionRepositoryDescriptor extensionRepositoryId = parseRepository(repositoryString); if (repositoriesMap.containsKey(extensionRepositoryId.getId())) { this.logger.warn( "Duplicated repository id in [{}] first found in [{}]. The last one will be used.", extensionRepositoryId, repositoriesMap.get(extensionRepositoryId.getId())); } repositoriesMap.put(extensionRepositoryId.getId(), extensionRepositoryId); } catch (Exception e) { this.logger.warn("Ignoring invalid repository configuration [{}]. " + "Root cause [{}]", repositoryString, ExceptionUtils.getRootCauseMessage(e)); } } else { this.logger.debug("Empty repository id found in the configuration"); } } repositories = repositoriesMap.values(); for (ExtensionRepositoryDescriptor descriptor : repositories) { setRepositoryProperties((DefaultExtensionRepositoryDescriptor) descriptor); } } return repositories; }  }
DefaultExtensionManagerConfiguration implements ExtensionManagerConfiguration { @Override public Collection<ExtensionRepositoryDescriptor> getExtensionRepositoryDescriptors() { Collection<ExtensionRepositoryDescriptor> repositories; List<String> repositoryStrings = this.configuration.get().getProperty(CK_PREFIX + "repositories", Collections.emptyList()); if (repositoryStrings.isEmpty()) { repositories = null; } else { Map<String, ExtensionRepositoryDescriptor> repositoriesMap = new LinkedHashMap<>(); for (String repositoryString : repositoryStrings) { if (StringUtils.isNotBlank(repositoryString)) { try { ExtensionRepositoryDescriptor extensionRepositoryId = parseRepository(repositoryString); if (repositoriesMap.containsKey(extensionRepositoryId.getId())) { this.logger.warn( "Duplicated repository id in [{}] first found in [{}]. The last one will be used.", extensionRepositoryId, repositoriesMap.get(extensionRepositoryId.getId())); } repositoriesMap.put(extensionRepositoryId.getId(), extensionRepositoryId); } catch (Exception e) { this.logger.warn("Ignoring invalid repository configuration [{}]. " + "Root cause [{}]", repositoryString, ExceptionUtils.getRootCauseMessage(e)); } } else { this.logger.debug("Empty repository id found in the configuration"); } } repositories = repositoriesMap.values(); for (ExtensionRepositoryDescriptor descriptor : repositories) { setRepositoryProperties((DefaultExtensionRepositoryDescriptor) descriptor); } } return repositories; }  File getHome(); @Override File getLocalRepository(); @Override Collection<ExtensionRepositoryDescriptor> getExtensionRepositoryDescriptors(); @Override Collection<ExtensionRepositoryId> getRepositories(); @Override String getUserAgent(); @Override boolean resolveCoreExtensions(); @Override VersionConstraint getRecomendedVersionConstraint(String id); @Override VersionConstraint getRecomendedVersionConstraint(String id, VersionConstraint defaultVersion); @Override boolean isIgnoredDependency(ExtensionDependency dependency); }
DefaultExtensionManagerConfiguration implements ExtensionManagerConfiguration { @Override public Collection<ExtensionRepositoryDescriptor> getExtensionRepositoryDescriptors() { Collection<ExtensionRepositoryDescriptor> repositories; List<String> repositoryStrings = this.configuration.get().getProperty(CK_PREFIX + "repositories", Collections.emptyList()); if (repositoryStrings.isEmpty()) { repositories = null; } else { Map<String, ExtensionRepositoryDescriptor> repositoriesMap = new LinkedHashMap<>(); for (String repositoryString : repositoryStrings) { if (StringUtils.isNotBlank(repositoryString)) { try { ExtensionRepositoryDescriptor extensionRepositoryId = parseRepository(repositoryString); if (repositoriesMap.containsKey(extensionRepositoryId.getId())) { this.logger.warn( "Duplicated repository id in [{}] first found in [{}]. The last one will be used.", extensionRepositoryId, repositoriesMap.get(extensionRepositoryId.getId())); } repositoriesMap.put(extensionRepositoryId.getId(), extensionRepositoryId); } catch (Exception e) { this.logger.warn("Ignoring invalid repository configuration [{}]. " + "Root cause [{}]", repositoryString, ExceptionUtils.getRootCauseMessage(e)); } } else { this.logger.debug("Empty repository id found in the configuration"); } } repositories = repositoriesMap.values(); for (ExtensionRepositoryDescriptor descriptor : repositories) { setRepositoryProperties((DefaultExtensionRepositoryDescriptor) descriptor); } } return repositories; }  File getHome(); @Override File getLocalRepository(); @Override Collection<ExtensionRepositoryDescriptor> getExtensionRepositoryDescriptors(); @Override Collection<ExtensionRepositoryId> getRepositories(); @Override String getUserAgent(); @Override boolean resolveCoreExtensions(); @Override VersionConstraint getRecomendedVersionConstraint(String id); @Override VersionConstraint getRecomendedVersionConstraint(String id, VersionConstraint defaultVersion); @Override boolean isIgnoredDependency(ExtensionDependency dependency);  }