]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1508] api to managed repository group : use it in webapp
authorOlivier Lamy <olamy@apache.org>
Tue, 6 Sep 2011 21:07:07 +0000 (21:07 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 6 Sep 2011 21:07:07 +0000 (21:07 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1165847 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdmin.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/resources/log4j.xml

index 8cd535d1403e4eb1194b4c0cae872a7b447aed9d..78e183ba3bcadc185e86d82ade820a304231e424 100644 (file)
@@ -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<String, RepositoryGroup> getRepositoryGroupsAsMap()
+        throws RepositoryAdminException
+    {
+        List<RepositoryGroup> repositoriesGroups = getRepositoriesGroups();
+        Map<String, RepositoryGroup> map = new HashMap<String, RepositoryGroup>( repositoriesGroups.size() );
+        for ( RepositoryGroup repositoryGroup : repositoriesGroups )
+        {
+            map.put( repositoryGroup.getId(), repositoryGroup );
+        }
+        return map;
+    }
+
+    public Map<String, List<String>> getGroupToRepositoryMap()
+        throws RepositoryAdminException
+    {
+
+        java.util.Map<String, java.util.List<String>> map = new java.util.HashMap<String, java.util.List<String>>();
+
+        for ( ManagedRepository repo : getManagedRepositoryAdmin().getManagedRepositories() )
+        {
+            for ( RepositoryGroup group : getRepositoriesGroups() )
+            {
+                if ( !group.getRepositories().contains( repo.getId() ) )
+                {
+                    String groupId = group.getId();
+                    java.util.List<String> repos = map.get( groupId );
+                    if ( repos == null )
+                    {
+                        repos = new java.util.ArrayList<String>();
+                        map.put( groupId, repos );
+                    }
+                    repos.add( repo.getId() );
+                }
+            }
+        }
+        return map;
+    }
+
+    public Map<String, List<String>> getRepositoryToGroupMap()
+        throws RepositoryAdminException
+    {
+        java.util.Map<String, java.util.List<String>> map = new java.util.HashMap<String, java.util.List<String>>();
+
+        for ( RepositoryGroup group : getRepositoriesGroups() )
+        {
+            for ( String repositoryId : group.getRepositories() )
+            {
+                java.util.List<String> groups = map.get( repositoryId );
+                if ( groups == null )
+                {
+                    groups = new java.util.ArrayList<String>();
+                    map.put( repositoryId, groups );
+                }
+                groups.add( group.getId() );
+            }
+        }
+        return map;
+    }
+
     public Boolean validateRepositoryGroup( RepositoryGroup repositoryGroup, boolean updateMode )
         throws RepositoryAdminException
     {
index b51af7975c81fc8555677235a45c8670375abffa..7c21b3a5b7e4cb2afedd6d3c6c688a5716e9a668 100644 (file)
@@ -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<String, RepositoryGroup> getRepositoryGroupsAsMap()
+        throws RepositoryAdminException;
+
+    /**
+     * @return Map with key repoGroupId and value List of ManagedRepositories
+     * @throws RepositoryAdminException
+     */
+    Map<String, List<String>> getGroupToRepositoryMap()
+        throws RepositoryAdminException;
+
+    /**
+     * @return Map with key managedRepo id and value List of repositoryGroup ids where the repo is
+     * @throws RepositoryAdminException
+     */
+    Map<String, List<String>> getRepositoryToGroupMap()
+        throws RepositoryAdminException;
 }
index 1975b097f9ef59c8084ead4b6beb424719ba6cbe..ca5fe97cd3b6e2508c248909cba5914cbc331e83 100644 (file)
@@ -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<ManagedRepository> managedRepositories;
 
     private List<RemoteRepository> remoteRepositories;
@@ -115,7 +119,7 @@ public class RepositoriesAction
 
         remoteRepositories = new ArrayList<RemoteRepository>( getRemoteRepositoryAdmin().getRemoteRepositories() );
         managedRepositories = new ArrayList<ManagedRepository>( 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;
+    }
 }
index 9a6d831408d138f52bec07e96ebe3561146b5b5e..463ac6e8c343cb0293577bf57949ac055e237d59 100644 (file)
@@ -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<String, RepositoryGroupConfiguration> repositoryGroups;
+    @Inject
+    private RepositoryGroupAdmin repositoryGroupAdmin;
+
+    private RepositoryGroup repositoryGroup;
+
+    private Map<String, RepositoryGroup> repositoryGroups;
 
     private Map<String, ManagedRepository> 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<String, RepositoryGroupConfiguration> getRepositoryGroups()
+    public Map<String, RepositoryGroup> getRepositoryGroups()
     {
         return repositoryGroups;
     }
 
-    public void setRepositoryGroups( Map<String, RepositoryGroupConfiguration> repositoryGroups )
+    public void setRepositoryGroups( Map<String, RepositoryGroup> 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;
+    }
 }
index b21e0e5d125a8d4460bacdb65a7d25e7b85a6d29..3592525547db0c3ceb413d333f82e54f859a74a4 100644 (file)
@@ -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 );
index e29d52ee7c41d44b1da971164147a994c240a395..92e14d50a12e4c330eea8faa40a0679e29a057c8 100644 (file)
@@ -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 ) );
 
index 4468d2c0a47e39ced68cee7367238f9093b06d25..01b2b30c3c55832e7db974dcdbb622873a19c771 100644 (file)
     <level value="error"/>
   </logger>
 
+  <!-- reduce noise for unit tests -->
+
+  <logger name="org.springframework">
+    <level value="error"/>
+  </logger>
+
+  <logger name="org.codehaus.plexus">
+    <level value="error"/>
+  </logger>
+
+  <logger name="org.codehaus.redback">
+    <level value="error"/>
+  </logger>
+
+  <logger name="org.apache.cxf">
+    <level value="error"/>
+  </logger>
+
+  <logger name="org.quartz">
+    <level value="error"/>
+  </logger>
+
   <root>
     <priority value ="info" />
     <appender-ref ref="console" />