From d7c9b6fc24f40e47ee758fb2d4d32a37ea7dac1f Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 26 Jun 2012 22:11:31 +0000 Subject: [PATCH] avoid writing test files in source tree git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1354264 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva-web/archiva-webapp/pom.xml | 1 + .../AddManagedRepositoryActionTest.java | 6 ++--- .../DeleteManagedRepositoryActionTest.java | 22 +++++++++---------- .../EditManagedRepositoryActionTest.java | 14 ++++++++---- 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index 957f66d4e..5d34a9912 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -906,6 +906,7 @@ ${redbackTestJdbcDriver} ${basedir} ${project.build.directory} + ${project.build.directory} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java index ad21c86f7..2c0266d2b 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java @@ -25,14 +25,14 @@ import org.apache.archiva.admin.repository.DefaultRepositoryCommonValidator; import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.Configuration; +import org.apache.archiva.redback.integration.interceptor.SecureActionBundle; +import org.apache.archiva.redback.integration.interceptor.SecureActionException; import org.apache.archiva.redback.role.RoleManager; import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler; import org.apache.archiva.scheduler.repository.RepositoryTask; import org.apache.archiva.security.common.ArchivaRoleConstants; import org.apache.archiva.web.validator.utils.ValidatorUtil; import org.apache.commons.io.FileUtils; -import org.apache.archiva.redback.integration.interceptor.SecureActionBundle; -import org.apache.archiva.redback.integration.interceptor.SecureActionException; import org.easymock.MockControl; import org.easymock.classextension.MockClassControl; @@ -91,7 +91,7 @@ public class AddManagedRepositoryActionTest repositoryTaskSchedulerControl = MockClassControl.createControl( RepositoryArchivaTaskScheduler.class ); repositoryTaskScheduler = (RepositoryArchivaTaskScheduler) repositoryTaskSchedulerControl.getMock(); - location = new File( "target/test/location" ); + location = new File( System.getProperty( "basedir" ), "target/test/location" ); ( (DefaultManagedRepositoryAdmin) getManagedRepositoryAdmin() ).setArchivaConfiguration( archivaConfiguration ); ( (DefaultManagedRepositoryAdmin) getManagedRepositoryAdmin() ).setRoleManager( roleManager ); ( (DefaultManagedRepositoryAdmin) getManagedRepositoryAdmin() ).setRegistry( registry ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java index 7b13ccf7a..8c17ef252 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java @@ -27,11 +27,6 @@ import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; import org.apache.archiva.audit.AuditEvent; import org.apache.archiva.audit.AuditListener; -import org.apache.archiva.metadata.repository.MetadataRepository; -import org.apache.archiva.metadata.repository.RepositorySession; -import org.apache.archiva.security.common.ArchivaRoleConstants; -import org.apache.archiva.webtest.memory.TestRepositorySessionFactory; -import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.IndeterminateConfigurationException; @@ -39,13 +34,18 @@ import org.apache.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.archiva.configuration.ProxyConnectorConfiguration; import org.apache.archiva.configuration.RemoteRepositoryConfiguration; import org.apache.archiva.configuration.RepositoryGroupConfiguration; -import org.apache.archiva.web.action.AbstractActionTestCase; -import org.apache.archiva.web.action.AuditEventArgumentsMatcher; -import org.apache.archiva.redback.role.RoleManager; -import org.apache.archiva.redback.role.RoleManagerException; +import org.apache.archiva.metadata.repository.MetadataRepository; +import org.apache.archiva.metadata.repository.RepositorySession; +import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager; import org.apache.archiva.redback.components.registry.RegistryException; import org.apache.archiva.redback.integration.interceptor.SecureActionBundle; import org.apache.archiva.redback.integration.interceptor.SecureActionException; +import org.apache.archiva.redback.role.RoleManager; +import org.apache.archiva.redback.role.RoleManagerException; +import org.apache.archiva.security.common.ArchivaRoleConstants; +import org.apache.archiva.web.action.AbstractActionTestCase; +import org.apache.archiva.web.action.AuditEventArgumentsMatcher; +import org.apache.archiva.webtest.memory.TestRepositorySessionFactory; import org.easymock.MockControl; import java.io.File; @@ -103,7 +103,7 @@ public class DeleteManagedRepositoryActionTest roleManagerControl = MockControl.createControl( RoleManager.class ); roleManager = (RoleManager) roleManagerControl.getMock(); //action.setRoleManager( roleManager ); - location = new File( "target/test/location" ); + location = new File( System.getProperty( "basedir" ), "target/test/location" ); repositoryStatisticsManagerControl = MockControl.createControl( RepositoryStatisticsManager.class ); repositoryStatisticsManager = (RepositoryStatisticsManager) repositoryStatisticsManagerControl.getMock(); @@ -185,11 +185,9 @@ public class DeleteManagedRepositoryActionTest stageRepoConfiguration.addManagedRepository( createStagingRepository() ); archivaConfigurationControl.setReturnValue( stageRepoConfiguration ); - archivaConfiguration.getConfiguration(); archivaConfigurationControl.setReturnValue( configuration ); - archivaConfigurationControl.replay(); action.setRepoid( REPO_ID ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java index 3878f4e93..1bb9d6679 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java @@ -31,15 +31,15 @@ import org.apache.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.archiva.metadata.repository.MetadataRepository; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager; +import org.apache.archiva.redback.integration.interceptor.SecureActionBundle; +import org.apache.archiva.redback.integration.interceptor.SecureActionException; +import org.apache.archiva.redback.role.RoleManager; import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler; import org.apache.archiva.scheduler.repository.RepositoryTask; import org.apache.archiva.security.common.ArchivaRoleConstants; import org.apache.archiva.web.validator.utils.ValidatorUtil; import org.apache.archiva.webtest.memory.TestRepositorySessionFactory; import org.apache.commons.io.FileUtils; -import org.apache.archiva.redback.role.RoleManager; -import org.apache.archiva.redback.integration.interceptor.SecureActionBundle; -import org.apache.archiva.redback.integration.interceptor.SecureActionException; import org.easymock.MockControl; import org.easymock.classextension.MockClassControl; @@ -260,11 +260,14 @@ public class EditManagedRepositoryActionTest (RepositoryStatisticsManager) repositoryStatisticsManagerControl.getMock(); ( (DefaultManagedRepositoryAdmin) getManagedRepositoryAdmin() ).setRepositoryStatisticsManager( repositoryStatisticsManager ); - // no deletion + repositoryStatisticsManager.deleteStatistics( metadataRepository , REPO_ID ); + repositoryStatisticsManagerControl.setVoidCallable(); repositoryStatisticsManagerControl.replay(); new File( "target/test/" + REPO_ID + "-stage" ).mkdirs(); + repository.setLocation( System.getProperty( "basedir" ) + "/target/test/" + REPO_ID ); + action.setRepository( repository ); action.setStageNeeded( true ); String status = action.commit(); @@ -588,6 +591,8 @@ public class EditManagedRepositoryActionTest throws IOException { ManagedRepository r = new ManagedRepository(); + r.setLocation( System.getProperty( "basedir" ) + "/target/repo-" + REPO_ID ); + r.setIndexDirectory( System.getProperty( "basedir" ) + "/target/repo-" + REPO_ID + "-index" ); r.setId( REPO_ID ); populateRepository( r ); return r; @@ -598,6 +603,7 @@ public class EditManagedRepositoryActionTest { ManagedRepositoryConfiguration r = new ManagedRepositoryConfiguration(); r.setId( REPO_ID + "-stage" ); + r.setLocation( System.getProperty( "basedir" ) + "/target/" + REPO_ID + "-stage" ); populateStagingRepository( r ); return r; } -- 2.39.5