use of org.apache.archiva.rest.api.model.ArtifactContentEntry in project archiva by apache.
the class DefaultBrowseService method getSmallerDepthEntries.
private List<ArtifactContentEntry> getSmallerDepthEntries(Map<String, ArtifactContentEntry> entries) {
int smallestDepth = Integer.MAX_VALUE;
Map<Integer, List<ArtifactContentEntry>> perDepthList = new HashMap<>();
for (Map.Entry<String, ArtifactContentEntry> entry : entries.entrySet()) {
ArtifactContentEntry current = entry.getValue();
if (current.getDepth() < smallestDepth) {
smallestDepth = current.getDepth();
}
List<ArtifactContentEntry> currentList = perDepthList.get(current.getDepth());
if (currentList == null) {
currentList = new ArrayList<>();
currentList.add(current);
perDepthList.put(current.getDepth(), currentList);
} else {
currentList.add(current);
}
}
return perDepthList.get(smallestDepth);
}
use of org.apache.archiva.rest.api.model.ArtifactContentEntry in project archiva by apache.
the class ArtifactContentEntriesTests method readArtifactContentEntriesOnlyFiles.
@Test
public void readArtifactContentEntriesOnlyFiles() throws Exception {
Path file = Paths.get(getBasedir(), "src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar");
List<ArtifactContentEntry> artifactContentEntries = browseService.readFileEntries(file, "org/apache/commons/logging/impl/", "foo");
log.info("artifactContentEntries: {}", artifactContentEntries);
assertThat(artifactContentEntries).isNotNull().isNotEmpty().hasSize(16).contains(new ArtifactContentEntry("org/apache/commons/logging/impl/AvalonLogger.class", true, 5, "foo"));
}
use of org.apache.archiva.rest.api.model.ArtifactContentEntry in project archiva by apache.
the class ArtifactContentEntriesTests method readArtifactContentEntriesRootPathNull.
@Test
public void readArtifactContentEntriesRootPathNull() throws Exception {
Path file = Paths.get(getBasedir(), "src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar");
List<ArtifactContentEntry> artifactContentEntries = browseService.readFileEntries(file, null, "foo");
log.info("artifactContentEntries: {}", artifactContentEntries);
assertThat(artifactContentEntries).isNotNull().isNotEmpty().hasSize(2).contains(new ArtifactContentEntry("org", false, 0, "foo"), new ArtifactContentEntry("META-INF", false, 0, "foo"));
}
use of org.apache.archiva.rest.api.model.ArtifactContentEntry in project archiva by apache.
the class ArtifactContentEntriesTests method readArtifactContentEntriesRootPathEmpty.
@Test
public void readArtifactContentEntriesRootPathEmpty() throws Exception {
Path file = Paths.get(getBasedir(), "src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar");
List<ArtifactContentEntry> artifactContentEntries = browseService.readFileEntries(file, "", "foo");
log.info("artifactContentEntries: {}", artifactContentEntries);
assertThat(artifactContentEntries).isNotNull().isNotEmpty().hasSize(2).contains(new ArtifactContentEntry("org", false, 0, "foo"), new ArtifactContentEntry("META-INF", false, 0, "foo"));
}
use of org.apache.archiva.rest.api.model.ArtifactContentEntry in project archiva by apache.
the class ArtifactContentEntriesTests method readArtifactContentEntriesSecondDepthOnlyOneDirectory.
@Test
public void readArtifactContentEntriesSecondDepthOnlyOneDirectory() throws Exception {
Path file = Paths.get(getBasedir(), "src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar");
List<ArtifactContentEntry> artifactContentEntries = browseService.readFileEntries(file, "org", "foo");
log.info("artifactContentEntries: {}", artifactContentEntries);
assertThat(artifactContentEntries).isNotNull().isNotEmpty().hasSize(1).contains(new ArtifactContentEntry("org/apache", false, 1, "foo"));
}
Aggregations