use of org.apache.archiva.repository.content.ItemSelector in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method testGetProjects.
@Test
public void testGetProjects() {
ItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.apache.maven").build();
Namespace ns = repoContent.getNamespace(selector);
assertNotNull(ns);
List<? extends Project> projects = repoContent.getProjects(ns);
assertEquals(12, projects.size());
String[] expected = new String[] { "A", "B", "C", "archiva", "discovery", "maven-parent", "samplejar", "shared", "some-ejb", "test", "testing", "update" };
Object[] actual = projects.stream().map(p -> p.getId()).sorted().toArray();
assertArrayEquals(expected, actual);
}
use of org.apache.archiva.repository.content.ItemSelector in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method testGetItemWithProjectSelector.
@Test
public void testGetItemWithProjectSelector() {
ItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.apache.maven").withProjectId("shared").build();
ContentItem item = repoContent.getItem(selector);
assertNotNull(item);
assertTrue(item instanceof Project);
}
use of org.apache.archiva.repository.content.ItemSelector in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method testNewItemStreamWithNamespace1.
@Test
public void testNewItemStreamWithNamespace1() {
ItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.apache.axis2").build();
Stream<? extends ContentItem> stream = repoContent.newItemStream(selector, false);
List<? extends ContentItem> result = stream.collect(Collectors.toList());
assertEquals(41, result.size());
ContentItem item = result.get(39);
Version version = item.adapt(Version.class);
assertNotNull(version);
assertEquals("1.3-SNAPSHOT", version.getId());
Project project = result.get(40).adapt(Project.class);
assertNotNull(project);
assertEquals("axis2", project.getId());
assertTrue(result.stream().anyMatch(a -> "axis2-1.3-20070725.210059-1.pom".equals(a.getAsset().getName())));
}
use of org.apache.archiva.repository.content.ItemSelector in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method testGetItemWithArtifactSelector.
@Test
public void testGetItemWithArtifactSelector() {
ItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.apache.maven").withProjectId("samplejar").withVersion("2.0").withArtifactId("samplejar").build();
ContentItem item = repoContent.getItem(selector);
assertNotNull(item);
assertTrue(item instanceof Artifact);
}
use of org.apache.archiva.repository.content.ItemSelector in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method testArtifactListWithArtifactSelectorVersionPattern.
@Test
public void testArtifactListWithArtifactSelectorVersionPattern() {
ItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.apache.maven").withProjectId("test").withVersion("1.0-SNAPSHOT").withArtifactVersion("1.0-*").build();
List<? extends Artifact> results = repoContent.getArtifacts(selector);
assertNotNull(results);
assertEquals(5, results.size());
Artifact artifact = results.stream().filter(a -> a.getFileName().equalsIgnoreCase("wrong-artifactId-1.0-20050611.112233-1.jar")).findFirst().get();
assertNotNull(artifact);
}
Aggregations