From 75f7fab6d40a5afb86620f567f585694a87a7100 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 2 Sep 2011 08:18:38 +0000 Subject: [MRM-1509] change xmlrpc to use new repository administration management api use new api for ManagedRepository git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1164392 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva-xmlrpc/archiva-xmlrpc-api/pom.xml | 4 + .../web/xmlrpc/api/AdministrationService.java | 63 ++++---- .../archiva-xmlrpc/archiva-xmlrpc-services/pom.xml | 4 + .../xmlrpc/services/AdministrationServiceImpl.java | 172 +++++---------------- .../services/AdministrationServiceImplTest.java | 50 +++++- 5 files changed, 127 insertions(+), 166 deletions(-) (limited to 'archiva-modules/archiva-web/archiva-xmlrpc') diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml index b1bcf198d..8dce1e56d 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml @@ -35,6 +35,10 @@ org.apache.archiva stage-repository-merge + + org.apache.archiva + archiva-repository-admin + com.atlassian.xmlrpc atlassian-xmlrpc-binder-annotations diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java index 78e90b24c..f7640c29e 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java @@ -19,75 +19,78 @@ package org.apache.archiva.web.xmlrpc.api; * under the License. */ -import java.util.List; - import com.atlassian.xmlrpc.ServiceObject; +import org.apache.archiva.admin.repository.RepositoryAdminException; import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository; import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository; +import java.util.List; + @ServiceObject( "AdministrationService" ) public interface AdministrationService { /** * Executes repository scanner on the given repository. - * + * * @param repoId id of the repository to be scanned * @return * @throws Exception */ - public Boolean executeRepositoryScanner( String repoId ) + Boolean executeRepositoryScanner( String repoId ) throws Exception; /** * Gets all available repository consumers. - * + * * @return */ - public List getAllRepositoryConsumers(); + List getAllRepositoryConsumers(); // TODO should we already implement config of consumers per repository? + /** * Configures (enable or disable) repository consumer. - * + * * @param repoId * @param consumerId * @param enable * @return * @throws Exception */ - public Boolean configureRepositoryConsumer( String repoId, String consumerId, boolean enable ) + Boolean configureRepositoryConsumer( String repoId, String consumerId, boolean enable ) throws Exception; /** * Gets all managed repositories. - * + * * @return */ - public List getAllManagedRepositories(); + List getAllManagedRepositories() + throws RepositoryAdminException; /** * Gets all remote repositories. - * + * * @return */ - public List getAllRemoteRepositories(); + List getAllRemoteRepositories(); /** * Deletes given artifact from the specified repository. - * - * @param repoId id of the repository where the artifact to be deleted resides - * @param groupId groupId of the artifact to be deleted + * + * @param repoId id of the repository where the artifact to be deleted resides + * @param groupId groupId of the artifact to be deleted * @param artifactId artifactId of the artifact to be deleted - * @param version version of the artifact to be deleted + * @param version version of the artifact to be deleted * @return * @throws Exception */ - public Boolean deleteArtifact( String repoId, String groupId, String artifactId, String version ) + Boolean deleteArtifact( String repoId, String groupId, String artifactId, String version ) throws Exception; /** * Create a new managed repository with the given parameters. - * + * * @param repoId * @param layout * @param name @@ -99,37 +102,39 @@ public interface AdministrationService * @return * @throws Exception */ - public Boolean addManagedRepository( String repoId, String layout, String name, String location, - boolean blockRedeployments, boolean releasesIncluded, - boolean snapshotsIncluded, boolean stageRepoNeeded, String cronExpression ) + Boolean addManagedRepository( String repoId, String layout, String name, String location, + boolean blockRedeployments, boolean releasesIncluded, boolean snapshotsIncluded, + boolean stageRepoNeeded, String cronExpression ) throws Exception; /** * Deletes a managed repository with the given repository id. - * + * * @param repoId * @return */ - public Boolean deleteManagedRepository( String repoId ) + Boolean deleteManagedRepository( String repoId ) throws Exception; /** * Deletes a managed repository content with the given repository id - * + * * @param repoId * @return * @throws Exception */ - public Boolean deleteManagedRepositoryContent( String repoId ) + Boolean deleteManagedRepositoryContent( String repoId ) throws Exception; /** * Get a managed repository with the given repository id. + * * @param repoId * @return * @throws Exception */ - public ManagedRepository getManagedRepository(String repoId) throws Exception; + ManagedRepository getManagedRepository( String repoId ) + throws Exception; // TODO // consider the following as additional services: // - getAllConfiguredRepositoryConsumers( String repoId ) - list all enabled consumers for the repo @@ -137,11 +142,13 @@ public interface AdministrationService /** * Merge staging repository with the managed repository and skips if there are conflicts + * * @param repoId * @param skipConflicts * @return * @throws Exception */ - public boolean merge( String repoId, boolean skipConflicts ) throws Exception; - + boolean merge( String repoId, boolean skipConflicts ) + throws Exception; + } diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml index bfb1f9108..e6597f845 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml @@ -39,6 +39,10 @@ + + org.apache.archiva + archiva-repository-admin + org.apache.archiva archiva-xmlrpc-security diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java index b6f4b9da0..f7eadc19c 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java @@ -19,6 +19,9 @@ package org.apache.archiva.web.xmlrpc.services; * under the License. */ +import org.apache.archiva.admin.AuditInformation; +import org.apache.archiva.admin.repository.RepositoryAdminException; +import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin; import org.apache.archiva.audit.AuditEvent; import org.apache.archiva.audit.AuditListener; import org.apache.archiva.metadata.model.ArtifactMetadata; @@ -38,7 +41,6 @@ import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository; import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.validator.GenericValidator; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.IndeterminateConfigurationException; @@ -54,9 +56,7 @@ import org.apache.maven.archiva.repository.ManagedRepositoryContent; import org.apache.maven.archiva.repository.RepositoryContentFactory; import org.apache.maven.archiva.repository.RepositoryException; import org.apache.maven.archiva.repository.RepositoryNotFoundException; -import org.codehaus.plexus.registry.Registry; import org.codehaus.plexus.registry.RegistryException; -import org.codehaus.redback.components.scheduler.CronExpressionValidator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -98,7 +98,7 @@ public class AdministrationServiceImpl private RepositorySessionFactory repositorySessionFactory; - private Registry registry; + private ManagedRepositoryAdmin managedRepositoryAdmin; private static final String REPOSITORY_ID_VALID_EXPRESSION = "^[a-zA-Z0-9._-]+$"; @@ -113,7 +113,7 @@ public class AdministrationServiceImpl Collection listeners, RepositoryStatisticsManager repositoryStatisticsManager, RepositoryMerger repositoryMerger, AuditListener auditListener, - Registry registry ) + ManagedRepositoryAdmin managedRepositoryAdmin ) { this.archivaConfiguration = archivaConfig; this.repoConsumersUtil = repoConsumersUtil; @@ -124,7 +124,7 @@ public class AdministrationServiceImpl this.repositoryStatisticsManager = repositoryStatisticsManager; this.repositoryMerger = repositoryMerger; this.auditListener = auditListener; - this.registry = registry; + this.managedRepositoryAdmin = managedRepositoryAdmin; } /** @@ -214,8 +214,8 @@ public class AdministrationServiceImpl repoContent.deleteVersion( ref ); MetadataRepository metadataRepository = repositorySession.getRepository(); - Collection artifacts = metadataRepository.getArtifacts( repoId, groupId, artifactId, - version ); + Collection artifacts = + metadataRepository.getArtifacts( repoId, groupId, artifactId, version ); for ( ArtifactMetadata artifact : artifacts ) { @@ -307,18 +307,15 @@ public class AdministrationServiceImpl * @see AdministrationService#getAllManagedRepositories() */ public List getAllManagedRepositories() + throws RepositoryAdminException { List managedRepos = new ArrayList(); - Configuration config = archivaConfiguration.getConfiguration(); - List managedRepoConfigs = config.getManagedRepositories(); - - for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs ) + for ( org.apache.archiva.admin.repository.managed.ManagedRepository repoConfig : managedRepositoryAdmin.getManagedRepositories() ) { - // TODO fix resolution of repo url! - ManagedRepository repo = new ManagedRepository( repoConfig.getId(), repoConfig.getName(), "URL", - repoConfig.getLayout(), repoConfig.isSnapshots(), - repoConfig.isReleases() ); + ManagedRepository repo = + new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(), + repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases() ); managedRepos.add( repo ); } @@ -368,89 +365,12 @@ public class AdministrationServiceImpl throws Exception { - Configuration config = archivaConfiguration.getConfiguration(); - - CronExpressionValidator validator = new CronExpressionValidator(); - - if ( config.getManagedRepositoriesAsMap().containsKey( repoId ) ) - { - throw new Exception( "Unable to add new repository with id [" + repoId + - "], that id already exists as a managed repository." ); - } - else if ( config.getRemoteRepositoriesAsMap().containsKey( repoId ) ) - { - throw new Exception( "Unable to add new repository with id [" + repoId + - "], that id already exists as a remote repository." ); - } - else if ( config.getRepositoryGroupsAsMap().containsKey( repoId ) ) - { - throw new Exception( "Unable to add new repository with id [" + repoId + - "], that id already exists as a repository group." ); - } - - if ( !validator.validate( cronExpression ) ) - { - throw new Exception( "Invalid cron expression." ); - } - - if( !GenericValidator.matchRegexp( repoId, REPOSITORY_ID_VALID_EXPRESSION ) ) - { - throw new Exception( "Invalid repository ID. Identifier must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); - } - - if( !GenericValidator.matchRegexp( name, REPOSITORY_NAME_VALID_EXPRESSION ) ) - { - throw new Exception( "Invalid repository name. Repository Name must only contain alphanumeric characters, white-spaces(' '), " + - "forward-slashes(/), open-parenthesis('('), close-parenthesis(')'), underscores(_), dots(.), and dashes(-)." ); - } - - String repoLocation = removeExpressions( location ); - - if( !GenericValidator.matchRegexp( repoLocation, REPOSITORY_LOCATION_VALID_EXPRESSION ) ) - { - throw new Exception( "Invalid repository location. Directory must only contain alphanumeric characters, equals(=), question-marks(?), " + - "exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." ); - } - - ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration(); + org.apache.archiva.admin.repository.managed.ManagedRepository repository = + new org.apache.archiva.admin.repository.managed.ManagedRepository( repoId, name, location, layout, + snapshotsIncluded, releasesIncluded, + blockRedeployments, cronExpression ); + return managedRepositoryAdmin.addManagedRepository( repository, stageRepoNeeded, getAuditInformation() ); - repository.setId( repoId ); - repository.setBlockRedeployments( blockRedeployments ); - repository.setReleases( releasesIncluded ); - repository.setSnapshots( snapshotsIncluded ); - repository.setName( name ); - repository.setLocation( repoLocation ); - repository.setLayout( layout ); - repository.setRefreshCronExpression( cronExpression ); - - addRepository( repository, config ); - - if ( stageRepoNeeded ) - { - ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository ); - addRepository( stagingRepository, config ); - } - - saveConfiguration( config ); - - //MRM-1342 Repository statistics report doesn't appear to be working correctly - //scan repository when adding of repository is successful - try - { - executeRepositoryScanner( repoId ); - if ( stageRepoNeeded ) - { - ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository ); - executeRepositoryScanner( stagingRepository.getId() ); - } - } - catch ( Exception e ) - { - log.warn( new StringBuilder( "Unable to scan repository [" ).append( repoId ).append( "]: " ).append( - e.getMessage() ).toString(), e ); - } - - return Boolean.TRUE; } public Boolean deleteManagedRepository( String repoId ) @@ -608,16 +528,16 @@ public class AdministrationServiceImpl log.info( "Repository to be merged contains releases only.." ); if ( skipConflicts ) { - List conflicts = repositoryMerger.getConflictingArtifacts( - metadataRepository, repoId, stagingId ); + List conflicts = + repositoryMerger.getConflictingArtifacts( metadataRepository, repoId, stagingId ); if ( log.isDebugEnabled() ) { log.debug( "Artifacts in conflict.." ); for ( ArtifactMetadata metadata : conflicts ) { - log.debug( metadata.getNamespace() + ":" + metadata.getProject() + ":" + - metadata.getProjectVersion() ); + log.debug( metadata.getNamespace() + ":" + metadata.getProject() + ":" + + metadata.getProjectVersion() ); } } @@ -637,16 +557,16 @@ public class AdministrationServiceImpl log.info( "Repository to be merged has snapshot artifacts.." ); if ( skipConflicts ) { - List conflicts = repositoryMerger.getConflictingArtifacts( - metadataRepository, repoId, stagingId ); + List conflicts = + repositoryMerger.getConflictingArtifacts( metadataRepository, repoId, stagingId ); if ( log.isDebugEnabled() ) { log.debug( "Artifacts in conflict.." ); for ( ArtifactMetadata metadata : conflicts ) { - log.debug( metadata.getNamespace() + ":" + metadata.getProject() + ":" + - metadata.getProjectVersion() ); + log.debug( metadata.getNamespace() + ":" + metadata.getProject() + ":" + + metadata.getProjectVersion() ); } } @@ -654,19 +574,19 @@ public class AdministrationServiceImpl log.debug( "Source artifacts size :: " + sourceArtifacts.size() ); - Filter artifactsWithOutConflicts = new IncludesFilter( - sourceArtifacts ); + Filter artifactsWithOutConflicts = + new IncludesFilter( sourceArtifacts ); repositoryMerger.merge( metadataRepository, stagingId, repoId, artifactsWithOutConflicts ); - log.info( "Staging repository '" + stagingId + "' merged successfully with managed repo '" + - repoId + "'." ); + log.info( "Staging repository '" + stagingId + "' merged successfully with managed repo '" + + repoId + "'." ); } else { repositoryMerger.merge( metadataRepository, stagingId, repoId ); - log.info( "Staging repository '" + stagingId + "' merged successfully with managed repo '" + - repoId + "'." ); + log.info( "Staging repository '" + stagingId + "' merged successfully with managed repo '" + + repoId + "'." ); } } } @@ -705,25 +625,6 @@ public class AdministrationServiceImpl return true; } - protected void addRepository( ManagedRepositoryConfiguration repository, Configuration configuration ) - throws IOException - { - // Normalize the path - File file = new File( repository.getLocation() ); - repository.setLocation( file.getCanonicalPath() ); - if ( !file.exists() ) - { - file.mkdirs(); - } - if ( !file.exists() || !file.isDirectory() ) - { - throw new IOException( - "Unable to add repository - no write access, can not create the root directory: " + file ); - } - - configuration.addManagedRepository( repository ); - } - // todo: setting userid of audit event private AuditEvent createAuditEvent( ManagedRepositoryConfiguration repoConfig ) { @@ -779,12 +680,9 @@ public class AdministrationServiceImpl return stagingRepository; } - private String removeExpressions( String directory ) + // FIXME find a way to get user id and adress + private AuditInformation getAuditInformation() { - String value = StringUtils.replace( directory, "${appserver.base}", registry.getString( "appserver.base", - "${appserver.base}" ) ); - value = StringUtils.replace( value, "${appserver.home}", registry.getString( "appserver.home", - "${appserver.home}" ) ); - return value; + return new AuditInformation( null, null ); } } diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java index 9acec835a..041c431f5 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java @@ -20,6 +20,8 @@ package org.apache.archiva.web.xmlrpc.services; */ import junit.framework.TestCase; +import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; +import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin; import org.apache.archiva.audit.AuditEvent; import org.apache.archiva.audit.AuditListener; import org.apache.archiva.metadata.model.ArtifactMetadata; @@ -53,6 +55,8 @@ import org.apache.maven.archiva.repository.content.ManagedDefaultRepositoryConte import org.apache.maven.archiva.repository.content.ManagedLegacyRepositoryContent; import org.apache.maven.archiva.repository.content.PathParser; import org.apache.maven.archiva.repository.layout.LayoutException; +import org.apache.maven.archiva.security.ArchivaRoleConstants; +import org.codehaus.plexus.redback.role.RoleManager; import org.codehaus.plexus.registry.Registry; import org.easymock.MockControl; import org.easymock.classextension.MockClassControl; @@ -65,6 +69,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.HashMap; @@ -140,12 +145,18 @@ public class AdministrationServiceImplTest private AuditListener auditListener; + private MockControl roleManagerControl; + + private RoleManager roleManager; + private MockControl registryControl; private Registry registry; private static final String STAGE = "-stage"; + private DefaultManagedRepositoryAdmin managedRepositoryAdmin; + @Before public void setUp() throws Exception @@ -189,6 +200,9 @@ public class AdministrationServiceImplTest listenerControl = MockControl.createControl( RepositoryListener.class ); listener = (RepositoryListener) listenerControl.getMock(); + roleManagerControl = MockControl.createControl( RoleManager.class ); + roleManager = (RoleManager) roleManagerControl.getMock(); + repositoryStatisticsManagerControl = MockControl.createControl( RepositoryStatisticsManager.class ); repositoryStatisticsManager = (RepositoryStatisticsManager) repositoryStatisticsManagerControl.getMock(); @@ -201,10 +215,20 @@ public class AdministrationServiceImplTest registryControl = MockControl.createControl( Registry.class ); registry = (Registry) registryControl.getMock(); + + managedRepositoryAdmin = new DefaultManagedRepositoryAdmin(); + managedRepositoryAdmin.setArchivaConfiguration( archivaConfig ); + managedRepositoryAdmin.setRegistry( registry ); + managedRepositoryAdmin.setRepositoryStatisticsManager( repositoryStatisticsManager ); + managedRepositoryAdmin.setRepositoryTaskScheduler( repositoryTaskScheduler ); + managedRepositoryAdmin.setRepositorySessionFactory( repositorySessionFactory ); + managedRepositoryAdmin.setAuditListeners( Arrays.asList( auditListener ) ); + managedRepositoryAdmin.setRoleManager( roleManager ); + service = new AdministrationServiceImpl( archivaConfig, repoConsumersUtil, repositoryFactory, repositorySessionFactory, repositoryTaskScheduler, Collections.singletonList( listener ), repositoryStatisticsManager, - repositoryMerger, auditListener, registry ); + repositoryMerger, auditListener, managedRepositoryAdmin ); } /* Tests for repository consumers */ @@ -948,6 +972,27 @@ public class AdministrationServiceImplTest configControl.expectAndReturn( config.getManagedRepositoriesAsMap(), managedRepoMap ); configControl.expectAndReturn( config.getRemoteRepositoriesAsMap(), remoteRepoMap ); configControl.expectAndReturn( config.getRepositoryGroupsAsMap(), repoGroupMap ); + + roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ); + roleManagerControl.setReturnValue( false ); + roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ); + roleManagerControl.setVoidCallable(); + roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ); + roleManagerControl.setReturnValue( false ); + roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ); + roleManagerControl.setVoidCallable(); + + roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId + "-stage" ); + roleManagerControl.setReturnValue( false ); + roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId + "-stage" ); + roleManagerControl.setVoidCallable(); + roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId + "-stage" ); + roleManagerControl.setReturnValue( false ); + roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId + "-stage" ); + roleManagerControl.setVoidCallable(); + + roleManagerControl.replay(); + registryControl.expectAndReturn( registry.getString( "appserver.base", "${appserver.base}" ), appserverBase ); registryControl.expectAndReturn( registry.getString( "appserver.home", "${appserver.home}" ), appserverBase ); config.addManagedRepository( managedRepo ); @@ -959,6 +1004,9 @@ public class AdministrationServiceImplTest archivaConfig.save( config ); archivaConfigControl.setVoidCallable(); + + + //managed repo repositoryTaskSchedulerControl.expectAndReturn( repositoryTaskScheduler.isProcessingRepositoryTask( repoId ), false ); -- cgit v1.2.3