You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by oc...@apache.org on 2007/11/08 10:03:46 UTC

svn commit: r593081 - in /maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src: main/java/org/apache/maven/archiva/consumers/core/repository/ test/java/org/apache/maven/archiva/consumers/core/repository/ test/java/org/apache/ma...

Author: oching
Date: Thu Nov  8 01:03:44 2007
New Revision: 593081

URL: http://svn.apache.org/viewvc?rev=593081&view=rev
Log:
- Updated repository purge tests to reflect the changes made in r592297 as suggested in the dev list

Modified:
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexFactoryStub.java
    maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java?rev=593081&r1=593080&r2=593081&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurge.java Thu Nov  8 01:03:44 2007
@@ -95,60 +95,63 @@
      * @throws RepositoryIndexException
      */
     protected void purge( Set<ArtifactReference> references )
-    {
-        List<LuceneRepositoryContentRecord> fileContentRecords = new ArrayList<LuceneRepositoryContentRecord>();
-        List<LuceneRepositoryContentRecord> hashcodeRecords = new ArrayList<LuceneRepositoryContentRecord>();
-        List<LuceneRepositoryContentRecord> bytecodeRecords = new ArrayList<LuceneRepositoryContentRecord>();
-
-        for ( ArtifactReference reference : references )
+    {        
+        if( references != null && !references.isEmpty() )
         {
-            File artifactFile = repository.toFile( reference );
-
-            ArchivaArtifact artifact =
-                new ArchivaArtifact( reference.getGroupId(), reference.getArtifactId(), reference.getVersion(),
-                                     reference.getClassifier(), reference.getType() );
-
-            FileContentRecord fileContentRecord = new FileContentRecord();
-            fileContentRecord.setFilename( repository.toPath( artifact ) );
-            fileContentRecords.add( fileContentRecord );
-
-            HashcodesRecord hashcodesRecord = new HashcodesRecord();
-            hashcodesRecord.setArtifact( artifact );
-            hashcodeRecords.add( hashcodesRecord );
-
-            BytecodeRecord bytecodeRecord = new BytecodeRecord();
-            bytecodeRecord.setArtifact( artifact );
-            bytecodeRecords.add( bytecodeRecord );
-
-            // TODO: this needs to be logged
-            artifactFile.delete();
-            purgeSupportFiles( artifactFile );
-
-            // intended to be swallowed
-            // continue updating the database for all artifacts
-            try
-            {
-                String artifactPath = toRelativePath( artifactFile );
-                updateDatabase( artifactPath );
+            List<LuceneRepositoryContentRecord> fileContentRecords = new ArrayList<LuceneRepositoryContentRecord>();
+            List<LuceneRepositoryContentRecord> hashcodeRecords = new ArrayList<LuceneRepositoryContentRecord>();
+            List<LuceneRepositoryContentRecord> bytecodeRecords = new ArrayList<LuceneRepositoryContentRecord>();
+            
+            for ( ArtifactReference reference : references )
+            {   
+                File artifactFile = repository.toFile( reference );
+                
+                ArchivaArtifact artifact =
+                    new ArchivaArtifact( reference.getGroupId(), reference.getArtifactId(), reference.getVersion(),
+                                         reference.getClassifier(), reference.getType() );
+    
+                FileContentRecord fileContentRecord = new FileContentRecord();
+                fileContentRecord.setFilename( repository.toPath( artifact ) );
+                fileContentRecords.add( fileContentRecord );
+    
+                HashcodesRecord hashcodesRecord = new HashcodesRecord();
+                hashcodesRecord.setArtifact( artifact );
+                hashcodeRecords.add( hashcodesRecord );
+    
+                BytecodeRecord bytecodeRecord = new BytecodeRecord();
+                bytecodeRecord.setArtifact( artifact );
+                bytecodeRecords.add( bytecodeRecord );
+    
+                // TODO: this needs to be logged
+                artifactFile.delete();
+                purgeSupportFiles( artifactFile );
+    
+                // intended to be swallowed
+                // continue updating the database for all artifacts
+                try
+                {
+                    String artifactPath = toRelativePath( artifactFile );
+                    updateDatabase( artifactPath );
+                }
+                catch ( ArchivaDatabaseException ae )
+                {
+                    // TODO: determine logging to be used
+                }
+                catch ( LayoutException le )
+                {
+                    // Ignore
+                }
             }
-            catch ( ArchivaDatabaseException ae )
+    
+            try
             {
-                // TODO: determine logging to be used
+                updateIndices( fileContentRecords, hashcodeRecords, bytecodeRecords );
             }
-            catch ( LayoutException le )
+            catch ( RepositoryIndexException e )
             {
                 // Ignore
             }
         }
-
-        try
-        {
-            updateIndices( fileContentRecords, hashcodeRecords, bytecodeRecords );
-        }
-        catch ( RepositoryIndexException e )
-        {
-            // Ignore
-        }
     }
 
     /**
@@ -196,18 +199,18 @@
 
         // TODO [MRM-37]: re-run the database consumers to clean up
     }
-
+    
     private void updateIndices( List<LuceneRepositoryContentRecord> fileContentRecords,
                                 List<LuceneRepositoryContentRecord> hashcodeRecords,
                                 List<LuceneRepositoryContentRecord> bytecodeRecords )
         throws RepositoryIndexException
-    {
+    {        
         RepositoryContentIndex index = indices.get( "filecontent" );
         index.deleteRecords( fileContentRecords );
-
+        
         index = indices.get( "hashcodes" );
         index.deleteRecords( hashcodeRecords );
-
+        
         index = indices.get( "bytecode" );
         index.deleteRecords( bytecodeRecords );
     }

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java?rev=593081&r1=593080&r2=593081&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumer.java Thu Nov  8 01:03:44 2007
@@ -235,4 +235,9 @@
         // we need to check all files for deletion, especially if not modified
         return true;
     }
+    
+    public void setRepositoryContentIndexFactory( RepositoryContentIndexFactory indexFactory )
+    {
+        this.indexFactory = indexFactory;
+    }
 }

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java?rev=593081&r1=593080&r2=593081&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java Thu Nov  8 01:03:44 2007
@@ -55,7 +55,7 @@
 
     public static final int TEST_DAYS_OLDER = 30;
 
-    public static final String PATH_TO_BY_DAYS_OLD_ARTIFACT = "org/apache/maven/plugins/maven-install-plugin/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar";
+    public static final String PATH_TO_BY_DAYS_OLD_ARTIFACT = "org/apache/maven/plugins/maven-install-plugin/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar";
 
     public static final String PATH_TO_BY_DAYS_OLD_METADATA_DRIVEN_ARTIFACT = "org/codehaus/plexus/plexus-utils/1.4.3-SNAPSHOT/plexus-utils-1.4.3-20070113.163208-4.jar";
 

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java?rev=593081&r1=593080&r2=593081&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java Thu Nov  8 01:03:44 2007
@@ -40,13 +40,7 @@
     protected void setUp()
         throws Exception
     {
-        super.setUp();
-
-        map = new HashMap<String, RepositoryContentIndex>();
-        map.put( "filecontent", new LuceneRepositoryContentIndexStub() );
-        map.put( "hashcodes", new LuceneRepositoryContentIndexStub() );
-        map.put( "bytecode", new LuceneRepositoryContentIndexStub() );        
-        
+        super.setUp();        
     }
 
     private void setLastModified( String dirPath )
@@ -62,9 +56,14 @@
     public void testByLastModified()
         throws Exception
     {        
+        map = new HashMap<String, RepositoryContentIndex>();
+        map.put( "filecontent", new LuceneRepositoryContentIndexStub( 2 ) );
+        map.put( "hashcodes", new LuceneRepositoryContentIndexStub( 2 ) );
+        map.put( "bytecode", new LuceneRepositoryContentIndexStub( 2 ) );        
+        
         repoPurge =
             new DaysOldRepositoryPurge( getRepository(), dao, getRepoConfiguration().getDaysOlder(), 
-                            1, map );
+                            getRepoConfiguration().getRetentionCount(), map );
         
         populateDbForTestByLastModified();
 
@@ -75,18 +74,38 @@
         setLastModified( projectRoot + "/2.2-SNAPSHOT/" );
 
         repoPurge.process( PATH_TO_BY_DAYS_OLD_ARTIFACT );
-
-        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar" );
-        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.md5" );
-        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.sha1" );
-        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom" );
-        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.md5" );
-        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.sha1" );
+        
+        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar" );
+        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar.md5" );
+        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar.sha1" );
+        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.pom" );
+        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.pom.md5" );
+        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.pom.sha1" );
+        
+        // shouldn't be deleted because even if older than 30 days (because retention count = 2)
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar.md5" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar.sha1" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom.md5" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom.sha1" );
+        
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.md5" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.sha1" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.md5" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.sha1" );
     }
 
     public void testMetadataDrivenSnapshots()
         throws Exception
     {
+        map = new HashMap<String, RepositoryContentIndex>();
+        map.put( "filecontent", new LuceneRepositoryContentIndexStub(2) );
+        map.put( "hashcodes", new LuceneRepositoryContentIndexStub(2) );
+        map.put( "bytecode", new LuceneRepositoryContentIndexStub(2) );    
+        
         repoPurge =
             new DaysOldRepositoryPurge( getRepository(), dao, getRepoConfiguration().getDaysOlder(), 
                             getRepoConfiguration().getRetentionCount(), map );
@@ -138,6 +157,8 @@
         throws Exception
     {
         List<String> versions = new ArrayList<String>();
+        versions.add( "2.2-20061118.060401-2" );
+        versions.add( "2.2-20070513.034619-5" );
         versions.add( "2.2-SNAPSHOT" );
 
         populateDb( "org.apache.maven.plugins", "maven-install-plugin", versions );

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java?rev=593081&r1=593080&r2=593081&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java Thu Nov  8 01:03:44 2007
@@ -24,7 +24,9 @@
 import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.maven.archiva.consumers.core.repository.stubs.LuceneRepositoryContentIndexFactoryStub;
 import org.apache.maven.archiva.database.ArchivaDatabaseException;
+import org.apache.maven.archiva.indexer.RepositoryContentIndexFactory;
 import org.custommonkey.xmlunit.XMLAssert;
 
 import java.io.File;
@@ -53,6 +55,11 @@
         KnownRepositoryContentConsumer repoPurgeConsumer = (KnownRepositoryContentConsumer) lookup(
             KnownRepositoryContentConsumer.class, "repo-purge-consumer-by-retention-count" );
 
+        LuceneRepositoryContentIndexFactoryStub indexFactory = new LuceneRepositoryContentIndexFactoryStub();
+        indexFactory.setExpectedRecordsSize( 2 );
+        
+        ( (RepositoryPurgeConsumer) repoPurgeConsumer ).setRepositoryContentIndexFactory( indexFactory ); 
+              
         populateDbForRetentionCountTest();
 
         ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration();
@@ -117,6 +124,11 @@
         KnownRepositoryContentConsumer repoPurgeConsumer = (KnownRepositoryContentConsumer) lookup(
             KnownRepositoryContentConsumer.class, "repo-purge-consumer-by-days-old" );
 
+        LuceneRepositoryContentIndexFactoryStub indexFactory = new LuceneRepositoryContentIndexFactoryStub();
+        indexFactory.setExpectedRecordsSize( 2 );
+        
+        ( (RepositoryPurgeConsumer) repoPurgeConsumer ).setRepositoryContentIndexFactory( indexFactory ); 
+        
         ManagedRepositoryConfiguration repoConfiguration = getRepoConfiguration();
         repoConfiguration.setDaysOlder( TEST_DAYS_OLDER );
         addRepoToConfiguration( "days-old", repoConfiguration );
@@ -130,12 +142,27 @@
 
         repoPurgeConsumer.processFile( PATH_TO_BY_DAYS_OLD_ARTIFACT );
 
-        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar" );
-        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.md5" );
-        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.sha1" );
-        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom" );
-        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.md5" );
-        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.sha1" );
+        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar" );
+        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar.md5" );
+        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar.sha1" );
+        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.pom" );
+        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.pom.md5" );
+        assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.pom.sha1" );
+        
+        // shouldn't be deleted because even if older than 30 days (because retention count = 2)
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar.md5" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar.sha1" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom.md5" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom.sha1" );
+        
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.md5" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.sha1" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.md5" );
+        assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.sha1" );
     }
 
     /**

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java?rev=593081&r1=593080&r2=593081&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java Thu Nov  8 01:03:44 2007
@@ -42,9 +42,9 @@
         super.setUp();
 
         Map<String, RepositoryContentIndex> map = new HashMap<String, RepositoryContentIndex>();
-        map.put( "filecontent", new LuceneRepositoryContentIndexStub() );
-        map.put( "hashcodes", new LuceneRepositoryContentIndexStub() );
-        map.put( "bytecode", new LuceneRepositoryContentIndexStub() );
+        map.put( "filecontent", new LuceneRepositoryContentIndexStub( 2 ) );
+        map.put( "hashcodes", new LuceneRepositoryContentIndexStub( 2 ) );
+        map.put( "bytecode", new LuceneRepositoryContentIndexStub( 2 ) );
         
         repoPurge = new RetentionCountRepositoryPurge( getRepository(), dao,
                                                        getRepoConfiguration().getRetentionCount(), map );

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexFactoryStub.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexFactoryStub.java?rev=593081&r1=593080&r2=593081&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexFactoryStub.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexFactoryStub.java Thu Nov  8 01:03:44 2007
@@ -33,22 +33,28 @@
     implements RepositoryContentIndexFactory
 {
 
+    private int expectedRecordsSize = 0;
+    
     public RepositoryContentIndex createBytecodeIndex( ManagedRepositoryConfiguration repository )
     {        
         // TODO Auto-generated method stub
-        return new LuceneRepositoryContentIndexStub();
+        return new LuceneRepositoryContentIndexStub( expectedRecordsSize );
     }
 
     public RepositoryContentIndex createFileContentIndex( ManagedRepositoryConfiguration repository )
     {
         // TODO Auto-generated method stub
-        return new LuceneRepositoryContentIndexStub();
+        return new LuceneRepositoryContentIndexStub( expectedRecordsSize );
     }
 
     public RepositoryContentIndex createHashcodeIndex( ManagedRepositoryConfiguration repository )
     {
         // TODO Auto-generated method stub
-        return new LuceneRepositoryContentIndexStub();
+        return new LuceneRepositoryContentIndexStub( expectedRecordsSize );
+    }    
+    
+    public void setExpectedRecordsSize( int size )
+    {
+        expectedRecordsSize = size;
     }
-
 }

Modified: maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java?rev=593081&r1=593080&r2=593081&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/stubs/LuceneRepositoryContentIndexStub.java Thu Nov  8 01:03:44 2007
@@ -41,15 +41,22 @@
 public class LuceneRepositoryContentIndexStub
     implements RepositoryContentIndex
 {
-
+    private int expectedRecordsSize;
+    
+    public LuceneRepositoryContentIndexStub()
+    {
+        
+    }
+    
+    public LuceneRepositoryContentIndexStub( int size )
+    {
+        expectedRecordsSize = size;
+    }
+    
     public void deleteRecords( Collection records )
         throws RepositoryIndexException
-    {
-        // TODO Auto-generated method stub
-        if( records.size() != 0 )
-        {
-            Assert.assertEquals( 2, records.size() );
-        }
+    {         
+        Assert.assertEquals( expectedRecordsSize, records.size() );        
     }
 
     public boolean exists()