]> source.dussan.org Git - archiva.git/commitdiff
o fix bug when checking for conflicting artifacts, compare managed repo & staging...
authorMaria Odea B. Ching <oching@apache.org>
Fri, 15 Oct 2010 02:58:49 +0000 (02:58 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Fri, 15 Oct 2010 02:58:49 +0000 (02:58 +0000)
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

archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java

index eda066da5e4a7b07adb0abeb52674bde8458ee9f..c34cc5559f39995bb75d521059598b9e44950453 100644 (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 + "'." );
                     }
                 }
             }
index 6dd467648a0c4e28984d6a91df9a92c208a7d18e..a323617678fdda327bf2d046fc9e6e195af17986 100644 (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 );