better documentation in SNIPPET

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1174540 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-09-23 06:41:41 +00:00
parent bfbdfc036e
commit 38036165f0
1 changed files with 7 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.model.ArtifactReference; import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.RepositoryContentFactory; import org.apache.archiva.repository.RepositoryContentFactory;
import org.apache.archiva.rest.api.model.ArtifactTransferRequest; 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.io.FileUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.junit.Test; import org.junit.Test;
@ -111,13 +112,18 @@ public class CopyArtifactTest
initSourceTargetRepo(); initSourceTargetRepo();
// START SNIPPET: copy-artifact // START SNIPPET: copy-artifact
// configure the artifact you want to copy
// if package ommited default will be jar
ArtifactTransferRequest artifactTransferRequest = new ArtifactTransferRequest(); ArtifactTransferRequest artifactTransferRequest = new ArtifactTransferRequest();
artifactTransferRequest.setGroupId( "org.apache.karaf.features" ); artifactTransferRequest.setGroupId( "org.apache.karaf.features" );
artifactTransferRequest.setArtifactId( "org.apache.karaf.features.core" ); artifactTransferRequest.setArtifactId( "org.apache.karaf.features.core" );
artifactTransferRequest.setVersion( "2.2.2" ); artifactTransferRequest.setVersion( "2.2.2" );
artifactTransferRequest.setRepositoryId( SOURCE_REPO_ID ); artifactTransferRequest.setRepositoryId( SOURCE_REPO_ID );
artifactTransferRequest.setTargetRepositoryId( TARGET_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 // END SNIPPET: copy-artifact
assertTrue( res ); assertTrue( res );