@Test void resolveVersions() throws ResolveException { when(this.mockRepository1.resolveVersions("id", 0, -1)).thenReturn(toIterableVersions("1.0", "2.0")); when(this.mockRepository2.resolveVersions("id", 0, -1)).thenReturn(toIterableVersions("3.0", "2.0", "4.0")); assertResolveVersions(0, -1, "1.0", "2.0", "3.0", "4.0"); assertResolveVersions(0, 1, "1.0"); assertResolveVersions(1, -1, "2.0", "3.0", "4.0"); }
@Override public IterableResult<Version> resolveVersions(String id, int offset, int nb) throws ResolveException { SortedSet<Version> versionSet = new TreeSet<>(); for (ExtensionRepository repository : this.repositories) { try { IterableResult<Version> versions = repository.resolveVersions(id, 0, -1); for (Version version : versions) { versionSet.add(version); } } catch (ExtensionNotFoundException e1) { this.logger.debug("Could not find extension with id [{}] in repository [{}]", id, repository.getDescriptor(), e1); } catch (ResolveException e2) { this.logger.error("Unexpected error when trying to find versions for extension with id [{}]", id, e2); } } if (versionSet.isEmpty()) { throw new ExtensionNotFoundException( String.format("Could not find versions for extension with id [%s]", id)); } return RepositoryUtils.getIterableResult(offset, nb, versionSet); }
DefaultExtensionRepositoryManager extends AbstractAdvancedSearchableExtensionRepository implements ExtensionRepositoryManager, Initializable { @Override public IterableResult<Version> resolveVersions(String id, int offset, int nb) throws ResolveException { SortedSet<Version> versionSet = new TreeSet<>(); for (ExtensionRepository repository : this.repositories) { try { IterableResult<Version> versions = repository.resolveVersions(id, 0, -1); for (Version version : versions) { versionSet.add(version); } } catch (ExtensionNotFoundException e1) { this.logger.debug("Could not find extension with id [{}] in repository [{}]", id, repository.getDescriptor(), e1); } catch (ResolveException e2) { this.logger.error("Unexpected error when trying to find versions for extension with id [{}]", id, e2); } } if (versionSet.isEmpty()) { throw new ExtensionNotFoundException( String.format("Could not find versions for extension with id [%s]", id)); } return RepositoryUtils.getIterableResult(offset, nb, versionSet); } }
DefaultExtensionRepositoryManager extends AbstractAdvancedSearchableExtensionRepository implements ExtensionRepositoryManager, Initializable { @Override public IterableResult<Version> resolveVersions(String id, int offset, int nb) throws ResolveException { SortedSet<Version> versionSet = new TreeSet<>(); for (ExtensionRepository repository : this.repositories) { try { IterableResult<Version> versions = repository.resolveVersions(id, 0, -1); for (Version version : versions) { versionSet.add(version); } } catch (ExtensionNotFoundException e1) { this.logger.debug("Could not find extension with id [{}] in repository [{}]", id, repository.getDescriptor(), e1); } catch (ResolveException e2) { this.logger.error("Unexpected error when trying to find versions for extension with id [{}]", id, e2); } } if (versionSet.isEmpty()) { throw new ExtensionNotFoundException( String.format("Could not find versions for extension with id [%s]", id)); } return RepositoryUtils.getIterableResult(offset, nb, versionSet); }  }
DefaultExtensionRepositoryManager extends AbstractAdvancedSearchableExtensionRepository implements ExtensionRepositoryManager, Initializable { @Override public IterableResult<Version> resolveVersions(String id, int offset, int nb) throws ResolveException { SortedSet<Version> versionSet = new TreeSet<>(); for (ExtensionRepository repository : this.repositories) { try { IterableResult<Version> versions = repository.resolveVersions(id, 0, -1); for (Version version : versions) { versionSet.add(version); } } catch (ExtensionNotFoundException e1) { this.logger.debug("Could not find extension with id [{}] in repository [{}]", id, repository.getDescriptor(), e1); } catch (ResolveException e2) { this.logger.error("Unexpected error when trying to find versions for extension with id [{}]", id, e2); } } if (versionSet.isEmpty()) { throw new ExtensionNotFoundException( String.format("Could not find versions for extension with id [%s]", id)); } return RepositoryUtils.getIterableResult(offset, nb, versionSet); }  @Override void initialize(); @Override @Deprecated ExtensionRepository addRepository(ExtensionRepositoryId repositoryId); @Override ExtensionRepository addRepository(ExtensionRepositoryDescriptor repositoryDescriptor); @Override ExtensionRepository addRepository(ExtensionRepositoryDescriptor repositoryDescriptor, int priority); @Override void addRepository(ExtensionRepository repository); @Override void addRepository(ExtensionRepository repository, int priority); @Override void removeRepository(String repositoryId); @Override ExtensionRepository getRepository(String repositoryId); @Override Collection<ExtensionRepository> getRepositories(); @Override Extension resolve(ExtensionId extensionId); @Override Extension resolve(ExtensionDependency extensionDependency); @Override IterableResult<Version> resolveVersions(String id, int offset, int nb); @Override boolean exists(ExtensionId extensionId); @Override IterableResult<Extension> search(ExtensionQuery query); @Override boolean isFilterable(); @Override boolean isSortable(); }
DefaultExtensionRepositoryManager extends AbstractAdvancedSearchableExtensionRepository implements ExtensionRepositoryManager, Initializable { @Override public IterableResult<Version> resolveVersions(String id, int offset, int nb) throws ResolveException { SortedSet<Version> versionSet = new TreeSet<>(); for (ExtensionRepository repository : this.repositories) { try { IterableResult<Version> versions = repository.resolveVersions(id, 0, -1); for (Version version : versions) { versionSet.add(version); } } catch (ExtensionNotFoundException e1) { this.logger.debug("Could not find extension with id [{}] in repository [{}]", id, repository.getDescriptor(), e1); } catch (ResolveException e2) { this.logger.error("Unexpected error when trying to find versions for extension with id [{}]", id, e2); } } if (versionSet.isEmpty()) { throw new ExtensionNotFoundException( String.format("Could not find versions for extension with id [%s]", id)); } return RepositoryUtils.getIterableResult(offset, nb, versionSet); }  @Override void initialize(); @Override @Deprecated ExtensionRepository addRepository(ExtensionRepositoryId repositoryId); @Override ExtensionRepository addRepository(ExtensionRepositoryDescriptor repositoryDescriptor); @Override ExtensionRepository addRepository(ExtensionRepositoryDescriptor repositoryDescriptor, int priority); @Override void addRepository(ExtensionRepository repository); @Override void addRepository(ExtensionRepository repository, int priority); @Override void removeRepository(String repositoryId); @Override ExtensionRepository getRepository(String repositoryId); @Override Collection<ExtensionRepository> getRepositories(); @Override Extension resolve(ExtensionId extensionId); @Override Extension resolve(ExtensionDependency extensionDependency); @Override IterableResult<Version> resolveVersions(String id, int offset, int nb); @Override boolean exists(ExtensionId extensionId); @Override IterableResult<Extension> search(ExtensionQuery query); @Override boolean isFilterable(); @Override boolean isSortable();  }