]> source.dussan.org Git - archiva.git/commitdiff
avoid writing test files in source tree
authorOlivier Lamy <olamy@apache.org>
Tue, 26 Jun 2012 22:11:31 +0000 (22:11 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 26 Jun 2012 22:11:31 +0000 (22:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1354264 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/pom.xml
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java

index 957f66d4ead71e736b612319b9603b176176f659..5d34a9912e1d536b923d94ad7614c4c586849b56 100644 (file)
             <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
             <basedir>${basedir}</basedir>
             <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
+            <buildDirectory>${project.build.directory}</buildDirectory>
           </systemPropertyVariables>
         </configuration>
       </plugin>
index ad21c86f7fce269c42119aae587fe8cccee0853f..2c0266d2be82150fa71dcc4a73a6491c1c7299a9 100644 (file)
@@ -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 );
index 7b13ccf7a6f30ceaf5b56c72c3c6cb960b53f1bf..8c17ef2526d74721a44eda76de24e4b1904794db 100644 (file)
@@ -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 );
index 3878f4e93b4ece8ce94539e6d1f07e8b733e4c13..1bb9d6679c12c6f3d4a602489abc60a8bb417a79 100644 (file)
@@ -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;
     }