From: Olivier Lamy Date: Tue, 6 Sep 2011 21:07:07 +0000 (+0000) Subject: [MRM-1508] api to managed repository group : use it in webapp X-Git-Tag: archiva-1.4-M1~373 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cd252dc729e14a9cf68b23a8874ee1666f620238;p=archiva.git [MRM-1508] api to managed repository group : use it in webapp git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1165847 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java index 8cd535d14..78e183ba3 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java @@ -21,6 +21,7 @@ package org.apache.archiva.admin.repository.group; import org.apache.archiva.admin.AuditInformation; import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; import org.apache.archiva.admin.repository.RepositoryAdminException; +import org.apache.archiva.admin.repository.managed.ManagedRepository; import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin; import org.apache.archiva.audit.AuditEvent; import org.apache.commons.lang.StringUtils; @@ -33,7 +34,9 @@ import org.springframework.stereotype.Service; import javax.inject.Inject; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -156,8 +159,8 @@ public class DefaultRepositoryGroupAdmin if ( repositoryGroup.getRepositories().contains( repositoryId ) ) { - log.info( "repositoryGroup {} already contains repository {} so skip adding it" ); - return Boolean.TRUE; + throw new RepositoryAdminException( + "repositoryGroup with id " + repositoryGroupId + " already contain repository with id" + repositoryId ); } validateManagedRepositoriesExists( Arrays.asList( repositoryId ) ); @@ -180,8 +183,9 @@ public class DefaultRepositoryGroupAdmin if ( !repositoryGroup.getRepositories().contains( repositoryId ) ) { - log.info( "repositoryGroup {} already contains repository {} so skip removing it" ); - return Boolean.TRUE; + throw new RepositoryAdminException( + "repositoryGroup with id " + repositoryGroupId + " doesn't not contains repository with id" + + repositoryId ); } repositoryGroup.removeRepository( repositoryId ); @@ -190,6 +194,65 @@ public class DefaultRepositoryGroupAdmin return Boolean.TRUE; } + public Map getRepositoryGroupsAsMap() + throws RepositoryAdminException + { + List repositoriesGroups = getRepositoriesGroups(); + Map map = new HashMap( repositoriesGroups.size() ); + for ( RepositoryGroup repositoryGroup : repositoriesGroups ) + { + map.put( repositoryGroup.getId(), repositoryGroup ); + } + return map; + } + + public Map> getGroupToRepositoryMap() + throws RepositoryAdminException + { + + java.util.Map> map = new java.util.HashMap>(); + + for ( ManagedRepository repo : getManagedRepositoryAdmin().getManagedRepositories() ) + { + for ( RepositoryGroup group : getRepositoriesGroups() ) + { + if ( !group.getRepositories().contains( repo.getId() ) ) + { + String groupId = group.getId(); + java.util.List repos = map.get( groupId ); + if ( repos == null ) + { + repos = new java.util.ArrayList(); + map.put( groupId, repos ); + } + repos.add( repo.getId() ); + } + } + } + return map; + } + + public Map> getRepositoryToGroupMap() + throws RepositoryAdminException + { + java.util.Map> map = new java.util.HashMap>(); + + for ( RepositoryGroup group : getRepositoriesGroups() ) + { + for ( String repositoryId : group.getRepositories() ) + { + java.util.List groups = map.get( repositoryId ); + if ( groups == null ) + { + groups = new java.util.ArrayList(); + map.put( repositoryId, groups ); + } + groups.add( group.getId() ); + } + } + return map; + } + public Boolean validateRepositoryGroup( RepositoryGroup repositoryGroup, boolean updateMode ) throws RepositoryAdminException { diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdmin.java index b51af7975..7c21b3a5b 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdmin.java @@ -22,6 +22,7 @@ import org.apache.archiva.admin.AuditInformation; import org.apache.archiva.admin.repository.RepositoryAdminException; import java.util.List; +import java.util.Map; /** * @author Olivier Lamy @@ -50,4 +51,25 @@ public interface RepositoryGroupAdmin Boolean deleteRepositoryFromGroup( String repositoryGroupId, String repositoryId, AuditInformation auditInformation ) throws RepositoryAdminException; + + /** + * @return Map with key repoGroupId and value repoGroup + * @throws RepositoryAdminException + */ + Map getRepositoryGroupsAsMap() + throws RepositoryAdminException; + + /** + * @return Map with key repoGroupId and value List of ManagedRepositories + * @throws RepositoryAdminException + */ + Map> getGroupToRepositoryMap() + throws RepositoryAdminException; + + /** + * @return Map with key managedRepo id and value List of repositoryGroup ids where the repo is + * @throws RepositoryAdminException + */ + Map> getRepositoryToGroupMap() + throws RepositoryAdminException; } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java index 1975b097f..ca5fe97cd 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java @@ -21,6 +21,7 @@ package org.apache.maven.archiva.web.action.admin.repositories; import com.opensymphony.xwork2.Preparable; import org.apache.archiva.admin.repository.RepositoryAdminException; +import org.apache.archiva.admin.repository.group.RepositoryGroupAdmin; import org.apache.archiva.admin.repository.managed.ManagedRepository; import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin; import org.apache.archiva.admin.repository.remote.RemoteRepository; @@ -73,6 +74,9 @@ public class RepositoriesAction @Inject private RemoteRepositoryAdmin remoteRepositoryAdmin; + @Inject + private RepositoryGroupAdmin repositoryGroupAdmin; + private List managedRepositories; private List remoteRepositories; @@ -115,7 +119,7 @@ public class RepositoriesAction remoteRepositories = new ArrayList( getRemoteRepositoryAdmin().getRemoteRepositories() ); managedRepositories = new ArrayList( getManagedRepositoryAdmin().getManagedRepositories() ); - repositoryToGroupMap = config.getRepositoryToGroupMap(); + repositoryToGroupMap = getRepositoryGroupAdmin().getRepositoryToGroupMap(); Collections.sort( managedRepositories, new RepositoryComparator() ); Collections.sort( remoteRepositories, new RepositoryComparator() ); @@ -202,4 +206,24 @@ public class RepositoriesAction { this.remoteRepositoryAdmin = remoteRepositoryAdmin; } + + public RepositoryGroupAdmin getRepositoryGroupAdmin() + { + return repositoryGroupAdmin; + } + + public void setRepositoryGroupAdmin( RepositoryGroupAdmin repositoryGroupAdmin ) + { + this.repositoryGroupAdmin = repositoryGroupAdmin; + } + + public RepositoryStatisticsManager getRepositoryStatisticsManager() + { + return repositoryStatisticsManager; + } + + public void setRepositoryStatisticsManager( RepositoryStatisticsManager repositoryStatisticsManager ) + { + this.repositoryStatisticsManager = repositoryStatisticsManager; + } } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java index 9a6d83140..463ac6e8c 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java @@ -21,21 +21,18 @@ package org.apache.maven.archiva.web.action.admin.repositories; import com.opensymphony.xwork2.Preparable; import org.apache.archiva.admin.repository.RepositoryAdminException; +import org.apache.archiva.admin.repository.group.RepositoryGroup; +import org.apache.archiva.admin.repository.group.RepositoryGroupAdmin; import org.apache.archiva.admin.repository.managed.ManagedRepository; -import org.apache.archiva.audit.AuditEvent; import org.apache.archiva.web.util.ContextUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.configuration.Configuration; -import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; -import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration; import org.apache.struts2.interceptor.ServletRequestAware; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; +import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import java.util.List; import java.util.Map; -import java.util.regex.Matcher; import java.util.regex.Pattern; /** @@ -47,9 +44,13 @@ public class RepositoryGroupsAction extends AbstractRepositoriesAdminAction implements ServletRequestAware, Preparable { - private RepositoryGroupConfiguration repositoryGroup; - private Map repositoryGroups; + @Inject + private RepositoryGroupAdmin repositoryGroupAdmin; + + private RepositoryGroup repositoryGroup; + + private Map repositoryGroups; private Map managedRepositories; @@ -74,163 +75,73 @@ public class RepositoryGroupsAction public void prepare() throws RepositoryAdminException { - Configuration config = archivaConfiguration.getConfiguration(); - repositoryGroup = new RepositoryGroupConfiguration(); - repositoryGroups = config.getRepositoryGroupsAsMap(); + repositoryGroup = new RepositoryGroup(); + repositoryGroups = getRepositoryGroupAdmin().getRepositoryGroupsAsMap(); managedRepositories = getManagedRepositoryAdmin().getManagedRepositoriesAsMap(); - groupToRepositoryMap = config.getGroupToRepositoryMap(); + groupToRepositoryMap = getRepositoryGroupAdmin().getGroupToRepositoryMap(); } public String addRepositoryGroup() { - Configuration configuration = archivaConfiguration.getConfiguration(); - - String repoGroupId = repositoryGroup.getId(); - - if ( repoGroupId == null || "".equals( repoGroupId.trim() ) ) - { - addActionError( "Identifier field is required." ); - return ERROR; - } - - if ( repoGroupId.length() > 100 ) + try { - addActionError( "Identifier [" + repoGroupId + "] is over the maximum limit of 100 characters" ); - return ERROR; + getRepositoryGroupAdmin().addRepositoryGroup( repositoryGroup, getAuditInformation() ); } - - Matcher matcher = REPO_GROUP_ID_PATTERN.matcher( repoGroupId ); - if ( !matcher.matches() ) - { - addActionError( - "Invalid character(s) found in identifier. Only the following characters are allowed: alphanumeric, '.', '-' and '_'" ); - return ERROR; - } - - if ( StringUtils.isBlank( repoGroupId ) ) + catch ( RepositoryAdminException e ) { - addActionError( "You must enter a repository group id." ); + addActionError( e.getMessage() ); return ERROR; } - if ( configuration.getRepositoryGroupsAsMap().containsKey( repoGroupId ) ) - { - addActionError( "Unable to add new repository group with id [" + repoGroupId - + "], that id already exists as a repository group." ); - return ERROR; - } - else if ( configuration.getManagedRepositoriesAsMap().containsKey( repoGroupId ) ) - { - addActionError( "Unable to add new repository group with id [" + repoGroupId - + "], that id already exists as a managed repository." ); - return ERROR; - } - else if ( configuration.getRemoteRepositoriesAsMap().containsKey( repoGroupId ) ) - { - addActionError( "Unable to add new repository group with id [" + repoGroupId - + "], that id already exists as a remote repository." ); - return ERROR; - } - - configuration.addRepositoryGroup( repositoryGroup ); - triggerAuditEvent( AuditEvent.ADD_REPO_GROUP + " " + repoGroupId ); - return saveConfiguration( configuration ); + return SUCCESS; } public String addRepositoryToGroup() { - Configuration config = archivaConfiguration.getConfiguration(); - RepositoryGroupConfiguration group = config.findRepositoryGroupById( repoGroupId ); - - validateRepository(); - - if ( hasErrors() ) + try { - return ERROR; + getRepositoryGroupAdmin().addRepositoryToGroup( repoGroupId, repoId, getAuditInformation() ); } - - if ( group.getRepositories().contains( repoId ) ) + catch ( RepositoryAdminException e ) { - addActionError( "Repository with id [" + repoId + "] is already in the group" ); + addActionError( e.getMessage() ); return ERROR; } - - // remove the old repository group configuration - config.removeRepositoryGroup( group ); - - // save repository group configuration - group.addRepository( repoId ); - config.addRepositoryGroup( group ); - - triggerAuditEvent( repoId, null, AuditEvent.ADD_REPO_TO_GROUP + " " + repoGroupId ); - - return saveConfiguration( config ); + return SUCCESS; } public String removeRepositoryFromGroup() { - Configuration config = archivaConfiguration.getConfiguration(); - RepositoryGroupConfiguration group = config.findRepositoryGroupById( repoGroupId ); - - validateRepository(); - - if ( hasErrors() ) + try { - return ERROR; + getRepositoryGroupAdmin().deleteRepositoryFromGroup( repoGroupId, repoId, getAuditInformation() ); } - - if ( !group.getRepositories().contains( repoId ) ) + catch ( RepositoryAdminException e ) { - addActionError( "No repository with id[" + repoId + "] found in the group" ); + addActionError( e.getMessage() ); return ERROR; } - - // remove the old repository group configuration - config.removeRepositoryGroup( group ); - - // save repository group configuration - group.removeRepository( repoId ); - config.addRepositoryGroup( group ); - - triggerAuditEvent( repoId, null, AuditEvent.DELETE_REPO_FROM_GROUP + " " + repoGroupId ); - - return saveConfiguration( config ); + return SUCCESS; } - public void validateRepository() - { - Configuration config = archivaConfiguration.getConfiguration(); - RepositoryGroupConfiguration group = config.findRepositoryGroupById( repoGroupId ); - ManagedRepositoryConfiguration repo = config.findManagedRepositoryById( repoId ); - if ( group == null ) - { - addActionError( "A repository group with that id does not exist." ); - } - - if ( repo == null ) - { - addActionError( "A repository with that id does not exist." ); - } - } - - public RepositoryGroupConfiguration getRepositoryGroup() + public RepositoryGroup getRepositoryGroup() { return repositoryGroup; } - public void setRepositoryGroup( RepositoryGroupConfiguration repositoryGroup ) + public void setRepositoryGroup( RepositoryGroup repositoryGroup ) { this.repositoryGroup = repositoryGroup; } - public Map getRepositoryGroups() + public Map getRepositoryGroups() { return repositoryGroups; } - public void setRepositoryGroups( Map repositoryGroups ) + public void setRepositoryGroups( Map repositoryGroups ) { this.repositoryGroups = repositoryGroups; } @@ -269,4 +180,14 @@ public class RepositoryGroupsAction { return baseUrl; } + + public RepositoryGroupAdmin getRepositoryGroupAdmin() + { + return repositoryGroupAdmin; + } + + public void setRepositoryGroupAdmin( RepositoryGroupAdmin repositoryGroupAdmin ) + { + this.repositoryGroupAdmin = repositoryGroupAdmin; + } } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.java index b21e0e5d1..359252554 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.java @@ -22,6 +22,7 @@ package org.apache.maven.archiva.web.action.admin.repositories; import com.meterware.servletunit.ServletRunner; import com.meterware.servletunit.ServletUnitClient; import com.opensymphony.xwork2.Action; +import org.apache.archiva.admin.repository.remote.DefaultRemoteRepositoryAdmin; import org.apache.archiva.metadata.repository.MetadataRepository; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory; @@ -48,8 +49,6 @@ public class RepositoriesActionTest throws Exception { super.setUp(); - - //action = (RepositoriesAction) lookup( Action.class.getName(), "repositoriesAction" ); action = (RepositoriesAction) getActionProxy( "/admin/index.action" ).getAction(); } @@ -87,6 +86,7 @@ public class RepositoriesActionTest ServletUnitClient sc = sr.newClient(); action.setServletRequest( sc.newInvocation( "http://localhost/admin/repositories.action" ).getRequest() ); + action.prepare(); String result = action.execute(); assertEquals( Action.SUCCESS, result ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java index e29d52ee7..92e14d50a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java @@ -23,6 +23,9 @@ import com.meterware.servletunit.ServletRunner; import com.meterware.servletunit.ServletUnitClient; import com.opensymphony.xwork2.Action; import org.apache.archiva.admin.repository.RepositoryAdminException; +import org.apache.archiva.admin.repository.group.DefaultRepositoryGroupAdmin; +import org.apache.archiva.admin.repository.group.RepositoryGroup; +import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; @@ -63,13 +66,17 @@ public class RepositoryGroupsActionTest archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class ); archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock(); action.setArchivaConfiguration( archivaConfiguration ); + ( (DefaultRepositoryGroupAdmin) action.getRepositoryGroupAdmin() ).setArchivaConfiguration( + archivaConfiguration ); + ( (DefaultManagedRepositoryAdmin) ( (DefaultRepositoryGroupAdmin) action.getRepositoryGroupAdmin() ).getManagedRepositoryAdmin() ).setArchivaConfiguration( + archivaConfiguration ); } public void testSecureActionBundle() throws SecureActionException, RepositoryAdminException { archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( new Configuration() ); + archivaConfigurationControl.setReturnValue( new Configuration(), 3 ); archivaConfigurationControl.replay(); action.prepare(); @@ -83,19 +90,20 @@ public class RepositoryGroupsActionTest { Configuration configuration = new Configuration(); archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( configuration, 2 ); + archivaConfigurationControl.setReturnValue( configuration, 6 ); archivaConfiguration.save( configuration ); archivaConfigurationControl.replay(); action.prepare(); - RepositoryGroupConfiguration repositoryGroup = action.getRepositoryGroup(); + RepositoryGroup repositoryGroup = action.getRepositoryGroup(); repositoryGroup.setId( REPO_GROUP_ID ); String status = action.addRepositoryGroup(); assertEquals( Action.SUCCESS, status ); - assertEquals( Collections.singletonList( repositoryGroup ), configuration.getRepositoryGroups() ); + assertEquals( Collections.singletonList( repositoryGroup ), + action.getRepositoryGroupAdmin().getRepositoriesGroups() ); archivaConfigurationControl.verify(); } @@ -105,7 +113,7 @@ public class RepositoryGroupsActionTest { Configuration configuration = new Configuration(); archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( configuration, 2 ); + archivaConfigurationControl.setReturnValue( configuration, 5 ); archivaConfiguration.save( configuration ); @@ -124,26 +132,28 @@ public class RepositoryGroupsActionTest { Configuration configuration = new Configuration(); archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( configuration, 3 ); + archivaConfigurationControl.setReturnValue( configuration, 8 ); archivaConfiguration.save( configuration ); archivaConfigurationControl.replay(); action.prepare(); - RepositoryGroupConfiguration repositoryGroup = action.getRepositoryGroup(); + RepositoryGroup repositoryGroup = action.getRepositoryGroup(); repositoryGroup.setId( REPO_GROUP_ID ); String status = action.addRepositoryGroup(); assertEquals( Action.SUCCESS, status ); - assertEquals( Collections.singletonList( repositoryGroup ), configuration.getRepositoryGroups() ); + assertEquals( Collections.singletonList( repositoryGroup ), + action.getRepositoryGroupAdmin().getRepositoriesGroups() ); repositoryGroup.setId( REPO_GROUP_ID ); status = action.addRepositoryGroup(); assertEquals( Action.ERROR, status ); - assertEquals( Collections.singletonList( repositoryGroup ), configuration.getRepositoryGroups() ); + assertEquals( Collections.singletonList( repositoryGroup ), + action.getRepositoryGroupAdmin().getRepositoriesGroups() ); } public void testGetRepositoryGroups() @@ -155,7 +165,7 @@ public class RepositoryGroupsActionTest Configuration configuration = createInitialConfiguration(); archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( configuration ); + archivaConfigurationControl.setReturnValue( configuration, 6 ); archivaConfigurationControl.replay(); action.setServletRequest( sc.newInvocation( "http://localhost/admin/repositoryGroups.action" ).getRequest() ); @@ -169,7 +179,7 @@ public class RepositoryGroupsActionTest assertEquals( 1, action.getRepositoryGroups().size() ); assertEquals( 2, action.getManagedRepositories().size() ); - RepositoryGroupConfiguration repoGroup = action.getRepositoryGroups().get( REPO_GROUP_ID ); + RepositoryGroup repoGroup = action.getRepositoryGroups().get( REPO_GROUP_ID ); assertEquals( 1, repoGroup.getRepositories().size() ); assertEquals( REPO1_ID, repoGroup.getRepositories().get( 0 ) ); @@ -187,7 +197,7 @@ public class RepositoryGroupsActionTest Configuration configuration = createInitialConfiguration(); archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( configuration, 6 ); + archivaConfigurationControl.setReturnValue( configuration, 17 ); archivaConfiguration.save( configuration ); archivaConfigurationControl.replay(); @@ -199,7 +209,7 @@ public class RepositoryGroupsActionTest assertEquals( 1, action.getRepositoryGroups().size() ); assertEquals( 2, action.getManagedRepositories().size() ); - RepositoryGroupConfiguration repoGroup = action.getRepositoryGroups().get( REPO_GROUP_ID ); + RepositoryGroup repoGroup = action.getRepositoryGroups().get( REPO_GROUP_ID ); assertEquals( 1, repoGroup.getRepositories().size() ); assertEquals( REPO1_ID, repoGroup.getRepositories().get( 0 ) ); @@ -236,7 +246,7 @@ public class RepositoryGroupsActionTest Configuration configuration = createInitialConfiguration(); archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( configuration, 6 ); + archivaConfigurationControl.setReturnValue( configuration, 13 ); archivaConfiguration.save( configuration ); archivaConfigurationControl.replay(); @@ -248,7 +258,7 @@ public class RepositoryGroupsActionTest assertEquals( 1, action.getRepositoryGroups().size() ); assertEquals( 2, action.getManagedRepositories().size() ); - RepositoryGroupConfiguration repoGroup = action.getRepositoryGroups().get( REPO_GROUP_ID ); + RepositoryGroup repoGroup = action.getRepositoryGroups().get( REPO_GROUP_ID ); assertEquals( 1, repoGroup.getRepositories().size() ); assertEquals( REPO1_ID, repoGroup.getRepositories().get( 0 ) ); @@ -299,7 +309,7 @@ public class RepositoryGroupsActionTest assertEquals( 1, action.getRepositoryGroups().size() ); assertEquals( 2, action.getManagedRepositories().size() ); - RepositoryGroupConfiguration repoGroup = action.getRepositoryGroups().get( REPO_GROUP_ID ); + RepositoryGroup repoGroup = action.getRepositoryGroups().get( REPO_GROUP_ID ); assertEquals( 1, repoGroup.getRepositories().size() ); assertEquals( REPO1_ID, repoGroup.getRepositories().get( 0 ) ); @@ -335,7 +345,7 @@ public class RepositoryGroupsActionTest assertEquals( 1, action.getRepositoryGroups().size() ); assertEquals( 2, action.getManagedRepositories().size() ); - RepositoryGroupConfiguration repoGroup = action.getRepositoryGroups().get( REPO_GROUP_ID ); + RepositoryGroup repoGroup = action.getRepositoryGroups().get( REPO_GROUP_ID ); assertEquals( 1, repoGroup.getRepositories().size() ); assertEquals( REPO1_ID, repoGroup.getRepositories().get( 0 ) ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/log4j.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/log4j.xml index 4468d2c0a..01b2b30c3 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/log4j.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/resources/log4j.xml @@ -52,6 +52,28 @@ + + + + + + + + + + + + + + + + + + + + + +