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(); Configuration config = archivaConfiguration.getConfiguration();
repoConfig = config.findManagedRepositoryById( repoId ); repoConfig = config.findManagedRepositoryById( repoId );
log.debug( "Retrieved repository configuration for repo '" + repoId + "'" );
if ( repoConfig != null ) if ( repoConfig != null )
{ {
stagingConfig = config.findManagedRepositoryById( stagingId ); stagingConfig = config.findManagedRepositoryById( stagingId );
@ -485,32 +487,62 @@ public class AdministrationServiceImpl
if ( repoConfig.isReleases() && !repoConfig.isSnapshots() ) if ( repoConfig.isReleases() && !repoConfig.isSnapshots() )
{ {
log.info( "Repository to be merged contains releases only.." );
if ( skipConflicts ) if ( skipConflicts )
{ {
List<ArtifactMetadata> conflicts = 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 ); sourceArtifacts.removeAll( conflicts );
log.debug( "Source artifacts size :: " + sourceArtifacts.size() );
mergeWithOutSnapshots( sourceArtifacts, stagingId, repoId ); mergeWithOutSnapshots( sourceArtifacts, stagingId, repoId );
} }
else else
{ {
log.debug( "Source artifacts size :: " + sourceArtifacts.size() );
mergeWithOutSnapshots( sourceArtifacts, stagingId, repoId ); mergeWithOutSnapshots( sourceArtifacts, stagingId, repoId );
} }
} }
else else
{ {
log.info( "Repository to be merged has snapshot artifacts.." );
if ( skipConflicts ) if ( skipConflicts )
{ {
List<ArtifactMetadata> conflicts = 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 ); sourceArtifacts.removeAll( conflicts );
log.debug( "Source artifacts size :: " + sourceArtifacts.size() );
Filter<ArtifactMetadata> artifactsWithOutConflicts = Filter<ArtifactMetadata> artifactsWithOutConflicts =
new IncludesFilter<ArtifactMetadata>( sourceArtifacts ); new IncludesFilter<ArtifactMetadata>( sourceArtifacts );
repositoryMerger.merge( stagingId, repoId, artifactsWithOutConflicts ); repositoryMerger.merge( stagingId, repoId, artifactsWithOutConflicts );
log.info( "Staging repository '" + stagingId + "' merged successfully with managed repo '" +
repoId + "'." );
} }
else else
{ {
repositoryMerger.merge( stagingId, repoId ); 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() ), merge.getId() ),
sources ); sources );
repositoryMerger.merge( staging.getId(), merge.getId() ); repositoryMerger.merge( staging.getId(), merge.getId() );
repositoryMergerControl.setMatcher( MockControl.ALWAYS_MATCHER );
repositoryMergerControl.setVoidCallable(); repositoryMergerControl.setVoidCallable();
repositoryTaskSchedulerControl.expectAndReturn( repositoryTaskScheduler.isProcessingRepositoryTask( "merge" ), repositoryTaskSchedulerControl.expectAndReturn( repositoryTaskScheduler.isProcessingRepositoryTask( "merge" ),
false ); false );