From 7db1bd8f9daa95841488d049a9fe62310d6fcee3 Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Mon, 6 Aug 2007 08:22:35 +0000 Subject: [PATCH] [MRM-294] - Changed DefaultCleanupReleasedSnapshots to CleanupReleasedSnapshotsRepositoryPurge - Removed unneeded fields in RepositoryPurgeConsumer - Added constructor for DaysOldRepositoryPurge, RetentionCountRepositoryPurge and CleanupReleasedSnapshotsRepositoryPurge - Updated test classes and test resources git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@563064 13f79535-47bb-0310-9956-ffa450edef68 --- .../repository/AbstractRepositoryPurge.java | 108 +++----- ...anupReleasedSnapshotsRepositoryPurge.java} | 41 +-- .../repository/DaysOldRepositoryPurge.java | 32 ++- .../core/repository/RepositoryPurge.java | 33 +-- .../repository/RepositoryPurgeConsumer.java | 44 +--- .../RetentionCountRepositoryPurge.java | 30 ++- .../AbstractRepositoryPurgeTest.java | 38 +-- .../DaysOldRepositoryPurgeTest.java | 43 ++- .../RetentionCountRepositoryPurgeTest.java | 248 +++++++++--------- .../repository/DaysOldRepositoryPurgeTest.xml | 170 +----------- .../RetentionCountRepositoryPurgeTest.xml | 170 +----------- 11 files changed, 280 insertions(+), 677 deletions(-) rename archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/{DefaultCleanupReleasedSnapshots.java => CleanupReleasedSnapshotsRepositoryPurge.java} (87%) diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java index f19ab4d38..433d9b217 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java @@ -19,7 +19,6 @@ package org.apache.maven.archiva.consumers.core.repository; * under the License. */ -import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.model.ArchivaArtifact; import org.apache.maven.archiva.repository.layout.FilenameParts; @@ -28,29 +27,33 @@ import org.apache.maven.archiva.repository.layout.LayoutException; import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.database.ArtifactDAO; -import org.apache.maven.archiva.indexer.RepositoryContentIndex; import org.apache.maven.archiva.indexer.RepositoryIndexException; -import org.apache.maven.archiva.indexer.filecontent.FileContentRecord; import org.apache.commons.lang.StringUtils; +import org.codehaus.plexus.logging.AbstractLogEnabled; import java.io.File; import java.io.FilenameFilter; -import java.util.ArrayList; -import java.util.List; /** * @author Maria Odea Ching + * @version */ public abstract class AbstractRepositoryPurge implements RepositoryPurge { - private ArchivaRepository repository; + protected ArchivaRepository repository; - private BidirectionalRepositoryLayout layout; + protected BidirectionalRepositoryLayout layout; - private RepositoryContentIndex index; + protected ArtifactDAO artifactDao; - private ArtifactDAO artifactDao; + public AbstractRepositoryPurge( ArchivaRepository repository, + BidirectionalRepositoryLayout layout, ArtifactDAO artifactDao ) + { + this.repository = repository; + this.layout = layout; + this.artifactDao = artifactDao; + } /** * Get all files from the directory that matches the specified filename. @@ -60,23 +63,14 @@ public abstract class AbstractRepositoryPurge * @return */ protected File[] getFiles( File dir, String filename ) - throws RepositoryPurgeException { FilenameFilter filter = new ArtifactFilenameFilter( filename ); - if ( !dir.isDirectory() ) - { - System.out.println( "File is not a directory." ); - } - File[] files = dir.listFiles( filter ); return files; } - public abstract void process( String path, Configuration configuration ) - throws RepositoryPurgeException; - /** * Purge the repo. Update db and index of removed artifacts. * @@ -84,49 +78,43 @@ public abstract class AbstractRepositoryPurge * @throws RepositoryIndexException */ protected void purge( File[] artifactFiles ) - throws RepositoryIndexException { - List records = new ArrayList(); - for ( int i = 0; i < artifactFiles.length; i++ ) { artifactFiles[i].delete(); - String[] artifactPathParts = artifactFiles[i].getAbsolutePath().split( getRepository().getUrl().getPath() ); + String[] artifactPathParts = artifactFiles[i].getAbsolutePath().split( repository.getUrl().getPath() ); String artifactPath = artifactPathParts[artifactPathParts.length - 1]; if ( !artifactPath.toUpperCase().endsWith( "SHA1" ) && !artifactPath.toUpperCase().endsWith( "MD5" ) ) { - updateDatabase( artifactPath ); + // intended to be swallowed + // continue updating the database for all artifacts + try + { + updateDatabase( artifactPath ); + } + catch ( ArchivaDatabaseException ae ) + { + //@todo determine logging to be used + } + catch ( LayoutException le ) + { + + } } - - FileContentRecord record = new FileContentRecord(); - record.setRepositoryId( this.repository.getId() ); - record.setFilename( artifactPath ); - records.add( record ); } - - //index.deleteRecords( records ); } private void updateDatabase( String path ) + throws ArchivaDatabaseException, LayoutException { - try - { - ArchivaArtifact artifact = layout.toArtifact( path ); - ArchivaArtifact queriedArtifact = artifactDao.getArtifact( artifact.getGroupId(), artifact.getArtifactId(), - artifact.getVersion(), artifact.getClassifier(), - artifact.getType() ); - - artifactDao.deleteArtifact( queriedArtifact ); - } - catch ( ArchivaDatabaseException ae ) - { - } - catch ( LayoutException le ) - { + ArchivaArtifact artifact = layout.toArtifact( path ); + ArchivaArtifact queriedArtifact = artifactDao.getArtifact( artifact.getGroupId(), artifact.getArtifactId(), + artifact.getVersion(), artifact.getClassifier(), + artifact.getType() ); - } + artifactDao.deleteArtifact( queriedArtifact ); } /** @@ -147,34 +135,4 @@ public abstract class AbstractRepositoryPurge return parts; } - public void setRepository( ArchivaRepository repository ) - { - this.repository = repository; - } - - public void setLayout( BidirectionalRepositoryLayout layout ) - { - this.layout = layout; - } - - public void setIndex( RepositoryContentIndex index ) - { - this.index = index; - } - - public void setArtifactDao( ArtifactDAO artifactDao ) - { - this.artifactDao = artifactDao; - } - - protected ArchivaRepository getRepository() - { - return repository; - } - - protected BidirectionalRepositoryLayout getLayout() - { - return layout; - } - } diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DefaultCleanupReleasedSnapshots.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java similarity index 87% rename from archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DefaultCleanupReleasedSnapshots.java rename to archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java index 7e9543c40..5141cd87a 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DefaultCleanupReleasedSnapshots.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/CleanupReleasedSnapshotsRepositoryPurge.java @@ -19,49 +19,56 @@ package org.apache.maven.archiva.consumers.core.repository; * under the License. */ -import org.apache.maven.archiva.configuration.Configuration; -import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; -import org.apache.maven.archiva.repository.layout.FilenameParts; -import org.apache.maven.archiva.repository.layout.LayoutException; import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader; import org.apache.maven.archiva.repository.metadata.RepositoryMetadataWriter; import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException; -import org.apache.maven.archiva.indexer.RepositoryIndexException; +import org.apache.maven.archiva.repository.layout.FilenameParts; +import org.apache.maven.archiva.repository.layout.LayoutException; +import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; +import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.RepositoryConfiguration; import org.apache.maven.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.common.utils.VersionComparator; +import org.apache.maven.archiva.indexer.RepositoryIndexException; +import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; +import org.apache.maven.archiva.model.ArchivaRepository; +import org.apache.maven.archiva.database.ArtifactDAO; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; import java.util.List; -import java.util.ArrayList; import java.util.Collections; -import java.util.Iterator; import java.util.Date; +import java.util.ArrayList; +import java.util.Iterator; /** * M2 implementation for cleaning up the released snapshots. * * @author Maria Odea Ching + * @version */ -public class DefaultCleanupReleasedSnapshots +public class CleanupReleasedSnapshotsRepositoryPurge extends AbstractRepositoryPurge { public static final String SNAPSHOT = "-SNAPSHOT"; private RepositoryMetadataReader metadataReader; - public DefaultCleanupReleasedSnapshots() + public CleanupReleasedSnapshotsRepositoryPurge( ArchivaRepository repository, BidirectionalRepositoryLayout layout, + ArtifactDAO artifactDao ) { - metadataReader = new RepositoryMetadataReader(); + super( repository, layout, artifactDao ); + metadataReader = new RepositoryMetadataReader(); } - public void process( String path, Configuration configuration ) + public void process( String path ) throws RepositoryPurgeException { try { - File artifactFile = new File( getRepository().getUrl().getPath(), path ); + File artifactFile = new File( repository.getUrl().getPath(), path ); if ( !artifactFile.exists() ) { @@ -93,7 +100,7 @@ public class DefaultCleanupReleasedSnapshots FileUtils.deleteDirectory( versionDir ); updated = true; - + break; } } @@ -112,10 +119,6 @@ public class DefaultCleanupReleasedSnapshots { throw new RepositoryPurgeException( ie.getMessage() ); } - catch ( RepositoryIndexException re ) - { - throw new RepositoryPurgeException( re.getMessage() ); - } } private void updateMetadata( File artifactIdDir ) @@ -147,7 +150,8 @@ public class DefaultCleanupReleasedSnapshots } catch ( RepositoryMetadataException rme ) { - System.out.println( "Error updating metadata " + metadataFiles[i].getAbsoluteFile() ); + // continue updating other metadata files even if there is an exception + // @todo log to console } } } @@ -186,5 +190,4 @@ public class DefaultCleanupReleasedSnapshots return versions; } - } diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java index 75b17cb2d..c10450398 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java @@ -21,31 +21,43 @@ package org.apache.maven.archiva.consumers.core.repository; import org.apache.maven.archiva.repository.layout.FilenameParts; import org.apache.maven.archiva.repository.layout.LayoutException; +import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.apache.maven.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.configuration.RepositoryConfiguration; import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.indexer.RepositoryIndexException; +import org.apache.maven.archiva.model.ArchivaRepository; +import org.apache.maven.archiva.database.ArtifactDAO; import java.util.Calendar; import java.util.GregorianCalendar; import java.io.File; /** + * Purge repository for snapshots older than the specified days in the repository configuration. + * * @author Maria Odea Ching - * @plexus.component role="org.apache.maven.archiva.consumers.core.repository.RepositoryPurge" - * role-hint="days-old" - * instantiation-strategy="per-lookup" + * @version */ public class DaysOldRepositoryPurge extends AbstractRepositoryPurge -{ +{ + private RepositoryConfiguration repoConfig; - public void process( String path, Configuration configuration ) + public DaysOldRepositoryPurge( ArchivaRepository repository, + BidirectionalRepositoryLayout layout, ArtifactDAO artifactDao, + RepositoryConfiguration repoConfig) + { + super( repository, layout, artifactDao ); + this.repoConfig = repoConfig; + } + + public void process( String path ) throws RepositoryPurgeException { try { - File artifactFile = new File( getRepository().getUrl().getPath(), path ); + File artifactFile = new File( repository.getUrl().getPath(), path ); if( !artifactFile.exists() ) { @@ -56,9 +68,7 @@ public class DaysOldRepositoryPurge if ( VersionUtil.isSnapshot( parts.version ) ) { - RepositoryConfiguration repoConfig = configuration.findRepositoryById( getRepository().getId() ); - - Calendar olderThanThisDate = new GregorianCalendar(); + Calendar olderThanThisDate = Calendar.getInstance(); olderThanThisDate.add( Calendar.DATE, ( -1 * repoConfig.getDaysOlder() ) ); if ( artifactFile.lastModified() < olderThanThisDate.getTimeInMillis() ) @@ -75,10 +85,6 @@ public class DaysOldRepositoryPurge { throw new RepositoryPurgeException( le.getMessage() ); } - catch ( RepositoryIndexException re ) - { - throw new RepositoryPurgeException( re.getMessage() ); - } } } diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurge.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurge.java index 6e829cc01..6e48f7287 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurge.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurge.java @@ -37,37 +37,8 @@ public interface RepositoryPurge * Perform checking on artifact for repository purge * * @param path path to the scanned artifact - * @param configuration the configuration for the repository currently being scanned */ - public void process( String path, Configuration configuration ) + public void process( String path ) throws RepositoryPurgeException; - - /** - * Set the repository to be purged - * - * @param repository - */ - public void setRepository( ArchivaRepository repository ); - - /** - * Set the layout of the repository to be purged - * - * @param layout - */ - public void setLayout( BidirectionalRepositoryLayout layout ); - - /** - * Set the index of the repository - * - * @param index - */ - public void setIndex( RepositoryContentIndex index ); - - /** - * Set the artifact dao used for updating the database of the changes in the repo - * - * @param artifactDao - */ - public void setArtifactDao( ArtifactDAO artifactDao ); - + } diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java index 065521f8b..8addb1220 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java @@ -73,15 +73,10 @@ public class RepositoryPurgeConsumer */ private BidirectionalRepositoryLayoutFactory layoutFactory; - /** - * @plexus.requirement role-hint="lucene" - */ - private RepositoryContentIndexFactory indexFactory; - /** * @plexus.requirement role-hint="jdo" */ - private ArchivaDAO dao; + private ArchivaDAO dao; /** * @plexus.requirement @@ -90,16 +85,12 @@ public class RepositoryPurgeConsumer private ArchivaRepository repository; - private BidirectionalRepositoryLayout repositoryLayout; - private List includes = new ArrayList(); private List propertyNameTriggers = new ArrayList(); private RepositoryPurge repoPurge; - private RepositoryContentIndex index; - private RepositoryPurge cleanUp; public String getId() @@ -130,17 +121,18 @@ public class RepositoryPurgeConsumer public void beginScan( ArchivaRepository repository ) throws ConsumerException { + BidirectionalRepositoryLayout repositoryLayout = null; + if ( !repository.isManaged() ) { throw new ConsumerException( "Consumer requires managed repository." ); } this.repository = repository; - this.index = indexFactory.createFileContentIndex( repository ); try { - this.repositoryLayout = layoutFactory.getLayout( this.repository.getLayoutType() ); + repositoryLayout = layoutFactory.getLayout( repository.getLayoutType() ); } catch ( LayoutException e ) { @@ -148,27 +140,18 @@ public class RepositoryPurgeConsumer "Unable to initialize consumer due to unknown repository layout: " + e.getMessage(), e ); } - // @todo handle better injection of RepositoryPurge RepositoryConfiguration repoConfig = configuration.getConfiguration().findRepositoryById( repository.getId() ); if ( repoConfig.getDaysOlder() != 0 ) { - repoPurge = new DaysOldRepositoryPurge(); + repoPurge = new DaysOldRepositoryPurge( repository, repositoryLayout, dao.getArtifactDAO(), repoConfig ); } else { - repoPurge = new RetentionCountRepositoryPurge(); + repoPurge = + new RetentionCountRepositoryPurge( repository, repositoryLayout, dao.getArtifactDAO(), repoConfig ); } - - repoPurge.setLayout( repositoryLayout ); - repoPurge.setRepository( repository ); - repoPurge.setIndex( index ); - repoPurge.setArtifactDao( dao.getArtifactDAO() ); - - cleanUp = new DefaultCleanupReleasedSnapshots(); - cleanUp.setRepository( repository ); - cleanUp.setLayout( repositoryLayout ); - cleanUp.setArtifactDao( dao.getArtifactDAO() ); - cleanUp.setIndex( index ); + + cleanUp = new CleanupReleasedSnapshotsRepositoryPurge( repository, repositoryLayout, dao.getArtifactDAO() ); } public void processFile( String path ) @@ -176,13 +159,14 @@ public class RepositoryPurgeConsumer { try { - RepositoryConfiguration repoConfig = configuration.getConfiguration().findRepositoryById( repository.getId() ); - if( repoConfig.isDeleteReleasedSnapshots() ) + RepositoryConfiguration repoConfig = + configuration.getConfiguration().findRepositoryById( repository.getId() ); + if ( repoConfig.isDeleteReleasedSnapshots() ) { - cleanUp.process( path, configuration.getConfiguration() ); + cleanUp.process( path ); } - repoPurge.process( path, configuration.getConfiguration() ); + repoPurge.process( path ); } catch ( RepositoryPurgeException rpe ) { diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java index 7d4eef262..18ba29c5c 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurge.java @@ -23,8 +23,11 @@ import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.RepositoryConfiguration; import org.apache.maven.archiva.repository.layout.FilenameParts; import org.apache.maven.archiva.repository.layout.LayoutException; +import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout; import org.apache.maven.archiva.common.utils.VersionUtil; import org.apache.maven.archiva.indexer.RepositoryIndexException; +import org.apache.maven.archiva.model.ArchivaRepository; +import org.apache.maven.archiva.database.ArtifactDAO; import java.io.File; import java.util.List; @@ -33,20 +36,30 @@ import java.util.Iterator; import java.util.Collections; /** + * Purge the repository by retention count. Retain only the specified number of snapshots. + * * @author Maria Odea Ching - * @plexus.component role="org.apache.maven.archiva.consumers.core.repository.RepositoryPurge" - * role-hint="retention-count" - * instantiation-strategy="per-lookup" + * @version */ public class RetentionCountRepositoryPurge extends AbstractRepositoryPurge { - public void process( String path, Configuration configuration ) + private RepositoryConfiguration repoConfig; + + public RetentionCountRepositoryPurge( ArchivaRepository repository, + BidirectionalRepositoryLayout layout, ArtifactDAO artifactDao, + RepositoryConfiguration repoConfig ) + { + super( repository, layout, artifactDao ); + this.repoConfig = repoConfig; + } + + public void process( String path ) throws RepositoryPurgeException { try { - File artifactFile = new File( getRepository().getUrl().getPath(), path ); + File artifactFile = new File( repository.getUrl().getPath(), path ); if( !artifactFile.exists() ) { @@ -56,8 +69,7 @@ public class RetentionCountRepositoryPurge FilenameParts parts = getFilenameParts( path ); if ( VersionUtil.isSnapshot( parts.version ) ) - { - RepositoryConfiguration repoConfig = configuration.findRepositoryById( getRepository().getId() ); + { File parentDir = artifactFile.getParentFile(); if ( parentDir.isDirectory() ) @@ -87,10 +99,6 @@ public class RetentionCountRepositoryPurge { throw new RepositoryPurgeException( le.getMessage() ); } - catch ( RepositoryIndexException re ) - { - throw new RepositoryPurgeException( re.getMessage() ); - } } private List getUniqueVersions( File[] files ) diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java index 46cbaa5d3..f59e2150d 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java @@ -58,7 +58,7 @@ public class AbstractRepositoryPurgeTest public static final int TEST_DAYS_OLDER = 30; - private Configuration config; + private RepositoryConfiguration config; private ArchivaRepository repo; @@ -136,38 +136,20 @@ public class AbstractRepositoryPurgeTest dao = (ArtifactDAO) lookup( ArtifactDAO.class.getName(), "jdo" ); } - public void lookupRepositoryPurge( String role ) - throws Exception - { - repoPurge = (RepositoryPurge) lookup( RepositoryPurge.class.getName(), role ); - - repoPurge.setArtifactDao( dao ); - - repoPurge.setRepository( getRepository() ); - - repoPurge.setLayout( getLayout() ); - } - - public Configuration getRepoConfiguration() + public RepositoryConfiguration getRepoConfiguration() { if ( config == null ) { - config = new Configuration(); + config = new RepositoryConfiguration(); } - RepositoryConfiguration repoConfig = new RepositoryConfiguration(); - repoConfig.setId( TEST_REPO_ID ); - repoConfig.setName( TEST_REPO_NAME ); - repoConfig.setDaysOlder( TEST_DAYS_OLDER ); - repoConfig.setUrl( TEST_REPO_URL ); - repoConfig.setReleases( true ); - repoConfig.setSnapshots( true ); - repoConfig.setRetentionCount( TEST_RETENTION_COUNT ); - - List repos = new ArrayList(); - repos.add( repoConfig ); - - config.setRepositories( repos ); + config.setId( TEST_REPO_ID ); + config.setName( TEST_REPO_NAME ); + config.setDaysOlder( TEST_DAYS_OLDER ); + config.setUrl( TEST_REPO_URL ); + config.setReleases( true ); + config.setSnapshots( true ); + config.setRetentionCount( TEST_RETENTION_COUNT ); return config; } diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java index 5a8214296..d52aeb63f 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java @@ -35,7 +35,7 @@ public class DaysOldRepositoryPurgeTest { super.setUp(); - lookupRepositoryPurge( "days-old" ); + repoPurge = new DaysOldRepositoryPurge( getRepository(), getLayout(), dao, getRepoConfiguration() ); } private void setLastModified() @@ -52,21 +52,11 @@ public class DaysOldRepositoryPurgeTest public void testIfAJarIsFound() throws Exception { - // Create it - ArchivaArtifact artifact = - dao.createArtifact( "org.apache.maven.plugins", "maven-install-plugin", "2.2-SNAPSHOT", "", "jar" ); - assertNotNull( artifact ); - - artifact.getModel().setLastModified( new Date() ); - artifact.getModel().setOrigin( "test" ); - - // Save it. - ArchivaArtifact savedArtifact = dao.saveArtifact( artifact ); - assertNotNull( savedArtifact ); - + populateDb(); + setLastModified(); - repoPurge.process( PATH_TO_BY_DAYS_OLD_ARTIFACT, getRepoConfiguration() ); + repoPurge.process( PATH_TO_BY_DAYS_OLD_ARTIFACT ); assertTrue( true ); @@ -90,4 +80,29 @@ public class DaysOldRepositoryPurgeTest super.tearDown(); repoPurge = null; } + + private void populateDb() + throws Exception + { + // Create it + ArchivaArtifact artifact = + dao.createArtifact( "org.apache.maven.plugins", "maven-install-plugin", "2.2-SNAPSHOT", "", "jar" ); + assertNotNull( artifact ); + + artifact.getModel().setLastModified( new Date() ); + artifact.getModel().setOrigin( "test" ); + + // Save it. + ArchivaArtifact savedArtifact = dao.saveArtifact( artifact ); + assertNotNull( savedArtifact ); + + //POM + artifact = + dao.createArtifact( "org.apache.maven.plugins", "maven-install-plugin", "2.2-SNAPSHOT", "", "pom" ); + assertNotNull( artifact ); + artifact.getModel().setLastModified( new Date() ); + artifact.getModel().setOrigin( "test" ); + savedArtifact = dao.saveArtifact( artifact ); + assertNotNull( savedArtifact ); + } } diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java index a54fee848..718415a65 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java @@ -44,7 +44,7 @@ public class RetentionCountRepositoryPurgeTest { super.setUp(); - lookupRepositoryPurge( "retention-count" ); + repoPurge = new RetentionCountRepositoryPurge( getRepository(), getLayout(), dao, getRepoConfiguration() ); } /** @@ -54,6 +54,134 @@ public class RetentionCountRepositoryPurgeTest */ public void testIfAJarWasFound() throws Exception + { + populateIfJarWasFoundDb(); + + repoPurge.process( PATH_TO_BY_RETENTION_COUNT_ARTIFACT ); + + // assert if removed from repo + assertFalse( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.jar" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.jar.md5" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.jar.sha1" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.pom" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.pom.md5" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.pom.sha1" ).exists() ); + + assertFalse( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.jar" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.jar.md5" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.jar.sha1" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.pom" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.pom.md5" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.pom.sha1" ).exists() ); + + // assert if not removed from repo + assertTrue( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.jar" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.jar.md5" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.jar.sha1" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.pom" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.pom.md5" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.pom.sha1" ).exists() ); + + assertTrue( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.jar" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.jar.md5" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.jar.sha1" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.pom" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.pom.md5" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.pom.sha1" ).exists() ); + } + + /** + * Test if the artifact to be processed is a pom + * + * @throws Exception + */ + public void testIfAPomWasFound() + throws Exception + { + populateIfPomWasFoundDb(); + + repoPurge.process( PATH_TO_BY_RETENTION_COUNT_POM ); + + // assert if removed from repo + assertFalse( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.jar" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.jar.md5" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.jar.sha1" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.pom" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.pom.md5" ).exists() ); + assertFalse( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.pom.sha1" ).exists() ); + + // assert if not removed from repo + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.pom" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.pom.md5" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.pom.sha1" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.jar" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.jar.md5" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.jar.sha1" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3-sources.jar" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3-sources.jar.md5" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3-sources.jar.sha1" ).exists() ); + + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.pom" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.pom.md5" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.pom.sha1" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.jar" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.jar.md5" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.jar.sha1" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2-sources.jar" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2-sources.jar.md5" ).exists() ); + assertTrue( new File( + "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2-sources.jar.sha1" ).exists() ); + } + + public void populateIfJarWasFoundDb() + throws Exception { // Create it ArchivaArtifact artifact = @@ -129,70 +257,9 @@ public class RetentionCountRepositoryPurgeTest artifact.getModel().setOrigin( "test" ); savedArtifact = dao.saveArtifact( artifact ); assertNotNull( savedArtifact ); - - repoPurge.process( PATH_TO_BY_RETENTION_COUNT_ARTIFACT, getRepoConfiguration() ); - - // assert if removed from repo - assertFalse( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.jar" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.jar.md5" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.jar.sha1" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.pom" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.pom.md5" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.pom.sha1" ).exists() ); - - assertFalse( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.jar" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.jar.md5" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.jar.sha1" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.pom" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.pom.md5" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.pom.sha1" ).exists() ); - - // assert if not removed from repo - assertTrue( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.jar" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.jar.md5" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.jar.sha1" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.pom" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.pom.md5" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.pom.sha1" ).exists() ); - - assertTrue( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.jar" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.jar.md5" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.jar.sha1" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.pom" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.pom.md5" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.pom.sha1" ).exists() ); } - /** - * Test if the artifact to be processed is a pom - * - * @throws Exception - */ - public void testIfAPomWasFound() + public void populateIfPomWasFoundDb() throws Exception { // Create it @@ -244,60 +311,5 @@ public class RetentionCountRepositoryPurgeTest artifact.getModel().setOrigin( "test" ); savedArtifact = dao.saveArtifact( artifact ); assertNotNull( savedArtifact ); - - repoPurge.process( PATH_TO_BY_RETENTION_COUNT_POM, getRepoConfiguration() ); - - // assert if removed from repo - assertFalse( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.jar" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.jar.md5" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.jar.sha1" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.pom" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.pom.md5" ).exists() ); - assertFalse( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.pom.sha1" ).exists() ); - - // assert if not removed from repo - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.pom" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.pom.md5" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.pom.sha1" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.jar" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.jar.md5" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.jar.sha1" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3-sources.jar" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3-sources.jar.md5" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3-sources.jar.sha1" ).exists() ); - - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.pom" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.pom.md5" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.pom.sha1" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.jar" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.jar.md5" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.jar.sha1" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2-sources.jar" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2-sources.jar.md5" ).exists() ); - assertTrue( new File( - "target/test-classes/test-repo/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2-sources.jar.sha1" ).exists() ); } } diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.xml b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.xml index 3994f3ed3..36d669d55 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.xml +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.xml @@ -20,91 +20,7 @@ - - - - org.apache.maven.archiva.consumers.core.repository.RepositoryPurge - days-old - org.apache.maven.archiva.consumers.core.repository.DaysOldRepositoryPurge - - - - - - org.apache.maven.archiva.indexer.RepositoryContentIndexFactory - lucene - org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentIndexFactory - - - org.apache.maven.archiva.configuration.ArchivaConfiguration - - - - - - - - org.apache.maven.archiva.configuration.ArchivaConfiguration - test-configuration - org.apache.maven.archiva.configuration.DefaultArchivaConfiguration - - - org.codehaus.plexus.registry.Registry - configured - - - - - org.codehaus.plexus.registry.Registry - configured - org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry - - - - - - - - - - - org.apache.maven.archiva.database.ArchivaDAO - jdo - org.apache.maven.archiva.database.jdo.JdoArchivaDAO - - - org.apache.maven.archiva.database.jdo.JdoAccess - archiva - - - org.apache.maven.archiva.database.ArtifactDAO - jdo - - - org.apache.maven.archiva.database.ProjectModelDAO - jdo - - - org.apache.maven.archiva.database.RepositoryDAO - jdo - - - org.apache.maven.archiva.database.RepositoryProblemDAO - jdo - - - - + org.apache.maven.archiva.database.jdo.JdoAccess @@ -118,58 +34,6 @@ - - - org.apache.maven.archiva.database.ArtifactDAO - jdo - org.apache.maven.archiva.database.jdo.JdoArtifactDAO - - - org.apache.maven.archiva.database.jdo.JdoAccess - archiva - - - - - - - org.apache.maven.archiva.database.ProjectModelDAO - jdo - org.apache.maven.archiva.database.jdo.JdoProjectModelDAO - - - org.apache.maven.archiva.database.jdo.JdoAccess - archiva - - - - - - - org.apache.maven.archiva.database.RepositoryDAO - jdo - org.apache.maven.archiva.database.jdo.JdoRepositoryDAO - - - org.apache.maven.archiva.database.jdo.JdoAccess - archiva - - - - - - - org.apache.maven.archiva.database.RepositoryProblemDAO - jdo - org.apache.maven.archiva.database.jdo.JdoRepositoryProblemDAO - - - org.apache.maven.archiva.database.jdo.JdoAccess - archiva - - - - org.codehaus.plexus.jdo.JdoFactory @@ -186,38 +50,6 @@ javax.jdo.PersistenceManagerFactoryClass org.jpox.PersistenceManagerFactoryImpl - diff --git a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.xml b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.xml index dd885d386..86639b525 100644 --- a/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.xml +++ b/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.xml @@ -19,91 +19,7 @@ --> - - - - - org.apache.maven.archiva.consumers.core.repository.RepositoryPurge - retention-count - org.apache.maven.archiva.consumers.core.repository.RetentionCountRepositoryPurge - - - - - - org.apache.maven.archiva.indexer.RepositoryContentIndexFactory - lucene - org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentIndexFactory - - - org.apache.maven.archiva.configuration.ArchivaConfiguration - - - - - - - - org.apache.maven.archiva.configuration.ArchivaConfiguration - test-configuration - org.apache.maven.archiva.configuration.DefaultArchivaConfiguration - - - org.codehaus.plexus.registry.Registry - configured - - - - - org.codehaus.plexus.registry.Registry - configured - org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry - - - - - - - - - - - org.apache.maven.archiva.database.ArchivaDAO - jdo - org.apache.maven.archiva.database.jdo.JdoArchivaDAO - - - org.apache.maven.archiva.database.jdo.JdoAccess - archiva - - - org.apache.maven.archiva.database.ArtifactDAO - jdo - - - org.apache.maven.archiva.database.ProjectModelDAO - jdo - - - org.apache.maven.archiva.database.RepositoryDAO - jdo - - - org.apache.maven.archiva.database.RepositoryProblemDAO - jdo - - - + @@ -118,58 +34,6 @@ - - - org.apache.maven.archiva.database.ArtifactDAO - jdo - org.apache.maven.archiva.database.jdo.JdoArtifactDAO - - - org.apache.maven.archiva.database.jdo.JdoAccess - archiva - - - - - - - org.apache.maven.archiva.database.ProjectModelDAO - jdo - org.apache.maven.archiva.database.jdo.JdoProjectModelDAO - - - org.apache.maven.archiva.database.jdo.JdoAccess - archiva - - - - - - - org.apache.maven.archiva.database.RepositoryDAO - jdo - org.apache.maven.archiva.database.jdo.JdoRepositoryDAO - - - org.apache.maven.archiva.database.jdo.JdoAccess - archiva - - - - - - - org.apache.maven.archiva.database.RepositoryProblemDAO - jdo - org.apache.maven.archiva.database.jdo.JdoRepositoryProblemDAO - - - org.apache.maven.archiva.database.jdo.JdoAccess - archiva - - - - org.codehaus.plexus.jdo.JdoFactory @@ -186,38 +50,6 @@ javax.jdo.PersistenceManagerFactoryClass org.jpox.PersistenceManagerFactoryImpl - - org.jpox.transactionIsolation - READ_COMMITTED - - - org.jpox.poid.transactionIsolation - READ_COMMITTED - - - org.jpox.autoCreateSchema - true - - - javax.jdo.option.RetainValues - true - - - javax.jdo.option.RestoreValues - true - - - org.jpox.validateTables - true - - - org.jpox.validateColumns - true - - - org.jpox.validateConstraints - true - -- 2.39.5