]> source.dussan.org Git - archiva.git/commitdiff
Archiva base configuration test refresh to junit 4
authorskygo <skygo@unknown>
Sat, 1 Sep 2012 14:42:09 +0000 (14:42 +0000)
committerskygo <skygo@unknown>
Sat, 1 Sep 2012 14:42:09 +0000 (14:42 +0000)
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

archiva-modules/archiva-base/archiva-configuration/pom.xml
archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationMRM789Test.java
archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java
archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ConfigurationTest.java
archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/FileTypesTest.java
archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/LegacyArtifactPathTest.java
archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/MavenProxyPropertyLoaderTest.java
archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java
archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java

index 03e142d4c7cddb772ec2a9ade131127d1904c96e..28166852136adc78edf666b9ab9803fe85e492ec 100644 (file)
               <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>
index f87ec34d37d001c1af79a78bc086afd38aec1cfc..d94d9d4bd54951991961ef4df0fa3b634243d645 100644 (file)
@@ -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;
 
index 1a34df82746d011e131194e4d12e7b38ee9eefaa..cc2addad38f58a9a17c52717dbf5b14195e869ca 100644 (file)
@@ -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() );
index e26d12276fc9146861d3bd8f85f1a0dfb2ffdc4f..cc058e6a96857bc4e92405ad498b99e32e8e94fc 100644 (file)
@@ -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();
 
index 2b92de4558538bd6ca3fdb227826150aaa2dc8c3..f0e5701fa2596f958b9457ff6785a74ddd96372a 100644 (file)
@@ -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()
     {
index 74166c2ea1acc567c66345d1a295f68c48912203..db4117c5b36729698773dd9e0c81238b9136040e 100644 (file)
@@ -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();
index 30dfc9a93cae8c539939d881fd8a79a8b8634532..88884f838bec3c19f9e3570fc2904f0e5cd0af38 100644 (file)
@@ -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();
     }
 }
index 49fc0a063d1d6df3b1ad9921817803ff737f8d0e..2e23b5afd2ece625539f07d5492ce7b45c1734ba 100644 (file)
@@ -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()
index 9be8c9a5979b07db57e139e27257030b5fb2794b..e1f4d0dfca5e752eb45b476939728a51c38e2a66 100644 (file)
@@ -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()