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 | |
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')
59 files changed, 240 insertions, 111 deletions
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml index e9b210646..edc637b51 100644 --- a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml +++ b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml @@ -76,8 +76,9 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-testutil</artifactId> + <version>${project.version}</version> <scope>test</scope> </dependency> </dependencies> diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java index 5b8a6dd24..b6636f6a4 100644 --- a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java +++ b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java @@ -36,7 +36,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import java.io.File; @@ -47,13 +46,14 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.regex.Matcher; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; /** * LegacyToDefaultConverterTest * * @version $Id$ */ -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public class LegacyToDefaultConverterTest extends TestCase diff --git a/archiva-modules/archiva-base/archiva-checksum/pom.xml b/archiva-modules/archiva-base/archiva-checksum/pom.xml index 015cb5d0f..27f90135f 100644 --- a/archiva-modules/archiva-base/archiva-checksum/pom.xml +++ b/archiva-modules/archiva-base/archiva-checksum/pom.xml @@ -38,10 +38,11 @@ <artifactId>slf4j-api</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> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> 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 812cc708b..5455fcb9f 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 @@ -19,16 +19,19 @@ package org.apache.archiva.checksum; * under the License. */ -import java.io.File; - import junit.framework.TestCase; import org.apache.archiva.common.utils.FileUtil; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; +import org.junit.runner.RunWith; + +import java.io.File; /** * AbstractChecksumTestCase * * @version $Id$ */ +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public abstract class AbstractChecksumTestCase extends TestCase { diff --git a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumAlgorithmTest.java b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumAlgorithmTest.java index 7f37469b1..dabff4d62 100644 --- a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumAlgorithmTest.java +++ b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumAlgorithmTest.java @@ -22,27 +22,34 @@ package org.apache.archiva.checksum; import java.io.File; import junit.framework.TestCase; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; +import org.junit.Test; +import org.junit.runner.RunWith; /** * ChecksumAlgorithmTest * * @version $Id$ */ +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class ChecksumAlgorithmTest extends TestCase { + @Test public void testGetHashByExtensionSha1() { assertEquals( ChecksumAlgorithm.SHA1, ChecksumAlgorithm.getByExtension( new File( "something.jar.sha1" ) ) ); assertEquals( ChecksumAlgorithm.SHA1, ChecksumAlgorithm.getByExtension( new File( "OTHER.JAR.SHA1" ) ) ); } - + + @Test public void testGetHashByExtensionMd5() { assertEquals( ChecksumAlgorithm.MD5, ChecksumAlgorithm.getByExtension( new File( "something.jar.md5" ) ) ); assertEquals( ChecksumAlgorithm.MD5, ChecksumAlgorithm.getByExtension( new File( "OTHER.JAR.MD5" ) ) ); } + @Test public void testGetHashByExtensionInvalid() { try diff --git a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumTest.java b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumTest.java index 4cfcc8dd2..40f95a56b 100644 --- a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumTest.java +++ b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumTest.java @@ -23,6 +23,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import org.junit.Test; /** * ChecksumTest @@ -34,6 +35,7 @@ public class ChecksumTest { private static final String UNSET_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709"; + @Test public void testConstructSha1() { Checksum checksum = new Checksum( ChecksumAlgorithm.SHA1 ); @@ -41,6 +43,7 @@ public class ChecksumTest .getAlgorithm() ); } + @Test public void testConstructMd5() { Checksum checksum = new Checksum( ChecksumAlgorithm.MD5 ); @@ -48,6 +51,7 @@ public class ChecksumTest .getAlgorithm() ); } + @Test public void testUpdate() { Checksum checksum = new Checksum( ChecksumAlgorithm.SHA1 ); @@ -57,6 +61,7 @@ public class ChecksumTest assertEquals( "Checksum", "e396119ae0542e85a74759602fd2f81e5d36d762", checksum.getChecksum() ); } + @Test public void testUpdateMany() throws IOException { @@ -76,6 +81,7 @@ public class ChecksumTest assertEquals( "Checksum MD5", "21c2c5ca87ec018adacb2e2fb3432219", checksumMd5.getChecksum() ); } + @Test public void testUpdateWholeUpdatePartial() { Checksum checksum = new Checksum( ChecksumAlgorithm.SHA1 ); diff --git a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksummedFileTest.java b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksummedFileTest.java index 5ca089087..e4122d93a 100644 --- a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksummedFileTest.java +++ b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksummedFileTest.java @@ -24,12 +24,14 @@ import java.io.IOException; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; +import org.junit.Test; /** * ChecksummedFileTest * * @version $Id$ */ + public class ChecksummedFileTest extends AbstractChecksumTestCase { @@ -75,6 +77,7 @@ public class ChecksummedFileTest return jarFile; } + @Test public void testCalculateChecksumMd5() throws IOException { @@ -85,6 +88,7 @@ public class ChecksummedFileTest assertEquals( expectedChecksum, actualChecksum ); } + @Test public void testCalculateChecksumSha1() throws IOException { @@ -95,6 +99,7 @@ public class ChecksummedFileTest assertEquals( expectedChecksum, actualChecksum ); } + @Test public void testCreateChecksum() throws IOException { @@ -108,6 +113,7 @@ public class ChecksummedFileTest assertEquals( "2bb14b388973351b0a4dfe11d171965f59cc61a1 redback-authz-open.jar", hashContents ); } + @Test public void testFixChecksum() throws IOException { @@ -126,12 +132,14 @@ public class ChecksummedFileTest assertTrue( "ChecksummedFile.isValid(SHA1) == true", checksummedFile.isValidChecksum( ChecksumAlgorithm.SHA1 ) ); } + @Test public void testGetChecksumFile() { ChecksummedFile checksummedFile = new ChecksummedFile( new File( "test.jar" ) ); assertEquals( "test.jar.sha1", checksummedFile.getChecksumFile( ChecksumAlgorithm.SHA1 ).getName() ); } + @Test public void testIsValidChecksum() throws IOException { @@ -141,6 +149,7 @@ public class ChecksummedFileTest assertTrue( "ChecksummedFile.isValid(SHA1)", checksummedFile.isValidChecksum( ChecksumAlgorithm.SHA1 ) ); } + @Test public void testIsValidChecksumInvalidSha1Format() throws IOException { @@ -155,6 +164,7 @@ public class ChecksummedFileTest } + @Test public void testIsValidChecksumNoChecksumFiles() throws IOException { @@ -167,6 +177,7 @@ public class ChecksummedFileTest } + @Test public void testIsValidChecksumSha1AndMd5() throws IOException { @@ -178,6 +189,7 @@ public class ChecksummedFileTest ChecksumAlgorithm.MD5 } ) ); } + @Test public void testIsValidChecksumSha1NoMd5() throws IOException { @@ -190,6 +202,7 @@ public class ChecksummedFileTest } + @Test public void testParseChecksum() throws IOException { @@ -204,6 +217,7 @@ public class ChecksummedFileTest } + @Test public void testParseChecksumAltDash1() throws IOException { @@ -215,6 +229,7 @@ public class ChecksummedFileTest assertEquals( "Checksum doesn't match", SERVLETAPI_SHA1, s ); } + @Test public void testParseChecksumAltDash2() throws IOException { @@ -226,6 +241,7 @@ public class ChecksummedFileTest assertEquals( "Checksum doesn't match", SERVLETAPI_SHA1, s ); } + @Test public void testRemoteMetadataChecksumFilePathSha1() throws IOException { @@ -246,6 +262,7 @@ public class ChecksummedFileTest } } + @Test public void testRemoteMetadataChecksumFilePathMd5() throws IOException { diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml index d1ce97ce8..b44c303aa 100644 --- a/archiva-modules/archiva-base/archiva-configuration/pom.xml +++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml @@ -103,20 +103,11 @@ <artifactId>archiva-policies</artifactId> </dependency> <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>xmlunit</groupId> - <artifactId>xmlunit</artifactId> - <scope>test</scope> - </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> </dependencies> <build> <plugins> diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java index 493c6528b..3ab407a68 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java @@ -32,17 +32,18 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + import javax.inject.Inject; import java.io.File; import java.util.List; import java.util.Map; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; /** * Test the configuration store. */ -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public class ArchivaConfigurationTest extends TestCase diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ConfigurationTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ConfigurationTest.java index ace63c3be..f84e9bac3 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ConfigurationTest.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ConfigurationTest.java @@ -22,16 +22,16 @@ package org.apache.archiva.configuration; import junit.framework.TestCase; import org.junit.Test; import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; import java.util.Arrays; import java.util.HashSet; import java.util.Map; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; /** * Test the generated Configuration class from Modello. This is primarily to test the hand coded methods. */ -@RunWith( JUnit4.class ) +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class ConfigurationTest extends TestCase { diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/FileTypesTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/FileTypesTest.java index 4689a1774..3319b7210 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/FileTypesTest.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/FileTypesTest.java @@ -23,11 +23,11 @@ import junit.framework.TestCase; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } ) public class FileTypesTest extends TestCase diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/LegacyArtifactPathTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/LegacyArtifactPathTest.java index 6c2d1422a..bca0295c9 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/LegacyArtifactPathTest.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/LegacyArtifactPathTest.java @@ -20,16 +20,16 @@ package org.apache.archiva.configuration; */ import junit.framework.TestCase; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; import org.junit.Test; import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; /** * Test the generated LegacyArtifactPath class from Modello. This is primarily to test the hand coded methods. * * @since 1.1 */ -@RunWith( JUnit4.class ) +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class LegacyArtifactPathTest extends TestCase { diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/MavenProxyPropertyLoaderTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/MavenProxyPropertyLoaderTest.java index 08a4b22df..65711773b 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/MavenProxyPropertyLoaderTest.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/MavenProxyPropertyLoaderTest.java @@ -30,10 +30,11 @@ import java.io.FileInputStream; import java.io.IOException; import java.util.Map; import java.util.Properties; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; /** */ -@RunWith( JUnit4.class ) +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class MavenProxyPropertyLoaderTest extends TestCase { diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java index 5eb3ab857..01ee311f5 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java @@ -26,15 +26,20 @@ import org.apache.commons.lang.StringUtils; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; +import org.junit.Test; +import org.junit.runner.RunWith; /** * ProxyConnectorConfigurationOrderComparatorTest * * @version $Id$ */ +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class ProxyConnectorConfigurationOrderComparatorTest extends TestCase { + @Test public void testSortOfAllZeros() { List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>(); @@ -49,6 +54,7 @@ public class ProxyConnectorConfigurationOrderComparatorTest assertProxyOrder( new String[]{ "corporate", "snapshots", "3rdparty", "sandbox" }, proxies ); } + @Test public void testSortNormal() { List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>(); @@ -63,6 +69,7 @@ public class ProxyConnectorConfigurationOrderComparatorTest assertProxyOrder( new String[]{ "snapshots", "3rdparty", "corporate", "sandbox" }, proxies ); } + @Test public void testSortPartial() { List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>(); diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java index 901e2272a..73f931d1a 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java @@ -24,13 +24,18 @@ import org.apache.archiva.configuration.AbstractRepositoryConfiguration; import org.apache.archiva.configuration.ManagedRepositoryConfiguration; import java.util.Comparator; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; +import org.junit.Test; +import org.junit.runner.RunWith; /** * Test the repositry comparator. */ +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class RepositoryConfigurationComparatorTest extends TestCase { + @Test public void testComparator() { Comparator<AbstractRepositoryConfiguration> comparator = new RepositoryConfigurationComparator(); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml index 0add9a295..b8165f315 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml @@ -67,8 +67,9 @@ <!-- test dependencies --> <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-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java index 90582b761..2da60bc67 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java @@ -35,12 +35,12 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import java.io.File; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public abstract class AbstractArtifactConsumerTest extends TestCase diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java index dfda5f5cc..3660915d8 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java @@ -21,10 +21,7 @@ package org.apache.archiva.consumers.core.repository; import junit.framework.TestCase; import org.apache.archiva.admin.model.beans.ManagedRepository; -import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; -import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; -import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.metadata.repository.MetadataRepository; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.repository.ManagedRepositoryContent; @@ -39,18 +36,17 @@ import org.junit.Before; import org.junit.runner.RunWith; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import java.io.File; -import java.io.IOException; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** */ -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public abstract class AbstractRepositoryPurgeTest extends TestCase diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml index 6ee974fbb..19e7e0d22 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml @@ -74,8 +74,9 @@ <artifactId>archiva-repository-admin-api</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-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java index ef4804b2f..edbc2ec30 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java @@ -36,7 +36,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import java.io.File; @@ -46,11 +45,12 @@ import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; /** * NexusIndexerConsumerTest */ -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } ) public class NexusIndexerConsumerTest extends TestCase diff --git a/archiva-modules/archiva-base/archiva-converter/pom.xml b/archiva-modules/archiva-base/archiva-converter/pom.xml index fed333129..77b522e7e 100644 --- a/archiva-modules/archiva-base/archiva-converter/pom.xml +++ b/archiva-modules/archiva-base/archiva-converter/pom.xml @@ -68,10 +68,11 @@ <scope>provided</scope> </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> </dependencies> <build> <plugins> diff --git a/archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/archiva/converter/RepositoryConverterTest.java b/archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/archiva/converter/RepositoryConverterTest.java index 68fafb4fc..e2994c749 100644 --- a/archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/archiva/converter/RepositoryConverterTest.java +++ b/archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/archiva/converter/RepositoryConverterTest.java @@ -31,7 +31,6 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import javax.inject.Named; @@ -39,6 +38,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; /** * Test the repository converter. @@ -48,7 +48,7 @@ import java.util.List; * @todo should reject if dependencies are missing - rely on reporting? * @todo group metadata */ -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml","classpath:/spring-context.xml"} ) public class RepositoryConverterTest extends TestCase diff --git a/archiva-modules/archiva-base/archiva-indexer/pom.xml b/archiva-modules/archiva-base/archiva-indexer/pom.xml index 134b1925c..6752ca2dd 100644 --- a/archiva-modules/archiva-base/archiva-indexer/pom.xml +++ b/archiva-modules/archiva-base/archiva-indexer/pom.xml @@ -113,8 +113,9 @@ <scope>test</scope> </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-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java index 0e21d5d88..eaf5cac5e 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java @@ -48,11 +48,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import java.io.File; import java.util.List; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; /** * @author Olivier Lamy */ -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public abstract class AbstractNexusRepositorySearch extends TestCase diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java index ed33539eb..16024d9a3 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java @@ -22,14 +22,14 @@ import junit.framework.TestCase; import org.apache.archiva.indexer.util.SearchUtil; import org.junit.Test; import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; import java.util.Arrays; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; /** * @author Olivier Lamy */ -@RunWith( JUnit4.class ) +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class NexusRepositorySearchPaginateTest extends TestCase { 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 cf66e7915..59bf24b25 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 @@ -24,16 +24,16 @@ import org.apache.archiva.indexer.util.SearchUtil; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public class NexusRepositorySearchTest extends AbstractNexusRepositorySearch diff --git a/archiva-modules/archiva-base/archiva-model/pom.xml b/archiva-modules/archiva-base/archiva-model/pom.xml index bc28daf6e..c008802f4 100755 --- a/archiva-modules/archiva-base/archiva-model/pom.xml +++ b/archiva-modules/archiva-base/archiva-model/pom.xml @@ -42,8 +42,9 @@ <artifactId>archiva-common</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-model/src/test/java/org/apache/archiva/model/RepositoryURLTest.java b/archiva-modules/archiva-base/archiva-model/src/test/java/org/apache/archiva/model/RepositoryURLTest.java index e239a178b..6ed556c2e 100644 --- a/archiva-modules/archiva-base/archiva-model/src/test/java/org/apache/archiva/model/RepositoryURLTest.java +++ b/archiva-modules/archiva-base/archiva-model/src/test/java/org/apache/archiva/model/RepositoryURLTest.java @@ -20,12 +20,16 @@ package org.apache.archiva.model; */ import junit.framework.TestCase; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; +import org.junit.Test; +import org.junit.runner.RunWith; /** * RepositoryURLTest * * @version $Id$ */ +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class RepositoryURLTest extends TestCase { @@ -49,43 +53,51 @@ public class RepositoryURLTest assertEquals( "Password", expectedPassword, rurl.getPassword() ); } + @Test public void testFileUrlNormal() { assertURL( "file:///home/joakim/code/test/this/", "file", NO_HOST, NO_PORT, "/home/joakim/code/test/this/", NO_USER, NO_PASS ); } + @Test public void testFileUrlShort() { assertURL( "file:/home/joakim/code/test/this/", "file", NO_HOST, NO_PORT, "/home/joakim/code/test/this/", NO_USER, NO_PASS ); } + @Test public void testHttpUrlPathless() { assertURL( "http://machine", "http", "machine", NO_PORT, "/", NO_USER, NO_PASS ); } + @Test public void testHttpUrlWithPort() { assertURL( "http://machine:8080/", "http", "machine", "8080", "/", NO_USER, NO_PASS ); } + @Test public void testHttpUrlWithUsernamePassword() { assertURL( "http://user:pass@machine/secured/", "http", "machine", NO_PORT, "/secured/", "user", "pass" ); } + @Test public void testHttpUrlWithUsernameNoPassword() { assertURL( "http://user@machine/secured/", "http", "machine", NO_PORT, "/secured/", "user", NO_PASS ); } + @Test public void testHttpUrlWithUsernamePasswordAndPort() { assertURL( "http://user:pass@machine:9090/secured/", "http", "machine", "9090", "/secured/", "user", "pass" ); } + @Test public void testBogusWithPath() { // This should not fail. The intent of RepositoryURL is to have it support oddball protocols that diff --git a/archiva-modules/archiva-base/archiva-policies/pom.xml b/archiva-modules/archiva-base/archiva-policies/pom.xml index c604832a7..5c756a089 100644 --- a/archiva-modules/archiva-base/archiva-policies/pom.xml +++ b/archiva-modules/archiva-base/archiva-policies/pom.xml @@ -81,10 +81,11 @@ </exclusions> </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> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> diff --git a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/CachedFailuresPolicyTest.java b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/CachedFailuresPolicyTest.java index 2fd8d24cb..c322e2357 100644 --- a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/CachedFailuresPolicyTest.java +++ b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/CachedFailuresPolicyTest.java @@ -24,19 +24,19 @@ import org.apache.archiva.policies.urlcache.UrlFailureCache; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import javax.inject.Named; import java.io.File; import java.util.Properties; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; /** * CachedFailuresPolicyTest * * @version $Id$ */ -@RunWith( value = SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } ) public class CachedFailuresPolicyTest extends TestCase diff --git a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ChecksumPolicyTest.java b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ChecksumPolicyTest.java index 67dc2cd8a..62d7ae92f 100644 --- a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ChecksumPolicyTest.java +++ b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ChecksumPolicyTest.java @@ -26,7 +26,6 @@ import org.junit.Test; import org.junit.rules.TestName; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.io.BufferedReader; import java.io.File; @@ -34,6 +33,7 @@ import java.io.FileReader; import java.util.Properties; import javax.inject.Inject; import javax.inject.Named; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; import static org.junit.Assert.*; @@ -42,7 +42,7 @@ import static org.junit.Assert.*; * * @version $Id$ */ -@RunWith( value = SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml"} ) public class ChecksumPolicyTest { diff --git a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ReleasePolicyTest.java b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ReleasePolicyTest.java index d99d216d9..35a7555ee 100644 --- a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ReleasePolicyTest.java +++ b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ReleasePolicyTest.java @@ -25,19 +25,19 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import javax.inject.Named; import java.io.File; import java.util.Properties; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; /** * ReleasePolicyTest * * @version $Id$ */ -@RunWith( value = SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } ) public class ReleasePolicyTest extends TestCase diff --git a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/SnapshotsPolicyTest.java b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/SnapshotsPolicyTest.java index 4567874d9..6fe09dbf0 100644 --- a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/SnapshotsPolicyTest.java +++ b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/SnapshotsPolicyTest.java @@ -25,19 +25,19 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import javax.inject.Named; import java.io.File; import java.util.Properties; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; /** * SnapshotsPolicyTest * * @version $Id$ */ -@RunWith( value = SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } ) public class SnapshotsPolicyTest extends TestCase diff --git a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml index 454b3be1c..1fe13a205 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml @@ -62,10 +62,11 @@ <artifactId>commons-logging-api</artifactId> </dependency> <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-testutil</artifactId> + <version>${project.version}</version> <scope>test</scope> - </dependency> + </dependency> </dependencies> <build> <plugins> diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java b/archiva-modules/archiva-base/archiva-proxy-common/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java index 85dc8d2ca..66d7afd9e 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java +++ b/archiva-modules/archiva-base/archiva-proxy-common/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java @@ -24,15 +24,15 @@ import org.apache.maven.wagon.Wagon; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; /** * Test the WagonFactory works through Spring to be bound into the RepositoryProxyConnectors implementation. * */ -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } ) public class WagonFactoryTest extends TestCase diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml index 5768ccd9c..394034c6f 100644 --- a/archiva-modules/archiva-base/archiva-proxy/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml @@ -129,10 +129,11 @@ <scope>provided</scope> </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> <dependency> <groupId>org.apache.archiva</groupId> <artifactId>archiva-repository-admin-default</artifactId> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java index a1f493840..5851cff6f 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java @@ -63,6 +63,7 @@ import java.util.Calendar; import java.util.Collection; import java.util.Date; import java.util.Locale; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; import static org.junit.Assert.*; @@ -71,7 +72,7 @@ import static org.junit.Assert.*; * * @version $Id$ */ -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public abstract class AbstractProxyTestCase { diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java index 8af5ea536..a58d8c332 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java @@ -45,7 +45,6 @@ import org.mortbay.jetty.Server; import org.mortbay.jetty.handler.AbstractHandler; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import javax.servlet.ServletException; @@ -53,6 +52,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; import static org.junit.Assert.*; @@ -61,7 +61,7 @@ import static org.junit.Assert.*; * * @version $Id: ManagedDefaultTransferTest.java 677852 2008-07-18 08:16:24Z brett $ */ -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public class HttpProxyTransferTest { diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml index ca24d008f..595a7dfa5 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml @@ -93,6 +93,12 @@ </exclusions> </dependency> <dependency> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-testutil</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${spring.version}</version> diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java index 02497556e..a6188d071 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java @@ -35,16 +35,16 @@ import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import java.io.File; import java.util.List; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; /** * @author Olivier Lamy */ -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public abstract class AbstractRepositoryAdminTest extends TestCase diff --git a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml index b258f78b3..4005a4a9c 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml @@ -67,10 +67,11 @@ <scope>test</scope> </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> <dependency> <groupId>org.apache.archiva</groupId> <artifactId>metadata-model</artifactId> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/AbstractRepositoryLayerTestCase.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/AbstractRepositoryLayerTestCase.java index 5b192f3c4..9c436fdf3 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/AbstractRepositoryLayerTestCase.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/AbstractRepositoryLayerTestCase.java @@ -28,17 +28,17 @@ import org.junit.rules.TestName; import org.junit.runner.RunWith; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.io.File; import javax.inject.Inject; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; /** * AbstractRepositoryLayerTestCase * * @version $Id$ */ -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public abstract class AbstractRepositoryLayerTestCase { diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/RepositoryURLTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/RepositoryURLTest.java index 83267d14c..f15cafce7 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/RepositoryURLTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/RepositoryURLTest.java @@ -25,12 +25,16 @@ import org.apache.archiva.model.RepositoryURL; import java.net.MalformedURLException; import junit.framework.TestCase; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; +import org.junit.Test; +import org.junit.runner.RunWith; /** * RepositoryURLTest * * @version $Id$ */ +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class RepositoryURLTest extends TestCase { @@ -46,7 +50,8 @@ public class RepositoryURLTest assertEquals( port, url.getPort() ); assertEquals( path, url.getPath() ); } - + + @Test public void testProtocolHttp() throws MalformedURLException { @@ -54,6 +59,7 @@ public class RepositoryURLTest "/path/to/resource.txt" ); } + @Test public void testProtocolWagonWebdav() throws MalformedURLException { @@ -61,6 +67,7 @@ public class RepositoryURLTest "/path/to/resource.txt" ); } + @Test public void testProtocolHttpWithPort() throws MalformedURLException { @@ -68,6 +75,7 @@ public class RepositoryURLTest "/path/to/resource.txt" ); } + @Test public void testProtocolHttpWithUsername() throws MalformedURLException { @@ -75,6 +83,7 @@ public class RepositoryURLTest "/path/to/resource.txt" ); } + @Test public void testProtocolHttpWithUsernamePassword() throws MalformedURLException { @@ -82,6 +91,7 @@ public class RepositoryURLTest "/path/to/resource.txt" ); } + @Test public void testProtocolHttpWithUsernamePasswordPort() throws MalformedURLException { diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/FilenameParserTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/FilenameParserTest.java index 99e34acab..a2a36f8e9 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/FilenameParserTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/FilenameParserTest.java @@ -20,16 +20,16 @@ package org.apache.archiva.repository.content; */ import junit.framework.TestCase; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; import org.junit.Test; import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; /** * FilenameParserTest * * @version $Id$ */ -@RunWith( JUnit4.class ) +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class FilenameParserTest extends TestCase { diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java index 8da14bd08..24cd88fc8 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java @@ -25,16 +25,16 @@ import org.apache.archiva.model.ArchivaRepositoryMetadata; import org.apache.archiva.xml.XMLException; import org.junit.Test; import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; import java.io.File; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; /** * RepositoryMetadataReaderTest * * @version $Id$ */ -@RunWith( JUnit4.class ) +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class RepositoryMetadataReaderTest extends TestCase { diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java index 373c8de9b..43ed7988a 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java @@ -25,17 +25,17 @@ import org.apache.archiva.model.ArchivaRepositoryMetadata; import org.custommonkey.xmlunit.XMLAssert; import org.junit.Test; import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; import java.io.File; import java.io.StringWriter; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; /** * RepositoryMetadataWriterTest * * @version $Id$ */ -@RunWith( JUnit4.class ) +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class RepositoryMetadataWriterTest extends TestCase { diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml index a1175279a..d19988931 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml @@ -58,8 +58,9 @@ --> </dependency> <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-test</artifactId> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-testutil</artifactId> + <version>${project.version}</version> <scope>test</scope> </dependency> </dependencies> diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java index e36b9fe45..a5d84621e 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java @@ -40,7 +40,6 @@ import org.springframework.context.NoSuchMessageException; import org.springframework.core.env.Environment; import org.springframework.core.io.Resource; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import java.io.File; @@ -53,13 +52,14 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; /** * RepositoryContentConsumersTest * * @version $Id$ */ -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public class RepositoryContentConsumersTest extends TestCase diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java index 89896838b..8b24abadd 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java @@ -29,7 +29,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.inject.Inject; import java.io.File; @@ -41,13 +40,14 @@ import java.util.Arrays; import java.util.List; import java.util.Locale; import java.util.TimeZone; +import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner; /** * RepositoryScannerTest * * @version $Id$ */ -@RunWith( SpringJUnit4ClassRunner.class ) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } ) public class RepositoryScannerTest extends TestCase 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(); diff --git a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml index b747595a4..fb800d186 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml +++ b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml @@ -53,6 +53,12 @@ <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId> </dependency> + <dependency> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-testutil</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> </dependencies> <build> <plugins> diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/AbstractArchivaXmlTestCase.java b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/AbstractArchivaXmlTestCase.java index 490083568..ebd5b0927 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/AbstractArchivaXmlTestCase.java +++ b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/AbstractArchivaXmlTestCase.java @@ -22,12 +22,15 @@ package org.apache.archiva.xml; import java.io.File; import junit.framework.TestCase; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; +import org.junit.runner.RunWith; /** * AbstractArchivaXmlTestCase * * @version $Id$ */ +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public abstract class AbstractArchivaXmlTestCase extends TestCase { diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntitiesTest.java b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntitiesTest.java index 96294a53f..d44b6b491 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntitiesTest.java +++ b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntitiesTest.java @@ -20,15 +20,20 @@ package org.apache.archiva.xml; */ import junit.framework.TestCase; +import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner; +import org.junit.Test; +import org.junit.runner.RunWith; /** * LatinEntitiesTest * * @version $Id$ */ +@RunWith( ArchivaBlockJUnit4ClassRunner.class ) public class LatinEntitiesTest extends TestCase { + @Test public void testResolveEntity() { // Good Entities. diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java index d8fd8493a..0fa4d42bd 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java +++ b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java @@ -32,6 +32,7 @@ import java.io.InputStreamReader; import java.io.Reader; import java.io.StringWriter; import java.net.URL; +import org.junit.Test; /** * LatinEntityResolutionReaderTest @@ -139,7 +140,8 @@ public class LatinEntityResolutionReaderTest fail( "IOException: " + e.getMessage() ); } } - + + @Test public void testReaderNormalBufsize() throws IOException { @@ -155,6 +157,7 @@ public class LatinEntityResolutionReaderTest assertProperRead( expected, "no-prolog-with-entities.xml", 4096 ); } + @Test public void testReaderSmallBufsize() throws IOException { @@ -170,6 +173,7 @@ public class LatinEntityResolutionReaderTest assertProperRead( expected, "no-prolog-with-entities.xml", 1024 ); } + @Test public void testReaderRediculouslyTinyBufsize() throws IOException { @@ -185,6 +189,7 @@ public class LatinEntityResolutionReaderTest assertProperRead( expected, "no-prolog-with-entities.xml", 32 ); } + @Test public void testReaderHugeBufsize() throws IOException { @@ -200,7 +205,7 @@ public class LatinEntityResolutionReaderTest assertProperRead( expected, "no-prolog-with-entities.xml", 409600 ); } - + @Test public void testReaderLeftOver() throws IOException { @@ -225,7 +230,7 @@ public class LatinEntityResolutionReaderTest } } - + @Test public void testNoLatinEntitiesHugeLine() { assertProperRead( "commons-codec-1.2.pom", "commons-codec-1.2.pom", 4096 ); diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLReaderTest.java b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLReaderTest.java index 3d9f1b7fd..0d2d0e7d0 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLReaderTest.java +++ b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLReaderTest.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.List; import org.dom4j.Element; +import org.junit.Test; /** * XMLReaderTest @@ -49,7 +50,8 @@ public class XMLReaderTest assertTrue( "Contains [" + expectedText + "]", texts.contains( expectedText ) ); } } - + + @Test public void testNoPrologBasicRead() throws XMLException { @@ -60,6 +62,7 @@ public class XMLReaderTest assertElementTexts( fruits, new String[] { "apple", "cherry", "pear", "peach" } ); } + @Test public void testNoPrologEntitiesRead() throws XMLException { @@ -70,6 +73,7 @@ public class XMLReaderTest assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } ); } + @Test public void testNoPrologUtf8Read() throws XMLException { @@ -80,6 +84,7 @@ public class XMLReaderTest assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } ); } + @Test public void testPrologUtf8Read() throws XMLException { @@ -91,6 +96,7 @@ public class XMLReaderTest } // MRM-1136 + @Test public void testProxiedMetadataRead() throws XMLException { diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLWriterTest.java b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLWriterTest.java index b138a13b6..0b90ac9d5 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLWriterTest.java +++ b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLWriterTest.java @@ -24,6 +24,7 @@ import org.dom4j.DocumentHelper; import org.dom4j.Element; import java.io.StringWriter; +import org.junit.Test; /** * XMLWriterTest @@ -33,6 +34,7 @@ import java.io.StringWriter; public class XMLWriterTest extends AbstractArchivaXmlTestCase { + @Test public void testWrite() throws Exception { |