[MRM-1396] Purge task problem : Not enough parts to the path

Merged from: r1049375


git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1049382 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2010-12-15 01:50:28 +00:00
parent 82485c9ed4
commit 3c7670142f
2 changed files with 28 additions and 3 deletions

View 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 )
{

View 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
{