diff options
author | Olivier Lamy <olamy@apache.org> | 2012-07-02 07:36:23 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-07-02 07:36:23 +0000 |
commit | 1484a3316addf47d88f4f05191ae4e570871eda7 (patch) | |
tree | 596b70b3f0975c00274bc3d2b2580092cc1390f5 /archiva-modules/archiva-base/archiva-transaction | |
parent | e3885c59da2e4748e2ba494f3901902be0470067 (diff) | |
download | archiva-1484a3316addf47d88f4f05191ae4e570871eda7.tar.gz archiva-1484a3316addf47d88f4f05191ae4e570871eda7.zip |
[MRM-1638] Improve unit test for archiva build
Based on patch provided by Eric Barboni.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1356091 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base/archiva-transaction')
4 files changed, 31 insertions, 5 deletions
diff --git a/archiva-modules/archiva-base/archiva-transaction/pom.xml b/archiva-modules/archiva-base/archiva-transaction/pom.xml index 18d6024dc..7ea8aefa0 100644 --- a/archiva-modules/archiva-base/archiva-transaction/pom.xml +++ b/archiva-modules/archiva-base/archiva-transaction/pom.xml @@ -52,8 +52,9 @@ <artifactId>plexus-utils</artifactId> </dependency> <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-testutil</artifactId> + <version>${project.version}</version> <scope>test</scope> </dependency> <dependency> diff --git a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/AbstractFileEventTest.java b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/AbstractFileEventTest.java index 13ed7327d..4e7c09316 100644 --- a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/AbstractFileEventTest.java +++ b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/AbstractFileEventTest.java @@ -29,16 +29,22 @@ import java.io.File; import java.io.IOException; import java.util.Arrays; import java.util.List; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; +import org.junit.Before; +import org.junit.runner.RunWith; /** * @version $Id$ */ +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public abstract class AbstractFileEventTest extends TestCase { protected List<Digester> digesters; @SuppressWarnings( "unchecked" ) + @Before + @Override public void setUp() throws Exception { diff --git a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java index d832ec40c..360f64df8 100644 --- a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java +++ b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java @@ -24,6 +24,9 @@ import org.apache.archiva.common.utils.FileUtil; import java.io.File; import java.io.IOException; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; /** */ @@ -40,6 +43,8 @@ public class CopyFileEventTest private String source, oldChecksum; + @Override + @Before public void setUp() throws Exception { @@ -67,7 +72,8 @@ public class CopyFileEventTest oldChecksum = readFile( testDestChecksum ); } - + + @Test public void testCopyCommitRollback() throws Exception { @@ -92,6 +98,7 @@ public class CopyFileEventTest assertChecksumRollback( testDest ); } + @Test public void testCopyCommitRollbackWithBackup() throws Exception { @@ -126,6 +133,7 @@ public class CopyFileEventTest assertChecksumRollback( testDest ); } + @Test public void testCreateRollbackCommit() throws Exception { @@ -148,7 +156,9 @@ public class CopyFileEventTest assertTrue( "Test that the destination contents are copied correctly", source.equals( target ) ); } - protected void tearDown() + @After + @Override + public void tearDown() throws Exception { super.tearDown(); @@ -156,6 +166,7 @@ public class CopyFileEventTest FileUtils.deleteDirectory( new File( FileUtil.getBasedir(), "target/transaction-tests" ) ); } + @Override protected void assertChecksumCommit( File file ) throws IOException { @@ -166,6 +177,7 @@ public class CopyFileEventTest assertFalse( "Test that the destination checksum contents are created correctly", oldChecksum.equals( target ) ); } + @Override protected void assertChecksumRollback( File file ) throws IOException { diff --git a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java index 9d23fe9ae..42b2f6245 100644 --- a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java +++ b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java @@ -23,6 +23,8 @@ import java.io.File; import org.apache.commons.io.FileUtils; import org.apache.archiva.common.utils.FileUtil; +import org.junit.After; +import org.junit.Test; /** */ @@ -31,6 +33,7 @@ public class CreateFileEventTest { private File testDir = new File( FileUtil.getBasedir(), "target/transaction-tests/create-file" ); + @Test public void testCreateCommitRollback() throws Exception { @@ -56,6 +59,7 @@ public class CreateFileEventTest assertTrue( "target directory still exists", new File( FileUtil.getBasedir(), "target" ).exists() ); } + @Test public void testCreateCommitRollbackWithBackup() throws Exception { @@ -90,6 +94,7 @@ public class CreateFileEventTest assertChecksumRollback( testFile ); } + @Test public void testCreateRollbackCommit() throws Exception { @@ -110,7 +115,9 @@ public class CreateFileEventTest assertChecksumCommit( testFile ); } - protected void tearDown() + @Override + @After + public void tearDown() throws Exception { super.tearDown(); |