]> source.dussan.org Git - archiva.git/commitdiff
fix rest services declaration
authorOlivier Lamy <olamy@apache.org>
Tue, 18 Sep 2012 21:58:50 +0000 (21:58 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 18 Sep 2012 21:58:50 +0000 (21:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1387379 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultMergeRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/MergeRepositoriesServiceTest.java

index 64d805d1d6ff80bf0cfd5dfc6f49bbda91da2679..4c5b9f260a8e3a35ef2a49e86f3c7ec787e5b031 100644 (file)
@@ -23,6 +23,7 @@ import org.apache.archiva.metadata.repository.RepositorySession;
 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
 import org.apache.archiva.rest.api.services.MergeRepositoriesService;
 import org.apache.archiva.stagerepository.merge.Maven2RepositoryMerger;
+import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -32,6 +33,7 @@ import java.util.List;
  * @author Olivier Lamy
  * @since 1.4-M3
  */
+@Service ( "mergeRepositoriesService#rest" )
 public class DefaultMergeRepositoriesService
     extends AbstractRestService
     implements MergeRepositoriesService
index b9900104880d9972f9830e03cfd1665b7d7b25ec..d9468127b1bf4baf1cf51554423add0600193a69 100644 (file)
@@ -70,6 +70,7 @@
       <ref bean="browseService#rest"/>
       <ref bean="systemStatusService#rest"/>
       <ref bean="reportRepositoriesService#rest" />
+      <ref bean="mergeRepositoriesService#rest"/>
     </jaxrs:serviceBeans>
 
     <jaxrs:outInterceptors>
index fdc8f3d302fdc4578b1ded85cc270095b367798a..a32794623502135e20191661eb7bd5fe3b9e1564 100644 (file)
@@ -18,10 +18,12 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
+import org.apache.archiva.metadata.model.ArtifactMetadata;
 import org.apache.archiva.rest.api.services.MergeRepositoriesService;
 import org.junit.Test;
 
 import java.io.File;
+import java.util.List;
 
 /**
  * @author Olivier Lamy
@@ -33,13 +35,22 @@ public class MergeRepositoriesServiceTest
     public void mergeConflictedArtifacts()
         throws Exception
     {
-        String testRepoId = "test-repo";
-        createStagedNeededAndIndexRepo( testRepoId, new File( "target/target-repo" ).getAbsolutePath() );
+        try
+        {
+            String testRepoId = "test-repo";
+            createStagedNeededAndIndexRepo( testRepoId, new File( "target/target-repo" ).getAbsolutePath() );
 
-        MergeRepositoriesService service = getMergeRepositoriesService();
+            MergeRepositoriesService service = getMergeRepositoriesService();
 
-        service.getMergeConflictedArtifacts( testRepoId );
+            List<ArtifactMetadata> artifactMetadatas = service.getMergeConflictedArtifacts( testRepoId );
 
-        deleteTestRepo( testRepoId );
+            log.info( "conflicts: {}", artifactMetadatas );
+
+            deleteTestRepo( testRepoId );
+        } catch( Exception e)
+        {
+            log.error( e.getMessage(), e );
+            throw e;
+        }
     }
 }