AbstractLayoutProvider implements LayoutProvider<T> { @Override public Set<ArtifactGroup> getArtifactGroups(RepositoryPath path) throws IOException { if (!RepositoryFiles.isArtifact(path)) { return Collections.emptySet(); } Repository repository = path.getFileSystem().getRepository(); Storage storage = repository.getStorage(); ArtifactCoordinates c = RepositoryFiles.readCoordinates(path); RepositoryArtifactIdGroupEntry artifactIdGroup = repositoryArtifactIdGroupService.findOne(storage.getId(), repository.getId(), c.getId()); return artifactIdGroup == null ? Collections.emptySet() : Sets.newHashSet(artifactIdGroup); }  abstract Set<String> getDefaultArtifactCoordinateValidators(); boolean isChecksum(RepositoryPath repositoryPath); URL resolveResource(RepositoryPath repositoryPath); @Override Set<String> listArchiveFilenames(final RepositoryPath repositoryPath); @Override Set<ArtifactGroup> getArtifactGroups(RepositoryPath path);  }
@Test public void shouldReturnExpectedArtifactGroups() throws IOException { RepositoryPath path = new RepositoryPath(REPOSITORY_BASEDIR, repositoryFileSystem).resolve("org") .resolve("carlspring") .resolve("abs-lay-prov-test") .resolve("1.8") .resolve("abs-lay-prov-test-1.8.jar"); Set<ArtifactGroupEntry> artifactGroups = layoutProvider.getArtifactGroups(path); assertThat(artifactGroups).isNotNull(); assertThat(artifactGroups).isEmpty(); RepositoryArtifactIdGroupEntry repositoryArtifactIdGroup = artifactGroupService.findOneOrCreate("storage0", "releases", "abs-lay-prov-test"); artifactGroups = layoutProvider.getArtifactGroups(path); assertThat(artifactGroups).isNotNull(); assertThat(artifactGroups).hasSize((1)); assertThat(artifactGroups.iterator().next()).isEqualTo(repositoryArtifactIdGroup); assertThat(repositoryArtifactIdGroup).isInstanceOf(RepositoryArtifactIdGroupEntry.class); assertThat(repositoryArtifactIdGroup.getArtifactId()).isEqualTo(("abs-lay-prov-test")); assertThat(repositoryArtifactIdGroup.getRepositoryId()).isEqualTo(("releases")); assertThat(repositoryArtifactIdGroup.getStorageId()).isEqualTo(("storage0")); assertThat(repositoryArtifactIdGroup.getClass()).isEqualTo((RepositoryArtifactIdGroupEntry.class)); }