o fix bug when checking for conflicting artifacts, compare managed repo & staging repo instead of both staging repo

o added debug logs
o removed alwaysmatcher for test so we can catch the specific values of passed params


git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1022813 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maria Odea B. Ching 2010-10-15 02:58:49 +00:00
parent e01a96d5f4
commit 421229b886
2 changed files with 34 additions and 3 deletions

View File

@ -475,6 +475,8 @@ public class AdministrationServiceImpl
Configuration config = archivaConfiguration.getConfiguration();
repoConfig = config.findManagedRepositoryById( repoId );
log.debug( "Retrieved repository configuration for repo '" + repoId + "'" );
if ( repoConfig != null )
{
stagingConfig = config.findManagedRepositoryById( stagingId );
@ -485,32 +487,62 @@ public class AdministrationServiceImpl
if ( repoConfig.isReleases() && !repoConfig.isSnapshots() )
{
log.info( "Repository to be merged contains releases only.." );
if ( skipConflicts )
{
List<ArtifactMetadata> conflicts =
repositoryMerger.getConflictingArtifacts( stagingId, stagingId );
repositoryMerger.getConflictingArtifacts( repoId, stagingId );
log.debug( "Artifacts in conflict.." );
for( ArtifactMetadata metadata : conflicts )
{
log.debug( metadata.getNamespace() + ":" + metadata.getProject() + ":" +
metadata.getProjectVersion() );
}
sourceArtifacts.removeAll( conflicts );
log.debug( "Source artifacts size :: " + sourceArtifacts.size() );
mergeWithOutSnapshots( sourceArtifacts, stagingId, repoId );
}
else
{
log.debug( "Source artifacts size :: " + sourceArtifacts.size() );
mergeWithOutSnapshots( sourceArtifacts, stagingId, repoId );
}
}
else
{
log.info( "Repository to be merged has snapshot artifacts.." );
if ( skipConflicts )
{
List<ArtifactMetadata> conflicts =
repositoryMerger.getConflictingArtifacts( stagingId, stagingId );
repositoryMerger.getConflictingArtifacts( repoId, stagingId );
log.debug( "Artifacts in conflict.." );
for( ArtifactMetadata metadata : conflicts )
{
log.debug( metadata.getNamespace() + ":" + metadata.getProject() + ":" +
metadata.getProjectVersion() );
}
sourceArtifacts.removeAll( conflicts );
log.debug( "Source artifacts size :: " + sourceArtifacts.size() );
Filter<ArtifactMetadata> artifactsWithOutConflicts =
new IncludesFilter<ArtifactMetadata>( sourceArtifacts );
repositoryMerger.merge( stagingId, repoId, artifactsWithOutConflicts );
log.info( "Staging repository '" + stagingId + "' merged successfully with managed repo '" +
repoId + "'." );
}
else
{
repositoryMerger.merge( stagingId, repoId );
log.info( "Staging repository '" + stagingId + "' merged successfully with managed repo '" +
repoId + "'." );
}
}
}

View File

@ -720,7 +720,6 @@ public class AdministrationServiceImplTest
merge.getId() ),
sources );
repositoryMerger.merge( staging.getId(), merge.getId() );
repositoryMergerControl.setMatcher( MockControl.ALWAYS_MATCHER );
repositoryMergerControl.setVoidCallable();
repositoryTaskSchedulerControl.expectAndReturn( repositoryTaskScheduler.isProcessingRepositoryTask( "merge" ),
false );