From: Maria Odea B. Ching Date: Fri, 15 Oct 2010 02:58:49 +0000 (+0000) Subject: o fix bug when checking for conflicting artifacts, compare managed repo & staging... X-Git-Tag: archiva-1.4-M1~900 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=421229b886b790648967152d31faaaea6e19cc9a;p=archiva.git 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 --- diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java index eda066da5..c34cc5559 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java @@ -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 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 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 artifactsWithOutConflicts = new IncludesFilter( 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 + "'." ); } } } diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java index 6dd467648..a32361767 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java @@ -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 );