From: Brett Porter Date: Wed, 15 Dec 2010 01:21:23 +0000 (+0000) Subject: [MRM-1396] Purge task problem : Not enough parts to the path X-Git-Tag: archiva-1.3.3~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9cae99ded306e933ea2584222cd1277fb2deca94;p=archiva.git [MRM-1396] Purge task problem : Not enough parts to the path git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x@1049375 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java index 15945b499..09bb79db0 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java @@ -191,7 +191,7 @@ public class CleanupReleasedSnapshotsRepositoryPurge } catch ( LayoutException e ) { - throw new RepositoryPurgeException( e.getMessage(), e ); + log.debug( "Not processing file that is not an artifact: " + e.getMessage() ); } catch ( ContentNotFoundException e ) { diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java index 292e7a99b..345c85b83 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java @@ -36,7 +36,9 @@ import org.easymock.MockControl; */ public class CleanupReleasedSnapshotsRepositoryPurgeTest extends AbstractRepositoryPurgeTest -{ +{ + private static final String INDEX_PATH = ".index\\nexus-maven-repository-index.zip"; + private ArchivaConfiguration archivaConfiguration; public static final String PATH_TO_RELEASED_SNAPSHOT_IN_DIFF_REPO = @@ -80,7 +82,7 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest "2.3-SNAPSHOT", "maven-plugin" ) ); listenerControl.replay(); - repoPurge.process( CleanupReleasedSnapshotsRepositoryPurgeTest.PATH_TO_RELEASED_SNAPSHOT_IN_SAME_REPO ); + repoPurge.process( PATH_TO_RELEASED_SNAPSHOT_IN_SAME_REPO ); listenerControl.verify(); @@ -122,6 +124,29 @@ public class CleanupReleasedSnapshotsRepositoryPurgeTest XMLAssert.assertXpathEvaluatesTo( "20070315032817", "//metadata/versioning/lastUpdated", metadataXml ); } + public void testNonArtifactFile() + throws Exception + { + Configuration config = archivaConfiguration.getConfiguration(); + config.removeManagedRepository( config.findManagedRepositoryById( TEST_REPO_ID ) ); + config.addManagedRepository( getRepoConfiguration( TEST_REPO_ID, TEST_REPO_NAME ) ); + + String repoRoot = prepareTestRepos(); + + // test listeners for the correct artifacts + listenerControl.replay(); + + File file = new File( repoRoot, INDEX_PATH ); + file.createNewFile(); + assertTrue( file.exists() ); + + repoPurge.process( INDEX_PATH ); + + listenerControl.verify(); + + assertTrue( file.exists() ); + } + public void testReleasedSnapshotsExistsInDifferentRepo() throws Exception {