]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1638] Improve unit test for archiva build
authorOlivier Lamy <olamy@apache.org>
Mon, 2 Jul 2012 07:36:23 +0000 (07:36 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 2 Jul 2012 07:36:23 +0000 (07:36 +0000)
Based on patch provided by Eric Barboni.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1356091 13f79535-47bb-0310-9956-ffa450edef68

146 files changed:
archiva-modules/archiva-base/archiva-artifact-converter/pom.xml
archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java
archiva-modules/archiva-base/archiva-checksum/pom.xml
archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java
archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumAlgorithmTest.java
archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumTest.java
archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksummedFileTest.java
archiva-modules/archiva-base/archiva-configuration/pom.xml
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
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml
archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java
archiva-modules/archiva-base/archiva-converter/pom.xml
archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/archiva/converter/RepositoryConverterTest.java
archiva-modules/archiva-base/archiva-indexer/pom.xml
archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java
archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java
archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java
archiva-modules/archiva-base/archiva-model/pom.xml
archiva-modules/archiva-base/archiva-model/src/test/java/org/apache/archiva/model/RepositoryURLTest.java
archiva-modules/archiva-base/archiva-policies/pom.xml
archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/CachedFailuresPolicyTest.java
archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ChecksumPolicyTest.java
archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ReleasePolicyTest.java
archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/SnapshotsPolicyTest.java
archiva-modules/archiva-base/archiva-proxy-common/pom.xml
archiva-modules/archiva-base/archiva-proxy-common/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java
archiva-modules/archiva-base/archiva-proxy/pom.xml
archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java
archiva-modules/archiva-base/archiva-repository-layer/pom.xml
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/AbstractRepositoryLayerTestCase.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/RepositoryURLTest.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/FilenameParserTest.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java
archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java
archiva-modules/archiva-base/archiva-repository-scanner/pom.xml
archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java
archiva-modules/archiva-base/archiva-transaction/pom.xml
archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/AbstractFileEventTest.java
archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java
archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java
archiva-modules/archiva-base/archiva-xml-tools/pom.xml
archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/AbstractArchivaXmlTestCase.java
archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntitiesTest.java
archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java
archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLReaderTest.java
archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLWriterTest.java
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java
archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorAbstractTest.java
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase1Test.java
archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
archiva-modules/archiva-web/archiva-rss/pom.xml
archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/RssFeedGeneratorTest.java
archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java
archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java
archiva-modules/archiva-web/archiva-security/pom.xml
archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/RoleManagerTest.java
archiva-modules/archiva-web/archiva-web-common/pom.xml
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java
archiva-modules/archiva-web/archiva-webapp-js/pom.xml
archiva-modules/archiva-web/archiva-webapp-js/src/test/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoServiceTest.java
archiva-modules/archiva-web/archiva-webapp/pom.xml
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/AbstractDownloadTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadArtifactsTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractActionTestCase.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractWebworkTestCase.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/BrowseActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/DeleteArtifactActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/SearchActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/ShowArtifactActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/UploadActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/AbstractOrganizationInfoActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/EditOrganizationInfoActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/OrganizationInfoActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/legacy/AddLegacyArtifactPathActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AbstractManagedRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/RepositoriesActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/SortRepositoriesActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/scanning/RepositoryScanningActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/reports/GenerateReportActionTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/startup/BannerTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/tags/DependencyTreeTest.java
archiva-modules/archiva-web/archiva-webdav/pom.xml
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceLocatorTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/MimeTypesLoaderTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MimeTypesTest.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/RepositoryPathUtilTest.java
archiva-modules/metadata/metadata-repository-api/pom.xml
archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
archiva-modules/plugins/audit/pom.xml
archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java
archiva-modules/plugins/maven2-repository/pom.xml
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilderTest.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/MavenRepositoryMetadataReaderTest.java
archiva-modules/plugins/metadata-store-file/pom.xml
archiva-modules/plugins/metadata-store-jcr/pom.xml
archiva-modules/plugins/problem-reports/pom.xml
archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java
archiva-modules/plugins/repository-statistics/pom.xml
archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java
archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
archiva-modules/plugins/stage-repository-merge/pom.xml
archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java
pom.xml

index e9b210646c13dc6474f13c11988c360569edf9e0..edc637b5186e23076ce79b49ac598ad210aadf44 100644 (file)
@@ -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>
index 5b8a6dd24c6410405e7ba30f5f2ed58ada0e3cc7..b6636f6a4216ec77b5c58170818dea5319fe6ede 100644 (file)
@@ -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
index 015cb5d0f280de3f86417fafcbcf19f7fee470b3..27f90135fc7a88c0bf33a822602faa69fb61ab80 100644 (file)
       <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>
index 812cc708b98f438af1dc52080f8196a6c60fa228..5455fcb9f5ce4865cd5ace0a244ec9cba3967ba0 100644 (file)
@@ -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
 {
index 7f37469b12b87ce8b00b179f793ca131abe7b535..dabff4d62793226f9495a79e91d19bd33cf53671 100644 (file)
@@ -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
index 4cfcc8dd22d0fd6c7eeaeac4ea10faf0944a8417..40f95a56b8d079de2cabe521d77a6f3d92c87c08 100644 (file)
@@ -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 );
index 5ca089087d9cfb325b503ad0235fbb166817c49b..e4122d93ae13d29c8a2d72c555ee8c8c6b6c1832 100644 (file)
@@ -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
     {
index d1ce97ce830a1b8683587ec46b3c199d2af7c6f1..b44c303aa50469daed82c48d8b59e601a1e68966 100644 (file)
       <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>
index 493c6528b890fc7f79dff645e866338aa8f75236..3ab407a682c1dc8e6b352fd40eb975bfbbcd5827 100644 (file)
@@ -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
index ace63c3be3f066bb77732093b18e7e1ac7adbbb2..f84e9bac3153ad6da6ec5cf460a94cdc51747c8c 100644 (file)
@@ -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
 {
index 4689a1774b04c330be11de3d6419e29785885500..3319b721007841f8ad0e515c224f150072b2b409 100644 (file)
@@ -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
index 6c2d1422a14a272247777a8e439af5655b866a58..bca0295c9b806c82e976913c929da3026b9df168 100644 (file)
@@ -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
 {
index 08a4b22df981f2fe7327cea74d64c64c2a1ded0c..65711773b59b0d47973b826ef4d7a9b80c99c496 100644 (file)
@@ -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
 {
index 5eb3ab857053f2f5bd5792fbdcb408e8145ae54a..01ee311f5fed7a630ca55180ba81c3af2adc7056 100644 (file)
@@ -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>();
index 901e2272adf7c7751e1a147a5ab5c7ee8f47a8bf..73f931d1a12258bddb6e9c31d3c3fcbe8b279d33 100644 (file)
@@ -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();
index 0add9a2959edf19a431b7859c4010b54fd124bde..b8165f315f5c0ff58ce99fdddfd56b2ae6d8b652 100644 (file)
@@ -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>
index 90582b761be220b8bae5db2dfb8a3eea1507b62c..2da60bc677f9124669a939bd91b929f05330ac40 100644 (file)
@@ -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
index dfda5f5cc76bbae889b268a90ae60ddea60ae616..3660915d8189ab9b04c52c11d720a7540d370b13 100644 (file)
@@ -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
index 6ee974fbb21f3f38dd77cad36125c51cc9286486..19e7e0d2276ec06be5f3e7376f96470f6d39aa94 100644 (file)
@@ -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>
index ef4804b2f1b2d2f25a3cfd74e0173e4d3a85cfef..edbc2ec308059f8420fa63c19fa2b2daf5b1ae46 100644 (file)
@@ -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
index fed333129c9c4c9871c171400a1403797625bbc9..77b522e7ebea3dd4945745da874b869c8b3db9a8 100644 (file)
       <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>
index 68fafb4fc2867fb65b996de1893bed097164a9de..e2994c74969306952521af8403830f08030cb713 100644 (file)
@@ -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
index 134b1925ccc19c76f7efff7cbc05d97067d0593b..6752ca2dd0a13d96d0f8a5c9eafdca9474c8c694 100644 (file)
       <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>
index 0e21d5d8819a3974f7f655516cb9d904aa3a45ae..eaf5cac5eb09ad4a1984cd683c12f82437dde858 100644 (file)
@@ -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
index ed33539eb978fc86405c68c61b5ec41a78c207fc..16024d9a3aacf4e4ff39f4fc903f3fdeacdbc031 100644 (file)
@@ -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
 {
index cf66e79153479d70032d377f840c9c7d84ce99f9..59bf24b25fed80e54fbdd80e716046e957d5af8a 100644 (file)
@@ -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
index bc28daf6e6a63783f64e30be3699d1d875b7023e..c008802f447624126763d4403f8f019dcffed260 100755 (executable)
@@ -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>
index e239a178b108a7d92e7a0777099edf4cb1023959..6ed556c2efeeb2d0a59c724f23657d51a9e6cd23 100644 (file)
@@ -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
index c604832a7a356c5c23727ff035ff7723bb74710b..5c756a08917ddd1fcf213cd6c9a8db7f942c40ce 100644 (file)
       </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>
index 2fd8d24cb0ae8824d0d673777f4f4dd5c9644494..c322e2357fc2fa43c31fe751b1abfe8ea9b788c8 100644 (file)
@@ -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
index 67dc2cd8aab815a5f7571ec78ba7f7586d7a0dd1..62d7ae92f4ba44690712345ee495efc5878f0ae8 100644 (file)
@@ -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
 {
index d99d216d98d3dc77ee4ee591b470230b4e566d2b..35a7555ee7af438f71f9783b007e5e68568d7608 100644 (file)
@@ -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
index 4567874d96aedcd6065e9cc5c1ffeedf4f0cf53b..6fe09dbf0d6a9a537bf44b763d6ebd64ca2bef89 100644 (file)
@@ -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
index 454b3be1c98abf98665e63a9055e0fba5af4d9fd..1fe13a205fe8502c7e8be99de6aff01f37163f26 100644 (file)
       <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>
index 85dc8d2cacf491a9f28bdb229b094996c9cfcc15..66d7afd9e97de83b79027dbeee6cfdd26845f70a 100644 (file)
@@ -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
index 5768ccd9c2540f885d8d27319b5434867101fe7e..394034c6f1c173c0e06c27782a05da6ec1b235df 100644 (file)
       <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>
index a1f493840b786d1652e96c94ccdb1e4312043ec8..5851cff6f8a9f82f2309e6b37ebf186577019b83 100644 (file)
@@ -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
 {
index 8af5ea5360385469c71f22516be0b35930006977..a58d8c3322237947fabbb3532171a9bc242aee40 100644 (file)
@@ -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
 {
index ca24d008f3d221652bbd8a552f00ceadf8747d51..595a7dfa544a8c27e6c439c7130970c632344f40 100644 (file)
           </exclusion>
         </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>
index 02497556e12d21a4cc356b0c3dd1df27d2f36fc3..a6188d0711d38a60399b661b1b4247c147ad4ab8 100644 (file)
@@ -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
index b258f78b308765568515fe7dda8d0ddd63022b56..4005a4a9c93670eebfa328ca817518a3336ddbba 100644 (file)
       <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>
index 5b192f3c48c8ef16ae2bac5286d3cc45220e4083..9c436fdf3dcecbf311f2c33b9005b5b8c574f46c 100644 (file)
@@ -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
 {
index 83267d14c9c37e811d691e50fb7d4d5f9b7a7d50..f15cafce735e2567d225b265e20a9db52b75b9e9 100644 (file)
@@ -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
     {
index 99e34acabdd541b3ed32730c14471756799f5ba1..a2a36f8e9a8b26f9ce7f58df61cd1569c09a19ac 100644 (file)
@@ -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
 {
index 8da14bd08c4ad801f2b06f80989d107da240a238..24cd88fc8bdefa31d996a4e809c9b0a87037d140 100644 (file)
@@ -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
 {
index 373c8de9bfd653ad3d399ec46192ca834e48f1b9..43ed7988a2b5f494013ad188fb43a31b54002a44 100644 (file)
@@ -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
 {
index a1175279aceca470f3d7f64bbf169b6094d33a58..d19988931dd954ae970f88824b49baf5f1bc7fee 100644 (file)
@@ -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>
index e36b9fe45cce9b3199ff8f8a030014943a443e1e..a5d84621efd2e0e468ba9b903522621a6685f7ec 100644 (file)
@@ -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
index 89896838bf1d11824f7335c7d996788a52ed26ab..8b24abadd3de064a257381c399690bcd07333962 100644 (file)
@@ -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
index 18d6024dc41a9b72a7529d9f70941a1ed5c685be..7ea8aefa019f10493f27da40a3ccbddd71299656 100644 (file)
@@ -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>
index 13ed7327d569f7ee36c11243c388c60825f96c5e..4e7c09316a75cf88a5fbf6e5a017bb24b0f7141a 100644 (file)
@@ -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
     {
index d832ec40c11312083b6aa1d8a321cb41838ea1ee..360f64df875d47b2d47cea08e7b136267cb394af 100644 (file)
@@ -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
     {
index 9d23fe9aeb5c79b90bff8e32269391b1c4a6dfaf..42b2f624554906d0b6dc9d741782abf3e83a8439 100644 (file)
@@ -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();
index b747595a4e5350e9ee9744b198996a72f0193711..fb800d186cd0d841de6070e2584eb3e166a34873 100644 (file)
       <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>
index 49008356832d1d37b8067350cbebc8e38870cfeb..ebd5b092762e3f4b24b542344848090232bb803b 100644 (file)
@@ -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
 {
index 96294a53fabf6a0bdb50fdb0e949bf5c83cbe713..d44b6b491e33788a729091225f99e101f0e0ff55 100644 (file)
@@ -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.
index d8fd8493a8b6988675bd4270243facd12b5f0bf3..0fa4d42bd54656c17d59de93a032fa7deb455710 100644 (file)
@@ -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 );
index 3d9f1b7fd1a37cea228bbd4300076bed1e32d226..0d2d0e7d0dc4c183f29fc31688854ed9be04bd88 100644 (file)
@@ -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
     {
index b138a13b645338a5f3c7d7b13fc5e7e6e8e935bf..0b90ac9d57eb8ff62bff190c2f43c08aa449a518 100644 (file)
@@ -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
     {
index c181bde9ca337986b2102ab8ddb87ad143bba964..8dde3020793cc14878bd3c617115aded3ab5a303 100644 (file)
       <artifactId>slf4j-log4j12</artifactId>
       <scope>test</scope>
     </dependency>
-
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-testutil</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency> 
+    
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-repository-admin-default</artifactId>
index f684abf15d1718d08bfc8e14fef9c9986e84d0a7..6eb6059a8db1c7a06fbef31c1b4f9df230ff81a3 100644 (file)
@@ -42,7 +42,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 java.io.BufferedInputStream;
@@ -55,11 +54,12 @@ import java.io.IOException;
 import java.util.Set;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
 
 /**
  * ArchivaIndexingTaskExecutorTest
  */
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
 public class ArchivaIndexingTaskExecutorTest
     extends TestCase
index ffecf55dd74038f2ed2fa1a1ba8e1162f72ff278..5033b71b444a10f64866069afc9633522d416753 100644 (file)
@@ -43,18 +43,18 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
 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 java.util.Arrays;
 import java.util.concurrent.TimeUnit;
+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 class DownloadRemoteIndexTaskTest
     extends TestCase
index 4414e35ad44b6dfa1c91258d687d1014ca1120b4..66828df98798afcc32d7ce401b25aad67c4c7998 100644 (file)
       <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>org.mockito</groupId>
       <artifactId>mockito-all</artifactId>
index ad5aa6e3c205ebef61c61c5123e211ed33def855..8da5f354baf1627fe69ea039c4f86d28e0912dd3 100644 (file)
@@ -31,22 +31,22 @@ import org.junit.After;
 import org.junit.Before;
 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.Calendar;
 import java.util.List;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
 
 import static org.mockito.Mockito.mock;
 
 /**
  * ArchivaRepositoryScanningTaskExecutorPhase1Test
  *
- * @version $Id: ArchivaRepositoryScanningTaskExecutorPhase1Test.java 1214303 2011-12-14 15:37:51Z olamy $
+ * @version $Id$
  */
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
 public abstract class ArchivaRepositoryScanningTaskExecutorAbstractTest
     extends TestCase
@@ -78,6 +78,7 @@ public abstract class ArchivaRepositoryScanningTaskExecutorAbstractTest
     protected MetadataRepository metadataRepository;
 
     @Before
+    @Override
     public void setUp()
         throws Exception
     {
@@ -123,6 +124,7 @@ public abstract class ArchivaRepositoryScanningTaskExecutorAbstractTest
     }
 
     @After
+    @Override
     public void tearDown()
         throws Exception
     {
index edc804ed4a442faf0a543253b1737f055e25bfaf..9a288566246c136373c8a0dc2f0fbbdaeec13bc4 100644 (file)
@@ -30,9 +30,8 @@ import java.util.Collection;
 /**
  * ArchivaRepositoryScanningTaskExecutorPhase1Test
  *
- * @version $Id: ArchivaRepositoryScanningTaskExecutorPhase1Test.java 1214303 2011-12-14 15:37:51Z olamy $
+ * @version $Id$
  */
-@RunWith( SpringJUnit4ClassRunner.class )
 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
 public class ArchivaRepositoryScanningTaskExecutorPhase1Test
     extends ArchivaRepositoryScanningTaskExecutorAbstractTest
index 6252979801b2fbf0e4d5c58ec5f86ce9b13fec32..225d3a1537da6a35bcba783629cc03c98592e3ec 100644 (file)
@@ -36,9 +36,9 @@ import java.util.Date;
 /**
  * ArchivaRepositoryScanningTaskExecutorPhase2Test
  *
- * @version $Id: ArchivaRepositoryScanningTaskExecutorTest.java 1214303 2011-12-14 15:37:51Z olamy $
+ * @version $Id$
  */
-@RunWith( SpringJUnit4ClassRunner.class )
+
 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
 public class ArchivaRepositoryScanningTaskExecutorPhase2Test
     extends ArchivaRepositoryScanningTaskExecutorAbstractTest
index 4518a403beb22cc32d7f473b95fd9cd1c134c9f5..251ae0a496b8b587a1911929a07b0af7a54d5417 100644 (file)
       <artifactId>spring-test</artifactId>
       <scope>test</scope>
     </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-web</artifactId>
index a607d17f35dc521833675d895a55d4b817f5629d..2580f2bf2084a51b8466cfb74d890088ffe893af 100644 (file)
@@ -45,10 +45,13 @@ import javax.ws.rs.core.MediaType;
 import java.io.File;
 import java.util.Collections;
 import java.util.Date;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.runner.RunWith;
 
 /**
  * @author Olivier Lamy
  */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public abstract class AbstractArchivaRestTest
     extends AbstractRestServicesTest
 {
index a29802b3d7f57a8b3cc29b9ca971fa86e1673298..faf93bd14a8790544d9bce78fe3d336c03c10cfc 100644 (file)
       <artifactId>slf4j-simple</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-testutil</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency> 
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>jcl-over-slf4j</artifactId>
index 0eb01b01a1181375c0b6165aa2fd96dbbbcedeb6..59f32dc78c7b05e598a7c281df5f9a9a6745fc74 100644 (file)
@@ -26,17 +26,17 @@ 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 java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
 
 /**
  * @version
  */
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
 @ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml"} )
 public class RssFeedGeneratorTest
     extends TestCase
index 184a850934223d52fae90924d9545499a05aa032..04a4db5991454a964b68c74abe3c813da27fc9fa 100644 (file)
@@ -34,7 +34,6 @@ import org.apache.archiva.rss.RssFeedGenerator;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
 
 import java.util.ArrayList;
 import java.util.Calendar;
@@ -44,8 +43,9 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.TimeZone;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
 
-@RunWith( JUnit4.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class NewArtifactsRssFeedProcessorTest
     extends TestCase
 {
index 846c2011bd73f15c1b3393849cbb96e36ec44e9a..c7261724810abdf0439f6438339413e333b2eb05 100644 (file)
@@ -29,7 +29,6 @@ import org.easymock.MockControl;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
 
 import java.util.Arrays;
 import java.util.Collections;
@@ -37,8 +36,9 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
 
-@RunWith( JUnit4.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class NewVersionsOfArtifactRssFeedProcessorTest
     extends TestCase
 {
index b4477976950fc4555cc576deea2c7cc40b76a14c..c7ee2cf48f56d4a40e736e118b12587c789666e4 100644 (file)
       <artifactId>slf4j-simple</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-testutil</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>  
     <dependency>
       <groupId>org.apache.derby</groupId>
       <artifactId>derby</artifactId>
index c80983bf33a86f92f13086dbff306ea1b60185a9..1bfc486e092e3e22635d813288facd525cc3f6cc 100644 (file)
@@ -38,18 +38,18 @@ 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 javax.inject.Named;
 import java.io.File;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
 
 /**
  * AbstractSecurityTest
  *
  * @version $Id: AbstractSecurityTest
  */
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
 public abstract class AbstractSecurityTest
     extends TestCase
index 345fc967fab092044ca45f6a701190d644998075..549a9ef88973c114bbaf4dc36fdc99bef8008dd2 100644 (file)
@@ -24,16 +24,16 @@ import org.apache.archiva.redback.role.RoleManager;
 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;
 
 /**
  * RoleProfilesTest 
  *
  * @version $Id: RoleManagerTest.java 4330 2007-05-10 17:28:56Z jmcconnell $
  */
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
 public class RoleManagerTest
     extends TestCase
index faf2d0d59c51052540b3d0295ba8edca7897bc1c..e0be6b22c4d4e2cd6ad958f6e27bf3e1eb15f102 100644 (file)
       <artifactId>slf4j-log4j12</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-testutil</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency> 
     <dependency>
       <groupId>org.apache.maven.wagon</groupId>
       <artifactId>wagon-http</artifactId>
index 9a55321c9a3867afd553659c2d0428e9a6c7730f..039e2f0a003e333fd80dd117495bfcb3972d187d 100644 (file)
@@ -35,12 +35,12 @@ import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.BlockJUnit4ClassRunner;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
 
-@RunWith( BlockJUnit4ClassRunner.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class RssFeedServletTest
     extends TestCase
 {
index 35d1a23fb264a55b59e63cf4bb6e4a85ae4c88bd..035db48ab270914c1dddf1bd8c87daf7be70b650 100644 (file)
       <artifactId>mail</artifactId>
       <scope>test</scope>
     </dependency>
-
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-testutil</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>  
   </dependencies>
 
   <build>
index aed5b3f937254a4211c286e5cc959655ea06b4ca..53c8ec5a55165c2c7c1f539600c120f699ad52b6 100644 (file)
@@ -29,10 +29,13 @@ import org.junit.Test;
 
 import java.io.File;
 import java.util.Collections;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.runner.RunWith;
 
 /**
  * @author Olivier Lamy
  */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class RuntimeInfoServiceTest
     extends AbstractRestServicesTest
 {
index d65e0da2b0a8679dcc0007851cd8b6a3f1932df1..ae764b2245a94c2147fa3b6ac0bfc530cfefc353 100644 (file)
       <scope>test</scope>
       <version>${project.version}</version>
     </dependency>
-
+    
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-testutil</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency> 
   </dependencies>
   <build>
     <resources>
index cb7e0e5b25fb543469e0d73ca5caecce16babcbb..5cf32d8df8bbba97ba2fb302e953c2bfd05074ca 100644 (file)
@@ -49,10 +49,13 @@ import org.slf4j.LoggerFactory;
 import org.springframework.web.context.ContextLoaderListener;
 
 import java.util.Collections;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.runner.RunWith;
 
 /**
  * @author Olivier Lamy
  */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public abstract class AbstractDownloadTest
     extends TestCase
 {
index b7efe7dc894952378a0443009273c1e7050fba21..f01bcf0b2002b72a02ad0feacd4672086f6a5acb 100644 (file)
@@ -34,7 +34,6 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,11 +50,12 @@ import java.util.Enumeration;
 import java.util.List;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
 
 /**
  * @author Olivier Lamy
  */
-@RunWith( JUnit4.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class DownloadArtifactsTest
     extends AbstractDownloadTest
 {
index 2870185aa5e1ce1361a5b9dfa309964cee1207cd..7aeeaff712f9075358c200fd055e652151c63469 100644 (file)
@@ -37,16 +37,16 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
 
 import java.io.File;
 import java.util.Arrays;
 import java.util.List;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
 
 /**
  * @author Olivier Lamy
  */
-@RunWith( JUnit4.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class DownloadMergedIndexTest
     extends AbstractDownloadTest
 {
index 136be1905160095875fdab6de3c5c6a1c89f9b5a..df0ba62e86d5cb24f6e0820d8b037db7a28822b8 100644 (file)
@@ -43,7 +43,11 @@ import org.apache.struts2.StrutsSpringTestCase;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public abstract class AbstractActionTestCase
     extends StrutsSpringTestCase
 {
@@ -207,7 +211,8 @@ public abstract class AbstractActionTestCase
     }
 
     @Override
-    protected void setUp( )
+    @Before
+    public void setUp( )
         throws Exception
     {
         super.setUp( );
@@ -223,7 +228,8 @@ public abstract class AbstractActionTestCase
     }
 
     @Override
-    protected void tearDown( )
+    @After
+    public void tearDown( )
         throws Exception
     {
         super.tearDown( );
index fd6b6a31ce5c5b0a894d72c1c3eae078cc67d94c..fc5d14885090f0a5f8be35377834378e31376e9d 100644 (file)
@@ -26,12 +26,14 @@ import org.apache.struts2.StrutsSpringTestCase;
 import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.List;
-
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.runner.RunWith;
 /**
  * AbstractWebworkTestCase 
  *
  * @version $Id$
  */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public abstract class AbstractWebworkTestCase
     extends StrutsSpringTestCase
 {
index 9503ccbd47fb9f228dda7343e839fd380f6f2649..29b5517d513886418c5e091576894559eae71dc4 100644 (file)
@@ -30,6 +30,7 @@ import org.apache.archiva.scheduler.indexing.DefaultDownloadRemoteIndexScheduler
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import org.junit.Test;
 
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -47,7 +48,8 @@ public class BrowseActionTest
 
     private static final String OTHER_TEST_REPO = "other-repo";
 
-    protected void setUp()
+    @Override
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -61,7 +63,8 @@ public class BrowseActionTest
         factory.setRepositorySession( repositorySession );
     }
 
-    protected void tearDown()
+    @Override
+    public void tearDown()
         throws Exception
     {
         super.tearDown();
@@ -69,11 +72,13 @@ public class BrowseActionTest
         setObservableRepos( Lists.<String>newArrayList( "test-repo" ) );
     }
 
+    @Test
     public void testInstantiation()
     {
         assertFalse( action == getActionProxy( "/browse.action" ).getAction() );
     }
 
+    @Test
     public void testBrowse()
         throws Exception
     {
@@ -92,6 +97,7 @@ public class BrowseActionTest
         assertNull( action.getSharedModel() );
     }
 
+    @Test
     public void testBrowseNoObservableRepos()
         throws Exception
     {
@@ -103,6 +109,7 @@ public class BrowseActionTest
         assertNoOutputVariables();
     }
 
+    @Test
     public void testBrowseGroupNoObservableRepos()
         throws Exception
     {
@@ -122,6 +129,7 @@ public class BrowseActionTest
         assertNull( action.getSharedModel() );
     }
 
+    @Test
     public void testBrowseArtifactNoObservableRepos()
         throws Exception
     {
@@ -143,6 +151,7 @@ public class BrowseActionTest
         assertNull( action.getSharedModel() );
     }
 
+    @Test
     public void testBrowseGroupNoGroupId()
         throws Exception
     {
@@ -151,6 +160,7 @@ public class BrowseActionTest
         assertNoOutputVariables();
     }
 
+    @Test
     public void testBrowseGroupNoArtifacts()
         throws Exception
     {
@@ -172,6 +182,7 @@ public class BrowseActionTest
         assertNull( action.getSharedModel() );
     }
 
+    @Test
     public void testBrowseGroupWithArtifacts()
         throws Exception
     {
@@ -195,6 +206,7 @@ public class BrowseActionTest
         assertNull( action.getSharedModel() );
     }
 
+    @Test
     public void testBrowseWithCollapsedGroupsAndArtifacts()
         throws Exception
     {
@@ -217,6 +229,7 @@ public class BrowseActionTest
         assertNull( action.getSharedModel() );
     }
 
+    @Test
     public void testBrowseWithCollapsedGroupsAndArtifactsAcrossRepositories()
         throws Exception
     {
@@ -241,6 +254,7 @@ public class BrowseActionTest
         assertNull( action.getSharedModel() );
     }
 
+    @Test
     public void testBrowseGroupWithCollapsedGroupsAndArtifacts()
         throws Exception
     {
@@ -266,6 +280,7 @@ public class BrowseActionTest
         assertNull( action.getSharedModel() );
     }
 
+    @Test
     public void testBrowseArtifactNoGroupId()
         throws Exception
     {
@@ -284,6 +299,7 @@ public class BrowseActionTest
         assertNull( action.getSharedModel() );
     }
 
+    @Test
     public void testBrowseArtifactNoArtifactId()
         throws Exception
     {
@@ -302,6 +318,7 @@ public class BrowseActionTest
         assertNull( action.getSharedModel() );
     }
 
+    @Test
     public void testBrowseArtifact()
         throws Exception
 
@@ -336,6 +353,7 @@ public class BrowseActionTest
         assertDefaultModel( model, selectedGroupId, selectedArtifactId, null );
     }
 
+    @Test
     public void testBrowseArtifactWithSnapshots()
         throws Exception
 
index dcf370ba3dcce0395dce1255dc0337bcf2e0d660..92b0a103e5f58189170bcc65b26d26ea559cd50a 100644 (file)
@@ -44,7 +44,12 @@ import java.util.ArrayList;
 
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class DeleteArtifactActionTest
     extends StrutsSpringTestCase
 {
@@ -79,7 +84,8 @@ public class DeleteArtifactActionTest
     }
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -111,7 +117,8 @@ public class DeleteArtifactActionTest
     }
 
     @Override
-    protected void tearDown()
+    @After
+    public void tearDown()
         throws Exception
     {
         action = null;
@@ -120,6 +127,7 @@ public class DeleteArtifactActionTest
     }
 
 
+    @Test
     public void testNPEInDeleteArtifact()
         throws Exception
     {
index 66ff41598be41db0fe5090ae250ea9ec7e0c44eb..38c0305cc108aac93e2d56463b1e43e6d2bb948c 100644 (file)
@@ -39,6 +39,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import org.junit.Test;
 
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -72,7 +73,7 @@ public class SearchActionTest
     private RepositorySession session;
 
     @Override
-    protected void setUp()
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -107,6 +108,7 @@ public class SearchActionTest
 
     // quick search...
 
+    @Test
     public void testQuickSearch()
         throws Exception
     {
@@ -153,6 +155,7 @@ public class SearchActionTest
         searchControl.verify();
     }
 
+    @Test
     public void testSearchWithinSearchResults()
         throws Exception
     {
@@ -203,6 +206,7 @@ public class SearchActionTest
         searchControl.verify();
     }
 
+    @Test
     public void testQuickSearchUserHasNoAccessToAnyRepository()
         throws Exception
     {
@@ -223,6 +227,7 @@ public class SearchActionTest
         userReposControl.verify();
     }
 
+    @Test
     public void testQuickSearchNoSearchHits()
         throws Exception
     {
@@ -258,6 +263,7 @@ public class SearchActionTest
 
     // advanced/filtered search...
 
+    @Test
     public void testAdvancedSearchOneRepository()
         throws Exception
     {
@@ -305,6 +311,7 @@ public class SearchActionTest
         searchControl.verify();
     }
 
+    @Test
     public void testAdvancedSearchAllRepositories()
         throws Exception
     {
@@ -356,6 +363,7 @@ public class SearchActionTest
         userReposControl.verify();
     }
 
+    @Test
     public void testAdvancedSearchNoSearchHits()
         throws Exception
     {
@@ -393,6 +401,7 @@ public class SearchActionTest
         searchControl.verify();
     }
 
+    @Test
     public void testAdvancedSearchUserHasNoAccessToAnyRepository()
         throws Exception
     {
@@ -406,6 +415,7 @@ public class SearchActionTest
         assertEquals(GlobalResults.ACCESS_TO_NO_REPOS, result);
     }
 
+    @Test
     public void testAdvancedSearchNoSpecifiedCriteria()
         throws Exception
     {
@@ -422,6 +432,7 @@ public class SearchActionTest
     }
 
     // find artifact..
+    @Test
     public void testFindArtifactWithOneHit()
         throws Exception
     {
@@ -450,6 +461,7 @@ public class SearchActionTest
         userReposControl.verify();
     }
 
+    @Test
     public void testFindArtifactWithMultipleHits()
         throws Exception
     {
@@ -478,6 +490,7 @@ public class SearchActionTest
         userReposControl.verify();
     }
 
+    @Test
     public void testFindArtifactNoChecksumSpecified()
         throws Exception
     {
@@ -488,6 +501,7 @@ public class SearchActionTest
         assertEquals("Unable to search for a blank checksum", (String) action.getActionErrors().iterator().next());
     }
 
+    @Test
     public void testFindArtifactNoResults()
         throws Exception
     {
index 2b2f184283649a77546998aa7a927909efdcdf3a..9376df16b1d679498a6a3c7fb34b6c4bb7cedecb 100644 (file)
@@ -47,6 +47,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import org.junit.Test;
 
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -77,7 +78,8 @@ public class ShowArtifactActionTest
 
     private static final String TEST_TYPE = "jar";
 
-    protected void setUp()
+    @Override
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -115,11 +117,13 @@ public class ShowArtifactActionTest
 
     }
 
+    @Test
     public void testInstantiation()
     {
         assertFalse( action == getActionProxy( "/showArtifact.action" ).getAction() );
     }
 
+    @Test
     public void testGetArtifactUniqueRelease()
     {
         metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
@@ -143,6 +147,7 @@ public class ShowArtifactActionTest
         assertTrue( action.getArtifacts().isEmpty() );
     }
 
+    @Test
     public void testGetArtifactUniqueSnapshot()
     {
         metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
@@ -173,6 +178,7 @@ public class ShowArtifactActionTest
         assertNull( action.getMailingLists() );
     }
 
+    @Test
     public void testGetArtifactUniqueSnapshotTimestamped()
     {
         metadataResolver.setProjectVersion( TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
@@ -189,6 +195,7 @@ public class ShowArtifactActionTest
         assertNoOutputFields();
     }
 
+    @Test
     public void testGetMissingProject()
     {
         setActionParameters();
@@ -200,6 +207,7 @@ public class ShowArtifactActionTest
         assertNoOutputFields();
     }
 
+    @Test
     public void testGetArtifactNoObservableRepos()
     {
         setObservableRepos( Collections.<String>emptyList() );
@@ -214,6 +222,7 @@ public class ShowArtifactActionTest
         assertNoOutputFields();
     }
 
+    @Test
     public void testGetArtifactNotInObservableRepos()
     {
         metadataResolver.setProjectVersion( OTHER_TEST_REPO, TEST_GROUP_ID, TEST_ARTIFACT_ID,
@@ -228,6 +237,7 @@ public class ShowArtifactActionTest
         assertNoOutputFields();
     }
 
+    @Test
     public void testGetArtifactOnlySeenInSecondObservableRepo()
     {
         setObservableRepos( Arrays.asList( OTHER_TEST_REPO, TEST_REPO ) );
@@ -252,6 +262,7 @@ public class ShowArtifactActionTest
         assertTrue( action.getArtifacts().isEmpty() );
     }
 
+    @Test
     public void testGetArtifactSeenInBothObservableRepo()
     {
         setObservableRepos( Arrays.asList( TEST_REPO, OTHER_TEST_REPO ) );
@@ -278,6 +289,7 @@ public class ShowArtifactActionTest
         assertTrue( action.getArtifacts().isEmpty() );
     }
 
+    @Test
     public void testGetArtifactCanOnlyObserveInOneOfTwoRepos()
     {
         setObservableRepos( Arrays.asList( TEST_REPO ) );
@@ -304,6 +316,7 @@ public class ShowArtifactActionTest
         assertTrue( action.getArtifacts().isEmpty() );
     }
 
+    @Test
     public void testGetArtifactNoMavenFacet()
     {
         ProjectVersionMetadata versionMetadata = new ProjectVersionMetadata();
@@ -335,6 +348,7 @@ public class ShowArtifactActionTest
         assertTrue( action.getArtifacts().isEmpty() );
     }
 
+    @Test
     public void testMetadataHasRepositoryFacetProblem()
     {
         String errMsg = "Error in resolving artifact's parent POM file: Sample Parent POM not found";
@@ -360,6 +374,7 @@ public class ShowArtifactActionTest
         assertEquals( "Artifact metadata is incomplete: " + errMsg, action.getActionErrors().toArray()[0].toString() );
     }
 
+    @Test
     public void testMetadataIncomplete()
     {
         ProjectVersionMetadata metaData = createProjectModel( TEST_SNAPSHOT_VERSION );
@@ -385,6 +400,7 @@ public class ShowArtifactActionTest
         assertEquals( "Artifact metadata is incomplete.", action.getActionErrors().toArray()[0].toString() );
     }
 
+    @Test
     public void testGetMailingLists()
     {
         ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
@@ -413,6 +429,7 @@ public class ShowArtifactActionTest
         assertTrue( action.getArtifacts().isEmpty() );
     }
 
+    @Test
     public void testGetDependencies()
     {
         ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
@@ -441,6 +458,7 @@ public class ShowArtifactActionTest
         assertTrue( action.getArtifacts().isEmpty() );
     }
 
+    @Test
     public void testGetDependees()
         throws Exception
     {
@@ -471,6 +489,7 @@ public class ShowArtifactActionTest
         assertTrue( action.getArtifacts().isEmpty() );
     }
 
+    @Test
     public void testGetProjectMetadata()
     {
         ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
@@ -498,6 +517,7 @@ public class ShowArtifactActionTest
         assertTrue( action.getArtifacts().isEmpty() );
     }
 
+    @Test
     public void testAddAndDeleteMetadataProperty()
     {
         ProjectVersionMetadata versionMetadata = createProjectModel( TEST_VERSION );
index 96c5ee5a7cf30ea31431574abfcdfb79370f4bae..cdb8788ba7095a10b443bc471507fd2389a2a0c3 100644 (file)
@@ -52,6 +52,7 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.TimeZone;
+import org.junit.Test;
 
 /**
  * UploadActionTest
@@ -78,6 +79,7 @@ public class UploadActionTest
 
     private ManagedRepository managedRepository;
 
+    @Override
     public void setUp()
         throws Exception
     {
@@ -116,6 +118,7 @@ public class UploadActionTest
 
     }
 
+    @Override
     public void tearDown()
         throws Exception
     {
@@ -286,6 +289,7 @@ public class UploadActionTest
         return control;
     }
 
+    @Test
     public void testArtifactUploadWithPomSuccessful()
         throws Exception
     {
@@ -327,6 +331,7 @@ public class UploadActionTest
         verifyProjectMetadataChecksums( repoLocation );
     }
 
+    @Test
     public void testArtifactUploadWithClassifier()
         throws Exception
     {
@@ -387,6 +392,7 @@ public class UploadActionTest
         verifyProjectMetadataChecksums( repoLocation );
     }
 
+    @Test
     public void testArtifactUploadGeneratePomSuccessful()
         throws Exception
     {
@@ -428,6 +434,7 @@ public class UploadActionTest
         verifyProjectMetadataChecksums( repoLocation );
     }
 
+    @Test
     public void testArtifactUploadNoPomSuccessful()
         throws Exception
     {
@@ -511,6 +518,7 @@ public class UploadActionTest
         assertTrue( StringUtils.contains( contents, md5 ) );
     }
 
+    @Test
     public void testArtifactUploadFailedRepositoryNotFound()
         throws Exception
     {
@@ -548,6 +556,7 @@ public class UploadActionTest
             new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() );
     }
 
+    @Test
     public void testArtifactUploadSnapshots()
         throws Exception
     {
@@ -680,6 +689,7 @@ public class UploadActionTest
         assertEquals( "Incorrect build number in filename.", "2", buildnumber );
     }
 
+    @Test
     public void testChecksumIsCorrectWhenArtifactIsReUploaded()
         throws Exception
     {
@@ -748,6 +758,7 @@ public class UploadActionTest
         verifyProjectMetadataChecksums( repoLocation );
     }
 
+    @Test
     public void testUploadArtifactAlreadyExistingRedeploymentsBlocked()
         throws Exception
     {
@@ -794,6 +805,7 @@ public class UploadActionTest
         verifyProjectMetadataChecksums( repoLocation );
     }
 
+    @Test
     public void testUploadArtifactAlreadyExistingRedeploymentsAllowed()
         throws Exception
     {
index d4d75809d381aa9fa557af3b9029c9b44ca99095..9597b5e1acfa07a13eee5cb874f18bb9f103f4c0 100644 (file)
@@ -24,6 +24,7 @@ import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.configuration.Configuration;
 import org.apache.archiva.web.action.AbstractWebworkTestCase;
 import org.easymock.MockControl;
+import org.junit.Before;
 
 /**
  */
@@ -40,8 +41,9 @@ public abstract class AbstractOrganizationInfoActionTest
 
     protected abstract AbstractAppearanceAction getAction();
 
+    @Before
     @Override
-    protected void setUp()
+    public void setUp()
         throws Exception
     {
         super.setUp();
index 64ae7f8ad5a26e55b91970dc24d9c4e729516f71..5a709eb4de11b5f0ab38e28b016e2de222b4faa4 100644 (file)
@@ -28,6 +28,8 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  */
@@ -54,6 +56,7 @@ public class EditOrganizationInfoActionTest
     private ActionValidatorManager actionValidatorManager;
 
     @Override
+    @Before
     public void setUp()
         throws Exception
     {
@@ -64,6 +67,7 @@ public class EditOrganizationInfoActionTest
         actionValidatorManager = factory.createDefaultActionValidatorManager();
     }
 
+    @Test
     public void testOrganisationInfoSaves()
         throws Exception
     {
@@ -96,6 +100,7 @@ public class EditOrganizationInfoActionTest
         assertEquals( "URL1", orginfo.getUrl() );
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithNullInputs()
         throws Exception
     {
@@ -122,6 +127,7 @@ public class EditOrganizationInfoActionTest
         ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithBlankInputs()
         throws Exception
     {
@@ -148,6 +154,7 @@ public class EditOrganizationInfoActionTest
         ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithInvalidInputs()
         throws Exception
     {
@@ -184,6 +191,7 @@ public class EditOrganizationInfoActionTest
         ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithValidInputs()
         throws Exception
     {
index de5adfa198b01526b462dbfc070c87d6779e76ab..24290692454bd04a720b6cad2e126f134e3d80e9 100644 (file)
@@ -20,12 +20,14 @@ package org.apache.archiva.web.action.admin.appearance;
  */
 
 import org.apache.archiva.configuration.OrganisationInformation;
+import org.junit.Test;
 
 /**
  */
 public class OrganizationInfoActionTest
     extends AbstractOrganizationInfoActionTest
 {
+    @Test
     public void testOrganisationInfoLoads()
         throws Exception
     {
index df62dd1d0d6092fdc8d37b7e1491eedbc22f5146..9ac59722c2d75d44ac0757112262b712fcc8b60c 100644 (file)
@@ -42,6 +42,8 @@ import org.easymock.MockControl;
 
 import java.util.List;
 import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * AddProxyConnectorActionTest
@@ -58,7 +60,8 @@ public class AddProxyConnectorActionTest
     private ArchivaConfiguration archivaConfiguration;
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -75,6 +78,7 @@ public class AddProxyConnectorActionTest
             archivaConfiguration );
     }
 
+    @Test
     public void testAddBlackListPattern()
         throws Exception
     {
@@ -106,6 +110,7 @@ public class AddProxyConnectorActionTest
         assertEquals( 1, connector.getBlackListPatterns().size() );
     }
 
+    @Test
     public void testAddProperty()
         throws Exception
     {
@@ -139,6 +144,7 @@ public class AddProxyConnectorActionTest
     }
 
     @SuppressWarnings( "unchecked" )
+    @Test
     public void testAddProxyConnectorCommit()
         throws Exception
     {
@@ -173,6 +179,7 @@ public class AddProxyConnectorActionTest
         assertEquals( "gramov-a-bits", actualConnector.getProperties().get( "eat-a" ) );
     }
 
+    @Test
     public void testAddProxyConnectorInitialPage()
         throws Exception
     {
@@ -194,6 +201,7 @@ public class AddProxyConnectorActionTest
         assertEquals( Action.INPUT, status );
     }
 
+    @Test
     public void testAddWhiteListPattern()
         throws Exception
     {
@@ -225,6 +233,7 @@ public class AddProxyConnectorActionTest
         assertEquals( 1, connector.getWhiteListPatterns().size() );
     }
 
+    @Test
     public void testRemoveBlackListPattern()
         throws Exception
     {
@@ -271,6 +280,7 @@ public class AddProxyConnectorActionTest
         assertEquals( "Should have left 1 blacklist pattern", "**/*.war", connector.getBlackListPatterns().get( 0 ) );
     }
 
+    @Test
     public void testRemoveProperty()
         throws Exception
     {
@@ -317,6 +327,7 @@ public class AddProxyConnectorActionTest
         assertEquals( "Should have left 1 property", "general-tso", connector.getProperties().get( "username" ) );
     }
 
+    @Test
     public void testRemoveWhiteListPattern()
         throws Exception
     {
@@ -363,6 +374,7 @@ public class AddProxyConnectorActionTest
         assertEquals( "Should have left 1 whitelist pattern", "javax/**/*", connector.getWhiteListPatterns().get( 0 ) );
     }
 
+    @Test
     public void testSecureActionBundle()
         throws Exception
     {
index 783cea8e70b8589eb2365838e54a089f22873e5c..ded32ea66793b56978245627cdbb9a9affa16f0d 100644 (file)
@@ -32,7 +32,8 @@ import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.archiva.web.action.AbstractWebworkTestCase;
 import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
 import org.easymock.MockControl;
-
+import org.junit.Before;
+import org.junit.Test;
 /**
  * DeleteProxyConnectorActionTest
  *
@@ -52,7 +53,8 @@ public class DeleteProxyConnectorActionTest
     private ArchivaConfiguration archivaConfiguration;
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -68,7 +70,8 @@ public class DeleteProxyConnectorActionTest
         ( (DefaultProxyConnectorAdmin) action.getProxyConnectorAdmin() ).setArchivaConfiguration(
             archivaConfiguration );
     }
-
+    
+    @Test
     public void testConfirmDelete()
         throws Exception
     {
@@ -84,6 +87,7 @@ public class DeleteProxyConnectorActionTest
         assertNoErrors( action );
     }
 
+    @Test
     public void testConfirmDeleteBadSourceOrTarget()
         throws Exception
     {
@@ -118,6 +122,7 @@ public class DeleteProxyConnectorActionTest
         assertHasErrors( action );
     }
 
+    @Test
     public void testConfirmDeleteNoSourceOrTarget()
         throws Exception
     {
@@ -152,6 +157,7 @@ public class DeleteProxyConnectorActionTest
         assertHasErrors( action );
     }
 
+    @Test
     public void testDelete()
         throws Exception
     {
@@ -177,6 +183,7 @@ public class DeleteProxyConnectorActionTest
         assertEquals( 0, archivaConfiguration.getConfiguration().getProxyConnectors().size() );
     }
 
+    @Test
     public void testSecureActionBundle()
         throws Exception
     {
index 679f548a5243db05470f6acb4c9c86bdfd5ba40e..c5ca578656d72700915e6016be233c4b0e909c44 100644 (file)
@@ -31,6 +31,8 @@ import org.apache.archiva.web.action.AbstractWebworkTestCase;
 import org.apache.archiva.redback.components.registry.RegistryException;
 import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
 import org.easymock.MockControl;
+import org.junit.Before;
+import org.junit.Test;
 
 public class DisableProxyConnectorActionTest
     extends AbstractWebworkTestCase
@@ -46,7 +48,8 @@ public class DisableProxyConnectorActionTest
     private ArchivaConfiguration archivaConfiguration;
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -62,6 +65,7 @@ public class DisableProxyConnectorActionTest
         ( (DefaultProxyConnectorAdmin) action.getProxyConnectorAdmin() ).setArchivaConfiguration( archivaConfiguration );
     }
 
+    @Test
     public void testConfirmDisableBadSourceOrTarget()
         throws Exception
     {
@@ -96,6 +100,7 @@ public class DisableProxyConnectorActionTest
         assertHasErrors( action );
     }
 
+    @Test
     public void testConfirmDisableNoSourceOrTarget()
         throws Exception
     {
@@ -130,6 +135,7 @@ public class DisableProxyConnectorActionTest
         assertHasErrors( action );
     }
 
+    @Test
     public void testDelete()
         throws Exception
     {
@@ -158,6 +164,7 @@ public class DisableProxyConnectorActionTest
         assertTrue( config.isDisabled() );
     }
 
+    @Test
     public void testSecureActionBundle()
         throws Exception
     {
@@ -169,6 +176,7 @@ public class DisableProxyConnectorActionTest
         assertEquals( 1, bundle.getAuthorizationTuples().size() );
     }
 
+    @Test
     public void testConfirmEnable()
         throws Exception
     {
index 6350b633b99a68d9d1b8084cfc53fe964ba40657..2f2a2a45e9a4631c8e21d9ca881433f9e38985d0 100644 (file)
@@ -43,6 +43,8 @@ import org.easymock.MockControl;
 
 import java.util.List;
 import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * EditProxyConnectorActionTest
@@ -63,7 +65,8 @@ public class EditProxyConnectorActionTest
     private ArchivaConfiguration archivaConfiguration;
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -112,6 +115,7 @@ public class EditProxyConnectorActionTest
             archivaConfiguration );
     }
 
+    @Test
     public void testAddBlackListPattern()
         throws Exception
     {
@@ -145,6 +149,7 @@ public class EditProxyConnectorActionTest
         assertEquals( 1, connector.getBlackListPatterns().size() );
     }
 
+    @Test
     public void testAddProperty()
         throws Exception
     {
@@ -180,6 +185,7 @@ public class EditProxyConnectorActionTest
         assertEquals( "gramov-a-bits", connector.getProperties().get( "eat-a" ) );
     }
 
+    @Test
     public void testAddWhiteListPattern()
         throws Exception
     {
@@ -214,6 +220,7 @@ public class EditProxyConnectorActionTest
     }
 
     @SuppressWarnings( "unchecked" )
+    @Test
     public void testEditProxyConnectorCommit()
         throws Exception
     {
@@ -250,6 +257,7 @@ public class EditProxyConnectorActionTest
 
     }
 
+    @Test
     public void testEditProxyConnectorInitialPage()
         throws Exception
     {
@@ -266,6 +274,7 @@ public class EditProxyConnectorActionTest
         assertEquals( Action.INPUT, status );
     }
 
+    @Test
     public void testRemoveBlackListPattern()
         throws Exception
     {
@@ -314,6 +323,7 @@ public class EditProxyConnectorActionTest
         assertEquals( "Should have left 1 blacklist pattern", "**/*.war", connector.getBlackListPatterns().get( 0 ) );
     }
 
+    @Test
     public void testRemoveProperty()
         throws Exception
     {
@@ -362,6 +372,7 @@ public class EditProxyConnectorActionTest
         assertEquals( "Should have left 1 property", "general-tso", connector.getProperties().get( "username" ) );
     }
 
+    @Test
     public void testRemoveWhiteListPattern()
         throws Exception
     {
@@ -410,6 +421,7 @@ public class EditProxyConnectorActionTest
         assertEquals( "Should have left 1 whitelist pattern", "javax/**/*", connector.getWhiteListPatterns().get( 0 ) );
     }
 
+    @Test
     public void testSecureActionBundle()
         throws Exception
     {
index 7797ccf3eb8b970e6d2913c3ac0f2aa5bef407d1..cac2a6ac79d8057d0c96a3b82d6bdb4562a6807c 100644 (file)
@@ -30,6 +30,8 @@ import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
 import org.apache.archiva.web.action.AbstractWebworkTestCase;
 import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
 import org.easymock.MockControl;
+import org.junit.Before;
+import org.junit.Test;
 
 public class EnableProxyConnectorActionTest
     extends AbstractWebworkTestCase
@@ -45,7 +47,8 @@ public class EnableProxyConnectorActionTest
     private ArchivaConfiguration archivaConfiguration;
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -69,6 +72,7 @@ public class EnableProxyConnectorActionTest
         archivaConfiguration.save( config );
     }
 
+    @Test
     public void testConfirmDeleteBadSourceOrTarget()
         throws Exception
     {
@@ -103,6 +107,7 @@ public class EnableProxyConnectorActionTest
         assertHasErrors( action );
     }
 
+    @Test
     public void testConfirmEnableNoSourceOrTarget()
         throws Exception
     {
@@ -137,6 +142,7 @@ public class EnableProxyConnectorActionTest
         assertHasErrors( action );
     }
 
+    @Test
     public void testEnable()
         throws Exception
     {
@@ -165,6 +171,7 @@ public class EnableProxyConnectorActionTest
         assertFalse( config.isDisabled() );
     }
 
+    @Test
     public void testSecureActionBundle()
         throws Exception
     {
@@ -176,6 +183,7 @@ public class EnableProxyConnectorActionTest
         assertEquals( 1, bundle.getAuthorizationTuples().size() );
     }
 
+    @Test
     public void testConfirmEnable()
         throws Exception
     {
index e76abcec9aacaa29ee959d0a6dbfe76f6a3c094c..b6d042e050e7846b55593bae454824c2bd909df8 100644 (file)
@@ -33,6 +33,8 @@ import org.apache.archiva.web.action.AbstractWebworkTestCase;
 import org.apache.archiva.redback.components.registry.RegistryException;
 import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
 import org.easymock.MockControl;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * ProxyConnectorsActionTest
@@ -55,7 +57,8 @@ public class ProxyConnectorsActionTest
     private ArchivaConfiguration archivaConfiguration;
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -72,6 +75,7 @@ public class ProxyConnectorsActionTest
             archivaConfiguration );
     }
 
+    @Test
     public void testSecureActionBundle()
         throws Exception
     {
@@ -84,6 +88,7 @@ public class ProxyConnectorsActionTest
         assertEquals( 1, bundle.getAuthorizationTuples().size() );
     }
 
+    @Test
     public void testExecute()
         throws Exception
     {
index 702a72ba4df26a0dd5b9825ccef6405a71457e38..5d23fc34805e77a5761c32ba9313a4eff792521e 100644 (file)
@@ -38,6 +38,8 @@ import org.easymock.MockControl;
 
 import java.util.Collections;
 import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * SortProxyConnectorsActionTest
@@ -62,7 +64,8 @@ public class SortProxyConnectorsActionTest
     private ArchivaConfiguration archivaConfiguration;
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -90,6 +93,7 @@ public class SortProxyConnectorsActionTest
         archivaConfiguration.save( config );
     }
 
+    @Test
     public void testSecureActionBundle()
         throws Exception
     {
@@ -101,6 +105,7 @@ public class SortProxyConnectorsActionTest
         assertEquals( 1, bundle.getAuthorizationTuples().size() );
     }
 
+    @Test
     public void testSortDown()
         throws Exception
     {
@@ -115,6 +120,7 @@ public class SortProxyConnectorsActionTest
         assertOrder( new String[]{ JAVAX, CENTRAL, CODEHAUS } );
     }
 
+    @Test
     public void testSortDownPastEnd()
         throws Exception
     {
@@ -131,6 +137,7 @@ public class SortProxyConnectorsActionTest
         assertOrder( new String[]{ CENTRAL, JAVAX, CODEHAUS } );
     }
 
+    @Test
     public void testSortUp()
         throws Exception
     {
@@ -145,6 +152,7 @@ public class SortProxyConnectorsActionTest
         assertOrder( new String[]{ CENTRAL, CODEHAUS, JAVAX } );
     }
 
+    @Test
     public void testSortUpPastBeginning()
         throws Exception
     {
index b0803a6b8423f7f50a6e730e1ee0ece969bba99c..5a5f8f99b32026ec79a1f006dad5510cd86ef93b 100644 (file)
@@ -29,7 +29,11 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class AddLegacyArtifactPathActionTest
     extends TestCase
 {
@@ -67,6 +71,7 @@ public class AddLegacyArtifactPathActionTest
     private ActionValidatorManager actionValidatorManager;
 
     @Override
+    @Before
     public void setUp()
         throws Exception
     {
@@ -77,6 +82,7 @@ public class AddLegacyArtifactPathActionTest
         actionValidatorManager = factory.createDefaultActionValidatorManager();
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithNullInputs()
         throws Exception
     {
@@ -120,6 +126,7 @@ public class AddLegacyArtifactPathActionTest
         ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithBlankInputs()
         throws Exception
     {
@@ -163,6 +170,7 @@ public class AddLegacyArtifactPathActionTest
         ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithInvalidInputs()
         throws Exception
     {
@@ -218,6 +226,7 @@ public class AddLegacyArtifactPathActionTest
         ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithValidInputs()
         throws Exception
     {
index f4aaf278d6c8c177b732161e525bbc1940808e10..041f94922fbda88bbe7f0115ce57e5f87e085e30 100644 (file)
@@ -29,7 +29,11 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class ConfigureNetworkProxyActionTest extends TestCase
 {
     private static final String EMPTY_STRING = "";
@@ -64,6 +68,7 @@ public class ConfigureNetworkProxyActionTest extends TestCase
     private ActionValidatorManager actionValidatorManager;
     
     @Override
+    @Before
     public void setUp()
         throws Exception
     {
@@ -74,6 +79,7 @@ public class ConfigureNetworkProxyActionTest extends TestCase
         actionValidatorManager = factory.createDefaultActionValidatorManager();
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithNullInputs() throws Exception
     {
         // prep
@@ -107,6 +113,7 @@ public class ConfigureNetworkProxyActionTest extends TestCase
         ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors);
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithBlankInputs() throws Exception
     {
         // prep
@@ -140,6 +147,7 @@ public class ConfigureNetworkProxyActionTest extends TestCase
         ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors);
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithInvalidInputs() throws Exception
     {
         // prep
@@ -183,6 +191,7 @@ public class ConfigureNetworkProxyActionTest extends TestCase
         ValidatorUtil.assertFieldErrors(expectedFieldErrors, fieldErrors);
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithValidInputs() throws Exception
     {
         // prep
index 41a3a25e6491e9bd304c90d53e62235e289a0814..892fa54b63f78a83ed0a62646e7e50cf7bc79d63 100644 (file)
@@ -25,7 +25,11 @@ import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.struts2.StrutsSpringTestCase;
 
 import java.io.File;
-
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public abstract class AbstractManagedRepositoryActionTest
     extends StrutsSpringTestCase
 {
@@ -71,7 +75,8 @@ public abstract class AbstractManagedRepositoryActionTest
     }
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
index 2c0266d2be82150fa71dcc4a73a6491c1c7299a9..46622989c8257f3f01896e06993b529c3d329484 100644 (file)
@@ -42,6 +42,8 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * AddManagedRepositoryActionTest
@@ -71,7 +73,8 @@ public class AddManagedRepositoryActionTest
 
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -111,6 +114,7 @@ public class AddManagedRepositoryActionTest
 
     }
 
+    @Test
     public void testSecureActionBundle()
         throws SecureActionException
     {
@@ -124,6 +128,7 @@ public class AddManagedRepositoryActionTest
         assertEquals( 1, bundle.getAuthorizationTuples().size() );
     }
 
+    @Test
     public void testAddRepositoryInitialPage()
         throws Exception
     {
@@ -153,6 +158,7 @@ public class AddManagedRepositoryActionTest
         assertFalse( configuration.isSnapshots() );
     }
 
+    @Test
     public void testAddRepository()
         throws Exception
     {
@@ -216,6 +222,7 @@ public class AddManagedRepositoryActionTest
     }
 
 
+    @Test
     public void testAddRepositoryExistingLocation()
         throws Exception
     {
@@ -242,6 +249,7 @@ public class AddManagedRepositoryActionTest
         registryControl.verify();
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithNullInputs()
         throws Exception
     {
@@ -277,6 +285,7 @@ public class AddManagedRepositoryActionTest
         ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithBlankInputs()
         throws Exception
     {
@@ -313,6 +322,7 @@ public class AddManagedRepositoryActionTest
         ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithInvalidInputs()
         throws Exception
     {
@@ -366,6 +376,7 @@ public class AddManagedRepositoryActionTest
         ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithValidInputs()
         throws Exception
     {
index 65e6c0002531bebc611a2a3122793bcd7ab3d05d..5b279bacf1239b2900c48156fd8f032c255e7b6f 100644 (file)
@@ -29,6 +29,8 @@ import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
 import org.easymock.MockControl;
 
 import java.util.Collections;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * AddRemoteRepositoryActionTest
@@ -46,7 +48,9 @@ public class AddRemoteRepositoryActionTest
 
     private static final String REPO_ID = "remote-repo-ident";
 
-    protected void setUp()
+    @Override
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -60,6 +64,7 @@ public class AddRemoteRepositoryActionTest
             archivaConfiguration );
     }
 
+    @Test
     public void testSecureActionBundle()
         throws Exception
     {
@@ -73,6 +78,7 @@ public class AddRemoteRepositoryActionTest
         assertEquals( 1, bundle.getAuthorizationTuples().size() );
     }
 
+    @Test
     public void testAddRemoteRepositoryInitialPage()
         throws Exception
     {
@@ -89,6 +95,7 @@ public class AddRemoteRepositoryActionTest
         assertEquals( Action.INPUT, status );
     }
 
+    @Test
     public void testAddRemoteRepository()
         throws Exception
     {
index 8c17ef2526d74721a44eda76de24e4b1904794db..f38910b6b76a1af5a2ce2131c52004a34e26796a 100644 (file)
@@ -53,6 +53,8 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
 
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -89,7 +91,9 @@ public class DeleteManagedRepositoryActionTest
 
     private MockControl metadataRepositoryControl;
 
-    protected void setUp()
+    @Override
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -129,6 +133,7 @@ public class DeleteManagedRepositoryActionTest
         metadataRepositoryControl.replay();
     }
 
+    @Test
     public void testSecureActionBundle()
         throws SecureActionException, RepositoryAdminException
     {
@@ -142,6 +147,7 @@ public class DeleteManagedRepositoryActionTest
         assertEquals( 1, bundle.getAuthorizationTuples().size() );
     }
 
+    @Test
     public void testDeleteRepositoryAndReposUnderRepoGroup()
         throws Exception
     {
@@ -172,6 +178,7 @@ public class DeleteManagedRepositoryActionTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testDeleteRepositoryConfirmation()
         throws Exception
     {
@@ -207,6 +214,7 @@ public class DeleteManagedRepositoryActionTest
                       action.getManagedRepositoryAdmin().getManagedRepositories() );
     }
 
+    @Test
     public void testDeleteRepositoryKeepContent()
         throws Exception
     {
@@ -248,6 +256,7 @@ public class DeleteManagedRepositoryActionTest
         return control;
     }
 
+    @Test
     public void testDeleteRepositoryDeleteContent()
         throws Exception
     {
@@ -275,6 +284,7 @@ public class DeleteManagedRepositoryActionTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testDeleteRepositoryAndAssociatedProxyConnectors()
         throws Exception
     {
@@ -306,6 +316,7 @@ public class DeleteManagedRepositoryActionTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testDeleteRepositoryCancelled()
         throws Exception
     {
index f810fa8561f9b47b1fc429dc9aa00b70136eea3f..f2e555cacc7fac5c25aa5d2271dac60e0c941ebe 100644 (file)
@@ -33,6 +33,8 @@ import org.apache.archiva.web.action.AbstractActionTestCase;
 import org.easymock.MockControl;
 
 import java.util.Collections;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * DeleteRemoteRepositoryActionTest
@@ -50,7 +52,9 @@ public class DeleteRemoteRepositoryActionTest
 
     private ArchivaConfiguration archivaConfiguration;
 
-    protected void setUp()
+    @Override
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -65,6 +69,7 @@ public class DeleteRemoteRepositoryActionTest
             archivaConfiguration );
     }
 
+    @Test
     public void testDeleteRemoteRepositoryConfirmation()
         throws Exception
     {
@@ -92,6 +97,7 @@ public class DeleteRemoteRepositoryActionTest
                       action.getRemoteRepositoryAdmin().getRemoteRepositories() );
     }
 
+    @Test
     public void testDeleteRemoteRepository()
         throws org.apache.archiva.redback.components.registry.RegistryException, IndeterminateConfigurationException, RepositoryAdminException
     {
@@ -123,6 +129,7 @@ public class DeleteRemoteRepositoryActionTest
         assertEquals( 0, configuration.getProxyConnectors().size() );
     }
 
+    @Test
     public void testDeleteRemoteRepositoryCancelled()
         throws Exception
     {
index 74976d5e5369bc6574f7fe03742b0caf20cf8a69..81ef1b95b56570a222b2d3cc4cb078362cc97a16 100644 (file)
@@ -32,6 +32,8 @@ import org.apache.archiva.redback.integration.interceptor.SecureActionException;
 import org.easymock.MockControl;
 
 import java.util.Collections;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * DeleteRepositoryGroupActionTest
@@ -47,7 +49,9 @@ public class DeleteRepositoryGroupActionTest
 
     private ArchivaConfiguration archivaConfiguration;
 
-    protected void setUp()
+    @Override
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -61,6 +65,7 @@ public class DeleteRepositoryGroupActionTest
             archivaConfiguration );
     }
 
+    @Test
     public void testSecureActionBundle()
         throws SecureActionException, RepositoryAdminException
     {
@@ -74,6 +79,7 @@ public class DeleteRepositoryGroupActionTest
         assertEquals( 1, bundle.getAuthorizationTuples().size() );
     }
 
+    @Test
     public void testDeleteRepositoryGroupConfirmation()
         throws Exception
     {
@@ -94,6 +100,7 @@ public class DeleteRepositoryGroupActionTest
         assertEquals( Collections.singletonList( origRepoGroup ), configuration.getRepositoryGroups() );
     }
 
+    @Test
     public void testDeleteRepositoryGroup()
         throws Exception
     {
@@ -118,6 +125,7 @@ public class DeleteRepositoryGroupActionTest
         assertTrue( configuration.getRepositoryGroups().isEmpty() );
     }
 
+    @Test
     public void testDeleteRepositoryGroupCancelled()
         throws Exception
     {
index 1bb9d6679c12c6f3d4a602489abc60a8bb417a79..641a6e96875a212c2254a68d4eacacbed3c117c0 100644 (file)
@@ -53,11 +53,17 @@ import java.util.Map;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 /**
  * EditManagedRepositoryActionTest
  *
  * @version $Id$
  */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class EditManagedRepositoryActionTest
     extends AbstractManagedRepositoryActionTest
 {
@@ -82,7 +88,8 @@ public class EditManagedRepositoryActionTest
     private RepositoryArchivaTaskScheduler repositoryTaskScheduler;
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -133,6 +140,7 @@ public class EditManagedRepositoryActionTest
 
     }
 
+    @Test
     public void testSecureActionBundle()
         throws SecureActionException, RepositoryAdminException
     {
@@ -146,6 +154,7 @@ public class EditManagedRepositoryActionTest
         assertEquals( 1, bundle.getAuthorizationTuples().size() );
     }
 
+    @Test
     public void testEditRepositoryInitialPage()
         throws Exception
     {
@@ -176,6 +185,7 @@ public class EditManagedRepositoryActionTest
         assertRepositoryEquals( repository, createRepository() );
     }
 
+    @Test
     public void testEditRepository()
         throws Exception
     {
@@ -285,6 +295,7 @@ public class EditManagedRepositoryActionTest
         registryControl.verify();
     }
 
+    @Test
     public void testEditRepositoryLocationChanged()
         throws Exception
     {
@@ -387,6 +398,7 @@ public class EditManagedRepositoryActionTest
         registryControl.verify();
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithNullInputs()
         throws Exception
     {
@@ -422,6 +434,7 @@ public class EditManagedRepositoryActionTest
         ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithBlankInputs()
         throws Exception
     {
@@ -458,6 +471,7 @@ public class EditManagedRepositoryActionTest
         ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithInvalidInputs()
         throws Exception
     {
@@ -511,6 +525,7 @@ public class EditManagedRepositoryActionTest
         ValidatorUtil.assertFieldErrors( expectedFieldErrors, fieldErrors );
     }
 
+    @Test
     public void testStruts2ValidationFrameworkWithValidInputs()
         throws Exception
     {
index 53ca83b95eb33ee20fc1ba7ae91ba8a990fec2b7..99ff981b331974253670f6931e864107c8580fdc 100644 (file)
@@ -33,11 +33,16 @@ import org.easymock.MockControl;
 
 import java.util.Collections;
 
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 /**
  * EditRemoteRepositoryActionTest
  *
  * @version $Id$
  */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class EditRemoteRepositoryActionTest
     extends StrutsSpringTestCase
 {
@@ -55,7 +60,9 @@ public class EditRemoteRepositoryActionTest
         return new String[]{ "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" };
     }
 
-    protected void setUp()
+    @Before
+    @Override
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -69,6 +76,7 @@ public class EditRemoteRepositoryActionTest
             archivaConfiguration );
     }
 
+    @Test
     public void testEditRemoteRepository()
         throws Exception
     {
@@ -98,6 +106,7 @@ public class EditRemoteRepositoryActionTest
         archivaConfigurationControl.verify();
     }
 
+    @Test
     public void testEditRemoteRepositoryInitialPage()
         throws Exception
     {
@@ -121,6 +130,7 @@ public class EditRemoteRepositoryActionTest
         assertRepositoryEquals( repository, createRepository() );
     }
 
+    @Test
     public void testSecureActionBundle()
         throws SecureActionException, RepositoryAdminException
     {
index 8840ef5341dd2634e79bee7a44d48ba2722f4c8e..40bdf94cb5523cbfc1e96398a28ad74363a8ac20 100644 (file)
@@ -41,10 +41,15 @@ import java.util.Arrays;
 
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 /**
  * Test the repositories action returns the correct data.
  */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class RepositoriesActionTest
     extends StrutsSpringTestCase
 {
@@ -54,7 +59,9 @@ public class RepositoriesActionTest
 
     ArchivaConfiguration originalArchivaConfiguration;
 
-    protected void setUp()
+    @Override
+    @Before
+    public void setUp()
         throws Exception
     {
 
@@ -73,7 +80,8 @@ public class RepositoriesActionTest
 
 
     @Override
-    protected void tearDown()
+    @After
+    public void tearDown()
         throws Exception
     {
         super.tearDown();
@@ -91,6 +99,7 @@ public class RepositoriesActionTest
         return new String[]{ "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" };
     }
 
+    @Test
     public void testGetRepositories()
         throws Exception
     {
@@ -145,6 +154,7 @@ public class RepositoriesActionTest
         }
     }
 
+    @Test
     public void testSecureActionBundle()
         throws SecureActionException
     {
index 8e5bec742ed18c1da5523a7d464b16c4d4fbc1a0..4af23936839cdf7d22dfe01b00e01966cfb61722 100644 (file)
@@ -37,6 +37,7 @@ import org.easymock.MockControl;
 
 import java.util.Collections;
 import java.util.List;
+import org.junit.Test;
 
 /**
  * RepositoryGroupsActionTest
@@ -56,7 +57,8 @@ public class RepositoryGroupsActionTest
 
     private ArchivaConfiguration archivaConfiguration;
 
-    protected void setUp()
+    @Override
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -72,6 +74,7 @@ public class RepositoryGroupsActionTest
             archivaConfiguration );
     }
 
+    @Test
     public void testSecureActionBundle()
         throws SecureActionException, RepositoryAdminException
     {
@@ -85,6 +88,7 @@ public class RepositoryGroupsActionTest
         assertEquals( 1, bundle.getAuthorizationTuples().size() );
     }
 
+    @Test
     public void testAddRepositoryGroup()
         throws Exception
     {
@@ -108,6 +112,7 @@ public class RepositoryGroupsActionTest
         archivaConfigurationControl.verify();
     }
 
+    @Test
     public void testAddEmptyRepositoryGroup()
         throws Exception
     {
@@ -127,6 +132,7 @@ public class RepositoryGroupsActionTest
         assertEquals( 0, configuration.getRepositoryGroups().size() );
     }
 
+    @Test
     public void testAddDuplicateRepositoryGroup()
         throws Exception
     {
@@ -156,6 +162,7 @@ public class RepositoryGroupsActionTest
                       action.getRepositoryGroupAdmin().getRepositoriesGroups() );
     }
 
+    @Test
     public void testGetRepositoryGroups()
         throws Exception
     {
@@ -191,6 +198,7 @@ public class RepositoryGroupsActionTest
         assertEquals( REPO2_ID, repos.get( 0 ) );
     }
 
+    @Test
     public void testAddRepositoryToGroup()
         throws Exception
     {
@@ -240,6 +248,7 @@ public class RepositoryGroupsActionTest
         assertNull( action.getGroupToRepositoryMap().get( repoGroup.getId() ) );
     }
 
+    @Test
     public void testRemoveRepositoryFromGroup()
         throws Exception
     {
@@ -291,6 +300,7 @@ public class RepositoryGroupsActionTest
         assertEquals( REPO2_ID, repos.get( 1 ) );
     }
 
+    @Test
     public void testAddDuplicateRepositoryToGroup()
         throws Exception
     {
@@ -327,6 +337,7 @@ public class RepositoryGroupsActionTest
         assertEquals( Action.ERROR, result );
     }
 
+    @Test
     public void testRemoveRepositoryNotInGroup()
         throws Exception
     {
index 79a4b99b2d653de8a6f2cb9bcfd856cd3290517b..199ee9067534a39685c4147e6440cf6b1265c354 100644 (file)
@@ -28,9 +28,15 @@ import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
 import org.apache.archiva.redback.integration.interceptor.SecureActionException;
 import org.easymock.MockControl;
 
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 /**
  * SortRepositoriesActionTest
  */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class SortRepositoriesActionTest
     extends StrutsSpringTestCase
 {
@@ -56,7 +62,9 @@ public class SortRepositoriesActionTest
         return new String[]{ "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" };
     }
 
-    protected void setUp()
+    @Before
+    @Override
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -68,13 +76,15 @@ public class SortRepositoriesActionTest
     }
 
     @Override
-    protected void tearDown()
+    @After
+    public void tearDown()
         throws Exception
     {
         super.tearDown();
         action.archivaConfiguration = originalArchivaConfiguration;
     }
 
+    @Test
     public void testSecureActionBundle()
         throws SecureActionException
     {
@@ -87,6 +97,7 @@ public class SortRepositoriesActionTest
         assertEquals( 1, bundle.getAuthorizationTuples().size() );
     }
 
+    @Test
     public void testSortDownFirstRepository()
         throws Exception
     {
@@ -121,6 +132,7 @@ public class SortRepositoriesActionTest
         assertEquals( REPO3_ID, repositories.get( 2 ) );
     }
 
+    @Test
     public void testSortDownLastRepository()
         throws Exception
     {
@@ -155,6 +167,7 @@ public class SortRepositoriesActionTest
         assertEquals( REPO3_ID, repositories.get( 2 ) );
     }
 
+    @Test
     public void testSortUpLastRepository()
         throws Exception
     {
@@ -189,6 +202,7 @@ public class SortRepositoriesActionTest
         assertEquals( REPO2_ID, repositories.get( 2 ) );
     }
 
+    @Test
     public void testSortUpFirstRepository()
         throws Exception
     {
index ce97851c15a4ceac6e62d049c61fbfed3649fded..ac4be6f5311cc05e17b3a53e240bf929939d1089 100644 (file)
@@ -9,6 +9,8 @@ import org.easymock.MockControl;
 
 import java.util.ArrayList;
 import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -40,7 +42,9 @@ public class RepositoryScanningActionTest
 
     private Configuration config;
 
-    protected void setUp()
+    @Override
+    @Before
+    public void setUp()
         throws Exception
     {
 
@@ -65,6 +69,7 @@ public class RepositoryScanningActionTest
 
     }
 
+    @Test
     public void testUpdateKnownConsumers()
         throws Exception
     {
@@ -90,6 +95,7 @@ public class RepositoryScanningActionTest
         assertEquals( "results " + results, 8, results.size() );
     }
 
+    @Test
     public void testDisableAllKnownConsumers()
         throws Exception
     {
index 354032e5b0fc69681c1b992a4c9512243c589688..b5e015ec93b13b784dba47dfc8b215268e73c876 100644 (file)
@@ -44,6 +44,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import org.junit.Test;
 
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -76,7 +77,7 @@ public class GenerateReportActionTest
 
 
     @Override
-    protected void setUp()
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -101,6 +102,8 @@ public class GenerateReportActionTest
         factory.setRepositorySession( repositorySession );
     }
 
+    
+    @Override
     @After
     public void tearDown()
         throws Exception
@@ -149,6 +152,7 @@ public class GenerateReportActionTest
         assertEquals( availableRepositories, action.getAvailableRepositories() );
     }
 
+    @Test
     public void testGenerateStatisticsInvalidRowCount()
         throws Exception
     {
@@ -162,6 +166,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testGenerateStatisticsInvalidEndDate()
         throws Exception
     {
@@ -176,6 +181,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testGenerateStatisticsMalformedEndDate()
         throws Exception
     {
@@ -191,6 +197,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testGenerateStatisticsInvalidEndDateMultiRepo()
         throws Exception
     {
@@ -205,6 +212,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testGenerateStatisticsMalformedEndDateMultiRepo()
         throws Exception
     {
@@ -220,6 +228,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testGenerateStatisticsNoRepos()
         throws Exception
     {
@@ -232,6 +241,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testGenerateStatisticsSingleRepo()
         throws Exception
     {
@@ -247,6 +257,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testGenerateStatisticsSingleRepoNoStats()
         throws Exception
 
@@ -264,6 +275,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testGenerateStatisticsOvershotPages()
         throws Exception
 
@@ -281,6 +293,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testGenerateStatisticsMultipleRepoNoResults()
         throws Exception
 
@@ -303,6 +316,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testGenerateStatisticsMultipleRepo()
         throws Exception
 
@@ -322,6 +336,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testDownloadStatisticsSingleRepo()
         throws Exception
     {
@@ -344,6 +359,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testDownloadStatisticsMultipleRepos()
         throws Exception
     {
@@ -365,6 +381,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testDownloadStatisticsMalformedEndDateMultiRepo()
         throws Exception
     {
@@ -380,6 +397,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testDownloadStatisticsMalformedEndDateSingleRepo()
         throws Exception
     {
@@ -395,6 +413,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testDownloadStatisticsInvalidEndDateMultiRepo()
         throws Exception
     {
@@ -409,6 +428,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testDownloadStatisticsInvalidEndDateSingleRepo()
         throws Exception
     {
@@ -423,6 +443,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testDownloadStatisticsSingleRepoNoStats()
         throws Exception
 
@@ -439,6 +460,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testDownloadStatisticsNoRepos()
         throws Exception
     {
@@ -451,6 +473,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testDownloadStatisticsMultipleRepoNoResults()
         throws Exception
 
@@ -472,6 +495,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testDownloadStatisticsMultipleRepoInStrutsFormat()
         throws Exception
     {
@@ -494,6 +518,7 @@ public class GenerateReportActionTest
         repositoryStatisticsManagerControl.verify();
     }
 
+    @Test
     public void testHealthReportSingleRepo()
         throws Exception
     {
@@ -524,6 +549,7 @@ public class GenerateReportActionTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testHealthReportInvalidRowCount()
         throws Exception
     {
@@ -542,6 +568,7 @@ public class GenerateReportActionTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testHealthReportAllRepos()
         throws Exception
     {
@@ -576,6 +603,7 @@ public class GenerateReportActionTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testHealthReportSingleRepoByCorrectGroupId()
         throws Exception
     {
@@ -606,6 +634,7 @@ public class GenerateReportActionTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testHealthReportSingleRepoByCorrectGroupIdAllRepositories()
         throws Exception
     {
@@ -641,6 +670,7 @@ public class GenerateReportActionTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testHealthReportSingleRepoByIncorrectGroupId()
         throws Exception
     {
@@ -681,6 +711,7 @@ public class GenerateReportActionTest
         return problem;
     }
 
+    @Test
     public void testHealthReportNoRepositoryId()
         throws Exception
     {
index c5c64c45a060d22acdd101f86ea449cfa88ba4e6..c4729e77bd58417d9c8bf1629ecbb71317a50d2e 100644 (file)
@@ -27,12 +27,15 @@ import java.util.zip.GZIPInputStream;
 import org.apache.commons.io.IOUtils;
 
 import junit.framework.TestCase;
-
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 /**
  * BannerTest
  *
  * @version $Id$
  */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class BannerTest
     extends TestCase
 {
@@ -43,14 +46,16 @@ public class BannerTest
         assertEquals( "Encoding: ", encoded, Banner.encode( decoded ) );
         assertEquals( "Decoding: ", decoded, Banner.decode( encoded ) );
     }
-
+    
+    @Test
     public void testEncodeDecode()
     {
         assertEncodeDecode( "[$10 ]", "[          ]" );
         assertEncodeDecode( "$$$5_$n$5_", "$_____" + eol + "_____" );
         assertEncodeDecode( "$${Refgjuvyr}", "${Erstwhile}" );
     }
-
+    
+    @Test
     public void testInjectVersion()
     {
         assertEquals( "[ 1.0 ]", Banner.injectVersion( "[#####]", "1.0" ) );
@@ -60,6 +65,7 @@ public class BannerTest
                       Banner.injectVersion( "Archiva:\"+eol+\" (##############)", "1.0-alpha-1" ) );
     }
 
+    @Test
     public void testGetBanner()
         throws IOException
     {
index 5c7421c9bbad6a91bb9ee9f19eb5333d78a32331..df20e384b4f26cf2cd471a28c3f22d9dde022c85 100644 (file)
@@ -42,15 +42,15 @@ 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 java.util.List;
 import javax.inject.Inject;
+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",
     "classpath:/spring-context-DependencyTreeTest.xml"} )
 public class DependencyTreeTest
index d3249fc757471e8234c147da8bc025b76c293ee2..bbf0d30c5d5418a70c5fe604479db91a154359a2 100644 (file)
       <artifactId>httpunit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-testutil</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>  
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-repository-admin-default</artifactId>
index 67df84d1be8e38ae45da56505395ec7490dc30cd..5fb51299171da7ab7894ecc46b45ac1453f252ea 100644 (file)
@@ -40,19 +40,19 @@ 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 javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.io.IOException;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
 
 /**
  * AbstractRepositoryServletTestCase
  *
  * @version $Id$
  */
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
 @ContextConfiguration( locations = { "classpath*:/repository-servlet-simple.xml" } )
 public abstract class AbstractRepositoryServletTestCase
     extends TestCase
index b8c1f34afd825ee5cb51366639a0e7367462d8f6..f802b9747c1b6edc6c9b4c47bbfa8192e8393b2b 100644 (file)
@@ -50,18 +50,18 @@ 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 java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
 
 /**
  * ArchivaDavResourceFactoryTest
  */
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
 public class ArchivaDavResourceFactoryTest
     extends TestCase
index c0f6ab309100c4170fc08a49b695f39c90b17f3d..26a895800debbca5d08add3983815e28131ba44a 100644 (file)
@@ -20,22 +20,29 @@ package org.apache.archiva.webdav;
  */
 
 import junit.framework.TestCase;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 /**
  */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class ArchivaDavResourceLocatorTest
     extends TestCase
 {
     ArchivaDavLocatorFactory factory;
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
         factory = new ArchivaDavLocatorFactory();
     }
 
+    @Test
     public void testAvoidDoubleSlashInHref()
         throws Exception
     {
@@ -53,6 +60,7 @@ public class ArchivaDavResourceLocatorTest
         assertEquals( "/repository/internal", locator.getRepositoryPath() );
     }
 
+    @Test
     public void testLocatorWithPrefixHref()
         throws Exception
     {
@@ -70,6 +78,7 @@ public class ArchivaDavResourceLocatorTest
         assertEquals( "/repository/internal", locator.getRepositoryPath() );
     }
 
+    @Test
     public void testLocatorWithHrefThatContainsPrefix()
         throws Exception
     {
@@ -87,6 +96,7 @@ public class ArchivaDavResourceLocatorTest
         assertEquals( "/repository/internal", locator.getRepositoryPath() );
     }
 
+    @Test
     public void testLocatorWithRootHref()
         throws Exception
     {
index 64499ead3e3523ad6387332ce0d39e4286652c65..430bbdac873192d7b790df81849b77d5308ca6d9 100644 (file)
@@ -48,7 +48,12 @@ import java.security.Principal;
 import java.util.Enumeration;
 import java.util.Locale;
 import java.util.Map;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class ArchivaDavSessionProviderTest
     extends TestCase
 {
@@ -57,7 +62,8 @@ public class ArchivaDavSessionProviderTest
     private WebdavRequest request;
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -65,6 +71,7 @@ public class ArchivaDavSessionProviderTest
         request = new WebdavRequestImpl( new HttpServletRequestMock(), null );
     }
 
+    @Test
     public void testAttachSession()
         throws Exception
     {
@@ -73,6 +80,7 @@ public class ArchivaDavSessionProviderTest
         assertNotNull( request.getDavSession() );
     }
 
+    @Test
     public void testReleaseSession()
         throws Exception
     {
index 7431b013ae6d352a7ccb38d8fb2c01afdd92d028..c2bafe2a2a05b51a11eed7a3e1f3f8cbdf8a6c2c 100644 (file)
@@ -21,8 +21,14 @@ package org.apache.archiva.webdav;
 
 import junit.framework.TestCase;
 
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class ArchivaDavSessionTest extends TestCase
 {
+    @Test
     public void testTokens()
     {
         ArchivaDavSession session = new ArchivaDavSession();
@@ -36,6 +42,7 @@ public class ArchivaDavSessionTest extends TestCase
         assertEquals(0, session.getLockTokens().length);
     }
     
+    @Test
     public void testAddReferencesThrowsUnsupportedOperationException()
     {
         ArchivaDavSession session = new ArchivaDavSession();
@@ -50,6 +57,7 @@ public class ArchivaDavSessionTest extends TestCase
         } 
     }
     
+    @Test
     public void testRemoveReferencesThrowsUnsupportedOperationException()
     {
         ArchivaDavSession session = new ArchivaDavSession();
index 3b4dc1a0f65a32370c23d23f51d7269590b0d2e9..bf907bfaf5f45b11fa97c8f27f62fa58b179ddd8 100644 (file)
@@ -42,13 +42,13 @@ 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 java.io.File;
 import java.util.Collections;
+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 DavResourceTest
     extends TestCase
index 36d53492a858e9c1f8a248f17ad6a6d249210338..2ef6dae6d3f5c873ea81679f1672c486fd683daf 100644 (file)
@@ -24,16 +24,16 @@ import org.apache.archiva.webdav.util.MimeTypes;
 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;
 
 /**
  * ArchivaMimeTypesTest 
  *
  * @version $Id$
  */
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
 public class MimeTypesLoaderTest
     extends TestCase
index 56fe9567b4b0da6725b99783241503f0557d5fba..ff4f3b51b791d619c9d4f5a341695ebb40037960 100644 (file)
@@ -54,13 +54,13 @@ 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 javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
 
 /**
  * RepositoryServletSecurityTest Test the flow of the authentication and authorization checks. This does not necessarily
@@ -68,7 +68,7 @@ import java.io.InputStream;
  * 
  * @version $Id$
  */
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
 public class RepositoryServletSecurityTest
     extends TestCase
index 1c1935490b240598af3eb8303cf4cebd3b71a16a..e48685aa5d76d58c3b4c3ac11b8456e448d14801 100644 (file)
@@ -23,16 +23,16 @@ 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;
 
 /**
  * MimeTypesTest
  *
  * @version $Id: MimeTypesTest.java 6556 2007-06-20 20:44:46Z joakime $
  */
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
 public class MimeTypesTest
     extends TestCase
index 1c0ca5655a6a3625a97dbc8d5249fbf03e0959f0..0082c18023b86b57f48424e8c6c0aa99f5168397 100644 (file)
@@ -20,12 +20,17 @@ package org.apache.archiva.webdav.util;
  */
 
 import junit.framework.TestCase;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 /**
  */
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class RepositoryPathUtilTest
     extends TestCase
 {
+    @Test
     public void testGetRepositoryId()
     {
         String href = "/path/to/my/resource";
@@ -38,6 +43,7 @@ public class RepositoryPathUtilTest
         assertEquals( "/", RepositoryPathUtil.getLogicalResource( href ) );
     }
 
+    @Test
     public void testGetLogicalPath()
     {
         String href = "/repository/internal/org/apache/maven/someartifact.jar";
index cbe3affaf10de26efa62d552ce46a5441df134ee..482b2590b61d43c5e587d2935846e0d58117a4fd 100644 (file)
       <artifactId>archiva-repository-admin-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>  
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
index 2d3c9fe996c482034597b08d1784af46b1783b83..10c1486e752a32bde1be8dba5f392f8599b3ca18 100644 (file)
@@ -38,7 +38,6 @@ 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 java.util.ArrayList;
 import java.util.Arrays;
@@ -49,8 +48,9 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+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 AbstractMetadataRepositoryTest
     extends TestCase
index 52a4cfecca6526a1a5e6a98a86312df0ce8a8974..6996d45c6d740bd0b7bd3b6234646803d60009c9 100644 (file)
       <artifactId>metadata-repository-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>  
   </dependencies>
 
   <build>
index 0a39c773861a3a271e4e5e1543e3e545f2e4c6cc..19333ee142025220faf9eef958917e5ee539808e 100644 (file)
@@ -35,7 +35,12 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.TimeZone;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class AuditManagerTest
     extends TestCase
 {
@@ -69,7 +74,8 @@ public class AuditManagerTest
     }
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -83,7 +89,8 @@ public class AuditManagerTest
         repository.setId( TEST_REPO_ID );
         repository.setLocation( "" );
     }
-
+    
+    @Test
     public void testGetMostRecentEvents()
         throws Exception
     {
@@ -122,6 +129,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetMostRecentEventsLessThan10()
         throws Exception
     {
@@ -159,6 +167,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetMostRecentEventsInterleavedRepositories()
         throws Exception
     {
@@ -207,6 +216,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetMostRecentEventsWhenEmpty()
         throws Exception
 
@@ -222,6 +232,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testAddAuditEvent()
         throws Exception
 
@@ -237,6 +248,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testAddAuditEventNoRepositoryId()
         throws Exception
     {
@@ -252,6 +264,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testDeleteStats()
         throws Exception
 
@@ -265,6 +278,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetEventsRangeInside()
         throws Exception
 
@@ -298,6 +312,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetEventsRangeUpperOutside()
         throws Exception
     {
@@ -335,6 +350,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetEventsRangeLowerOutside()
         throws Exception
     {
@@ -372,6 +388,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetEventsRangeLowerAndUpperOutside()
         throws Exception
     {
@@ -415,6 +432,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetEventsWithResource()
         throws Exception
     {
@@ -458,6 +476,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetEventsWithNonExistantResource()
         throws Exception
     {
@@ -497,6 +516,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetEventsRangeMultipleRepositories()
         throws Exception
     {
@@ -546,6 +566,7 @@ public class AuditManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetEventsRangeNotInside()
         throws Exception
     {
index 47de02dea9636d3a39ca65edcb2148de8ff25c32..cb51fa248e8a92ee69803a71b522bf27b34c10ee 100644 (file)
       <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>
index f0ff715823fc39ff968bb851e591c91aa1d60ac4..39cb331d31d4bc558abc2a8cfa6258304e96f4d6 100644 (file)
@@ -34,14 +34,14 @@ 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.Collections;
+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 DependencyTreeBuilderTest
     extends TestCase
index 20b839d5e7466f085a879f8a1c22f7af27bf17bc..e39361871b044560c4407d576f1ad26afa79c1f9 100644 (file)
@@ -55,11 +55,12 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+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 class Maven2RepositoryMetadataResolverTest
     extends TestCase
index 28b15be1c8b12ce4d09219e89e2d4f909922135a..d587c2dc0e0d4656897be0dc66970c84c4ce4e53 100644 (file)
@@ -31,13 +31,14 @@ import org.junit.runners.JUnit4;
 
 import java.io.File;
 import java.util.Arrays;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
 
 /**
  * RepositoryMetadataReaderTest
  *
  * @version $Id$
  */
-@RunWith( JUnit4.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class MavenRepositoryMetadataReaderTest
     extends TestCase
 {
index 951c2e0b4423991c72d71f304656d121ce0cbd74..67ed7a038a4b069d260026628ddccd805bf6598f 100644 (file)
       <artifactId>slf4j-simple</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-testutil</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging-api</artifactId>
index 218bb3923d9bd0c324bed188dfd628a81fcf65d5..a4796a78adeb802125e403a1ff52edfd9d9ccb08 100644 (file)
       <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>javax.jcr</groupId>
       <artifactId>jcr</artifactId>
index 7dec12dc439548ae0e91f413f0a9bce2b5589d80..2a7576a1b7beb6a5f0ead61193c5dc23d91d02ab 100644 (file)
       <artifactId>archiva-consumer-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>org.mockito</groupId>
       <artifactId>mockito-all</artifactId>
index 75676975ebd11d9ee3dbf075c706e37f941cde9d..d1012afe43d2e7c350413eea3f56ea197e493f81 100644 (file)
@@ -36,7 +36,6 @@ import org.mockito.ArgumentCaptor;
 import org.mockito.Matchers;
 import org.springframework.context.ApplicationContext;
 import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -44,11 +43,12 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.util.Arrays;
 import java.util.Date;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
 
 import static org.mockito.Mockito.*;
 
 @SuppressWarnings( { "ThrowableInstanceNeverThrown" } )
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
 public class DuplicateArtifactsConsumerTest
     extends TestCase
index a5832a30805a558093b0b8d503960831e07e1659..3784367fd37142a03efb460afc88cf9d54adcab4 100644 (file)
       <artifactId>jackrabbit-jcr-commons</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>org.slf4j</groupId>
       <artifactId>jcl-over-slf4j</artifactId>
index b8105daeca2353b9a19fd416c0a1e61516cd47df..9e51faeb9d9a49d1ed429a67817cdc4050246eab 100644 (file)
@@ -39,9 +39,14 @@ import java.io.IOException;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.zip.GZIPInputStream;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import static org.mockito.Mockito.*;
-
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class JcrRepositoryStatisticsGatheringTest
     extends TestCase
 {
@@ -58,7 +63,8 @@ public class JcrRepositoryStatisticsGatheringTest
     private Session session;
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -100,7 +106,8 @@ public class JcrRepositoryStatisticsGatheringTest
     }
 
     @Override
-    protected void tearDown()
+    @After
+    public void tearDown()
         throws Exception
     {
         session.logout();
@@ -108,6 +115,7 @@ public class JcrRepositoryStatisticsGatheringTest
         super.tearDown();
     }
 
+    @Test
     public void testJcrStatisticsQuery()
         throws Exception
     {
index b7e4fae0da812171353da80531e3d5cd0c77ea8d..31903a6caaddc9bebb5aa584bfdbba3a047eda58 100644 (file)
@@ -35,7 +35,12 @@ import java.util.List;
 import java.util.Map;
 import java.util.TimeZone;
 import javax.jcr.Session;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
 public class RepositoryStatisticsManagerTest
     extends TestCase
 {
@@ -63,7 +68,8 @@ public class RepositoryStatisticsManagerTest
     }
 
     @Override
-    protected void setUp()
+    @Before
+    public void setUp()
         throws Exception
     {
         super.setUp();
@@ -74,6 +80,7 @@ public class RepositoryStatisticsManagerTest
         metadataRepository = (MetadataRepository) metadataRepositoryControl.getMock();
     }
 
+    @Test
     public void testGetLatestStats()
         throws Exception
     {
@@ -113,6 +120,7 @@ public class RepositoryStatisticsManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetLatestStatsWhenEmpty()
         throws Exception
     {
@@ -127,6 +135,7 @@ public class RepositoryStatisticsManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testAddNewStats()
         throws Exception
     {
@@ -165,6 +174,7 @@ public class RepositoryStatisticsManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testDeleteStats()
         throws Exception
     {
@@ -210,6 +220,7 @@ public class RepositoryStatisticsManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testDeleteStatsWhenEmpty()
         throws Exception
     {
@@ -229,6 +240,7 @@ public class RepositoryStatisticsManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetStatsRangeInside()
         throws Exception
     {
@@ -272,6 +284,7 @@ public class RepositoryStatisticsManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetStatsRangeUpperOutside()
         throws Exception
     {
@@ -320,6 +333,7 @@ public class RepositoryStatisticsManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetStatsRangeLowerOutside()
         throws Exception
     {
@@ -368,6 +382,7 @@ public class RepositoryStatisticsManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetStatsRangeLowerAndUpperOutside()
         throws Exception
     {
@@ -422,6 +437,7 @@ public class RepositoryStatisticsManagerTest
         metadataRepositoryControl.verify();
     }
 
+    @Test
     public void testGetStatsRangeNotInside()
         throws Exception
     {
index 57ebe1cf1147485fdf0bd7f1e73b1eecbb444903..8e4222520517df1ff6c0c5a0f9a11a3f8e49f0ba 100644 (file)
       <artifactId>wagon-http-lightweight</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-testutil</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <build>
     <plugins>
index a5f183c29dc771309ec88ba9f6ba1d47a7da4bb5..a5f864de96aadba543a37dad93b9705a3066059d 100644 (file)
@@ -31,16 +31,16 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.MockitoAnnotations;
 import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
 import javax.inject.Inject;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
 
 import static org.mockito.Mockito.*;
 
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
 public class Maven2RepositoryMergerTest
     extends TestCase
@@ -57,6 +57,7 @@ public class Maven2RepositoryMergerTest
     private MetadataRepository metadataRepository;
 
     @Before
+    @Override
     public void setUp()
         throws Exception
     {
diff --git a/pom.xml b/pom.xml
index 8ecff37fa2782575d88e440372c16e3d4c1a1af4..7fc1ee41ddbb2ce26ae3cfd28596c99648aa20fb 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -38,6 +38,7 @@
   <url>http://archiva.apache.org</url>
 
   <modules>
+    <module>archiva-testutil</module>
     <module>archiva-cli</module>
     <module>archiva-modules</module>
     <module>archiva-docs</module>