use of org.apache.archiva.repository.content.Artifact in project archiva by apache.
the class SnapshotTransferTest method testTimestampDrivenSnapshotNotPresentAlready.
@Test
public void testTimestampDrivenSnapshotNotPresentAlready() throws Exception {
String path = "org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar";
setupTestableManagedRepository(path);
Path expectedFile = managedDefaultDir.resolve(path);
BaseRepositoryContentLayout layout = managedDefaultRepository.getLayout(BaseRepositoryContentLayout.class);
Artifact artifact = layout.getArtifact(path);
Files.deleteIfExists(expectedFile);
assertFalse(Files.exists(expectedFile));
// Configure Connector (usually done within archiva.xml configuration)
saveConnector(ID_DEFAULT_MANAGED, ID_PROXIED1, false);
StorageAsset downloadedFile = proxyHandler.fetchFromProxies(managedDefaultRepository.getRepository(), artifact);
Path proxiedFile = Paths.get(REPOPATH_PROXIED1, path);
assertFileEquals(expectedFile, downloadedFile.getFilePath(), proxiedFile);
assertNoTempFiles(expectedFile);
}
use of org.apache.archiva.repository.content.Artifact in project archiva by apache.
the class SnapshotTransferTest method testSnapshotNonExistant.
@Test
public void testSnapshotNonExistant() throws Exception {
String path = "org/apache/maven/test/does-not-exist/1.0-SNAPSHOT/does-not-exist-1.0-SNAPSHOT.jar";
setupTestableManagedRepository(path);
Path expectedFile = managedDefaultDir.resolve(path);
BaseRepositoryContentLayout layout = managedDefaultRepository.getLayout(BaseRepositoryContentLayout.class);
Artifact artifact = layout.getArtifact(path);
Files.deleteIfExists(expectedFile);
assertFalse(Files.exists(expectedFile));
// Configure Connector (usually done within archiva.xml configuration)
saveConnector(ID_DEFAULT_MANAGED, ID_PROXIED1, false);
StorageAsset downloadedFile = proxyHandler.fetchFromProxies(managedDefaultRepository.getRepository(), artifact);
assertNotDownloaded(downloadedFile);
assertNoTempFiles(expectedFile);
}
use of org.apache.archiva.repository.content.Artifact in project archiva by apache.
the class SnapshotTransferTest method testGetMetadataDrivenSnapshotRemoteUpdate.
@Test
public void testGetMetadataDrivenSnapshotRemoteUpdate() throws Exception {
// Metadata driven snapshots (using a full timestamp) are treated like a release. It is the timing of the
// updates to the metadata files that triggers which will be downloaded
String path = "org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar";
setupTestableManagedRepository(path);
Path expectedFile = managedDefaultDir.resolve(path);
BaseRepositoryContentLayout layout = managedDefaultRepository.getLayout(BaseRepositoryContentLayout.class);
Artifact artifact = layout.getArtifact(path);
assertTrue(Files.exists(expectedFile));
Files.setLastModifiedTime(expectedFile, FileTime.from(getPastDate().getTime(), TimeUnit.MILLISECONDS));
// Configure Connector (usually done within archiva.xml configuration)
saveConnector(ID_DEFAULT_MANAGED, ID_PROXIED1, false);
StorageAsset downloadedFile = proxyHandler.fetchFromProxies(managedDefaultRepository.getRepository(), artifact);
Path proxiedFile = Paths.get(REPOPATH_PROXIED1, path);
assertNotNull(downloadedFile);
assertFileEquals(expectedFile, downloadedFile.getFilePath(), proxiedFile);
assertNoTempFiles(expectedFile);
}
use of org.apache.archiva.repository.content.Artifact in project archiva by apache.
the class ManagedDefaultTransferTest method testGetDefaultLayoutAlreadyPresentPolicyOnce.
/**
* The attempt here should result in no file being transferred.
* <p/>
* The file exists locally, and the policy is ONCE.
*
* @throws Exception
*/
@Test
public void testGetDefaultLayoutAlreadyPresentPolicyOnce() throws Exception {
String path = "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
setupTestableManagedRepository(path);
Path expectedFile = managedDefaultDir.resolve(path);
BaseRepositoryContentLayout layout = managedDefaultRepository.getLayout(BaseRepositoryContentLayout.class);
Artifact artifact = layout.getArtifact(path);
assertTrue(Files.exists(expectedFile));
// Configure Connector (usually done within archiva.xml configuration)
saveConnector(ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ONCE, SnapshotsPolicy.ONCE, CachedFailuresPolicy.NO, false);
// Attempt the proxy fetch.
StorageAsset downloadedFile = proxyHandler.fetchFromProxies(managedDefaultRepository.getRepository(), artifact);
assertFileEquals(expectedFile, downloadedFile.getFilePath(), expectedFile);
assertNoTempFiles(expectedFile);
}
use of org.apache.archiva.repository.content.Artifact in project archiva by apache.
the class ManagedDefaultTransferTest method testGetDefaultLayoutRemoteUpdate.
/**
* The attempt here should result in file being transferred.
* <p/>
* The file exists locally, is over 6 years old, and the policy is DAILY.
*
* @throws Exception
*/
@Test
public void testGetDefaultLayoutRemoteUpdate() throws Exception {
String path = "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
setupTestableManagedRepository(path);
Path expectedFile = managedDefaultDir.resolve(path);
BaseRepositoryContentLayout layout = managedDefaultRepository.getLayout(BaseRepositoryContentLayout.class);
Artifact artifact = layout.getArtifact(path);
assertTrue(Files.exists(expectedFile));
Files.setLastModifiedTime(expectedFile, FileTime.from(getPastDate().getTime(), TimeUnit.MILLISECONDS));
// Configure Connector (usually done within archiva.xml configuration)
saveConnector(ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.DAILY, SnapshotsPolicy.DAILY, CachedFailuresPolicy.NO, false);
// Attempt the proxy fetch.
StorageAsset downloadedFile = proxyHandler.fetchFromProxies(managedDefaultRepository.getRepository(), artifact);
Path proxiedFile = Paths.get(REPOPATH_PROXIED1, path);
assertFileEquals(expectedFile, downloadedFile.getFilePath(), proxiedFile);
assertNoTempFiles(expectedFile);
}
Aggregations