summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/archiva-base')
-rw-r--r--archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/maven/archiva/converter/artifact/LegacyToDefaultConverterTest.java16
-rw-r--r--archiva-modules/archiva-base/archiva-checksum/pom.xml4
-rw-r--r--archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java24
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java22
-rw-r--r--archiva-modules/archiva-base/archiva-converter/pom.xml4
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java60
-rw-r--r--archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java16
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AbstractRepositoryLayerTestCase.java11
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java3
-rw-r--r--archiva-modules/archiva-base/archiva-transaction/pom.xml4
-rw-r--r--archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/AbstractFileEventTest.java12
-rw-r--r--archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/CopyFileEventTest.java7
-rw-r--r--archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/CreateFileEventTest.java7
13 files changed, 61 insertions, 129 deletions
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/maven/archiva/converter/artifact/LegacyToDefaultConverterTest.java b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/maven/archiva/converter/artifact/LegacyToDefaultConverterTest.java
index b81612d1e..0d0b37b21 100644
--- a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/maven/archiva/converter/artifact/LegacyToDefaultConverterTest.java
+++ b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/maven/archiva/converter/artifact/LegacyToDefaultConverterTest.java
@@ -22,6 +22,7 @@ package org.apache.maven.archiva.converter.artifact;
import junit.framework.TestCase;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.commons.io.FileUtils;
+import org.apache.maven.archiva.common.utils.FileUtil;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
@@ -108,18 +109,7 @@ public class LegacyToDefaultConverterTest
public static File getTestFile( String path )
{
- return new File( getBasedir(), path );
- }
-
- public static String getBasedir()
- {
- String basedir = System.getProperty( "basedir" );
- if ( basedir == null )
- {
- basedir = new File( "" ).getAbsolutePath();
- }
-
- return basedir;
+ return new File( FileUtil.getBasedir(), path );
}
private void copyDirectoryStructure( File sourceDirectory, File destinationDirectory )
@@ -440,7 +430,7 @@ public class LegacyToDefaultConverterTest
Artifact artifact =
createArtifact( "org.apache.maven.plugins", "maven-foo-plugin", "1.0", "1.0", "maven-plugin" );
artifact.setFile(
- new File( getBasedir(), "src/test/source-repository/test/plugins/maven-foo-plugin-1.0.jar" ) );
+ new File( FileUtil.getBasedir(), "src/test/source-repository/test/plugins/maven-foo-plugin-1.0.jar" ) );
artifactConverter.convert( artifact, targetRepository );
// There is a warning but I can't figure out how to look at it. Eyeballing the results it appears
// the plugin is being coverted correctly.
diff --git a/archiva-modules/archiva-base/archiva-checksum/pom.xml b/archiva-modules/archiva-base/archiva-checksum/pom.xml
index 5d7053fea..3faf4fa5f 100644
--- a/archiva-modules/archiva-base/archiva-checksum/pom.xml
+++ b/archiva-modules/archiva-base/archiva-checksum/pom.xml
@@ -41,6 +41,10 @@
<dependencies>
<dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-common</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
diff --git a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java
index 6f75f6944..6f8d285a0 100644
--- a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java
+++ b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java
@@ -22,6 +22,7 @@ package org.apache.archiva.checksum;
import java.io.File;
import junit.framework.TestCase;
+import org.apache.maven.archiva.common.utils.FileUtil;
/**
* AbstractChecksumTestCase
@@ -31,28 +32,9 @@ import junit.framework.TestCase;
public abstract class AbstractChecksumTestCase
extends TestCase
{
- private File basedir;
-
- public File getBasedir()
- {
- if ( basedir == null )
- {
- String sysprop = System.getProperty( "basedir" );
- if ( sysprop != null )
- {
- basedir = new File( sysprop );
- }
- else
- {
- basedir = new File( System.getProperty( "user.dir" ) );
- }
- }
- return basedir;
- }
-
public File getTestOutputDir()
{
- File dir = new File( getBasedir(), "target/test-output/" + getName() );
+ File dir = new File( FileUtil.getBasedir(), "target/test-output/" + getName() );
if ( dir.exists() == false )
{
if ( dir.mkdirs() == false )
@@ -65,7 +47,7 @@ public abstract class AbstractChecksumTestCase
public File getTestResource( String filename )
{
- File dir = new File( getBasedir(), "src/test/resources" );
+ File dir = new File( FileUtil.getBasedir(), "src/test/resources" );
File file = new File( dir, filename );
if ( file.exists() == false )
{
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java
index a167c973d..048544ece 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java
@@ -22,6 +22,7 @@ package org.apache.maven.archiva.configuration;
import junit.framework.TestCase;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.common.utils.FileUtil;
import org.codehaus.plexus.registry.RegistryException;
import org.codehaus.redback.components.springutils.ComponentContainer;
import org.custommonkey.xmlunit.XMLAssert;
@@ -48,20 +49,9 @@ public class ArchivaConfigurationTest
@Inject
private ComponentContainer componentContainer;
- public static String getBasedir()
- {
- String basedir = System.getProperty( "basedir" );
- if ( basedir == null )
- {
- basedir = new File( "" ).getAbsolutePath();
- }
-
- return basedir;
- }
-
public static File getTestFile( String path )
{
- return new File( getBasedir(), path );
+ return new File( FileUtil.getBasedir(), path );
}
/**
@@ -131,19 +121,19 @@ public class ArchivaConfigurationTest
public void testGetConfigurationFromDefaultsWithDefaultRepoLocationAlreadyExisting()
throws Exception
{
- File repo = new File( getBasedir(), "/target/test-classes/existing_snapshots" );
+ File repo = new File( FileUtil.getBasedir(), "/target/test-classes/existing_snapshots" );
repo.mkdirs();
- repo = new File( getBasedir(), "/target/test-classes/existing_internal" );
+ repo = new File( FileUtil.getBasedir(), "/target/test-classes/existing_internal" );
repo.mkdirs();
String existingTestDefaultArchivaConfigFile = FileUtils.readFileToString(
getTestFile( "target/test-classes/org/apache/maven/archiva/configuration/test-default-archiva.xml" ) );
existingTestDefaultArchivaConfigFile =
- StringUtils.replace( existingTestDefaultArchivaConfigFile, "${appserver.base}", getBasedir() );
+ StringUtils.replace( existingTestDefaultArchivaConfigFile, "${appserver.base}", FileUtil.getBasedir() );
File generatedTestDefaultArchivaConfigFile =
- new File( getBasedir(), "target/test-classes/org/apache/maven/archiva/configuration/default-archiva.xml" );
+ new File( FileUtil.getBasedir(), "target/test-classes/org/apache/maven/archiva/configuration/default-archiva.xml" );
FileUtils.writeStringToFile( generatedTestDefaultArchivaConfigFile, existingTestDefaultArchivaConfigFile,
null );
diff --git a/archiva-modules/archiva-base/archiva-converter/pom.xml b/archiva-modules/archiva-base/archiva-converter/pom.xml
index 25b1888e0..8f7dc1e6f 100644
--- a/archiva-modules/archiva-base/archiva-converter/pom.xml
+++ b/archiva-modules/archiva-base/archiva-converter/pom.xml
@@ -49,6 +49,10 @@
<artifactId>archiva-plexus-bridge</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-common</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-i18n</artifactId>
</dependency>
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java
index 687a5fb20..3b1a83da3 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java
@@ -23,6 +23,7 @@ import junit.framework.TestCase;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.commons.io.FileUtils;
import org.apache.maven.archiva.common.utils.ArchivaNexusIndexerUtil;
+import org.apache.maven.archiva.common.utils.FileUtil;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
@@ -100,26 +101,15 @@ public class NexusRepositorySearchTest
config.addManagedRepository( createRepositoryConfig( TEST_REPO_2 ) );
}
- public static String getBasedir()
- {
- String basedir = System.getProperty( "basedir" );
- if ( basedir == null )
- {
- basedir = new File( "" ).getAbsolutePath();
- }
-
- return basedir;
- }
-
private void createSimpleIndex()
throws IOException, UnsupportedExistingLuceneIndexException, IllegalArtifactCoordinateException
{
List<File> files = new ArrayList<File>();
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar" ) );
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar" ) );
createIndex( TEST_REPO_1, files );
@@ -129,19 +119,19 @@ public class NexusRepositorySearchTest
throws IOException, UnsupportedExistingLuceneIndexException, IllegalArtifactCoordinateException
{
List<File> files = new ArrayList<File>();
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ "/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.jar" ) );
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ "/org/apache/archiva/archiva-test/2.0/archiva-test-2.0.jar" ) );
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ "/org/apache/archiva/archiva-webapp/1.0/archiva-webapp-1.0.war" ) );
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ "/com/artifactid-numeric/1.0/artifactid-numeric-1.0.jar" ) );
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ "/com/artifactid-numeric123/1.0/artifactid-numeric123-1.0.jar" ) );
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ "/com/classname-search/1.0/classname-search-1.0.jar" ) );
createIndex( TEST_REPO_1, files );
@@ -151,7 +141,7 @@ public class NexusRepositorySearchTest
{
ManagedRepositoryConfiguration repositoryConfig = new ManagedRepositoryConfiguration();
repositoryConfig.setId( repository );
- repositoryConfig.setLocation( getBasedir() + "/target/test-classes/" + repository );
+ repositoryConfig.setLocation( FileUtil.getBasedir() + "/target/test-classes/" + repository );
repositoryConfig.setLayout( "default" );
repositoryConfig.setName( repository );
repositoryConfig.setScanned( true );
@@ -165,11 +155,11 @@ public class NexusRepositorySearchTest
public void tearDown()
throws Exception
{
- FileUtils.deleteDirectory( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 + "/.indexer" ) );
- assertFalse( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1 + "/.indexer" ).exists() );
+ FileUtils.deleteDirectory( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1 + "/.indexer" ) );
+ assertFalse( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1 + "/.indexer" ).exists() );
- FileUtils.deleteDirectory( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_2 + "/.indexer" ) );
- assertFalse( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_2 + "/.indexer" ).exists() );
+ FileUtils.deleteDirectory( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2 + "/.indexer" ) );
+ assertFalse( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2 + "/.indexer" ).exists() );
super.tearDown();
}
@@ -178,8 +168,8 @@ public class NexusRepositorySearchTest
throws IOException, UnsupportedExistingLuceneIndexException, IllegalArtifactCoordinateException
{
context = new DefaultIndexingContext( repository, repository,
- new File( getBasedir(), "/target/test-classes/" + repository ),
- new File( getBasedir(),
+ new File( FileUtil.getBasedir(), "/target/test-classes/" + repository ),
+ new File( FileUtil.getBasedir(),
"/target/test-classes/" + repository + "/.indexer" ), null,
null, ArchivaNexusIndexerUtil.FULL_INDEX, false );
//indexer.addIndexingContext( repository, repository, new File( getBasedir(), "/target/test-classes/" +
@@ -199,7 +189,7 @@ public class NexusRepositorySearchTest
//indexerEngine.endIndexing( context );
//indexer.removeIndexingContext( context, false );
- assertTrue( new File( getBasedir(), "/target/test-classes/" + repository + "/.indexer" ).exists() );
+ assertTrue( new File( FileUtil.getBasedir(), "/target/test-classes/" + repository + "/.indexer" ).exists() );
}
@Test
@@ -319,9 +309,9 @@ public class NexusRepositorySearchTest
createSimpleIndex();
List<File> files = new ArrayList<File>();
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_2
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_2
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2
+ "/org/apache/archiva/archiva-search/1.1/archiva-search-1.1.jar" ) );
createIndex( TEST_REPO_2, files );
@@ -447,9 +437,9 @@ public class NexusRepositorySearchTest
throws Exception
{
List<File> files = new ArrayList<File>();
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_2
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2
+ "/org/apache/archiva/archiva-search/1.0/archiva-search-1.0.jar" ) );
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_2
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_2
+ "/org/apache/archiva/archiva-search/1.1/archiva-search-1.1.jar" ) );
createIndex( TEST_REPO_2, files );
@@ -533,9 +523,9 @@ public class NexusRepositorySearchTest
throws Exception
{
List<File> files = new ArrayList<File>();
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ "/com/artifactid-numeric/1.0/artifactid-numeric-1.0.jar" ) );
- files.add( new File( getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ files.add( new File( FileUtil.getBasedir(), "/target/test-classes/" + TEST_REPO_1
+ "/com/artifactid-numeric123/1.0/artifactid-numeric123-1.0.jar" ) );
createIndex( TEST_REPO_1, files );
diff --git a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java
index 7d7448862..e2a3aa92e 100644
--- a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java
+++ b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java
@@ -21,6 +21,7 @@ package org.apache.maven.archiva.policies;
import junit.framework.TestCase;
import org.apache.commons.io.FileUtils;
+import org.apache.maven.archiva.common.utils.FileUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
@@ -357,22 +358,9 @@ public class ChecksumPolicyTest
return localFile;
}
-
-
- public static String getBasedir()
- {
- String basedir = System.getProperty( "basedir" );
- if ( basedir == null )
- {
- basedir = new File( "" ).getAbsolutePath();
- }
-
- return basedir;
- }
-
public static File getTestFile( String path )
{
- return new File( getBasedir(), path );
+ return new File( FileUtil.getBasedir(), path );
}
}
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AbstractRepositoryLayerTestCase.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AbstractRepositoryLayerTestCase.java
index 9ed7d5e7c..7697905b7 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AbstractRepositoryLayerTestCase.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/AbstractRepositoryLayerTestCase.java
@@ -41,17 +41,6 @@ public abstract class AbstractRepositoryLayerTestCase
extends TestCase
{
- public static String getBasedir()
- {
- String basedir = System.getProperty( "basedir" );
- if ( basedir == null )
- {
- basedir = new File( "" ).getAbsolutePath();
- }
-
- return basedir;
- }
-
@Inject
protected ApplicationContext applicationContext;
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java
index 894ec85d4..5ac2583ea 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java
@@ -20,6 +20,7 @@ package org.apache.maven.archiva.repository.content;
*/
import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.common.utils.FileUtil;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
@@ -369,7 +370,7 @@ public class RepositoryRequestTest
private ManagedRepositoryContent createManagedRepo( String layout )
throws Exception
{
- File repoRoot = new File( getBasedir() + "/target/test-repo" );
+ File repoRoot = new File( FileUtil.getBasedir() + "/target/test-repo" );
return createManagedRepositoryContent( "test-internal", "Internal Test Repo", repoRoot, layout );
}
diff --git a/archiva-modules/archiva-base/archiva-transaction/pom.xml b/archiva-modules/archiva-base/archiva-transaction/pom.xml
index 2de639c52..193b4c19f 100644
--- a/archiva-modules/archiva-base/archiva-transaction/pom.xml
+++ b/archiva-modules/archiva-base/archiva-transaction/pom.xml
@@ -29,6 +29,10 @@
<description>API for managing transaction.</description>
<dependencies>
<dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-common</artifactId>
+ </dependency>
+ <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
diff --git a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/AbstractFileEventTest.java b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/AbstractFileEventTest.java
index f25f0488e..c860a6852 100644
--- a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/AbstractFileEventTest.java
+++ b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/AbstractFileEventTest.java
@@ -38,18 +38,6 @@ public abstract class AbstractFileEventTest
{
protected List<Digester> digesters;
- public static String getBasedir()
- {
-
- String basedir = System.getProperty( "basedir" );
- if (basedir == null)
- {
- basedir = new File( "" ).getAbsolutePath();
- }
- return basedir;
-
- }
-
@SuppressWarnings( "unchecked" )
public void setUp()
throws Exception
diff --git a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/CopyFileEventTest.java b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/CopyFileEventTest.java
index 001213320..4d9c86c60 100644
--- a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/CopyFileEventTest.java
+++ b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/CopyFileEventTest.java
@@ -20,6 +20,7 @@ package org.apache.maven.archiva.transaction;
*/
import org.apache.commons.io.FileUtils;
+import org.apache.maven.archiva.common.utils.FileUtil;
import java.io.File;
import java.io.IOException;
@@ -29,11 +30,11 @@ import java.io.IOException;
public class CopyFileEventTest
extends AbstractFileEventTest
{
- private File testDir = new File( getBasedir(), "target/transaction-tests/copy-file" );
+ private File testDir = new File( FileUtil.getBasedir(), "target/transaction-tests/copy-file" );
private File testDest = new File( testDir, "test-file.txt" );
- private File testSource = new File( getBasedir(), "target/transaction-tests/test-file.txt" );
+ private File testSource = new File( FileUtil.getBasedir(), "target/transaction-tests/test-file.txt" );
private File testDestChecksum;
@@ -152,7 +153,7 @@ public class CopyFileEventTest
{
super.tearDown();
- FileUtils.deleteDirectory( new File( getBasedir(), "target/transaction-tests" ) );
+ FileUtils.deleteDirectory( new File( FileUtil.getBasedir(), "target/transaction-tests" ) );
}
protected void assertChecksumCommit( File file )
diff --git a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/CreateFileEventTest.java b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/CreateFileEventTest.java
index 467ffc9e3..263ff9fe4 100644
--- a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/CreateFileEventTest.java
+++ b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/maven/archiva/transaction/CreateFileEventTest.java
@@ -22,13 +22,14 @@ package org.apache.maven.archiva.transaction;
import java.io.File;
import org.apache.commons.io.FileUtils;
+import org.apache.maven.archiva.common.utils.FileUtil;
/**
*/
public class CreateFileEventTest
extends AbstractFileEventTest
{
- private File testDir = new File( getBasedir(), "target/transaction-tests/create-file" );
+ private File testDir = new File( FileUtil.getBasedir(), "target/transaction-tests/create-file" );
public void testCreateCommitRollback()
throws Exception
@@ -52,7 +53,7 @@ public class CreateFileEventTest
assertChecksumRollback( testFile );
assertFalse( "Test file parent directories has been rolledback too", testDir.exists() );
- assertTrue( "target directory still exists", new File( getBasedir(), "target" ).exists() );
+ assertTrue( "target directory still exists", new File( FileUtil.getBasedir(), "target" ).exists() );
}
public void testCreateCommitRollbackWithBackup()
@@ -114,6 +115,6 @@ public class CreateFileEventTest
{
super.tearDown();
- FileUtils.deleteDirectory( new File( getBasedir(), "target/transaction-tests" ) );
+ FileUtils.deleteDirectory( new File( FileUtil.getBasedir(), "target/transaction-tests" ) );
}
}