1 package org.apache.archiva.web.xmlrpc.services;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import java.util.ArrayList;
23 import java.util.List;
25 import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository;
26 import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository;
27 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
28 import org.apache.maven.archiva.configuration.Configuration;
29 import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration;
30 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
31 import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
32 import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
33 import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer;
34 import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
35 import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
36 import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
37 import org.apache.maven.archiva.database.updater.DatabaseConsumers;
38 import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers;
39 import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler;
40 import org.apache.maven.archiva.scheduled.tasks.DatabaseTask;
41 import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
42 import org.codehaus.plexus.spring.PlexusInSpringTestCase;
43 import org.easymock.MockControl;
44 import org.easymock.classextension.MockClassControl;
47 * AdministrationServiceImplTest
49 * @version $Id: AdministrationServiceImplTest.java
51 public class AdministrationServiceImplTest
52 extends PlexusInSpringTestCase
54 private MockControl archivaConfigControl;
56 private ArchivaConfiguration archivaConfig;
58 private MockControl configControl;
60 private Configuration config;
62 private AdministrationServiceImpl service;
64 private MockControl taskSchedulerControl;
66 private ArchivaTaskScheduler taskScheduler;
68 // repository consumers
69 private MockControl repoConsumerUtilsControl;
71 private RepositoryContentConsumers repoConsumersUtil;
73 private MockControl knownContentConsumerControl;
75 private MockControl invalidContentConsumerControl;
77 private KnownRepositoryContentConsumer indexArtifactConsumer;
79 private KnownRepositoryContentConsumer indexPomConsumer;
81 private InvalidRepositoryContentConsumer checkPomConsumer;
83 private InvalidRepositoryContentConsumer checkMetadataConsumer;
86 private MockControl dbConsumersUtilControl;
88 private DatabaseConsumers dbConsumersUtil;
90 private MockControl unprocessedConsumersControl;
92 private MockControl cleanupConsumersControl;
94 private DatabaseUnprocessedArtifactConsumer processArtifactConsumer;
96 private DatabaseUnprocessedArtifactConsumer processPomConsumer;
98 private DatabaseCleanupConsumer cleanupIndexConsumer;
100 private DatabaseCleanupConsumer cleanupDbConsumer;
102 protected void setUp()
107 archivaConfigControl = MockControl.createControl( ArchivaConfiguration.class );
108 archivaConfig = ( ArchivaConfiguration ) archivaConfigControl.getMock();
110 configControl = MockClassControl.createControl( Configuration.class );
111 config = ( Configuration ) configControl.getMock();
113 taskSchedulerControl = MockControl.createControl( ArchivaTaskScheduler.class );
114 taskScheduler = ( ArchivaTaskScheduler ) taskSchedulerControl.getMock();
117 repoConsumerUtilsControl = MockClassControl.createControl( RepositoryContentConsumers.class );
118 repoConsumersUtil = ( RepositoryContentConsumers ) repoConsumerUtilsControl.getMock();
120 knownContentConsumerControl = MockControl.createControl( KnownRepositoryContentConsumer.class );
121 indexArtifactConsumer = ( KnownRepositoryContentConsumer ) knownContentConsumerControl.getMock();
122 indexPomConsumer = ( KnownRepositoryContentConsumer ) knownContentConsumerControl.getMock();
124 invalidContentConsumerControl = MockControl.createControl( InvalidRepositoryContentConsumer.class );
125 checkPomConsumer = ( InvalidRepositoryContentConsumer ) invalidContentConsumerControl.getMock();
126 checkMetadataConsumer = ( InvalidRepositoryContentConsumer ) invalidContentConsumerControl.getMock();
129 dbConsumersUtilControl = MockClassControl.createControl( DatabaseConsumers.class );
130 dbConsumersUtil = ( DatabaseConsumers ) dbConsumersUtilControl.getMock();
132 cleanupConsumersControl = MockControl.createControl( DatabaseCleanupConsumer.class );
133 cleanupIndexConsumer = ( DatabaseCleanupConsumer ) cleanupConsumersControl.getMock();
134 cleanupDbConsumer = ( DatabaseCleanupConsumer ) cleanupConsumersControl.getMock();
136 unprocessedConsumersControl = MockControl.createControl( DatabaseUnprocessedArtifactConsumer.class );
137 processArtifactConsumer = ( DatabaseUnprocessedArtifactConsumer ) unprocessedConsumersControl.getMock();
138 processPomConsumer = ( DatabaseUnprocessedArtifactConsumer ) unprocessedConsumersControl.getMock();
140 service = new AdministrationServiceImpl();
141 service.setArchivaConfiguration( archivaConfig );
142 service.setRepoConsumersUtil( repoConsumersUtil );
143 service.setDbConsumersUtil( dbConsumersUtil );
144 service.setTaskScheduler( taskScheduler );
147 /* Tests for database consumers */
149 public void testGetAllDbConsumers()
154 dbConsumersUtilControl.replay();
155 cleanupConsumersControl.replay();
156 unprocessedConsumersControl.replay();
158 List<String> dbConsumers = service.getAllDatabaseConsumers();
160 dbConsumersUtilControl.verify();
161 cleanupConsumersControl.verify();
162 unprocessedConsumersControl.verify();
164 assertNotNull( dbConsumers );
165 assertEquals( 4, dbConsumers.size() );
166 assertTrue( dbConsumers.contains( "cleanup-index" ) );
167 assertTrue( dbConsumers.contains( "cleanup-database" ) );
168 assertTrue( dbConsumers.contains( "process-artifact" ) );
169 assertTrue( dbConsumers.contains( "process-pom" ) );
172 public void testConfigureValidDatabaseConsumer()
175 DatabaseScanningConfiguration dbScanning = new DatabaseScanningConfiguration();
176 dbScanning.addCleanupConsumer( "cleanup-index" );
177 dbScanning.addCleanupConsumer( "cleanup-database" );
178 dbScanning.addUnprocessedConsumer( "process-artifact" );
182 // test enable "process-pom" db consumer
183 archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
184 configControl.expectAndReturn( config.getDatabaseScanning(), dbScanning );
186 config.setDatabaseScanning( dbScanning );
187 configControl.setMatcher( MockControl.ALWAYS_MATCHER );
188 configControl.setVoidCallable();
190 archivaConfig.save( config );
191 archivaConfigControl.setVoidCallable();
193 dbConsumersUtilControl.replay();
194 cleanupConsumersControl.replay();
195 unprocessedConsumersControl.replay();
196 archivaConfigControl.replay();
197 configControl.replay();
201 boolean success = service.configureDatabaseConsumer( "process-pom", true );
202 assertTrue( success );
204 catch ( Exception e )
206 fail( "An exception should not have been thrown." );
209 dbConsumersUtilControl.verify();
210 cleanupConsumersControl.verify();
211 unprocessedConsumersControl.verify();
212 archivaConfigControl.verify();
213 configControl.verify();
215 // test disable "process-pom" db consumer
216 dbConsumersUtilControl.reset();
217 cleanupConsumersControl.reset();
218 unprocessedConsumersControl.reset();
219 archivaConfigControl.reset();
220 configControl.reset();
222 dbScanning.addUnprocessedConsumer( "process-pom" );
226 archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
227 configControl.expectAndReturn( config.getDatabaseScanning(), dbScanning );
229 config.setDatabaseScanning( dbScanning );
230 configControl.setMatcher( MockControl.ALWAYS_MATCHER );
231 configControl.setVoidCallable();
233 archivaConfig.save( config );
234 archivaConfigControl.setVoidCallable();
236 dbConsumersUtilControl.replay();
237 cleanupConsumersControl.replay();
238 unprocessedConsumersControl.replay();
239 archivaConfigControl.replay();
240 configControl.replay();
244 boolean success = service.configureDatabaseConsumer( "process-pom", false );
245 assertTrue( success );
247 catch ( Exception e )
249 fail( "An exception should not have been thrown." );
252 dbConsumersUtilControl.verify();
253 cleanupConsumersControl.verify();
254 unprocessedConsumersControl.verify();
255 archivaConfigControl.verify();
256 configControl.verify();
259 public void testConfigureInvalidDatabaseConsumer()
264 dbConsumersUtilControl.replay();
265 cleanupConsumersControl.replay();
266 unprocessedConsumersControl.replay();
270 service.configureDatabaseConsumer( "invalid-consumer", true );
271 fail( "An exception should have been thrown." );
273 catch ( Exception e )
275 assertEquals( "Invalid database consumer.", e.getMessage() );
278 dbConsumersUtilControl.verify();
279 cleanupConsumersControl.verify();
280 unprocessedConsumersControl.verify();
283 /* Tests for repository consumers */
285 public void testGetAllRepoConsumers()
288 recordRepoConsumers();
290 repoConsumerUtilsControl.replay();
291 knownContentConsumerControl.replay();
292 invalidContentConsumerControl.replay();
294 List<String> repoConsumers = service.getAllRepositoryConsumers();
296 repoConsumerUtilsControl.verify();
297 knownContentConsumerControl.verify();
298 invalidContentConsumerControl.verify();
300 assertNotNull( repoConsumers );
301 assertEquals( 4, repoConsumers.size() );
302 assertTrue( repoConsumers.contains( "index-artifact" ) );
303 assertTrue( repoConsumers.contains( "index-pom" ) );
304 assertTrue( repoConsumers.contains( "check-pom" ) );
305 assertTrue( repoConsumers.contains( "check-metadata" ) );
308 public void testConfigureValidRepositoryConsumer()
311 RepositoryScanningConfiguration repoScanning = new RepositoryScanningConfiguration();
312 repoScanning.addKnownContentConsumer( "index-artifact" );
313 repoScanning.addKnownContentConsumer( "index-pom" );
314 repoScanning.addInvalidContentConsumer( "check-pom" );
316 // test enable "check-metadata" consumer
317 recordRepoConsumers();
319 archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
320 configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning );
322 config.setRepositoryScanning( repoScanning );
323 configControl.setMatcher( MockControl.ALWAYS_MATCHER );
324 configControl.setVoidCallable();
326 archivaConfig.save( config );
327 archivaConfigControl.setVoidCallable();
329 repoConsumerUtilsControl.replay();
330 knownContentConsumerControl.replay();
331 invalidContentConsumerControl.replay();
332 archivaConfigControl.replay();
333 configControl.replay();
337 boolean success = service.configureRepositoryConsumer( null, "check-metadata", true );
338 assertTrue( success );
340 catch ( Exception e )
342 fail( "An exception should not have been thrown." );
345 repoConsumerUtilsControl.verify();
346 knownContentConsumerControl.verify();
347 invalidContentConsumerControl.verify();
348 archivaConfigControl.verify();
349 configControl.verify();
351 // test disable "check-metadata" consumer
352 repoConsumerUtilsControl.reset();
353 knownContentConsumerControl.reset();
354 invalidContentConsumerControl.reset();
355 archivaConfigControl.reset();
356 configControl.reset();
358 repoScanning.addInvalidContentConsumer( "check-metadata" );
360 recordRepoConsumers();
362 archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
363 configControl.expectAndReturn( config.getRepositoryScanning(), repoScanning );
365 config.setRepositoryScanning( repoScanning );
366 configControl.setMatcher( MockControl.ALWAYS_MATCHER );
367 configControl.setVoidCallable();
369 archivaConfig.save( config );
370 archivaConfigControl.setVoidCallable();
372 repoConsumerUtilsControl.replay();
373 knownContentConsumerControl.replay();
374 invalidContentConsumerControl.replay();
375 archivaConfigControl.replay();
376 configControl.replay();
380 boolean success = service.configureRepositoryConsumer( null, "check-metadata", false );
382 repoConsumerUtilsControl.verify();
383 knownContentConsumerControl.verify();
384 invalidContentConsumerControl.verify();
385 archivaConfigControl.verify();
386 configControl.verify();
388 assertTrue( success );
390 catch ( Exception e )
392 fail( "An excecption should not have been thrown." );
397 public void testConfigureInvalidRepositoryConsumer()
400 recordRepoConsumers();
402 repoConsumerUtilsControl.replay();
403 knownContentConsumerControl.replay();
404 invalidContentConsumerControl.replay();
408 service.configureRepositoryConsumer( null, "invalid-consumer", true );
409 fail( "An exception should have been thrown." );
411 catch ( Exception e )
413 assertEquals( "Invalid repository consumer.", e.getMessage() );
416 repoConsumerUtilsControl.verify();
417 knownContentConsumerControl.verify();
418 invalidContentConsumerControl.verify();
421 /* Tests for delete artifact */
423 /* public void testDeleteArtifactArtifactExists()
426 archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
427 configControl.expectAndReturn( config.findManagedRepositoryById( "internal" ),
428 createManagedRepo( "internal", "default", "Internal Repository", true, false ) );
431 // - mock checking of artifact existence in the repo
432 // - mock artifact delete
434 archivaConfigControl.replay();
435 configControl.replay();
439 boolean success = service.deleteArtifact( "internal", "org.apache.archiva", "archiva-test", "1.0" );
440 assertTrue( success );
442 catch ( Exception e )
444 fail( "An exception should not have been thrown." );
447 archivaConfigControl.verify();
448 configControl.verify();
451 public void testDeleteArtifactArtifactDoesNotExist()
454 archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
455 configControl.expectAndReturn( config.findManagedRepositoryById( "internal" ),
456 createManagedRepo( "internal", "default", "Internal Repository", true, false ) );
458 // TODO mock checking of artifact existence in the repo
460 archivaConfigControl.replay();
461 configControl.replay();
465 service.deleteArtifact( "internal", "org.apache.archiva", "archiva-test", "1.0" );
466 fail( "An exception should have been thrown." );
468 catch ( Exception e )
470 assertEquals( "Artifact does not exist.", e.getMessage() );
473 archivaConfigControl.verify();
474 configControl.verify();
477 public void testDeleteArtifacRepositoryDoesNotExist()
480 archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
481 configControl.expectAndReturn( config.findManagedRepositoryById( "internal" ), null );
483 archivaConfigControl.replay();
484 configControl.replay();
488 service.deleteArtifact( "internal", "org.apache.archiva", "archiva-test", "1.0" );
489 fail( "An exception should have been thrown." );
491 catch ( Exception e )
493 assertEquals( "Repository does not exist.", e.getMessage() );
496 archivaConfigControl.verify();
497 configControl.verify();
501 /* Tests for repository scanning */
503 public void testExecuteRepoScannerRepoExistsAndNotBeingScanned()
506 archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
507 configControl.expectAndReturn( config.findManagedRepositoryById( "internal" ),
508 createManagedRepo( "internal", "default", "Internal Repository", true, false ) );
510 RepositoryTask task = new RepositoryTask();
512 taskSchedulerControl.expectAndReturn( taskScheduler.isProcessingAnyRepositoryTask(), true );
513 taskSchedulerControl.expectAndReturn( taskScheduler.isProcessingRepositoryTask( "internal" ), false );
515 taskScheduler.queueRepositoryTask( task );
516 taskSchedulerControl.setMatcher( MockControl.ALWAYS_MATCHER );
517 taskSchedulerControl.setVoidCallable();
519 archivaConfigControl.replay();
520 configControl.replay();
521 taskSchedulerControl.replay();
525 boolean success = service.executeRepositoryScanner( "internal" );
526 assertTrue( success );
528 catch ( Exception e )
530 fail( "An exception should not have been thrown." );
533 archivaConfigControl.verify();
534 configControl.verify();
535 taskSchedulerControl.verify();
538 public void testExecuteRepoScannerRepoExistsButBeingScanned()
541 archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
542 configControl.expectAndReturn( config.findManagedRepositoryById( "internal" ),
543 createManagedRepo( "internal", "default", "Internal Repository", true, false ) );
545 taskSchedulerControl.expectAndReturn( taskScheduler.isProcessingAnyRepositoryTask(), true );
546 taskSchedulerControl.expectAndReturn( taskScheduler.isProcessingRepositoryTask( "internal" ), true);
548 archivaConfigControl.replay();
549 configControl.replay();
550 taskSchedulerControl.replay();
554 boolean success = service.executeRepositoryScanner( "internal" );
555 assertFalse( success );
557 catch ( Exception e )
559 fail( "An exception should not have been thrown." );
562 archivaConfigControl.verify();
563 configControl.verify();
564 taskSchedulerControl.verify();
567 public void testExecuteRepoScannerRepoDoesNotExist()
570 archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
571 configControl.expectAndReturn( config.findManagedRepositoryById( "internal" ), null );
573 archivaConfigControl.replay();
574 configControl.replay();
578 service.executeRepositoryScanner( "internal" );
579 fail( "An exception should have been thrown." );
581 catch ( Exception e )
583 assertEquals( "Repository does not exist.", e.getMessage() );
586 archivaConfigControl.verify();
587 configControl.verify();
590 /* Tests for db scanning */
592 public void testExecuteDbScannerDbNotBeingScanned()
595 DatabaseTask task = new DatabaseTask();
597 taskSchedulerControl.expectAndReturn( taskScheduler.isProcessingDatabaseTask(), false );
599 taskScheduler.queueDatabaseTask( task );
600 taskSchedulerControl.setMatcher( MockControl.ALWAYS_MATCHER );
601 taskSchedulerControl.setVoidCallable();
603 taskSchedulerControl.replay();
605 boolean success = service.executeDatabaseScanner();
607 taskSchedulerControl.verify();
609 assertTrue( success );
612 public void testExecuteDbScannerDbIsBeingScanned()
615 taskSchedulerControl.expectAndReturn( taskScheduler.isProcessingDatabaseTask(), true );
617 taskSchedulerControl.replay();
619 boolean success = service.executeDatabaseScanner();
621 taskSchedulerControl.verify();
623 assertFalse( success );
626 /* Tests for querying repositories */
628 public void testGetAllManagedRepositories()
631 List<ManagedRepositoryConfiguration> managedRepos = new ArrayList<ManagedRepositoryConfiguration>();
632 managedRepos.add( createManagedRepo( "internal", "default", "Internal Repository", true, false ) );
633 managedRepos.add( createManagedRepo( "snapshots", "default", "Snapshots Repository", false, true ) );
635 archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
636 configControl.expectAndReturn( config.getManagedRepositories(), managedRepos );
638 archivaConfigControl.replay();
639 configControl.replay();
641 List<ManagedRepository> repos = service.getAllManagedRepositories();
643 archivaConfigControl.verify();
644 configControl.verify();
646 assertNotNull( repos );
647 assertEquals( 2, repos.size() );
649 assertManagedRepo( ( ManagedRepository ) repos.get( 0 ), managedRepos.get( 0 ) );
650 assertManagedRepo( ( ManagedRepository ) repos.get( 1 ), managedRepos.get( 1 ) );
653 public void testGetAllRemoteRepositories()
656 List<RemoteRepositoryConfiguration> remoteRepos = new ArrayList<RemoteRepositoryConfiguration>();
657 remoteRepos.add( createRemoteRepository( "central", "Central Repository", "default", "http://repo1.maven.org/maven2") );
658 remoteRepos.add( createRemoteRepository( "dummy", "Dummy Remote Repository", "legacy", "http://dummy.com/dummy") );
660 archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
661 configControl.expectAndReturn( config.getRemoteRepositories(), remoteRepos );
663 archivaConfigControl.replay();
664 configControl.replay();
666 List<RemoteRepository> repos = service.getAllRemoteRepositories();
668 archivaConfigControl.verify();
669 configControl.verify();
671 assertNotNull( repos );
672 assertEquals( 2, repos.size() );
674 assertRemoteRepo( (RemoteRepository) repos.get( 0 ), remoteRepos.get( 0 ) );
675 assertRemoteRepo( (RemoteRepository) repos.get( 1 ), remoteRepos.get( 1 ) );
678 /* private methods */
680 private void assertRemoteRepo( RemoteRepository remoteRepo, RemoteRepositoryConfiguration expectedRepoConfig )
682 assertEquals( expectedRepoConfig.getId(), remoteRepo.getId() );
683 assertEquals( expectedRepoConfig.getLayout(), remoteRepo.getLayout() );
684 assertEquals( expectedRepoConfig.getName(), remoteRepo.getName() );
685 assertEquals( expectedRepoConfig.getUrl(), remoteRepo.getUrl() );
688 private RemoteRepositoryConfiguration createRemoteRepository(String id, String name, String layout, String url)
690 RemoteRepositoryConfiguration remoteConfig = new RemoteRepositoryConfiguration();
691 remoteConfig.setId( id );
692 remoteConfig.setName( name );
693 remoteConfig.setLayout( layout );
694 remoteConfig.setUrl( url );
699 private void assertManagedRepo( ManagedRepository managedRepo, ManagedRepositoryConfiguration expectedRepoConfig )
701 assertEquals( expectedRepoConfig.getId(), managedRepo.getId() );
702 assertEquals( expectedRepoConfig.getLayout(), managedRepo.getLayout() );
703 assertEquals( expectedRepoConfig.getName(), managedRepo.getName() );
704 //assertEquals( "http://localhost:8080/archiva/repository/" + expectedRepoConfig.getId(), managedRepo.getUrl() );
705 assertEquals( expectedRepoConfig.isReleases(), managedRepo.isReleases() );
706 assertEquals( expectedRepoConfig.isSnapshots(), managedRepo.isSnapshots() );
709 private ManagedRepositoryConfiguration createManagedRepo( String id, String layout, String name,
710 boolean hasReleases, boolean hasSnapshots )
712 ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration();
713 repoConfig.setId( id );
714 repoConfig.setLayout( layout );
715 repoConfig.setName( name );
716 repoConfig.setReleases( hasReleases );
717 repoConfig.setSnapshots( hasSnapshots );
722 private void recordRepoConsumers()
724 List<KnownRepositoryContentConsumer> availableKnownConsumers = new ArrayList<KnownRepositoryContentConsumer>();
725 availableKnownConsumers.add( indexArtifactConsumer );
726 availableKnownConsumers.add( indexPomConsumer );
728 List<InvalidRepositoryContentConsumer> availableInvalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>();
729 availableInvalidConsumers.add( checkPomConsumer );
730 availableInvalidConsumers.add( checkMetadataConsumer );
732 repoConsumerUtilsControl.expectAndReturn( repoConsumersUtil.getAvailableKnownConsumers(), availableKnownConsumers );
733 knownContentConsumerControl.expectAndReturn( indexArtifactConsumer.getId(), "index-artifact" );
734 knownContentConsumerControl.expectAndReturn( indexPomConsumer.getId(), "index-pom" );
736 repoConsumerUtilsControl.expectAndReturn( repoConsumersUtil.getAvailableInvalidConsumers(), availableInvalidConsumers );
737 invalidContentConsumerControl.expectAndReturn( checkPomConsumer.getId(), "check-pom" );
738 invalidContentConsumerControl.expectAndReturn( checkMetadataConsumer.getId(), "check-metadata" );
741 private void recordDbConsumers()
743 List<DatabaseCleanupConsumer> cleanupConsumers = new ArrayList<DatabaseCleanupConsumer>();
744 cleanupConsumers.add( cleanupIndexConsumer );
745 cleanupConsumers.add( cleanupDbConsumer );
747 List<DatabaseUnprocessedArtifactConsumer> unprocessedConsumers =
748 new ArrayList<DatabaseUnprocessedArtifactConsumer>();
749 unprocessedConsumers.add( processArtifactConsumer );
750 unprocessedConsumers.add( processPomConsumer );
752 dbConsumersUtilControl.expectAndReturn( dbConsumersUtil.getAvailableCleanupConsumers(), cleanupConsumers );
753 cleanupConsumersControl.expectAndReturn( cleanupIndexConsumer.getId(), "cleanup-index" );
754 cleanupConsumersControl.expectAndReturn( cleanupDbConsumer.getId(), "cleanup-database" );
756 dbConsumersUtilControl.expectAndReturn( dbConsumersUtil.getAvailableUnprocessedConsumers(), unprocessedConsumers );
757 unprocessedConsumersControl.expectAndReturn( processArtifactConsumer.getId(), "process-artifact" );
758 unprocessedConsumersControl.expectAndReturn( processPomConsumer.getId(), "process-pom" );