@Test void shouldVisitParsedElements() throws Exception { Path rootPath = Paths.get("src/test/resources/registry/repository"); assertThat(rootPath).exists(); ObjectMapper mapper = new ObjectMapper(); Repository repository = Repository.parse(rootPath, mapper); RepositoryIndexer indexer = new RepositoryIndexer(new TestArtifactResolver()); IndexVisitor mock = mock(IndexVisitor.class); indexer.index(repository, mock); verify(mock, atLeast(4)).visitPlatform(any(QuarkusPlatformDescriptor.class)); verify(mock, atLeast(2)).visitExtension(any(Extension.class), anyString()); }
public void index(Repository repository, IndexVisitor visitor) throws IOException { for (Platform platform : repository.getPlatforms()) { for (Release release : platform.getReleases()) { QuarkusPlatformDescriptor descriptor = artifactResolver.resolvePlatform(platform, release); if (descriptor != null) { visitor.visitPlatform(descriptor); } } } for (Extension extension : repository.getIndividualExtensions()) { for (Release release : extension.getReleases()) { io.quarkus.dependencies.Extension ext = artifactResolver.resolveExtension(extension, release); if (ext != null) { visitor.visitExtension(ext, release.getQuarkusCore()); } } } }
RepositoryIndexer { public void index(Repository repository, IndexVisitor visitor) throws IOException { for (Platform platform : repository.getPlatforms()) { for (Release release : platform.getReleases()) { QuarkusPlatformDescriptor descriptor = artifactResolver.resolvePlatform(platform, release); if (descriptor != null) { visitor.visitPlatform(descriptor); } } } for (Extension extension : repository.getIndividualExtensions()) { for (Release release : extension.getReleases()) { io.quarkus.dependencies.Extension ext = artifactResolver.resolveExtension(extension, release); if (ext != null) { visitor.visitExtension(ext, release.getQuarkusCore()); } } } } }
RepositoryIndexer { public void index(Repository repository, IndexVisitor visitor) throws IOException { for (Platform platform : repository.getPlatforms()) { for (Release release : platform.getReleases()) { QuarkusPlatformDescriptor descriptor = artifactResolver.resolvePlatform(platform, release); if (descriptor != null) { visitor.visitPlatform(descriptor); } } } for (Extension extension : repository.getIndividualExtensions()) { for (Release release : extension.getReleases()) { io.quarkus.dependencies.Extension ext = artifactResolver.resolveExtension(extension, release); if (ext != null) { visitor.visitExtension(ext, release.getQuarkusCore()); } } } } RepositoryIndexer(ArtifactResolver artifactResolver); }
RepositoryIndexer { public void index(Repository repository, IndexVisitor visitor) throws IOException { for (Platform platform : repository.getPlatforms()) { for (Release release : platform.getReleases()) { QuarkusPlatformDescriptor descriptor = artifactResolver.resolvePlatform(platform, release); if (descriptor != null) { visitor.visitPlatform(descriptor); } } } for (Extension extension : repository.getIndividualExtensions()) { for (Release release : extension.getReleases()) { io.quarkus.dependencies.Extension ext = artifactResolver.resolveExtension(extension, release); if (ext != null) { visitor.visitExtension(ext, release.getQuarkusCore()); } } } } RepositoryIndexer(ArtifactResolver artifactResolver); void index(Repository repository, IndexVisitor visitor); }
RepositoryIndexer { public void index(Repository repository, IndexVisitor visitor) throws IOException { for (Platform platform : repository.getPlatforms()) { for (Release release : platform.getReleases()) { QuarkusPlatformDescriptor descriptor = artifactResolver.resolvePlatform(platform, release); if (descriptor != null) { visitor.visitPlatform(descriptor); } } } for (Extension extension : repository.getIndividualExtensions()) { for (Release release : extension.getReleases()) { io.quarkus.dependencies.Extension ext = artifactResolver.resolveExtension(extension, release); if (ext != null) { visitor.visitExtension(ext, release.getQuarkusCore()); } } } } RepositoryIndexer(ArtifactResolver artifactResolver); void index(Repository repository, IndexVisitor visitor);  }