Search in sources :

Example 71 with Artifact

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());
}
Also used : SubArtifact(org.sonatype.aether.util.artifact.SubArtifact) Artifact(org.sonatype.aether.artifact.Artifact) SubArtifact(org.sonatype.aether.util.artifact.SubArtifact) Test(org.junit.Test)

Example 72 with Artifact

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());
}
Also used : SubArtifact(org.sonatype.aether.util.artifact.SubArtifact) Artifact(org.sonatype.aether.artifact.Artifact) SubArtifact(org.sonatype.aether.util.artifact.SubArtifact) Test(org.junit.Test)

Example 73 with Artifact

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());
}
Also used : SubArtifact(org.sonatype.aether.util.artifact.SubArtifact) Artifact(org.sonatype.aether.artifact.Artifact) SubArtifact(org.sonatype.aether.util.artifact.SubArtifact) Test(org.junit.Test)

Example 74 with Artifact

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));
}
Also used : Artifact(org.sonatype.aether.artifact.Artifact) Test(org.junit.Test)

Example 75 with 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());
}
Also used : Artifact(org.sonatype.aether.artifact.Artifact) Test(org.junit.Test)

Aggregations

Artifact (org.sonatype.aether.artifact.Artifact)116 Test (org.junit.Test)62 File (java.io.File)34 RemoteRepository (org.sonatype.aether.repository.RemoteRepository)33 StubArtifact (org.sonatype.aether.test.util.impl.StubArtifact)28 DefaultArtifact (org.sonatype.aether.util.artifact.DefaultArtifact)28 Dependency (org.sonatype.aether.graph.Dependency)21 ArtifactResult (org.sonatype.aether.resolution.ArtifactResult)17 ArtifactDownload (org.sonatype.aether.spi.connector.ArtifactDownload)16 LocalArtifactRequest (org.sonatype.aether.repository.LocalArtifactRequest)15 LocalArtifactResult (org.sonatype.aether.repository.LocalArtifactResult)15 ArtifactRequest (org.sonatype.aether.resolution.ArtifactRequest)15 RepositorySystemSession (org.sonatype.aether.RepositorySystemSession)13 SubArtifact (org.sonatype.aether.util.artifact.SubArtifact)13 ArtifactTransferException (org.sonatype.aether.transfer.ArtifactTransferException)12 ArrayList (java.util.ArrayList)11 RepositorySystem (org.sonatype.aether.RepositorySystem)10 Metadata (org.sonatype.aether.metadata.Metadata)10 CollectRequest (org.sonatype.aether.collection.CollectRequest)9 IOException (java.io.IOException)8