mirror of https://github.com/apache/archiva.git
REST service to copy artifact from one repo to an other one use a field from parent class
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1174542 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
041699f218
commit
b79bd84a0c
|
@ -125,7 +125,7 @@ public class DefaultRepositoriesService
|
|||
{
|
||||
if ( repositoryTaskScheduler.isProcessingRepositoryTask( repositoryId ) )
|
||||
{
|
||||
log.info( "scanning of repository with id {} already scheduled" );
|
||||
log.info( "scanning of repository with id {} already scheduled", repositoryId );
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
RepositoryTask task = new RepositoryTask();
|
||||
|
@ -148,7 +148,7 @@ public class DefaultRepositoriesService
|
|||
return repositoryTaskScheduler.isProcessingRepositoryTask( repositoryId );
|
||||
}
|
||||
|
||||
public Boolean removeScanningTaskFromQueue( @PathParam( "repositoryId" ) String repositoryId )
|
||||
public Boolean removeScanningTaskFromQueue( String repositoryId )
|
||||
{
|
||||
RepositoryTask task = new RepositoryTask();
|
||||
task.setRepositoryId( repositoryId );
|
||||
|
@ -201,7 +201,7 @@ public class DefaultRepositoriesService
|
|||
throw new ArchivaRestServiceException( "copyArtifact call: userName not found" );
|
||||
}
|
||||
|
||||
if ( StringUtils.isBlank( artifactTransferRequest.getSourceRepositoryId() ) )
|
||||
if ( StringUtils.isBlank( artifactTransferRequest.getRepositoryId() ) )
|
||||
{
|
||||
throw new ArchivaRestServiceException( "copyArtifact call: sourceRepositoryId cannot be null" );
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ public class DefaultRepositoriesService
|
|||
ManagedRepository source = null;
|
||||
try
|
||||
{
|
||||
source = managedRepositoryAdmin.getManagedRepository( artifactTransferRequest.getSourceRepositoryId() );
|
||||
source = managedRepositoryAdmin.getManagedRepository( artifactTransferRequest.getRepositoryId() );
|
||||
}
|
||||
catch ( RepositoryAdminException e )
|
||||
{
|
||||
|
@ -224,7 +224,7 @@ public class DefaultRepositoriesService
|
|||
if ( source == null )
|
||||
{
|
||||
throw new ArchivaRestServiceException(
|
||||
"cannot find repository with id " + artifactTransferRequest.getSourceRepositoryId() );
|
||||
"cannot find repository with id " + artifactTransferRequest.getRepositoryId() );
|
||||
}
|
||||
|
||||
ManagedRepository target = null;
|
||||
|
@ -282,11 +282,11 @@ public class DefaultRepositoriesService
|
|||
{
|
||||
boolean authz =
|
||||
securitySystem.isAuthorized( securitySession, ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS,
|
||||
artifactTransferRequest.getSourceRepositoryId() );
|
||||
artifactTransferRequest.getRepositoryId() );
|
||||
if ( !authz )
|
||||
{
|
||||
throw new ArchivaRestServiceException(
|
||||
"not authorized to access repo:" + artifactTransferRequest.getSourceRepositoryId() );
|
||||
"not authorized to access repo:" + artifactTransferRequest.getRepositoryId() );
|
||||
}
|
||||
}
|
||||
catch ( AuthorizationException e )
|
||||
|
@ -327,7 +327,7 @@ public class DefaultRepositoriesService
|
|||
{
|
||||
|
||||
ManagedRepositoryContent sourceRepository =
|
||||
repositoryFactory.getManagedRepositoryContent( artifactTransferRequest.getSourceRepositoryId() );
|
||||
repositoryFactory.getManagedRepositoryContent( artifactTransferRequest.getRepositoryId() );
|
||||
|
||||
String artifactSourcePath = sourceRepository.toPath( artifactReference );
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@ package org.apache.archiva.rest.services;
|
|||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.beans.ManagedRepository;
|
||||
import org.apache.archiva.common.utils.FileUtil;
|
||||
import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
|
||||
import org.apache.archiva.rest.api.services.RepositoriesService;
|
||||
import org.apache.cxf.jaxrs.client.ServerWebApplicationException;
|
||||
import org.apache.cxf.jaxrs.client.WebClient;
|
||||
import org.apache.archiva.common.utils.FileUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -66,6 +66,13 @@ public class RepositoriesServiceTest
|
|||
|
||||
String repoId = managedRepositoriesService.getManagedRepositories().get( 0 ).getId();
|
||||
|
||||
// take care if already in scan queue by startup phase
|
||||
if ( service.alreadyScanning( repoId ) )
|
||||
{
|
||||
service.removeScanningTaskFromQueue( repoId );
|
||||
assertFalse( service.alreadyScanning( repoId ) );
|
||||
}
|
||||
|
||||
assertTrue( service.scanRepository( repoId, true ) );
|
||||
|
||||
log.info( "scanRepo call ok " );
|
||||
|
|
Loading…
Reference in New Issue