use of org.apache.archiva.model.ArtifactReference in project archiva by apache.
the class ChecksumTransferTest method testGetWithNoChecksumsUsingIgnoredSetting.
@Test
public void testGetWithNoChecksumsUsingIgnoredSetting() throws Exception {
String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
setupTestableManagedRepository(path);
Path expectedFile = managedDefaultDir.resolve(path);
ArtifactReference artifact = managedDefaultRepository.toArtifactReference(path);
FileUtils.deleteDirectory(expectedFile.getParent());
assertFalse(Files.exists(expectedFile));
// Configure Connector (usually done within archiva.xml configuration)
saveConnector(ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false);
Path downloadedFile = proxyHandler.fetchFromProxies(managedDefaultRepository, artifact);
Path proxied1File = Paths.get(REPOPATH_PROXIED1, path);
assertFileEquals(expectedFile, downloadedFile, proxied1File);
assertNoTempFiles(expectedFile);
assertChecksums(expectedFile, null, null);
}
use of org.apache.archiva.model.ArtifactReference in project archiva by apache.
the class ChecksumTransferTest method testGetChecksumBadSha1BadMd5IgnoredSetting.
@Test
public void testGetChecksumBadSha1BadMd5IgnoredSetting() throws Exception {
String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
setupTestableManagedRepository(path);
Path expectedFile = managedDefaultDir.resolve(path);
ArtifactReference artifact = managedDefaultRepository.toArtifactReference(path);
FileUtils.deleteDirectory(expectedFile.getParent());
assertFalse(Files.exists(expectedFile));
// Configure Connector (usually done within archiva.xml configuration)
saveConnector(ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false);
Path downloadedFile = proxyHandler.fetchFromProxies(managedDefaultRepository, artifact);
Path proxied1File = Paths.get(REPOPATH_PROXIED1, path);
assertFileEquals(expectedFile, downloadedFile, proxied1File);
assertNoTempFiles(expectedFile);
assertChecksums(expectedFile, "invalid checksum file", "invalid checksum file");
}
use of org.apache.archiva.model.ArtifactReference in project archiva by apache.
the class ChecksumTransferTest method testGetChecksumBadSha1BadMd5FixSetting.
@Test
public void testGetChecksumBadSha1BadMd5FixSetting() throws Exception {
String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
setupTestableManagedRepository(path);
Path expectedFile = managedDefaultDir.resolve(path);
ArtifactReference artifact = managedDefaultRepository.toArtifactReference(path);
FileUtils.deleteDirectory(expectedFile.getParent());
assertFalse(Files.exists(expectedFile));
// Configure Connector (usually done within archiva.xml configuration)
saveConnector(ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false);
Path downloadedFile = proxyHandler.fetchFromProxies(managedDefaultRepository, artifact);
Path proxied1File = Paths.get(REPOPATH_PROXIED1, path);
assertFileEquals(expectedFile, downloadedFile, proxied1File);
assertNoTempFiles(expectedFile);
assertChecksums(expectedFile, "4ec20a12dc91557330bd0b39d1805be5e329ae56 get-checksum-both-bad-1.0.jar", "a292491a35925465e693a44809a078b5 get-checksum-both-bad-1.0.jar");
}
use of org.apache.archiva.model.ArtifactReference in project archiva by apache.
the class ChecksumTransferTest method testGetChecksumBothCorrect.
@Test
public void testGetChecksumBothCorrect() throws Exception {
String path = "org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar";
setupTestableManagedRepository(path);
Path expectedFile = managedDefaultDir.resolve(path);
ArtifactReference artifact = managedDefaultRepository.toArtifactReference(path);
org.apache.archiva.common.utils.FileUtils.deleteDirectory(expectedFile.getParent());
assertFalse(Files.exists(expectedFile));
// Configure Connector (usually done within archiva.xml configuration)
saveConnector(ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false);
Path downloadedFile = proxyHandler.fetchFromProxies(managedDefaultRepository, artifact);
Path proxied1File = Paths.get(REPOPATH_PROXIED1, path);
assertFileEquals(expectedFile, downloadedFile, proxied1File);
assertNoTempFiles(expectedFile);
assertChecksums(expectedFile, "066d76e459f7782c312c31e8a11b3c0f1e3e43a7 *get-checksum-both-right-1.0.jar", "e58f30c6a150a2e843552438d18e15cb *get-checksum-both-right-1.0.jar");
}
use of org.apache.archiva.model.ArtifactReference in project archiva by apache.
the class ChecksumTransferTest method testGetAlwaysBadChecksumPresentLocallyAbsentRemoteUsingFailSetting.
@Test
public void testGetAlwaysBadChecksumPresentLocallyAbsentRemoteUsingFailSetting() throws Exception {
String path = "org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar";
setupTestableManagedRepository(path);
Path expectedFile = managedDefaultDir.resolve(path);
Path remoteFile = Paths.get(REPOPATH_PROXIED1, path);
setManagedOlderThanRemote(expectedFile, remoteFile);
ArtifactReference artifact = managedDefaultRepository.toArtifactReference(path);
// Configure Connector (usually done within archiva.xml configuration)
saveConnector(ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS, SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false);
Path downloadedFile = proxyHandler.fetchFromProxies(managedDefaultRepository, artifact);
assertNotDownloaded(downloadedFile);
assertNoTempFiles(expectedFile);
// There are no hashcodes on the proxy side to download.
// The FAIL policy will delete the checksums as bad.
assertChecksums(expectedFile, "invalid checksum file", "invalid checksum file");
}
Aggregations