]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1397] reflect in the staging repo changes made in the configuration of the manag...
authorMaria Odea B. Ching <oching@apache.org>
Sun, 1 Aug 2010 03:04:06 +0000 (03:04 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Sun, 1 Aug 2010 03:04:06 +0000 (03:04 +0000)
submitted by Patti Arachchige Eshan Sudharaka

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-MRM-980@981121 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/MergeAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/mergeExcludeConflicts.jsp
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java

index 78a6c4fc65c07790eea2b7cae41c131f094f4809..a1d4ceebd18e4324ab65c9a76e13ce4b71e9e74b 100644 (file)
@@ -33,6 +33,9 @@ import org.apache.maven.archiva.configuration.Configuration;
 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
 
 import java.util.List;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
 
 /**
  * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="mergeAction" instantiation-strategy="per-lookup"
@@ -71,6 +74,8 @@ public class MergeAction
 
     private List<ArtifactMetadata> conflictSourceArtifacts;
 
+    private List<ArtifactMetadata> conflictSourceArtifactsToBeDisplayed;
+
     public String getConflicts()
     {
         targetRepoId = repoid + "-stage";
@@ -165,6 +170,7 @@ public class MergeAction
         targetRepoId = repoid + "-stage";
         conflictSourceArtifacts = repositoryMerger.getConflictsartifacts( targetRepoId, repoid );
         this.repository = new ManagedRepositoryConfiguration();
+        setConflictSourceArtifactsToBeDisplayed( conflictSourceArtifacts );
     }
 
     public String getTargetRepoId()
@@ -196,5 +202,29 @@ public class MergeAction
     {
         this.conflictSourceArtifacts = conflictSourceArtifacts;
     }
+
+      public  List<ArtifactMetadata> getConflictSourceArtifactsToBeDisplayed()
+    {
+        return conflictSourceArtifactsToBeDisplayed;
+    }
+
+    public void setConflictSourceArtifactsToBeDisplayed( List<ArtifactMetadata> conflictSourceArtifacts )
+        throws Exception
+    {
+        this.conflictSourceArtifactsToBeDisplayed = new ArrayList<ArtifactMetadata>();
+       HashMap<String, ArtifactMetadata> map = new HashMap<String, ArtifactMetadata>();
+        for ( ArtifactMetadata metadata : conflictSourceArtifacts )
+        {
+                String metadataId = metadata.getNamespace() + metadata.getProject() + metadata.getProjectVersion() + metadata.getVersion();
+                map.put( metadataId, metadata );
+        }
+        Iterator iterator = map.keySet().iterator();
+
+        while ( iterator.hasNext() )
+        {
+            conflictSourceArtifactsToBeDisplayed.add( map.get(iterator.next() ));
+        }
+
+    }
 }
 
index 5107e7c9a37d9097c9bf9e04a809cc0b602ec816..2cfc4b1999f3e1b51dd84e2c8eb991f0c462b2e8 100644 (file)
@@ -45,6 +45,8 @@ public class DeleteManagedRepositoryAction
 {
     private ManagedRepositoryConfiguration repository;
 
+    private ManagedRepositoryConfiguration stagingRepository;
+
     private String repoid;
 
     /**
@@ -62,6 +64,7 @@ public class DeleteManagedRepositoryAction
         if ( StringUtils.isNotBlank( repoid ) )
         {
             this.repository = archivaConfiguration.getConfiguration().findManagedRepositoryById( repoid );
+            this.stagingRepository = archivaConfiguration.getConfiguration().findManagedRepositoryById( repoid +"-stage");
         }
     }
 
@@ -87,8 +90,9 @@ public class DeleteManagedRepositoryAction
     }
 
     private String deleteRepository( boolean deleteContents )
-    {   
+    {
         ManagedRepositoryConfiguration existingRepository = repository;
+        ManagedRepositoryConfiguration attachedStagingRepo = stagingRepository;
         if ( existingRepository == null )
         {
             addActionError( "A repository with that id does not exist" );
@@ -103,12 +107,23 @@ public class DeleteManagedRepositoryAction
             cleanupRepositoryData( existingRepository );
             removeRepository( repoid, configuration );
             triggerAuditEvent( repoid, null, AuditEvent.DELETE_MANAGED_REPO );
+            if(attachedStagingRepo !=null)
+            {
+                cleanupRepositoryData( attachedStagingRepo );
+                removeRepository( repoid +"-stage", configuration );
+                triggerAuditEvent(repoid +"-stage", null, AuditEvent.DELETE_MANAGED_REPO );
+
+            }
             result = saveConfiguration( configuration );
 
             if ( result.equals( SUCCESS ) )
             {
                 if ( deleteContents )
                 {
+                    if(attachedStagingRepo !=null)
+                    {
+                        removeContents( attachedStagingRepo );
+                    }
                     removeContents( existingRepository );
                 }
             }
@@ -154,7 +169,7 @@ public class DeleteManagedRepositoryAction
                 {
                     archivaConfiguration.getConfiguration().findRepositoryGroupById( repoGroup ).removeRepository( cleanupRepository.getId() );
                 }
-            }            
+            }
         }
     }
 
index b38e4830f1d00b4aef0be59a03f5b771bd3e675e..a0a4f7cf632158723d9c7d5998750202de75eaf3 100644 (file)
@@ -47,6 +47,8 @@ public class EditManagedRepositoryAction
      */
     private ManagedRepositoryConfiguration repository;
 
+    private ManagedRepositoryConfiguration stagingRepository;
+
     private String repoid;
 
     private final String action = "editRepository";
@@ -63,6 +65,7 @@ public class EditManagedRepositoryAction
         if ( StringUtils.isNotBlank( repoid ) )
         {
             repository = archivaConfiguration.getConfiguration().findManagedRepositoryById( repoid );
+            stagingRepository = archivaConfiguration.getConfiguration().findManagedRepositoryById( repoid + "-stage" );
         }
         else if ( repository != null )
         {
@@ -92,7 +95,6 @@ public class EditManagedRepositoryAction
     {
         ManagedRepositoryConfiguration existingConfig =
             archivaConfiguration.getConfiguration().findManagedRepositoryById( repository.getId() );
-
         boolean resetStats = false;
 
         // check if the location was changed
@@ -117,6 +119,10 @@ public class EditManagedRepositoryAction
 
         // We are in edit mode, remove the old repository configuration.
         removeRepository( repository.getId(), configuration );
+        if ( stagingRepository != null )
+        {
+            removeRepository( stagingRepository.getId(), configuration );
+        }
 
         // Save the repository configuration.
         String result;
@@ -126,15 +132,23 @@ public class EditManagedRepositoryAction
             triggerAuditEvent( repository.getId(), null, AuditEvent.MODIFY_MANAGED_REPO );
             addRepositoryRoles( repository );
 
+            //update changes of the staging repo
             if ( stageNeeded )
             {
-                ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig();
-//                if(new File( stagingRepository.getLocation()).exists())
+
+                stagingRepository = getStageRepoConfig( configuration );
                 addRepository( stagingRepository, configuration );
-                triggerAuditEvent( stagingRepository.getId(), null, AuditEvent.ADD_MANAGED_REPO );
                 addRepositoryRoles( stagingRepository );
 
             }
+            //delete staging repo when we dont need it
+            if ( !stageNeeded )
+            {
+                stagingRepository = getStageRepoConfig(configuration);
+                removeRepository( stagingRepository.getId(), configuration );
+                removeContents( stagingRepository );
+                removeRepositoryRoles( stagingRepository );
+            }
 
             result = saveConfiguration( configuration );
             if ( resetStats )
@@ -156,9 +170,27 @@ public class EditManagedRepositoryAction
         return result;
     }
 
-    private ManagedRepositoryConfiguration getStageRepoConfig()
+    private ManagedRepositoryConfiguration getStageRepoConfig( Configuration configuration )
+    {
+        for ( ManagedRepositoryConfiguration repoConf : configuration.getManagedRepositories() )
+        {
+            if ( repoConf.getId().equals( repository.getId() + "-stage" ) )
+            {
+                stagingRepository = repoConf;
+                removeRepository( repoConf .getId() , configuration);
+                updateStagingRepository( stagingRepository );
+                return stagingRepository;
+            }
+        }
+
+        stagingRepository = new ManagedRepositoryConfiguration();
+        updateStagingRepository( stagingRepository );
+
+        return stagingRepository;
+    }
+
+    private void updateStagingRepository( ManagedRepositoryConfiguration stagingRepository )
     {
-        ManagedRepositoryConfiguration stagingRepository = new ManagedRepositoryConfiguration();
         stagingRepository.setId( repository.getId() + "-stage" );
         stagingRepository.setLayout( repository.getLayout() );
         stagingRepository.setName( repository.getName() + "-stage" );
@@ -174,9 +206,8 @@ public class EditManagedRepositoryAction
         stagingRepository.setRetentionCount( repository.getRetentionCount() );
         stagingRepository.setScanned( repository.isScanned() );
         stagingRepository.setSnapshots( repository.isSnapshots() );
-        return stagingRepository;
     }
-    
+
     @Override
     public void validate()
     {
@@ -191,7 +222,7 @@ public class EditManagedRepositoryAction
     private void resetStatistics()
     {
         repositoryStatisticsManager.deleteStatistics( repository.getId() );
-       }
+    }
 
     public String getRepoid()
     {
@@ -232,4 +263,14 @@ public class EditManagedRepositoryAction
     {
         this.repositoryStatisticsManager = repositoryStatisticsManager;
     }
+
+    public ManagedRepositoryConfiguration getStagingRepository()
+    {
+        return stagingRepository;
+    }
+
+    public void setStagingRepository( ManagedRepositoryConfiguration stagingRepository )
+    {
+        this.stagingRepository = stagingRepository;
+    }
 }
index 561dc30fdfd8ad95d3dcbe7dcf94482b51bd0ab4..88086a6f27435782ca8249881c8fa81cf7e975bf 100644 (file)
     <s:hidden name="repository.id"/>
     <s:label label="ID" name="repository.id" />
     <%@ include file="/WEB-INF/jsp/admin/include/repositoryForm.jspf" %>
-    <s:checkbox name="stageNeeded" value="stageNeeded" label="Create stage repository"/>
+
+    <c:set var="stats" value="${stagingRepository == null}"/>
+     <jsp:useBean id="stats" type="java.lang.Boolean" scope="page"/>
+     <c:if
+      test='<%= !stats.booleanValue() %>'>
+      <s:checkbox name="stageNeeded" value="true" label="Create stage repository"/>
+     </c:if>
+     <c:if
+      test='<%= stats.booleanValue() %>'>
+      <s:checkbox name="stageNeeded" value="false" label="Create stage repository"/>
+     </c:if>
     <s:submit value="Update Repository"/>
   </s:form>
 
index be89c6bf347d5605d70d61f61a760298e44e261d..10731ffc06ac7e68b0d2b6e1a0a95616a7779e80 100644 (file)
             <strong>WARNING: The following are the artifacts in conflict.</strong>
           </p>
         </div>
-        <c:forEach items="${conflictSourceArtifacts}" var="artifact">
+        <c:forEach items="${conflictSourceArtifactsToBeDisplayed}" var="artifact">
           <tr>
             <td>Artifact Id :</td>
-            <td><code>${artifact.id}</code></td>
+            <%--<td><code>${artifact.id}</code></td>--%>
+            <td align="left"> <code>${artifact.namespace} ${" "} ${artifact.project}  ${" "} ${artifact.version}</code></td>
           </tr>
         </c:forEach>
         <tr>
index d730cf5cee5788ba5df8b2185ea040558c2333af..a0ad561eee0d85c57e329299b928622a0a211bd2 100644 (file)
@@ -48,7 +48,7 @@ import java.util.Collections;
 import java.util.List;
 
 /**
- * DeleteManagedRepositoryActionTest 
+ * DeleteManagedRepositoryActionTest
  *
  * @version $Id$
  */
@@ -64,7 +64,7 @@ public class DeleteManagedRepositoryActionTest
     private MockControl archivaConfigurationControl;
 
     private ArchivaConfiguration archivaConfiguration;
-    
+
     private static final String REPO_ID = "repo-ident";
 
     private File location;
@@ -79,11 +79,11 @@ public class DeleteManagedRepositoryActionTest
         super.setUp();
 
         action = new DeleteManagedRepositoryAction();
-        
+
         archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
         archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
         action.setArchivaConfiguration( archivaConfiguration );
-        
+
         roleManagerControl = MockControl.createControl( RoleManager.class );
         roleManager = (RoleManager) roleManagerControl.getMock();
         action.setRoleManager( roleManager );
@@ -122,6 +122,11 @@ public class DeleteManagedRepositoryActionTest
 
         archivaConfiguration.getConfiguration();
         archivaConfigurationControl.setReturnValue( configuration );
+
+         Configuration stageRepoConfiguration = new Configuration();
+        stageRepoConfiguration.addManagedRepository( createSatingRepository() );
+        archivaConfigurationControl.setReturnValue( stageRepoConfiguration );
+
         archivaConfigurationControl.replay();
 
         action.setRepoid( REPO_ID );
@@ -131,10 +136,10 @@ public class DeleteManagedRepositoryActionTest
         ManagedRepositoryConfiguration repository = action.getRepository();
         assertNotNull( repository );
         assertRepositoryEquals( repository, createRepository() );
-        
+
         String status = action.execute();
         assertEquals( Action.SUCCESS, status );
-                
+
         repository = action.getRepository();
         assertRepositoryEquals( repository, createRepository() );
         assertEquals( Collections.singletonList( originalRepository ), configuration.getManagedRepositories() );
@@ -148,7 +153,7 @@ public class DeleteManagedRepositoryActionTest
         repositoryStatisticsManagerControl.replay();
 
         prepareRoleManagerMock();
-        
+
         Configuration configuration = prepDeletionTest( createRepository(), 4 );
 
         MockControl control = mockAuditListeners();
@@ -196,15 +201,15 @@ public class DeleteManagedRepositoryActionTest
         repositoryStatisticsManagerControl.replay();
 
         prepareRoleManagerMock();
-        
-        Configuration configuration = prepDeletionTest( createRepository(), 4 );              
-        
+
+        Configuration configuration = prepDeletionTest( createRepository(), 4 );
+
         MockControl control = mockAuditListeners();
 
         MockControl metadataRepositoryControl = mockMetadataRepository();
 
         String status = action.deleteContents();
-        
+
         assertEquals( Action.SUCCESS, status );
 
         assertTrue( configuration.getManagedRepositories().isEmpty() );
@@ -215,7 +220,7 @@ public class DeleteManagedRepositoryActionTest
         control.verify();
         metadataRepositoryControl.verify();
     }
-    
+
     public void testDeleteRepositoryAndAssociatedProxyConnectors()
         throws Exception
     {
@@ -230,11 +235,11 @@ public class DeleteManagedRepositoryActionTest
         prepareRoleManagerMock();
 
         assertEquals( 1, configuration.getProxyConnectors().size() );
-        
+
         MockControl control = mockAuditListeners();
         MockControl metadataRepositoryControl = mockMetadataRepository();
         String status = action.deleteContents();
-        
+
         assertEquals( Action.SUCCESS, status );
 
         assertTrue( configuration.getManagedRepositories().isEmpty() );
@@ -246,7 +251,7 @@ public class DeleteManagedRepositoryActionTest
         control.verify();
         metadataRepositoryControl.verify();
     }
-    
+
     public void testDeleteRepositoryCancelled()
         throws Exception
     {
@@ -254,7 +259,7 @@ public class DeleteManagedRepositoryActionTest
 
         ManagedRepositoryConfiguration originalRepository = createRepository();
         Configuration configuration = prepDeletionTest( originalRepository, 3 );
-                
+
         String status = action.execute();
         assertEquals( Action.SUCCESS, status );
 
@@ -266,36 +271,8 @@ public class DeleteManagedRepositoryActionTest
 
         repositoryStatisticsManagerControl.verify();
     }
-    
-    public void testDeleteRepositoryAndReposUnderRepoGroup()
-        throws Exception
-    {
-        repositoryStatisticsManager.deleteStatistics( REPO_ID );
-        repositoryStatisticsManagerControl.replay();
-
-        Configuration configuration = prepDeletionTest( createRepository(), 5 );
-        List<String> repoIds = new ArrayList<String>();
-        repoIds.add( REPO_ID );
-        configuration.addRepositoryGroup( createRepoGroup( repoIds, "repo.group" ) );
-
-        prepareRoleManagerMock();
-
-        assertEquals( 1, configuration.getRepositoryGroups().size() );
-        
-        MockControl control = mockAuditListeners();
-        MockControl metadataRepositoryControl = mockMetadataRepository();
-        String status = action.deleteContents();
-        assertEquals( Action.SUCCESS, status );
-
-        assertTrue( configuration.getManagedRepositories().isEmpty() );
-        assertEquals( 0, configuration.getRepositoryGroups().get( 0 ).getRepositories().size() );
 
-        assertFalse( location.exists() );
 
-        repositoryStatisticsManagerControl.verify();
-        control.verify();
-        metadataRepositoryControl.verify();
-    }
 
     private Configuration prepDeletionTest( ManagedRepositoryConfiguration originalRepository, int expectCountGetConfig )
         throws RegistryException, IndeterminateConfigurationException
@@ -307,6 +284,11 @@ public class DeleteManagedRepositoryActionTest
         archivaConfiguration.getConfiguration();
         archivaConfigurationControl.setReturnValue( configuration, expectCountGetConfig );
 
+        Configuration stageRepoConfiguration = new Configuration();
+        stageRepoConfiguration.addManagedRepository( createSatingRepository() );
+        archivaConfigurationControl.setReturnValue( stageRepoConfiguration );
+
+
         archivaConfiguration.save( configuration );
         archivaConfigurationControl.replay();
 
@@ -363,16 +345,33 @@ public class DeleteManagedRepositoryActionTest
         return r;
     }
 
+    private ManagedRepositoryConfiguration createSatingRepository()
+    {
+        ManagedRepositoryConfiguration r = new ManagedRepositoryConfiguration();
+        r.setId( REPO_ID +"-stage" );
+        r.setName( "repo name" );
+        r.setLocation( location.getAbsolutePath() );
+        r.setLayout( "default" );
+        r.setRefreshCronExpression( "* 0/5 * * * ?" );
+        r.setDaysOlder( 0 );
+        r.setRetentionCount( 0 );
+        r.setReleases( true );
+        r.setSnapshots( true );
+        r.setScanned( false );
+        r.setDeleteReleasedSnapshots( false );
+        return r;
+    }
+
     private RemoteRepositoryConfiguration createRemoteRepository(String id, String url)
     {
         RemoteRepositoryConfiguration r = new RemoteRepositoryConfiguration();
         r.setId( id );
         r.setUrl( url );
         r.setLayout( "default" );
-        
+
         return r;
     }
-    
+
     private ProxyConnectorConfiguration createProxyConnector( String managedRepoId, String remoteRepoId )
     {
         ProxyConnectorConfiguration connector = new ProxyConnectorConfiguration();
@@ -387,10 +386,10 @@ public class DeleteManagedRepositoryActionTest
         RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
         repoGroup.setId( repoGroupId );
         repoGroup.setRepositories( repoIds );
-        
+
         return repoGroup;
     }
-    
+
     private void prepareRoleManagerMock()
         throws RoleManagerException
     {
index 1f5024fb5d9d5206ebcfba77fa1961e1763aafc3..7f2fc6ec3c79e4ddc98ff17ec38beceff4624a28 100644 (file)
@@ -95,6 +95,10 @@ public class EditManagedRepositoryActionTest
 
         archivaConfiguration.getConfiguration();
         archivaConfigurationControl.setReturnValue( configuration );
+        Configuration stageRepoConfiguration = new Configuration();
+        stageRepoConfiguration.addManagedRepository( createStagingRepository() );
+        archivaConfigurationControl.setReturnValue( stageRepoConfiguration );
+
         archivaConfigurationControl.replay();
 
         action.setRepoid( REPO_ID );
@@ -116,10 +120,18 @@ public class EditManagedRepositoryActionTest
     {
         roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, REPO_ID );
         roleManagerControl.setReturnValue( false );
+
+         roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, REPO_ID +"-stage" );
+        roleManagerControl.setReturnValue( false );
+
         roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, REPO_ID );
         roleManagerControl.setVoidCallable();
         roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, REPO_ID );
         roleManagerControl.setReturnValue( false );
+
+        roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, REPO_ID +"-stage");
+        roleManagerControl.setReturnValue( false );
+
         roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, REPO_ID );
         roleManagerControl.setVoidCallable();
 
@@ -128,6 +140,10 @@ public class EditManagedRepositoryActionTest
         Configuration configuration = createConfigurationForEditing( createRepository() );
         archivaConfiguration.getConfiguration();
         archivaConfigurationControl.setReturnValue( configuration );
+
+        Configuration stageRepoConfiguration = new Configuration();
+        stageRepoConfiguration.addManagedRepository( createStagingRepository() );
+        archivaConfigurationControl.setReturnValue( stageRepoConfiguration );
         archivaConfigurationControl.setReturnValue( configuration );
         archivaConfigurationControl.setReturnValue( configuration );
 
@@ -167,10 +183,18 @@ public class EditManagedRepositoryActionTest
     {
         roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, REPO_ID );
         roleManagerControl.setReturnValue( false );
+
+        roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, REPO_ID +"-stage");
+        roleManagerControl.setReturnValue( false );
+
         roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, REPO_ID );
         roleManagerControl.setVoidCallable();
         roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, REPO_ID );
         roleManagerControl.setReturnValue( false );
+
+        roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, REPO_ID +"-stage");
+        roleManagerControl.setReturnValue( false );
+
         roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, REPO_ID );
         roleManagerControl.setVoidCallable();
 
@@ -179,6 +203,11 @@ public class EditManagedRepositoryActionTest
         Configuration configuration = createConfigurationForEditing( createRepository() );
         archivaConfiguration.getConfiguration();
         archivaConfigurationControl.setReturnValue( configuration );
+        Configuration stageRepoConfiguration = new Configuration();
+        stageRepoConfiguration.addManagedRepository( createStagingRepository() );
+        archivaConfigurationControl.setReturnValue( stageRepoConfiguration );
+
+
         archivaConfigurationControl.setReturnValue( configuration );
         archivaConfigurationControl.setReturnValue( configuration );
 
@@ -230,9 +259,11 @@ public class EditManagedRepositoryActionTest
     }
 
     private Configuration createConfigurationForEditing( ManagedRepositoryConfiguration repositoryConfiguration )
+        throws Exception
     {
         Configuration configuration = new Configuration();
         configuration.addManagedRepository( repositoryConfiguration );
+//        configuration.addManagedRepository( createStagingRepository() );
         return configuration;
     }
 
@@ -245,6 +276,15 @@ public class EditManagedRepositoryActionTest
         return r;
     }
 
+    private ManagedRepositoryConfiguration createStagingRepository()
+        throws IOException
+    {
+        ManagedRepositoryConfiguration r = new ManagedRepositoryConfiguration();
+        r.setId( REPO_ID + "-stage" );
+        populateStagingRepository( r );
+        return r;
+    }
+
     private void populateRepository( ManagedRepositoryConfiguration repository )
         throws IOException
     {
@@ -260,4 +300,19 @@ public class EditManagedRepositoryActionTest
         repository.setScanned( false );
         repository.setDeleteReleasedSnapshots( true );
     }
+    private void populateStagingRepository( ManagedRepositoryConfiguration repository )
+        throws IOException
+    {
+        repository.setId( REPO_ID + "-stage");
+        repository.setName( "repo name" );
+        repository.setLocation( location.getCanonicalPath() );
+        repository.setLayout( "default" );
+        repository.setRefreshCronExpression( "* 0/5 * * * ?" );
+        repository.setDaysOlder( 31 );
+        repository.setRetentionCount( 20 );
+        repository.setReleases( true );
+        repository.setSnapshots( true );
+        repository.setScanned( false );
+        repository.setDeleteReleasedSnapshots( true );
+    }
 }