]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1396] Purge task problem : Not enough parts to the path
authorBrett Porter <brett@apache.org>
Wed, 15 Dec 2010 01:50:28 +0000 (01:50 +0000)
committerBrett Porter <brett@apache.org>
Wed, 15 Dec 2010 01:50:28 +0000 (01:50 +0000)
Merged from: r1049375

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1049382 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurgeTest.java

index a242e2e8c0e881cf1f813818e3555bb9186592de..2865e94199af73776ae8d06c054e9322dd1a5b91 100644 (file)
@@ -192,7 +192,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 )
         {
index 01b771d461f3718305d18adf885ec5b64f1d0d1b..f5282e23c8f5b7d54b997c6b3d90bffe2ed9239f 100644 (file)
@@ -36,7 +36,9 @@ import java.util.Collections;
  */
 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-plugin-2.3-SNAPSHOT.jar" );
         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
     {