Filter<ArtifactMetadata> artifactsWithOutConflicts = new IncludesFilter<ArtifactMetadata>( sources );
RepositoryTask task = new RepositoryTask();
task.setScanAll( true );
ManagedRepositoryConfiguration repo = createManagedRepo( "repo", "default", "repo", true, true );
repo.setLocation( "target/test-repository/one" );
ManagedRepositoryConfiguration staging = createStagingRepo( repo );
configControl.reset();
configControl.expectAndReturn( config.getManagedRepositories(), Arrays.asList( repo, staging ), 1, 5 );
archivaConfigControl.reset();
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 5 );
metadataRepositoryControl.expectAndReturn( metadataRepository.getArtifacts( staging.getId() ), sources );
repositoryMergerControl.expectAndDefaultReturn(
repositoryMerger.getConflictingArtifacts( metadataRepository, staging.getId(), repo.getId() ), conflicts );
repositoryMerger.merge( metadataRepository, staging.getId(), repo.getId(), artifactsWithOutConflicts );
repositoryMergerControl.setMatcher( MockControl.ALWAYS_MATCHER );
repositoryMergerControl.setVoidCallable();
repositoryTaskSchedulerControl.expectAndReturn( repositoryTaskScheduler.isProcessingRepositoryTask( "repo" ),
false );
repositoryTaskScheduler.queueTask( task );