use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class TimeoutTest method testRequestTimeout.
@Test(timeout = 3000)
public void testRequestTimeout() throws Exception {
Map<String, Object> configProps = new HashMap<String, Object>();
configProps.put(ConfigurationProperties.CONNECT_TIMEOUT, "60000");
configProps.put(ConfigurationProperties.REQUEST_TIMEOUT, "1000");
session().setConfigProperties(configProps);
File f = TestFileUtils.createTempFile("");
Artifact a = artifact("foo");
ArtifactDownload down = new ArtifactDownload(a, null, f, RepositoryPolicy.CHECKSUM_POLICY_FAIL);
Collection<? extends ArtifactDownload> downs = Arrays.asList(down);
connector().get(downs, null);
assertNotNull(down.getException());
}
use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class ArtifactWorkerTest method testDecodeURL.
@Test
public void testDecodeURL() throws ArtifactTransferException, IOException {
String enc = "%72%65%70%6F";
File dir = TestFileUtils.createTempDir();
String repoDir = dir.toURI().toURL().toString() + "/" + enc;
repository = new RemoteRepository("test", "default", repoDir);
Artifact artifact = new DefaultArtifact("gid", "aid", "jar", "ver");
String content = "test content";
uploadArtifact(artifact, content);
File repo = new File(dir, "repo");
assertTrue("Repository from encoded URL does not exist.", repo.exists());
assertTrue("Artifact was not uploaded correctly.", new File(repo, layout.getPath(artifact).getRawPath()).exists());
TestFileUtils.delete(dir);
}
use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class PutTest method testArtifactUpload.
@Test
public void testArtifactUpload() throws Exception {
addExpectation("gid/aid/version/aid-version-classifier.extension", "artifact");
addExpectation("gid/aid/version/aid-version-classifier.extension.sha1", sha1("artifact"));
addExpectation("gid/aid/version/aid-version-classifier.extension.md5", md5("artifact"));
Artifact artifact = artifact("artifact");
ArtifactUpload up = new ArtifactUpload(artifact, artifact.getFile());
List<ArtifactUpload> uploads = Arrays.asList(up);
connector().put(uploads, null);
ArtifactTransferException ex = up.getException();
assertNull(ex != null ? ex.getMessage() : "", ex);
assertExpectations();
}
use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class PutTest method testArtifactWithZeroBytesFile.
@Test
@Ignore("https://issues.sonatype.org/browse/AHC-5")
public void testArtifactWithZeroBytesFile() throws Exception {
String content = "";
addExpectation("gid/aid/version/aid-version-classifier.extension", content);
addExpectation("gid/aid/version/aid-version-classifier.extension.sha1", sha1(content));
addExpectation("gid/aid/version/aid-version-classifier.extension.md5", md5(content));
Artifact artifact = artifact(content);
ArtifactUpload up = new ArtifactUpload(artifact, artifact.getFile());
List<ArtifactUpload> uploads = Arrays.asList(up);
connector().put(uploads, null);
ArtifactTransferException ex = up.getException();
assertNull(ex != null ? ex.getMessage() : "", ex);
assertExpectations();
}
use of org.sonatype.aether.artifact.Artifact in project sonatype-aether by sonatype.
the class GetTest method testDownloadArtifact.
@Test
public void testDownloadArtifact() throws Exception {
addDelivery("gid/aid/version/aid-version-classifier.extension", "artifact");
addDelivery("gid/aid/version/aid-version-classifier.extension.sha1", sha1("artifact"));
addDelivery("gid/aid/version/aid-version-classifier.extension.md5", md5("artifact"));
File f = TestFileUtils.createTempFile("");
Artifact a = artifact("bla");
ArtifactDownload down = new ArtifactDownload(a, null, f, RepositoryPolicy.CHECKSUM_POLICY_FAIL);
Collection<? extends ArtifactDownload> downs = Arrays.asList(down);
RepositoryConnector c = connector();
c.get(downs, null);
assertNull(String.valueOf(down.getException()), down.getException());
TestFileUtils.assertContent("artifact", f);
}
Aggregations