From: Olivier Lamy Date: Wed, 25 Jan 2012 00:21:45 +0000 (+0000) Subject: avoid writing tmp files to sources tree X-Git-Tag: archiva-1.4-M3~1474 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=39cd325287835e4b64600adf8ca46ffa89d17193;p=archiva.git avoid writing tmp files to sources tree git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1235569 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index d4e368c13..184c84648 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -845,6 +845,7 @@ ${redbackTestJdbcUrl} ${redbackTestJdbcDriver} ${basedir} + ${project.build.directory} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java index 2210ef8e7..19d562cd0 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java @@ -29,14 +29,17 @@ import org.apache.archiva.rest.api.services.ProxyConnectorService; import org.apache.archiva.rest.api.services.RepositoriesService; import org.apache.archiva.rest.api.services.RepositoryGroupService; import org.apache.archiva.rest.api.services.SearchService; +import org.apache.commons.io.FileUtils; import org.codehaus.redback.integration.security.role.RedbackRoleConstants; import org.codehaus.redback.rest.services.FakeCreateAdminService; +import org.junit.After; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; +import java.io.File; import java.util.Arrays; import java.util.List; @@ -66,16 +69,34 @@ public class DownloadMergedIndexTest return "classpath*:META-INF/spring-context.xml classpath*:spring-context-merge-index-download.xml"; } + @After + public void cleanup() + throws Exception + { + super.tearDown(); + File tmpIndexDir = new File( System.getProperty( "java.io.tmpdir" ) + "/tmpIndex" ); + if ( tmpIndexDir.exists() ) + { + FileUtils.deleteDirectory( tmpIndexDir ); + } + } + + @Test public void downloadMergedIndex() throws Exception { + File tmpIndexDir = new File( System.getProperty( "java.io.tmpdir" ) + "/tmpIndex" ); + if ( tmpIndexDir.exists() ) + { + FileUtils.deleteDirectory( tmpIndexDir ); + } String id = Long.toString( System.currentTimeMillis() ); ManagedRepository managedRepository = new ManagedRepository(); managedRepository.setId( id ); managedRepository.setName( "name of " + id ); managedRepository.setLocation( "src/test/repositories/test-repo" ); - managedRepository.setIndexDirectory( System.getProperty( "java.io.tmpdir" ) + "/target/tmpIndex/" + id ); + managedRepository.setIndexDirectory( System.getProperty( "java.io.tmpdir" ) + "/tmpIndex/" + id ); ManagedRepositoriesService managedRepositoriesService = getManagedRepositoriesService(); @@ -112,7 +133,7 @@ public class DownloadMergedIndexTest managedRepository.setId( id ); managedRepository.setName( "name of " + id ); managedRepository.setLocation( "src/test/repositories/test-repo" ); - managedRepository.setIndexDirectory( System.getProperty( "java.io.tmpdir" ) + "/target/tmpIndex/" + id ); + managedRepository.setIndexDirectory( System.getProperty( "java.io.tmpdir" ) + "/tmpIndex/" + id ); if ( managedRepositoriesService.getManagedRepository( id ) != null ) {