aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2010-12-15 03:39:46 +0000
committerBrett Porter <brett@apache.org>2010-12-15 03:39:46 +0000
commit70537eb036c6752947a678404d663f31f7146bf0 (patch)
treed85e3cc09a4ff69069c663e56bc8656e7f5f2e5e /archiva-modules
parentf475ae1d1bc438b4cdf738e70534c4a7c784c596 (diff)
downloadarchiva-70537eb036c6752947a678404d663f31f7146bf0.tar.gz
archiva-70537eb036c6752947a678404d663f31f7146bf0.zip
[MRM-1421] Archiva repository purge incorrectly purges based on file timestamps even when the snapshot timestamp is known
Merged from: r1049391:1049399 git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1049407 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java4
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java19
2 files changed, 15 insertions, 8 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
index 7f15d5912..42eee8103 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
@@ -128,10 +128,6 @@ public class DaysOldRepositoryPurge
{
doPurgeAllRelated( newArtifactReference );
}
- else if ( newArtifactFile.lastModified() < olderThanThisDate.getTimeInMillis() )
- {
- doPurgeAllRelated( newArtifactReference );
- }
}
}
}
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java
index 78dcb1bf9..6db918d6a 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java
@@ -31,6 +31,8 @@ import java.util.Collections;
public class DaysOldRepositoryPurgeTest
extends AbstractRepositoryPurgeTest
{
+ private static final int OLD_TIMESTAMP = 1179382029;
+
private void setLastModified( String dirPath, long lastModified )
{
File dir = new File( dirPath );
@@ -54,7 +56,7 @@ public class DaysOldRepositoryPurgeTest
String projectRoot = repoRoot + "/org/apache/maven/plugins/maven-install-plugin";
- setLastModified( projectRoot + "/2.2-SNAPSHOT/", 1179382029 );
+ setLastModified( projectRoot + "/2.2-SNAPSHOT/", OLD_TIMESTAMP );
// test listeners for the correct artifacts
listener.deleteArtifact( getRepository().getId(), "org.apache.maven.plugins", "maven-install-plugin",
@@ -113,7 +115,7 @@ public class DaysOldRepositoryPurgeTest
String projectRoot = repoRoot + "/org/apache/maven/plugins/maven-assembly-plugin";
- setLastModified( projectRoot + "/1.1.2-SNAPSHOT/", 1179382029 );
+ setLastModified( projectRoot + "/1.1.2-SNAPSHOT/", OLD_TIMESTAMP );
// test listeners for the correct artifacts
listener.deleteArtifact( getRepository().getId(), "org.apache.maven.plugins", "maven-assembly-plugin",
@@ -169,8 +171,17 @@ public class DaysOldRepositoryPurgeTest
for ( int i = 5; i <= 7; i++ )
{
- new File( versionRoot, "/plexus-utils-1.4.3-" + timestamp + "-" + i + ".jar" ).createNewFile();
- new File( versionRoot, "/plexus-utils-1.4.3-" + timestamp + "-" + i + ".pom" ).createNewFile();
+ File jarFile = new File( versionRoot, "/plexus-utils-1.4.3-" + timestamp + "-" + i + ".jar" );
+ jarFile.createNewFile();
+ File pomFile = new File( versionRoot, "/plexus-utils-1.4.3-" + timestamp + "-" + i + ".pom" );
+ pomFile.createNewFile();
+
+ // set timestamp to older than 100 days for the first build, but ensure the filename timestamp is honoured instead
+ if ( i == 5 )
+ {
+ jarFile.setLastModified( OLD_TIMESTAMP );
+ pomFile.setLastModified( OLD_TIMESTAMP );
+ }
}
// test listeners for the correct artifacts