use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class SubArtifactTest method testDerivedExtension.
@Test
public void testDerivedExtension() {
Artifact main = newMainArtifact("gid:aid:ext:cls:ver");
Artifact sub = new SubArtifact(main, "", "*.asc");
assertEquals("ext.asc", sub.getExtension());
sub = new SubArtifact(main, "", "asc.*");
assertEquals("asc.ext", sub.getExtension());
}
use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class SubArtifactTest method testEmptyExtension.
@Test
public void testEmptyExtension() {
Artifact main = newMainArtifact("gid:aid:ext:cls:ver");
Artifact sub = new SubArtifact(main, "tests", "");
assertEquals("", sub.getExtension());
sub = new SubArtifact(main, "tests", null);
assertEquals("", sub.getExtension());
}
use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class SubArtifactTest method testDerivedClassifier.
@Test
public void testDerivedClassifier() {
Artifact main = newMainArtifact("gid:aid:ext:cls:ver");
Artifact sub = new SubArtifact(main, "*-tests", "pom");
assertEquals("cls-tests", sub.getClassifier());
sub = new SubArtifact(main, "tests-*", "pom");
assertEquals("tests-cls", sub.getClassifier());
main = newMainArtifact("gid:aid:ext:ver");
sub = new SubArtifact(main, "*-tests", "pom");
assertEquals("tests", sub.getClassifier());
sub = new SubArtifact(main, "tests-*", "pom");
assertEquals("tests", sub.getClassifier());
}
use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class ArtifacIdUtilsTest method testToIdArtifact.
@Test
public void testToIdArtifact() {
Artifact artifact = null;
assertSame(null, ArtifacIdUtils.toId(artifact));
artifact = new DefaultArtifact("gid", "aid", "ext", "1.0-20110205.132618-23");
assertEquals("gid:aid:ext:1.0-20110205.132618-23", ArtifacIdUtils.toId(artifact));
artifact = new DefaultArtifact("gid", "aid", "cls", "ext", "1.0-20110205.132618-23");
assertEquals("gid:aid:ext:cls:1.0-20110205.132618-23", ArtifacIdUtils.toId(artifact));
}
use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class DefaultArtifactTest method testDefaultArtifactString.
@Test
public void testDefaultArtifactString() {
Artifact a;
a = new DefaultArtifact("gid:aid:ver");
assertEquals("gid", a.getGroupId());
assertEquals("aid", a.getArtifactId());
assertEquals("ver", a.getVersion());
assertEquals("jar", a.getExtension());
assertEquals("", a.getClassifier());
a = new DefaultArtifact("gid:aid:ext:ver");
assertEquals("gid", a.getGroupId());
assertEquals("aid", a.getArtifactId());
assertEquals("ver", a.getVersion());
assertEquals("ext", a.getExtension());
assertEquals("", a.getClassifier());
a = new DefaultArtifact("org.gid:foo-bar:jar:1.1-20101116.150650-3");
assertEquals("org.gid", a.getGroupId());
assertEquals("foo-bar", a.getArtifactId());
assertEquals("1.1-20101116.150650-3", a.getVersion());
assertEquals("jar", a.getExtension());
assertEquals("", a.getClassifier());
a = new DefaultArtifact("gid:aid:ext:cls:ver");
assertEquals("gid", a.getGroupId());
assertEquals("aid", a.getArtifactId());
assertEquals("ver", a.getVersion());
assertEquals("ext", a.getExtension());
assertEquals("cls", a.getClassifier());
a = new DefaultArtifact("gid:aid::cls:ver");
assertEquals("gid", a.getGroupId());
assertEquals("aid", a.getArtifactId());
assertEquals("ver", a.getVersion());
assertEquals("jar", a.getExtension());
assertEquals("cls", a.getClassifier());
a = new DefaultArtifact(new DefaultArtifact("gid:aid:ext:cls:ver").toString());
assertEquals("gid", a.getGroupId());
assertEquals("aid", a.getArtifactId());
assertEquals("ver", a.getVersion());
assertEquals("ext", a.getExtension());
assertEquals("cls", a.getClassifier());
}
Aggregations