Search in sources :

Example 11 with LocalArtifactResult

use of org.sonatype.aether.repository.LocalArtifactResult in project sonatype-aether by sonatype.

the class EnhancedLocalRepositoryManagerTest method testDoNotFindDifferentContext.

@Test
public void testDoNotFindDifferentContext() throws Exception {
    addRemoteArtifact(artifact);
    LocalArtifactRequest request = new LocalArtifactRequest(artifact, Arrays.asList(repository), "different");
    LocalArtifactResult result = manager.find(session, request);
    assertFalse(result.isAvailable());
}
Also used : LocalArtifactResult(org.sonatype.aether.repository.LocalArtifactResult) LocalArtifactRequest(org.sonatype.aether.repository.LocalArtifactRequest) Test(org.junit.Test)

Example 12 with LocalArtifactResult

use of org.sonatype.aether.repository.LocalArtifactResult in project sonatype-aether by sonatype.

the class EnhancedLocalRepositoryManagerTest method testDoNotFindNullFile.

@Test
public void testDoNotFindNullFile() throws Exception {
    artifact = artifact.setFile(null);
    addLocalArtifact(artifact);
    LocalArtifactRequest request = new LocalArtifactRequest(artifact, Arrays.asList(repository), testContext);
    LocalArtifactResult result = manager.find(session, request);
    assertFalse(result.isAvailable());
}
Also used : LocalArtifactResult(org.sonatype.aether.repository.LocalArtifactResult) LocalArtifactRequest(org.sonatype.aether.repository.LocalArtifactRequest) Test(org.junit.Test)

Example 13 with LocalArtifactResult

use of org.sonatype.aether.repository.LocalArtifactResult in project sonatype-aether by sonatype.

the class EnhancedLocalRepositoryManagerTest method testFindArtifactUsesTimestampedVersion.

@Test
public void testFindArtifactUsesTimestampedVersion() throws Exception {
    Artifact artifact = new DefaultArtifact("g.i.d:a.i.d:1.0-SNAPSHOT");
    File file = new File(basedir, manager.getPathForLocalArtifact(artifact));
    TestFileUtils.write("test", file);
    addLocalArtifact(artifact);
    artifact = artifact.setVersion("1.0-20110329.221805-4");
    LocalArtifactRequest request = new LocalArtifactRequest();
    request.setArtifact(artifact);
    LocalArtifactResult result = manager.find(session, request);
    assertNull(result.toString(), result.getFile());
    assertFalse(result.toString(), result.isAvailable());
}
Also used : LocalArtifactResult(org.sonatype.aether.repository.LocalArtifactResult) File(java.io.File) Artifact(org.sonatype.aether.artifact.Artifact) DefaultArtifact(org.sonatype.aether.util.artifact.DefaultArtifact) DefaultArtifact(org.sonatype.aether.util.artifact.DefaultArtifact) LocalArtifactRequest(org.sonatype.aether.repository.LocalArtifactRequest) Test(org.junit.Test)

Example 14 with LocalArtifactResult

use of org.sonatype.aether.repository.LocalArtifactResult in project sonatype-aether by sonatype.

the class EnhancedLocalRepositoryManagerTest method testDoNotFindDeletedFile.

@Test
public void testDoNotFindDeletedFile() throws Exception {
    addLocalArtifact(artifact);
    assertTrue("could not delete artifact file", artifactFile.delete());
    LocalArtifactRequest request = new LocalArtifactRequest(artifact, Arrays.asList(repository), testContext);
    LocalArtifactResult result = manager.find(session, request);
    assertFalse(result.isAvailable());
}
Also used : LocalArtifactResult(org.sonatype.aether.repository.LocalArtifactResult) LocalArtifactRequest(org.sonatype.aether.repository.LocalArtifactRequest) Test(org.junit.Test)

Example 15 with LocalArtifactResult

use of org.sonatype.aether.repository.LocalArtifactResult in project sonatype-aether by sonatype.

the class EnhancedLocalRepositoryManagerTest method testFindRemoteArtifact.

@Test
public void testFindRemoteArtifact() throws Exception {
    addRemoteArtifact(artifact);
    LocalArtifactRequest request = new LocalArtifactRequest(artifact, Arrays.asList(repository), testContext);
    LocalArtifactResult result = manager.find(session, request);
    assertTrue(result.isAvailable());
}
Also used : LocalArtifactResult(org.sonatype.aether.repository.LocalArtifactResult) LocalArtifactRequest(org.sonatype.aether.repository.LocalArtifactRequest) Test(org.junit.Test)

Aggregations

LocalArtifactResult (org.sonatype.aether.repository.LocalArtifactResult)15 LocalArtifactRequest (org.sonatype.aether.repository.LocalArtifactRequest)12 Test (org.junit.Test)11 Artifact (org.sonatype.aether.artifact.Artifact)7 File (java.io.File)6 RemoteRepository (org.sonatype.aether.repository.RemoteRepository)5 IOException (java.io.IOException)4 LocalArtifactRegistration (org.sonatype.aether.repository.LocalArtifactRegistration)4 LocalRepositoryManager (org.sonatype.aether.repository.LocalRepositoryManager)4 ArtifactRequest (org.sonatype.aether.resolution.ArtifactRequest)4 ArtifactResult (org.sonatype.aether.resolution.ArtifactResult)4 RepositorySystemSession (org.sonatype.aether.RepositorySystemSession)3 Metadata (org.sonatype.aether.metadata.Metadata)3 LocalMetadataRegistration (org.sonatype.aether.repository.LocalMetadataRegistration)3 LocalMetadataRequest (org.sonatype.aether.repository.LocalMetadataRequest)3 LocalMetadataResult (org.sonatype.aether.repository.LocalMetadataResult)3 LocalRepository (org.sonatype.aether.repository.LocalRepository)3 VersionRequest (org.sonatype.aether.resolution.VersionRequest)3 VersionResolutionException (org.sonatype.aether.resolution.VersionResolutionException)3 VersionResult (org.sonatype.aether.resolution.VersionResult)3