archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r703311 - in /archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src: main/java/org/apache/archiva/web/xmlrpc/services/ test/java/org/apache/archiva/web/xmlrpc/services/
Date Fri, 10 Oct 2008 01:31:13 GMT
Author: oching
Date: Thu Oct  9 18:31:13 2008
New Revision: 703311

URL: http://svn.apache.org/viewvc?rev=703311&view=rev
Log:
-implemented getAllDatabaseConsumers() and configureDatabaseConsumer() in admin service
-activated tests for these 2 methods

Modified:
    archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
    archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java

Modified: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java?rev=703311&r1=703310&r2=703311&view=diff
==============================================================================
--- archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
(original)
+++ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
Thu Oct  9 18:31:13 2008
@@ -30,11 +30,19 @@
 import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration;
 import org.apache.maven.archiva.configuration.IndeterminateConfigurationException;
 import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
+import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer;
+import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.maven.archiva.database.updater.DatabaseConsumers;
 import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers;
 import org.codehaus.plexus.registry.RegistryException;
 
+/**
+ * AdministrationServiceImpl
+ * 
+ * @version $Id: AdministrationServiceImpl.java
+ */
 public class AdministrationServiceImpl
     implements AdministrationService
 {
@@ -43,14 +51,64 @@
      */
     private ArchivaConfiguration archivaConfiguration;
     
-    private RepositoryContentConsumers consumerUtil;
+    private RepositoryContentConsumers repoConsumersUtil;
     
+    private DatabaseConsumers dbConsumersUtil;
+    
+    /**
+     * @see AdministrationService#configureDatabaseConsumer(String, boolean)
+     */
     public boolean configureDatabaseConsumer( String consumerId, boolean enable ) throws
Exception
     {
-        //Configuration config = archivaConfiguration.getConfiguration();
-             
-        // TODO Auto-generated method stub
-        return false;
+        List<DatabaseCleanupConsumer> cleanupConsumers = dbConsumersUtil.getAvailableCleanupConsumers();
+        List<DatabaseUnprocessedArtifactConsumer> unprocessedConsumers =
+            dbConsumersUtil.getAvailableUnprocessedConsumers();
+        
+        boolean found = false;
+        boolean isCleanupConsumer = false;        
+        for( DatabaseCleanupConsumer consumer : cleanupConsumers )
+        {
+            if( consumer.getId().equals( consumerId ) )
+            {
+                found = true;
+                isCleanupConsumer = true;
+                break;
+            }
+        }
+        
+        if( !found )
+        {
+            for( DatabaseUnprocessedArtifactConsumer consumer : unprocessedConsumers )
+            {
+                if( consumer.getId().equals( consumerId ) )
+                {
+                    found = true;
+                    break;
+                }
+            }
+        }
+        
+        if( !found )
+        {
+            throw new Exception( "Invalid database consumer." );
+        }
+        
+        Configuration config = archivaConfiguration.getConfiguration();
+        DatabaseScanningConfiguration dbScanningConfig = config.getDatabaseScanning();
+        
+        if( isCleanupConsumer )
+        {
+            dbScanningConfig.addCleanupConsumer( consumerId );            
+        }
+        else
+        {
+            dbScanningConfig.addUnprocessedConsumer( consumerId );
+        }
+        
+        config.setDatabaseScanning( dbScanningConfig );        
+        saveConfiguration( config );
+        
+        return true;
     }
 
     /**
@@ -59,8 +117,10 @@
     public boolean configureRepositoryConsumer( String repoId, String consumerId, boolean
enable )
         throws Exception
     {
-        List<KnownRepositoryContentConsumer> knownConsumers = consumerUtil.getAvailableKnownConsumers();
-        List<InvalidRepositoryContentConsumer> invalidConsumers = consumerUtil.getAvailableInvalidConsumers();
+        // TODO use repoId once consumers are configured per repository! (MRM-930)
+        
+        List<KnownRepositoryContentConsumer> knownConsumers = repoConsumersUtil.getAvailableKnownConsumers();
+        List<InvalidRepositoryContentConsumer> invalidConsumers = repoConsumersUtil.getAvailableInvalidConsumers();
         
         boolean found = false;
         boolean isKnownContentConsumer = false;
@@ -109,6 +169,9 @@
         return true;
     }
     
+    /**
+     * @see AdministrationService#deleteArtifact(String, String, String, String)
+     */
     public boolean deleteArtifact( String repoId, String groupId, String artifactId, String
version ) throws Exception
     {
         // TODO implement delete artifact in Archiva
@@ -117,12 +180,18 @@
         return false;
     }
 
+    /**
+     * @see AdministrationService#executeDatabaseScanner()
+     */
     public boolean executeDatabaseScanner() throws Exception
     {
         // TODO Auto-generated method stub
         return false;
     }
 
+    /**
+     * @see AdministrationService#executeRepositoryScanner(String)
+     */
     public boolean executeRepositoryScanner( String repoId ) throws Exception
     {
         // TODO Auto-generated method stub
@@ -136,6 +205,19 @@
     {
         List<String> consumers = new ArrayList<String>();
         
+        List<DatabaseCleanupConsumer> cleanupConsumers = dbConsumersUtil.getAvailableCleanupConsumers();
+        List<DatabaseUnprocessedArtifactConsumer> unprocessedConsumers = dbConsumersUtil.getAvailableUnprocessedConsumers();
+        
+        for( DatabaseCleanupConsumer consumer : cleanupConsumers )
+        {
+            consumers.add( consumer.getId() );
+        }  
+        
+        for( DatabaseUnprocessedArtifactConsumer consumer : unprocessedConsumers )
+        {
+            consumers.add( consumer.getId() );
+        } 
+        
         return consumers;
     }
 
@@ -146,8 +228,8 @@
     {
         List<String> consumers = new ArrayList<String>();
                 
-        List<KnownRepositoryContentConsumer> knownConsumers = consumerUtil.getAvailableKnownConsumers();
-        List<InvalidRepositoryContentConsumer> invalidConsumers = consumerUtil.getAvailableInvalidConsumers();
+        List<KnownRepositoryContentConsumer> knownConsumers = repoConsumersUtil.getAvailableKnownConsumers();
+        List<InvalidRepositoryContentConsumer> invalidConsumers = repoConsumersUtil.getAvailableInvalidConsumers();
         
         for( KnownRepositoryContentConsumer consumer : knownConsumers )
         {
@@ -162,11 +244,17 @@
         return consumers;
     }
 
+    /**
+     * @see AdministrationService#getAllManagedRepositories()
+     */
     public List<ManagedRepository> getAllManagedRepositories()
     {
         return null;
     }
 
+    /**
+     * @see AdministrationService#getAllRemoteRepositories()
+     */
     public List<RemoteRepository> getAllRemoteRepositories()
     {
         return null;
@@ -194,13 +282,13 @@
         this.archivaConfiguration = archivaConfiguration;
     }
 
-    public RepositoryContentConsumers getConsumerUtil()
-    {
-        return consumerUtil;
-    }
-
-    public void setConsumerUtil( RepositoryContentConsumers consumerUtil )
+    public void setRepoConsumersUtil( RepositoryContentConsumers consumerUtil )
     {
-        this.consumerUtil = consumerUtil;
+        this.repoConsumersUtil = consumerUtil;
     }    
+    
+    public void setDbConsumersUtil( DatabaseConsumers consumerUtil )
+    {
+        this.dbConsumersUtil = consumerUtil;
+    }   
 }

Modified: archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java?rev=703311&r1=703310&r2=703311&view=diff
==============================================================================
--- archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
(original)
+++ archiva/branches/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java
Thu Oct  9 18:31:13 2008
@@ -31,8 +31,11 @@
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
+import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer;
+import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
+import org.apache.maven.archiva.database.updater.DatabaseConsumers;
 import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers;
 import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler;
 import org.apache.maven.archiva.scheduled.tasks.DatabaseTask;
@@ -42,8 +45,9 @@
 import org.easymock.classextension.MockClassControl;
 
 /**
+ * AdministrationServiceImplTest
  * 
- * @version $Id$
+ * @version $Id: AdministrationServiceImplTest.java
  */
 public class AdministrationServiceImplTest
     extends PlexusInSpringTestCase
@@ -62,10 +66,11 @@
     
     private ArchivaTaskScheduler taskScheduler;
     
-    private MockControl consumerUtilControl;
+    // repository consumers
+    private MockControl repoConsumerUtilsControl;
+    
+    private RepositoryContentConsumers repoConsumersUtil;
     
-    private RepositoryContentConsumers consumerUtil;
-
     private MockControl knownContentConsumerControl;
 
     private MockControl invalidContentConsumerControl;
@@ -77,6 +82,23 @@
     private InvalidRepositoryContentConsumer checkPomConsumer;
 
     private InvalidRepositoryContentConsumer checkMetadataConsumer;
+    
+    // database consumers
+    private MockControl dbConsumersUtilControl;
+    
+    private DatabaseConsumers dbConsumersUtil;
+    
+    private MockControl unprocessedConsumersControl;
+    
+    private MockControl cleanupConsumersControl;
+    
+    private DatabaseUnprocessedArtifactConsumer processArtifactConsumer;
+    
+    private DatabaseUnprocessedArtifactConsumer processPomConsumer;
+    
+    private DatabaseCleanupConsumer cleanupIndexConsumer;
+    
+    private DatabaseCleanupConsumer cleanupDbConsumer;
         
     protected void setUp()
         throws Exception
@@ -92,8 +114,9 @@
         taskSchedulerControl = MockControl.createControl( ArchivaTaskScheduler.class );
         taskScheduler = ( ArchivaTaskScheduler ) taskSchedulerControl.getMock();
         
-        consumerUtilControl = MockClassControl.createControl( RepositoryContentConsumers.class
);
-        consumerUtil = ( RepositoryContentConsumers ) consumerUtilControl.getMock();
+        // repo consumers
+        repoConsumerUtilsControl = MockClassControl.createControl( RepositoryContentConsumers.class
);
+        repoConsumersUtil = ( RepositoryContentConsumers ) repoConsumerUtilsControl.getMock();
         
         knownContentConsumerControl = MockControl.createControl( KnownRepositoryContentConsumer.class
);
         indexArtifactConsumer = ( KnownRepositoryContentConsumer ) knownContentConsumerControl.getMock();
@@ -103,40 +126,47 @@
         checkPomConsumer = ( InvalidRepositoryContentConsumer ) invalidContentConsumerControl.getMock();
         checkMetadataConsumer = ( InvalidRepositoryContentConsumer ) invalidContentConsumerControl.getMock();
         
+        // db consumers
+        dbConsumersUtilControl = MockClassControl.createControl( DatabaseConsumers.class
);
+        dbConsumersUtil = ( DatabaseConsumers ) dbConsumersUtilControl.getMock();
+                
+        cleanupConsumersControl = MockControl.createControl( DatabaseCleanupConsumer.class
);
+        cleanupIndexConsumer = ( DatabaseCleanupConsumer ) cleanupConsumersControl.getMock();
+        cleanupDbConsumer = ( DatabaseCleanupConsumer ) cleanupConsumersControl.getMock();
+        
+        unprocessedConsumersControl = MockControl.createControl( DatabaseUnprocessedArtifactConsumer.class
);
+        processArtifactConsumer = ( DatabaseUnprocessedArtifactConsumer ) unprocessedConsumersControl.getMock();
+        processPomConsumer = ( DatabaseUnprocessedArtifactConsumer ) unprocessedConsumersControl.getMock();
+        
         service = new AdministrationServiceImpl();
         service.setArchivaConfiguration( archivaConfig );
-        service.setConsumerUtil( consumerUtil );        
+        service.setRepoConsumersUtil( repoConsumersUtil );     
+        service.setDbConsumersUtil( dbConsumersUtil );
     }
-        
-  // DATABASE CONSUMERS
-    /*    public void testGetAllDbConsumers()
+  
+/* Tests for database consumers  */
+    
+    public void testGetAllDbConsumers()
         throws Exception
     {   
-        DatabaseScanningConfiguration dbScanning = new DatabaseScanningConfiguration();
-        dbScanning.addCleanupConsumer( "cleanup-index" );
-        dbScanning.addCleanupConsumer( "cleanup-database" );
-        dbScanning.addUnprocessedConsumer( "unprocessed-artifacts" );
-        dbScanning.addUnprocessedConsumer( "unprocessed-poms" );
-        
-        archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
-        configControl.expectAndReturn( config.getDatabaseScanning(), dbScanning );
-        
-        archivaConfigControl.replay();
-        configControl.replay();
+        recordDbConsumers();
         
+        dbConsumersUtilControl.replay();
+        cleanupConsumersControl.replay();
+        unprocessedConsumersControl.replay();
         
+        List<String> dbConsumers = service.getAllDatabaseConsumers();
         
-        List<String> dbConsumers = service.getAllDatabaseConsumers(); 
-        
-        archivaConfigControl.verify();
-        configControl.verify();
+        dbConsumersUtilControl.verify();
+        cleanupConsumersControl.verify();
+        unprocessedConsumersControl.verify();
         
         assertNotNull( dbConsumers );
         assertEquals( 4, dbConsumers.size() );
         assertTrue( dbConsumers.contains( "cleanup-index" ) );
         assertTrue( dbConsumers.contains( "cleanup-database" ) );
-        assertTrue( dbConsumers.contains( "unprocessed-artifacts" ) );
-        assertTrue( dbConsumers.contains( "unprocessed-poms" ) );
+        assertTrue( dbConsumers.contains( "process-artifact" ) );
+        assertTrue( dbConsumers.contains( "process-pom" ) );
     }
     
     public void testConfigureValidDatabaseConsumer()
@@ -145,12 +175,11 @@
         DatabaseScanningConfiguration dbScanning = new DatabaseScanningConfiguration();
         dbScanning.addCleanupConsumer( "cleanup-index" );
         dbScanning.addCleanupConsumer( "cleanup-database" );
-        dbScanning.addUnprocessedConsumer( "unprocessed-artifacts" );
-        dbScanning.addUnprocessedConsumer( "unprocessed-poms" );
-     
-      //TODO mock checking whether the db consumer is valid or not
+        dbScanning.addUnprocessedConsumer( "process-artifact" );
+        
+        recordDbConsumers();
         
-     // test enable
+     // test enable "process-pom" db consumer
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
         configControl.expectAndReturn( config.getDatabaseScanning(), dbScanning );
         
@@ -161,12 +190,15 @@
         archivaConfig.save( config );
         archivaConfigControl.setVoidCallable();
         
+        dbConsumersUtilControl.replay();
+        cleanupConsumersControl.replay();
+        unprocessedConsumersControl.replay();
         archivaConfigControl.replay();
         configControl.replay();
         
         try
         {
-            boolean success = service.configureDatabaseConsumer( "new-cleanup-consumer",
true );
+            boolean success = service.configureDatabaseConsumer( "process-pom", true );
             assertTrue( success );
         }
         catch ( Exception e )
@@ -174,14 +206,22 @@
             fail( "An exception should not have been thrown." );
         }
         
+        dbConsumersUtilControl.verify();
+        cleanupConsumersControl.verify();
+        unprocessedConsumersControl.verify();
         archivaConfigControl.verify();
         configControl.verify();
                 
-      // test disable 
+      // test disable "process-pom" db consumer        
+        dbConsumersUtilControl.reset();
+        cleanupConsumersControl.reset();
+        unprocessedConsumersControl.reset();
         archivaConfigControl.reset();
         configControl.reset();
+                
+        dbScanning.addUnprocessedConsumer( "process-pom" );
         
-      //TODO mock checking whether the db consumer is valid or not
+        recordDbConsumers();
         
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
         configControl.expectAndReturn( config.getDatabaseScanning(), dbScanning );
@@ -193,12 +233,15 @@
         archivaConfig.save( config );
         archivaConfigControl.setVoidCallable();
         
+        dbConsumersUtilControl.replay();
+        cleanupConsumersControl.replay();
+        unprocessedConsumersControl.replay();
         archivaConfigControl.replay();
         configControl.replay();
         
         try
         {
-            boolean success = service.configureDatabaseConsumer( "new-cleanup-consumer",
false );
+            boolean success = service.configureDatabaseConsumer( "process-pom", false );
             assertTrue( success );
         }
         catch ( Exception e )
@@ -206,6 +249,9 @@
             fail( "An exception should not have been thrown." );
         }
         
+        dbConsumersUtilControl.verify();
+        cleanupConsumersControl.verify();
+        unprocessedConsumersControl.verify();
         archivaConfigControl.verify();
         configControl.verify();
     }
@@ -213,7 +259,11 @@
     public void testConfigureInvalidDatabaseConsumer()
         throws Exception
     {
-        //TODO mock checking whether the db consumer is valid or not
+        recordDbConsumers();
+        
+        dbConsumersUtilControl.replay();
+        cleanupConsumersControl.replay();
+        unprocessedConsumersControl.replay();
         
         try
         {
@@ -224,23 +274,26 @@
         {
             assertEquals( "Invalid database consumer.", e.getMessage() );
         }
+        
+        dbConsumersUtilControl.verify();
+        cleanupConsumersControl.verify();
+        unprocessedConsumersControl.verify();
     }
+        
+/* Tests for repository consumers  */
     
-    */
-    
- // REPOSITORY CONSUMERS
     public void testGetAllRepoConsumers()
         throws Exception
     {   
-        recordRepoConsumerValidation();
+        recordRepoConsumers();
         
-        consumerUtilControl.replay();
+        repoConsumerUtilsControl.replay();
         knownContentConsumerControl.replay();
         invalidContentConsumerControl.replay();
                 
         List<String> repoConsumers = service.getAllRepositoryConsumers(); 
         
-        consumerUtilControl.verify();
+        repoConsumerUtilsControl.verify();
         knownContentConsumerControl.verify();
         invalidContentConsumerControl.verify();
                         
@@ -261,7 +314,7 @@
         repoScanning.addInvalidContentConsumer( "check-pom" );        
         
      // test enable "check-metadata" consumer
-        recordRepoConsumerValidation();
+        recordRepoConsumers();
         
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
         configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning );
@@ -273,7 +326,7 @@
         archivaConfig.save( config );
         archivaConfigControl.setVoidCallable();
                 
-        consumerUtilControl.replay();
+        repoConsumerUtilsControl.replay();
         knownContentConsumerControl.replay();
         invalidContentConsumerControl.replay();
         archivaConfigControl.replay();
@@ -289,14 +342,14 @@
             fail( "An exception should not have been thrown." );
         }
         
-        consumerUtilControl.verify();
+        repoConsumerUtilsControl.verify();
         knownContentConsumerControl.verify();
         invalidContentConsumerControl.verify();        
         archivaConfigControl.verify();
         configControl.verify();
                 
      // test disable "check-metadata" consumer 
-        consumerUtilControl.reset();
+        repoConsumerUtilsControl.reset();
         knownContentConsumerControl.reset();
         invalidContentConsumerControl.reset();        
         archivaConfigControl.reset();
@@ -304,7 +357,7 @@
         
         repoScanning.addInvalidContentConsumer( "check-metadata" );
 
-        recordRepoConsumerValidation();
+        recordRepoConsumers();
         
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
         configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning );
@@ -316,7 +369,7 @@
         archivaConfig.save( config );
         archivaConfigControl.setVoidCallable();
                 
-        consumerUtilControl.replay();
+        repoConsumerUtilsControl.replay();
         knownContentConsumerControl.replay();
         invalidContentConsumerControl.replay();
         archivaConfigControl.replay();
@@ -326,7 +379,7 @@
         {
             boolean success = service.configureRepositoryConsumer( null, "check-metadata",
false );
             
-            consumerUtilControl.verify();
+            repoConsumerUtilsControl.verify();
             knownContentConsumerControl.verify();
             invalidContentConsumerControl.verify();        
             archivaConfigControl.verify();
@@ -340,11 +393,15 @@
         }     
     }
  
-    /*
+    
     public void testConfigureInvalidRepositoryConsumer()
         throws Exception
     {
-        //TODO mock checking whether the repo consumer is valid or not
+        recordRepoConsumers();
+        
+        repoConsumerUtilsControl.replay();
+        knownContentConsumerControl.replay();
+        invalidContentConsumerControl.replay();
         
         try
         {
@@ -355,11 +412,15 @@
         {
             assertEquals( "Invalid repository consumer.", e.getMessage() );
         }
+        
+        repoConsumerUtilsControl.verify();
+        knownContentConsumerControl.verify();
+        invalidContentConsumerControl.verify(); 
     }
 
-// DELETE ARTIFACT
+/* Tests for delete artifact  */
     
-    public void testDeleteArtifactArtifactExists()
+    /*   public void testDeleteArtifactArtifactExists()
         throws Exception
     {
         archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
@@ -612,7 +673,7 @@
         return repoConfig;
     }
     
-    private void recordRepoConsumerValidation()
+    private void recordRepoConsumers()
     {
         List<KnownRepositoryContentConsumer> availableKnownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
         availableKnownConsumers.add( indexArtifactConsumer );
@@ -622,13 +683,32 @@
         availableInvalidConsumers.add( checkPomConsumer );
         availableInvalidConsumers.add( checkMetadataConsumer );
         
-        consumerUtilControl.expectAndReturn( consumerUtil.getAvailableKnownConsumers(), availableKnownConsumers
);
+        repoConsumerUtilsControl.expectAndReturn( repoConsumersUtil.getAvailableKnownConsumers(),
availableKnownConsumers );
         knownContentConsumerControl.expectAndReturn( indexArtifactConsumer.getId(), "index-artifact"
);
         knownContentConsumerControl.expectAndReturn( indexPomConsumer.getId(), "index-pom"
);
         
-        consumerUtilControl.expectAndReturn( consumerUtil.getAvailableInvalidConsumers(),
availableInvalidConsumers );
+        repoConsumerUtilsControl.expectAndReturn( repoConsumersUtil.getAvailableInvalidConsumers(),
availableInvalidConsumers );
         invalidContentConsumerControl.expectAndReturn( checkPomConsumer.getId(), "check-pom"
);
         invalidContentConsumerControl.expectAndReturn( checkMetadataConsumer.getId(), "check-metadata"
);
     }
     
+    private void recordDbConsumers()
+    {
+        List<DatabaseCleanupConsumer> cleanupConsumers = new ArrayList<DatabaseCleanupConsumer>();
+        cleanupConsumers.add( cleanupIndexConsumer );
+        cleanupConsumers.add( cleanupDbConsumer );
+        
+        List<DatabaseUnprocessedArtifactConsumer> unprocessedConsumers =
+            new ArrayList<DatabaseUnprocessedArtifactConsumer>();
+        unprocessedConsumers.add( processArtifactConsumer );
+        unprocessedConsumers.add( processPomConsumer );
+        
+        dbConsumersUtilControl.expectAndReturn( dbConsumersUtil.getAvailableCleanupConsumers(),
cleanupConsumers );
+        cleanupConsumersControl.expectAndReturn( cleanupIndexConsumer.getId(), "cleanup-index"
);
+        cleanupConsumersControl.expectAndReturn( cleanupDbConsumer.getId(), "cleanup-database"
);
+        
+        dbConsumersUtilControl.expectAndReturn( dbConsumersUtil.getAvailableUnprocessedConsumers(),
unprocessedConsumers );
+        unprocessedConsumersControl.expectAndReturn( processArtifactConsumer.getId(), "process-artifact"
);
+        unprocessedConsumersControl.expectAndReturn( processPomConsumer.getId(), "process-pom"
);
+    }    
 }
\ No newline at end of file



Mime
View raw message