From: Olivier Lamy Date: Mon, 9 Jan 2012 21:46:07 +0000 (+0000) Subject: fix junit due to ArrayList init mock call number changed X-Git-Tag: archiva-1.4-M3~1613 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=609db54fef4bd42545ccdddd189bb52c4c0fe67e;p=archiva.git fix junit due to ArrayList init mock call number changed git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1229366 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java index 504d9d38b..824779b1a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java @@ -400,13 +400,8 @@ public class AddProxyConnectorActionTest throws RegistryException, IndeterminateConfigurationException { Configuration config = createInitialConfiguration(); - - for ( int i = 0; i < requestConfigCount; i++ ) - { - archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( config ); - } - + archivaConfiguration.getConfiguration(); + archivaConfigurationControl.setReturnValue( config, requestConfigCount, requestConfigCount + 1 ); archivaConfiguration.save( config ); } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java index 12adeb498..b4f4939ed 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java @@ -20,7 +20,6 @@ package org.apache.archiva.web.action.admin.connectors.proxy; */ import com.opensymphony.xwork2.Action; - import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; import org.apache.archiva.admin.repository.proxyconnector.DefaultProxyConnectorAdmin; import org.apache.archiva.admin.repository.remote.DefaultRemoteRepositoryAdmin; @@ -31,12 +30,12 @@ import org.apache.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.archiva.configuration.ProxyConnectorConfiguration; import org.apache.archiva.configuration.RemoteRepositoryConfiguration; import org.apache.archiva.web.action.AbstractWebworkTestCase; -import org.codehaus.redback.integration.interceptor.SecureActionBundle; import org.codehaus.plexus.registry.RegistryException; +import org.codehaus.redback.integration.interceptor.SecureActionBundle; import org.easymock.MockControl; /** - * ProxyConnectorsActionTest + * ProxyConnectorsActionTest * * @version $Id$ */ @@ -61,7 +60,7 @@ public class ProxyConnectorsActionTest { super.setUp(); - action = (ProxyConnectorsAction) getActionProxy("/admin/proxyConnectors.action" ).getAction(); + action = (ProxyConnectorsAction) getActionProxy( "/admin/proxyConnectors.action" ).getAction(); archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class ); archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock(); @@ -69,13 +68,14 @@ public class ProxyConnectorsActionTest archivaConfiguration ); ( (DefaultRemoteRepositoryAdmin) action.getRemoteRepositoryAdmin() ).setArchivaConfiguration( archivaConfiguration ); - ( (DefaultProxyConnectorAdmin) action.getProxyConnectorAdmin() ).setArchivaConfiguration( archivaConfiguration ); + ( (DefaultProxyConnectorAdmin) action.getProxyConnectorAdmin() ).setArchivaConfiguration( + archivaConfiguration ); } public void testSecureActionBundle() throws Exception { - expectConfigurationRequests( 4 ); + expectConfigurationRequests( 5 ); archivaConfigurationControl.replay(); action.prepare(); @@ -95,7 +95,7 @@ public class ProxyConnectorsActionTest String status = action.execute(); assertEquals( Action.SUCCESS, status ); assertNoErrors( action ); - + assertNotNull( action.getProxyConnectorMap() ); assertNotNull( action.getRepoMap() ); @@ -108,11 +108,8 @@ public class ProxyConnectorsActionTest { Configuration config = createInitialConfiguration(); - for ( int i = 0; i < requestConfigCount; i++ ) - { - archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( config ); - } + archivaConfiguration.getConfiguration(); + archivaConfigurationControl.setReturnValue( config, requestConfigCount + 1 ); archivaConfiguration.save( config ); } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java index ef3491675..ff2f07bc2 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java @@ -26,7 +26,6 @@ import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.web.action.AbstractActionTestCase; import org.codehaus.redback.integration.interceptor.SecureActionBundle; -import org.codehaus.redback.integration.interceptor.SecureActionException; import org.easymock.MockControl; import java.util.Collections; @@ -95,12 +94,12 @@ public class AddRemoteRepositoryActionTest { Configuration configuration = new Configuration(); archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( configuration ); + archivaConfigurationControl.setReturnValue( configuration, 2 ); archivaConfiguration.save( configuration ); archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( configuration ); + archivaConfigurationControl.setReturnValue( configuration, 1 ); archivaConfigurationControl.replay(); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java index d4e87195e..0e3bfdb2b 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java @@ -73,10 +73,7 @@ public class DeleteRemoteRepositoryActionTest Configuration configuration = createConfigurationForEditing( originalRepository ); archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( configuration ); - - archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( configuration ); + archivaConfigurationControl.setReturnValue( configuration, 3, 4 ); archivaConfigurationControl.replay(); @@ -134,7 +131,7 @@ public class DeleteRemoteRepositoryActionTest Configuration configuration = createConfigurationForEditing( originalRepository ); archivaConfiguration.getConfiguration(); - archivaConfigurationControl.setReturnValue( configuration, 2 ); + archivaConfigurationControl.setReturnValue( configuration, 4 ); archivaConfiguration.save( configuration ); archivaConfigurationControl.replay();