summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
authorskygo <skygo@unknown>2012-09-01 14:42:09 +0000
committerskygo <skygo@unknown>2012-09-01 14:42:09 +0000
commitc9167d64b94d05ee179b96b9d188f4a829928591 (patch)
tree1259e7e7a9135a1f977d497d2d886ce1fa69bb32 /archiva-modules/archiva-base
parent23a775efab2c91b042c6d02d05257bc89cae2af8 (diff)
downloadarchiva-c9167d64b94d05ee179b96b9d188f4a829928591.tar.gz
archiva-c9167d64b94d05ee179b96b9d188f4a829928591.zip
Archiva base configuration test refresh to junit 4
remove testcase; reorder import; dirty context annotation for ArchivvaConfigurationTest git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1379764 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base')
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/pom.xml1
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationMRM789Test.java17
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java19
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ConfigurationTest.java8
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/FileTypesTest.java15
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/LegacyArtifactPathTest.java3
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/MavenProxyPropertyLoaderTest.java27
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java8
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java6
9 files changed, 36 insertions, 68 deletions
diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml
index 03e142d4c..281668521 100644
--- a/archiva-modules/archiva-base/archiva-configuration/pom.xml
+++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml
@@ -213,6 +213,7 @@
<exclude>src/main/resources/org/apache/archiva/configuration/default-archiva.xml</exclude>
<exclude>src/test/conf/maven-proxy-complete.conf</exclude>
<exclude>src/test/resources/org/apache/archiva/configuration/test-default-archiva.xml</exclude>
+ <exclude>nbactions.xml</exclude>
</excludes>
</configuration>
</plugin>
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationMRM789Test.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationMRM789Test.java
index f87ec34d3..d94d9d4bd 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationMRM789Test.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationMRM789Test.java
@@ -19,34 +19,27 @@ package org.apache.archiva.configuration;
* under the License.
*/
-import junit.framework.TestCase;
+import java.io.File;
+import java.util.List;
+import javax.inject.Inject;
import org.apache.archiva.common.utils.FileUtil;
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
+import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.util.List;
-import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
-
/**
* Test the configuration store.
*/
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class ArchivaConfigurationMRM789Test
- extends TestCase
{
- private Logger log = LoggerFactory.getLogger( getClass() );
-
@Inject
protected ApplicationContext applicationContext;
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 1a34df827..cc2addad3 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
@@ -19,34 +19,33 @@ package org.apache.archiva.configuration;
* under the License.
*/
-import junit.framework.TestCase;
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import javax.inject.Inject;
import org.apache.archiva.common.utils.FileUtil;
import org.apache.archiva.redback.components.registry.RegistryException;
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
import org.custommonkey.xmlunit.XMLAssert;
import org.easymock.MockControl;
+import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.util.List;
-import java.util.Map;
-import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
-
/**
* Test the configuration store.
*/
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
public class ArchivaConfigurationTest
- extends TestCase
{
private Logger log = LoggerFactory.getLogger( getClass() );
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 e26d12276..cc058e6a9 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
@@ -19,21 +19,19 @@ package org.apache.archiva.configuration;
* under the License.
*/
-import junit.framework.TestCase;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Test the generated Configuration class from Modello. This is primarily to test the hand coded methods.
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class ConfigurationTest
- extends TestCase
{
private Configuration configuration = new Configuration();
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 2b92de455..f0e5701fa 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
@@ -19,29 +19,20 @@ package org.apache.archiva.configuration;
* under the License.
*/
-import junit.framework.TestCase;
+import javax.inject.Inject;
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
+import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
-import javax.inject.Inject;
-import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
-
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } )
public class FileTypesTest
- extends TestCase
{
@Inject
private FileTypes filetypes;
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- }
-
@Test
public void testIsArtifact()
{
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 74166c2ea..db4117c5b 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
@@ -19,8 +19,8 @@ package org.apache.archiva.configuration;
* under the License.
*/
-import junit.framework.TestCase;
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
+import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -31,7 +31,6 @@ import org.junit.runner.RunWith;
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class LegacyArtifactPathTest
- extends TestCase
{
private LegacyArtifactPath legacyArtifactPath = new LegacyArtifactPath();
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 30dfc9a93..88884f838 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
@@ -19,23 +19,21 @@ package org.apache.archiva.configuration;
* under the License.
*/
-import junit.framework.TestCase;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Map;
import java.util.Properties;
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
+import static org.junit.Assert.*;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class MavenProxyPropertyLoaderTest
- extends TestCase
{
private MavenProxyPropertyLoader loader;
@@ -81,26 +79,19 @@ public class MavenProxyPropertyLoaderTest
assertEquals( "Repository url", expectedUrl, repo.getUrl() );
}
- @Test
- public void testInvalidConfiguration()
+ @Test( expected=InvalidConfigurationException.class )
+ public void testInvalidConfiguration()
+ throws InvalidConfigurationException
{
Configuration configuration = new Configuration();
- try
- {
- loader.load( new Properties(), configuration );
- fail( "Incomplete config should have failed" );
- }
- catch ( InvalidConfigurationException e )
- {
- assertTrue( true );
- }
+ loader.load( new Properties(), configuration );
+ //fail( "Incomplete config should have failed" );
}
@Before
public void setUp()
throws Exception
{
- super.setUp();
loader = new MavenProxyPropertyLoader();
}
}
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 49fc0a063..2e23b5afd 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
@@ -19,14 +19,13 @@ package org.apache.archiva.configuration.functors;
* under the License.
*/
-import junit.framework.TestCase;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
-import org.apache.commons.lang.StringUtils;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.apache.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
+import org.apache.commons.lang.StringUtils;
+import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -37,7 +36,6 @@ import org.junit.runner.RunWith;
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class ProxyConnectorConfigurationOrderComparatorTest
- extends TestCase
{
@Test
public void testSortOfAllZeros()
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 9be8c9a59..e1f4d0dfc 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
@@ -19,12 +19,11 @@ package org.apache.archiva.configuration.functors;
* under the License.
*/
-import junit.framework.TestCase;
+import java.util.Comparator;
import org.apache.archiva.configuration.AbstractRepositoryConfiguration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-
-import java.util.Comparator;
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
+import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -33,7 +32,6 @@ import org.junit.runner.RunWith;
*/
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryConfigurationComparatorTest
- extends TestCase
{
@Test
public void testComparator()