]> source.dussan.org Git - archiva.git/commitdiff
better documentation in SNIPPET
authorOlivier Lamy <olamy@apache.org>
Fri, 23 Sep 2011 06:41:41 +0000 (06:41 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 23 Sep 2011 06:41:41 +0000 (06:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1174540 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/CopyArtifactTest.java

index 46dfa8868e5dfe0982c4e78f349e04deee172623..9eb1faf866c360181fa5c1a04943ad5501d31b3a 100644 (file)
@@ -22,6 +22,7 @@ import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.model.ArtifactReference;
 import org.apache.archiva.repository.RepositoryContentFactory;
 import org.apache.archiva.rest.api.model.ArtifactTransferRequest;
+import org.apache.archiva.rest.api.services.RepositoriesService;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
 import org.junit.Test;
@@ -111,13 +112,18 @@ public class CopyArtifactTest
         initSourceTargetRepo();
 
         // START SNIPPET: copy-artifact
+        // configure the artifact you want to copy
+        // if package ommited default will be jar
         ArtifactTransferRequest artifactTransferRequest = new ArtifactTransferRequest();
         artifactTransferRequest.setGroupId( "org.apache.karaf.features" );
         artifactTransferRequest.setArtifactId( "org.apache.karaf.features.core" );
         artifactTransferRequest.setVersion( "2.2.2" );
         artifactTransferRequest.setRepositoryId( SOURCE_REPO_ID );
         artifactTransferRequest.setTargetRepositoryId( TARGET_REPO_ID );
-        Boolean res = getRepositoriesService( authorizationHeader ).copyArtifact( artifactTransferRequest );
+        // retrieve the service
+        RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
+        // copy the artifact
+        Boolean res = repositoriesService.copyArtifact( artifactTransferRequest );
         // END SNIPPET: copy-artifact
         assertTrue( res );