]> 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:21:23 +0000 (01:21 +0000)
committerBrett Porter <brett@apache.org>
Wed, 15 Dec 2010 01:21:23 +0000 (01:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x@1049375 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 15945b499d480876436d9daa67c8b207ef4a93b6..09bb79db09dd255c673bbd4611b3b74875895c00 100644 (file)
@@ -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 )
         {
index 292e7a99b62bc84361df243c450aec03722a1563..345c85b83bc572479a101d688deeb68437183334 100644 (file)
@@ -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
     {