use of org.apache.archiva.repository.content.ItemSelector in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method testArtifactStreamWithNamespaceSelectorRecursive.
@Test
public void testArtifactStreamWithNamespaceSelectorRecursive() {
ItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.multilevel").recurse().build();
Stream<? extends Artifact> results = repoContent.newArtifactStream(selector);
checkArtifactListWithNamespaceSelectorRecursive(results.collect(Collectors.toList()));
}
use of org.apache.archiva.repository.content.ItemSelector in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method testGetRelatedArtifactsFromArtifact.
@Test
public void testGetRelatedArtifactsFromArtifact() {
ItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.apache.maven.shared").withProjectId("maven-downloader").withVersion("1.1").withExtension("jar").withArtifactId("maven-downloader").build();
Artifact artifact = repoContent.getArtifact(selector);
assertNotNull(artifact);
List<? extends Artifact> artifacts = repoContent.getArtifacts(artifact);
assertNotNull(artifacts);
assertEquals(2, artifacts.size());
}
use of org.apache.archiva.repository.content.ItemSelector in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method testGetArtifactStreamWithVersionSelector2.
@Test
public void testGetArtifactStreamWithVersionSelector2() {
ItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.apache.axis2").withProjectId("axis2").withVersion("1.3-SNAPSHOT").build();
try (Stream<? extends Artifact> stream = repoContent.newArtifactStream(selector)) {
assertNotNull(stream);
List<? extends Artifact> results = stream.collect(Collectors.toList());
checkArtifactListWithVersionSelector2(results);
}
}
use of org.apache.archiva.repository.content.ItemSelector in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method testArtifactListWithProjectSelector.
@Test
public void testArtifactListWithProjectSelector() {
ItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.apache.maven.shared").withProjectId("maven-downloader").build();
List<? extends Artifact> results = repoContent.getArtifacts(selector);
checkArtifactListWithProjectSelector(results);
}
use of org.apache.archiva.repository.content.ItemSelector in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method testArtifactListWithArtifactSelector4.
@Test
public void testArtifactListWithArtifactSelector4() {
ItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.apache.maven").withProjectId("test").withVersion("1.0-SNAPSHOT").withClassifier("").build();
List<? extends Artifact> results = repoContent.getArtifacts(selector);
assertNotNull(results);
assertEquals(5, results.size());
Artifact artifact = results.stream().filter(a -> a.getFileName().equalsIgnoreCase("test-1.0-20050611.112233-1-javadoc.jar")).findFirst().get();
assertNotNull(artifact);
assertEquals("javadoc", artifact.getClassifier());
assertEquals("javadoc", artifact.getType());
artifact = results.stream().filter(a -> a.getFileName().equalsIgnoreCase("wrong-artifactId-1.0-20050611.112233-1.jar")).findFirst().get();
assertNotNull(artifact);
assertEquals("", artifact.getClassifier());
assertEquals("wrong-artifactId", artifact.getId());
artifact = results.stream().filter(a -> a.getFileName().equalsIgnoreCase("wrong-artifactId-1.0-20050611.1122x-1.jar")).findFirst().get();
assertNotNull(artifact);
assertEquals("", artifact.getClassifier());
assertEquals("wrong-artifactId", artifact.getId());
assertEquals("", artifact.getArtifactVersion());
artifact = results.stream().filter(a -> a.getFileName().equalsIgnoreCase("test-1.0-20050611.1122x-1.jar")).findFirst().get();
assertNotNull(artifact);
assertEquals("", artifact.getClassifier());
assertEquals("test", artifact.getId());
assertEquals("1.0-20050611.1122x-1", artifact.getArtifactVersion());
}
Aggregations