use of org.apache.archiva.repository.content.Artifact in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method testArtifactListWithArtifactSelector1.
@Test
public void testArtifactListWithArtifactSelector1() {
ItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.apache.maven").withProjectId("test").withVersion("1.0-SNAPSHOT").withArtifactId("test").withArtifactVersion("1.0-20050611.112233-1").build();
List<? extends Artifact> results = repoContent.getArtifacts(selector);
assertNotNull(results);
assertEquals(1, results.size());
Artifact artifact = results.stream().filter(a -> a.getFileName().equalsIgnoreCase("test-1.0-20050611.112233-1.jar")).findFirst().get();
assertNotNull(artifact);
assertEquals("", artifact.getClassifier());
}
use of org.apache.archiva.repository.content.Artifact in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method checkArtifactListWithProjectSelector.
private void checkArtifactListWithProjectSelector(List<? extends Artifact> results) {
assertNotNull(results);
assertEquals(27, results.size());
Artifact artifact = results.stream().filter(a -> a.getFileName().equalsIgnoreCase("maven-metadata.xml")).findFirst().get();
assertNotNull(artifact);
assertEquals("xml", artifact.getExtension());
assertEquals(BaseArtifactTypes.METADATA, artifact.getDataType());
artifact = results.stream().filter(a -> a.getFileName().equalsIgnoreCase("maven-downloader-1.0-sources.jar")).findFirst().get();
assertNotNull(artifact);
assertEquals(BaseArtifactTypes.MAIN, artifact.getDataType());
assertEquals("sources", artifact.getClassifier());
assertEquals("java-source", artifact.getType());
artifact = results.stream().filter(a -> a.getFileName().equalsIgnoreCase("maven-downloader-1.0-sources.jar.sha1")).findFirst().get();
assertNotNull(artifact);
assertEquals(BaseArtifactTypes.RELATED, artifact.getDataType());
assertEquals("sources", artifact.getClassifier());
assertEquals("sha1", artifact.getType());
assertEquals(".jar.sha1", artifact.getRemainder());
}
use of org.apache.archiva.repository.content.Artifact in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method testArtifactListWithArtifactSelector2.
@Test
public void testArtifactListWithArtifactSelector2() {
ItemSelector selector = ArchivaItemSelector.builder().withNamespace("org.apache.maven").withProjectId("test").withVersion("1.0-SNAPSHOT").withClassifier("*").withArtifactId("test").withArtifactVersion("1.0-20050611.112233-1").build();
List<? extends Artifact> results = repoContent.getArtifacts(selector);
assertNotNull(results);
assertEquals(2, 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());
}
use of org.apache.archiva.repository.content.Artifact in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method checkArtifactListWithVersionSelector2.
private void checkArtifactListWithVersionSelector2(List<? extends Artifact> results) {
assertNotNull(results);
assertEquals(39, results.size());
Artifact artifact = results.stream().filter(a -> a.getFileName().equals("axis2-1.3-20070725.210059-1.pom")).findFirst().get();
assertNotNull(artifact);
assertEquals("pom", artifact.getExtension());
assertEquals(BaseArtifactTypes.MAIN, artifact.getDataType());
assertEquals("1.3-SNAPSHOT", artifact.getVersion().getId());
assertEquals("1.3-20070725.210059-1", artifact.getArtifactVersion());
assertEquals(".pom", artifact.getRemainder());
assertEquals("axis2", artifact.getId());
assertEquals("axis2", artifact.getVersion().getProject().getId());
assertEquals("org.apache.axis2", artifact.getVersion().getProject().getNamespace().getId());
assertEquals("", artifact.getClassifier());
assertEquals("pom", artifact.getType());
artifact = null;
artifact = results.stream().filter(a -> a.getFileName().equals("axis2-1.3-20070725.210059-1.pom.md5")).findFirst().get();
assertNotNull(artifact);
assertEquals("md5", artifact.getExtension());
assertEquals(BaseArtifactTypes.RELATED, artifact.getDataType());
assertEquals("1.3-SNAPSHOT", artifact.getVersion().getId());
assertEquals("1.3-20070725.210059-1", artifact.getArtifactVersion());
assertEquals(".pom.md5", artifact.getRemainder());
assertEquals("axis2", artifact.getId());
assertEquals("axis2", artifact.getVersion().getProject().getId());
assertEquals("org.apache.axis2", artifact.getVersion().getProject().getNamespace().getId());
assertEquals("", artifact.getClassifier());
assertEquals("md5", artifact.getType());
artifact = null;
artifact = results.stream().filter(a -> a.getFileName().equals("maven-metadata.xml")).findFirst().get();
assertNotNull(artifact);
assertEquals(BaseArtifactTypes.METADATA, artifact.getDataType());
assertEquals("1.3-SNAPSHOT", artifact.getVersion().getId());
assertEquals("xml", artifact.getExtension());
}
use of org.apache.archiva.repository.content.Artifact in project archiva by apache.
the class ManagedDefaultRepositoryContentTest method checkArtifactListWithArtifactSelector2.
private void checkArtifactListWithArtifactSelector2(List<? extends Artifact> results) {
assertNotNull(results);
assertEquals(3, results.size());
Artifact artifact = results.stream().filter(a -> a.getFileName().equalsIgnoreCase("axis2-1.3-20070731.113304-21.pom")).findFirst().get();
assertNotNull(artifact);
assertEquals("pom", artifact.getExtension());
assertEquals(BaseArtifactTypes.MAIN, artifact.getDataType());
artifact = results.stream().filter(a -> a.getFileName().equalsIgnoreCase("axis2-1.3-20070731.113304-21.pom.sha1")).findFirst().get();
assertNotNull(artifact);
assertEquals("sha1", artifact.getExtension());
assertEquals(BaseArtifactTypes.RELATED, artifact.getDataType());
}
Aggregations