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-configuration | |
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-configuration')
8 files changed, 27 insertions, 22 deletions
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(); |