aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-07-02 07:36:23 +0000
committerOlivier Lamy <olamy@apache.org>2012-07-02 07:36:23 +0000
commit1484a3316addf47d88f4f05191ae4e570871eda7 (patch)
tree596b70b3f0975c00274bc3d2b2580092cc1390f5
parente3885c59da2e4748e2ba494f3901902be0470067 (diff)
downloadarchiva-1484a3316addf47d88f4f05191ae4e570871eda7.tar.gz
archiva-1484a3316addf47d88f4f05191ae4e570871eda7.zip
[MRM-1638] Improve unit test for archiva build
Based on patch provided by Eric Barboni. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1356091 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-base/archiva-artifact-converter/pom.xml5
-rw-r--r--archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-checksum/pom.xml7
-rw-r--r--archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java7
-rw-r--r--archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumAlgorithmTest.java9
-rw-r--r--archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumTest.java6
-rw-r--r--archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksummedFileTest.java17
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/pom.xml17
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java5
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ConfigurationTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/FileTypesTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/LegacyArtifactPathTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/MavenProxyPropertyLoaderTest.java3
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java7
-rw-r--r--archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java5
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml5
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java8
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml5
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-converter/pom.xml7
-rw-r--r--archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/archiva/converter/RepositoryConverterTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/pom.xml5
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java3
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java4
-rwxr-xr-xarchiva-modules/archiva-base/archiva-model/pom.xml5
-rw-r--r--archiva-modules/archiva-base/archiva-model/src/test/java/org/apache/archiva/model/RepositoryURLTest.java12
-rw-r--r--archiva-modules/archiva-base/archiva-policies/pom.xml7
-rw-r--r--archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/CachedFailuresPolicyTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ChecksumPolicyTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ReleasePolicyTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/SnapshotsPolicyTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-common/pom.xml7
-rw-r--r--archiva-modules/archiva-base/archiva-proxy-common/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/pom.xml7
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java3
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml6
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/pom.xml7
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/AbstractRepositoryLayerTestCase.java4
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/RepositoryURLTest.java12
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/FilenameParserTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/pom.xml5
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java4
-rw-r--r--archiva-modules/archiva-base/archiva-transaction/pom.xml5
-rw-r--r--archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/AbstractFileEventTest.java6
-rw-r--r--archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java16
-rw-r--r--archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java9
-rw-r--r--archiva-modules/archiva-base/archiva-xml-tools/pom.xml6
-rw-r--r--archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/AbstractArchivaXmlTestCase.java3
-rw-r--r--archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntitiesTest.java5
-rw-r--r--archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java11
-rw-r--r--archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLReaderTest.java8
-rw-r--r--archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLWriterTest.java2
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml8
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java4
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java4
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml7
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorAbstractTest.java8
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase1Test.java3
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java4
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml7
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java3
-rw-r--r--archiva-modules/archiva-web/archiva-rss/pom.xml6
-rw-r--r--archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/RssFeedGeneratorTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-security/pom.xml6
-rw-r--r--archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/RoleManagerTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/pom.xml6
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/pom.xml7
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/src/test/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoServiceTest.java3
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/pom.xml8
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/AbstractDownloadTest.java3
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadArtifactsTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractActionTestCase.java12
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractWebworkTestCase.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/BrowseActionTest.java22
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/DeleteArtifactActionTest.java14
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/SearchActionTest.java16
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/ShowArtifactActionTest.java22
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/UploadActionTest.java12
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/AbstractOrganizationInfoActionTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/EditOrganizationInfoActionTest.java8
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/OrganizationInfoActionTest.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java14
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.java13
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.java10
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java14
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorActionTest.java10
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java7
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsActionTest.java10
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/legacy/AddLegacyArtifactPathActionTest.java11
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyActionTest.java11
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AbstractManagedRepositoryActionTest.java9
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java13
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java9
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java13
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java9
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.java10
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java17
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.java12
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/RepositoriesActionTest.java16
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java13
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/SortRepositoriesActionTest.java18
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/scanning/RepositoryScanningActionTest.java8
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/reports/GenerateReportActionTest.java33
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/startup/BannerTest.java12
-rw-r--r--archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/tags/DependencyTreeTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/pom.xml6
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceLocatorTest.java12
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java10
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionTest.java8
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/MimeTypesLoaderTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MimeTypesTest.java4
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/RepositoryPathUtilTest.java6
-rw-r--r--archiva-modules/metadata/metadata-repository-api/pom.xml7
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java4
-rw-r--r--archiva-modules/plugins/audit/pom.xml7
-rw-r--r--archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java25
-rw-r--r--archiva-modules/plugins/maven2-repository/pom.xml5
-rw-r--r--archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilderTest.java4
-rw-r--r--archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java3
-rw-r--r--archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/MavenRepositoryMetadataReaderTest.java3
-rw-r--r--archiva-modules/plugins/metadata-store-file/pom.xml6
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/pom.xml7
-rw-r--r--archiva-modules/plugins/problem-reports/pom.xml7
-rw-r--r--archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java4
-rw-r--r--archiva-modules/plugins/repository-statistics/pom.xml7
-rw-r--r--archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java14
-rw-r--r--archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java18
-rw-r--r--archiva-modules/plugins/stage-repository-merge/pom.xml6
-rw-r--r--archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java5
-rw-r--r--pom.xml1
146 files changed, 844 insertions, 237 deletions
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml
index e9b210646..edc637b51 100644
--- a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml
+++ b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml
@@ -76,8 +76,9 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java
index 5b8a6dd24..b6636f6a4 100644
--- a/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java
+++ b/archiva-modules/archiva-base/archiva-artifact-converter/src/test/java/org/apache/archiva/converter/artifact/LegacyToDefaultConverterTest.java
@@ -36,7 +36,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
@@ -47,13 +46,14 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* LegacyToDefaultConverterTest
*
* @version $Id$
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class LegacyToDefaultConverterTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-checksum/pom.xml b/archiva-modules/archiva-base/archiva-checksum/pom.xml
index 015cb5d0f..27f90135f 100644
--- a/archiva-modules/archiva-base/archiva-checksum/pom.xml
+++ b/archiva-modules/archiva-base/archiva-checksum/pom.xml
@@ -38,10 +38,11 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
diff --git a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java
index 812cc708b..5455fcb9f 100644
--- a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java
+++ b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/AbstractChecksumTestCase.java
@@ -19,16 +19,19 @@ package org.apache.archiva.checksum;
* under the License.
*/
-import java.io.File;
-
import junit.framework.TestCase;
import org.apache.archiva.common.utils.FileUtil;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.runner.RunWith;
+
+import java.io.File;
/**
* AbstractChecksumTestCase
*
* @version $Id$
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public abstract class AbstractChecksumTestCase
extends TestCase
{
diff --git a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumAlgorithmTest.java b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumAlgorithmTest.java
index 7f37469b1..dabff4d62 100644
--- a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumAlgorithmTest.java
+++ b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumAlgorithmTest.java
@@ -22,27 +22,34 @@ package org.apache.archiva.checksum;
import java.io.File;
import junit.framework.TestCase;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* ChecksumAlgorithmTest
*
* @version $Id$
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class ChecksumAlgorithmTest
extends TestCase
{
+ @Test
public void testGetHashByExtensionSha1()
{
assertEquals( ChecksumAlgorithm.SHA1, ChecksumAlgorithm.getByExtension( new File( "something.jar.sha1" ) ) );
assertEquals( ChecksumAlgorithm.SHA1, ChecksumAlgorithm.getByExtension( new File( "OTHER.JAR.SHA1" ) ) );
}
-
+
+ @Test
public void testGetHashByExtensionMd5()
{
assertEquals( ChecksumAlgorithm.MD5, ChecksumAlgorithm.getByExtension( new File( "something.jar.md5" ) ) );
assertEquals( ChecksumAlgorithm.MD5, ChecksumAlgorithm.getByExtension( new File( "OTHER.JAR.MD5" ) ) );
}
+ @Test
public void testGetHashByExtensionInvalid()
{
try
diff --git a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumTest.java b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumTest.java
index 4cfcc8dd2..40f95a56b 100644
--- a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumTest.java
+++ b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksumTest.java
@@ -23,6 +23,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import org.junit.Test;
/**
* ChecksumTest
@@ -34,6 +35,7 @@ public class ChecksumTest
{
private static final String UNSET_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
+ @Test
public void testConstructSha1()
{
Checksum checksum = new Checksum( ChecksumAlgorithm.SHA1 );
@@ -41,6 +43,7 @@ public class ChecksumTest
.getAlgorithm() );
}
+ @Test
public void testConstructMd5()
{
Checksum checksum = new Checksum( ChecksumAlgorithm.MD5 );
@@ -48,6 +51,7 @@ public class ChecksumTest
.getAlgorithm() );
}
+ @Test
public void testUpdate()
{
Checksum checksum = new Checksum( ChecksumAlgorithm.SHA1 );
@@ -57,6 +61,7 @@ public class ChecksumTest
assertEquals( "Checksum", "e396119ae0542e85a74759602fd2f81e5d36d762", checksum.getChecksum() );
}
+ @Test
public void testUpdateMany()
throws IOException
{
@@ -76,6 +81,7 @@ public class ChecksumTest
assertEquals( "Checksum MD5", "21c2c5ca87ec018adacb2e2fb3432219", checksumMd5.getChecksum() );
}
+ @Test
public void testUpdateWholeUpdatePartial()
{
Checksum checksum = new Checksum( ChecksumAlgorithm.SHA1 );
diff --git a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksummedFileTest.java b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksummedFileTest.java
index 5ca089087..e4122d93a 100644
--- a/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksummedFileTest.java
+++ b/archiva-modules/archiva-base/archiva-checksum/src/test/java/org/apache/archiva/checksum/ChecksummedFileTest.java
@@ -24,12 +24,14 @@ import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
+import org.junit.Test;
/**
* ChecksummedFileTest
*
* @version $Id$
*/
+
public class ChecksummedFileTest
extends AbstractChecksumTestCase
{
@@ -75,6 +77,7 @@ public class ChecksummedFileTest
return jarFile;
}
+ @Test
public void testCalculateChecksumMd5()
throws IOException
{
@@ -85,6 +88,7 @@ public class ChecksummedFileTest
assertEquals( expectedChecksum, actualChecksum );
}
+ @Test
public void testCalculateChecksumSha1()
throws IOException
{
@@ -95,6 +99,7 @@ public class ChecksummedFileTest
assertEquals( expectedChecksum, actualChecksum );
}
+ @Test
public void testCreateChecksum()
throws IOException
{
@@ -108,6 +113,7 @@ public class ChecksummedFileTest
assertEquals( "2bb14b388973351b0a4dfe11d171965f59cc61a1 redback-authz-open.jar", hashContents );
}
+ @Test
public void testFixChecksum()
throws IOException
{
@@ -126,12 +132,14 @@ public class ChecksummedFileTest
assertTrue( "ChecksummedFile.isValid(SHA1) == true", checksummedFile.isValidChecksum( ChecksumAlgorithm.SHA1 ) );
}
+ @Test
public void testGetChecksumFile()
{
ChecksummedFile checksummedFile = new ChecksummedFile( new File( "test.jar" ) );
assertEquals( "test.jar.sha1", checksummedFile.getChecksumFile( ChecksumAlgorithm.SHA1 ).getName() );
}
+ @Test
public void testIsValidChecksum()
throws IOException
{
@@ -141,6 +149,7 @@ public class ChecksummedFileTest
assertTrue( "ChecksummedFile.isValid(SHA1)", checksummedFile.isValidChecksum( ChecksumAlgorithm.SHA1 ) );
}
+ @Test
public void testIsValidChecksumInvalidSha1Format()
throws IOException
{
@@ -155,6 +164,7 @@ public class ChecksummedFileTest
}
+ @Test
public void testIsValidChecksumNoChecksumFiles()
throws IOException
{
@@ -167,6 +177,7 @@ public class ChecksummedFileTest
}
+ @Test
public void testIsValidChecksumSha1AndMd5()
throws IOException
{
@@ -178,6 +189,7 @@ public class ChecksummedFileTest
ChecksumAlgorithm.MD5 } ) );
}
+ @Test
public void testIsValidChecksumSha1NoMd5()
throws IOException
{
@@ -190,6 +202,7 @@ public class ChecksummedFileTest
}
+ @Test
public void testParseChecksum()
throws IOException
{
@@ -204,6 +217,7 @@ public class ChecksummedFileTest
}
+ @Test
public void testParseChecksumAltDash1()
throws IOException
{
@@ -215,6 +229,7 @@ public class ChecksummedFileTest
assertEquals( "Checksum doesn't match", SERVLETAPI_SHA1, s );
}
+ @Test
public void testParseChecksumAltDash2()
throws IOException
{
@@ -226,6 +241,7 @@ public class ChecksummedFileTest
assertEquals( "Checksum doesn't match", SERVLETAPI_SHA1, s );
}
+ @Test
public void testRemoteMetadataChecksumFilePathSha1()
throws IOException
{
@@ -246,6 +262,7 @@ public class ChecksummedFileTest
}
}
+ @Test
public void testRemoteMetadataChecksumFilePathMd5()
throws IOException
{
diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml
index d1ce97ce8..b44c303aa 100644
--- a/archiva-modules/archiva-base/archiva-configuration/pom.xml
+++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml
@@ -103,20 +103,11 @@
<artifactId>archiva-policies</artifactId>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
- </dependency>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java
index 493c6528b..3ab407a68 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ArchivaConfigurationTest.java
@@ -32,17 +32,18 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
import javax.inject.Inject;
import java.io.File;
import java.util.List;
import java.util.Map;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* Test the configuration store.
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class ArchivaConfigurationTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ConfigurationTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ConfigurationTest.java
index ace63c3be..f84e9bac3 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ConfigurationTest.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/ConfigurationTest.java
@@ -22,16 +22,16 @@ package org.apache.archiva.configuration;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
/**
* Test the generated Configuration class from Modello. This is primarily to test the hand coded methods.
*/
-@RunWith( JUnit4.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class ConfigurationTest
extends TestCase
{
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/FileTypesTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/FileTypesTest.java
index 4689a1774..3319b7210 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/FileTypesTest.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/FileTypesTest.java
@@ -23,11 +23,11 @@ import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } )
public class FileTypesTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/LegacyArtifactPathTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/LegacyArtifactPathTest.java
index 6c2d1422a..bca0295c9 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/LegacyArtifactPathTest.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/LegacyArtifactPathTest.java
@@ -20,16 +20,16 @@ package org.apache.archiva.configuration;
*/
import junit.framework.TestCase;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
/**
* Test the generated LegacyArtifactPath class from Modello. This is primarily to test the hand coded methods.
*
* @since 1.1
*/
-@RunWith( JUnit4.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class LegacyArtifactPathTest
extends TestCase
{
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/MavenProxyPropertyLoaderTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/MavenProxyPropertyLoaderTest.java
index 08a4b22df..65711773b 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/MavenProxyPropertyLoaderTest.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/MavenProxyPropertyLoaderTest.java
@@ -30,10 +30,11 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.util.Map;
import java.util.Properties;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
/**
*/
-@RunWith( JUnit4.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class MavenProxyPropertyLoaderTest
extends TestCase
{
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java
index 5eb3ab857..01ee311f5 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/ProxyConnectorConfigurationOrderComparatorTest.java
@@ -26,15 +26,20 @@ import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* ProxyConnectorConfigurationOrderComparatorTest
*
* @version $Id$
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class ProxyConnectorConfigurationOrderComparatorTest
extends TestCase
{
+ @Test
public void testSortOfAllZeros()
{
List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>();
@@ -49,6 +54,7 @@ public class ProxyConnectorConfigurationOrderComparatorTest
assertProxyOrder( new String[]{ "corporate", "snapshots", "3rdparty", "sandbox" }, proxies );
}
+ @Test
public void testSortNormal()
{
List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>();
@@ -63,6 +69,7 @@ public class ProxyConnectorConfigurationOrderComparatorTest
assertProxyOrder( new String[]{ "snapshots", "3rdparty", "corporate", "sandbox" }, proxies );
}
+ @Test
public void testSortPartial()
{
List<ProxyConnectorConfiguration> proxies = new ArrayList<ProxyConnectorConfiguration>();
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java
index 901e2272a..73f931d1a 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/archiva/configuration/functors/RepositoryConfigurationComparatorTest.java
@@ -24,13 +24,18 @@ import org.apache.archiva.configuration.AbstractRepositoryConfiguration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
import java.util.Comparator;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Test the repositry comparator.
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryConfigurationComparatorTest
extends TestCase
{
+ @Test
public void testComparator()
{
Comparator<AbstractRepositoryConfiguration> comparator = new RepositoryConfigurationComparator();
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml
index 0add9a295..b8165f315 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml
@@ -67,8 +67,9 @@
<!-- test dependencies -->
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java
index 90582b761..2da60bc67 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java
@@ -35,12 +35,12 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractArtifactConsumerTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
index dfda5f5cc..3660915d8 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
@@ -21,10 +21,7 @@ package org.apache.archiva.consumers.core.repository;
import junit.framework.TestCase;
import org.apache.archiva.admin.model.beans.ManagedRepository;
-import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.repository.ManagedRepositoryContent;
@@ -39,18 +36,17 @@ import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
-import java.io.IOException;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractRepositoryPurgeTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml
index 6ee974fbb..19e7e0d22 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml
@@ -74,8 +74,9 @@
<artifactId>archiva-repository-admin-api</artifactId>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java
index ef4804b2f..edbc2ec30 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java
@@ -36,7 +36,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
@@ -46,11 +45,12 @@ import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* NexusIndexerConsumerTest
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class NexusIndexerConsumerTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-converter/pom.xml b/archiva-modules/archiva-base/archiva-converter/pom.xml
index fed333129..77b522e7e 100644
--- a/archiva-modules/archiva-base/archiva-converter/pom.xml
+++ b/archiva-modules/archiva-base/archiva-converter/pom.xml
@@ -68,10 +68,11 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
- </dependency>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/archiva/converter/RepositoryConverterTest.java b/archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/archiva/converter/RepositoryConverterTest.java
index 68fafb4fc..e2994c749 100644
--- a/archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/archiva/converter/RepositoryConverterTest.java
+++ b/archiva-modules/archiva-base/archiva-converter/src/test/java/org/apache/archiva/converter/RepositoryConverterTest.java
@@ -31,7 +31,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.inject.Named;
@@ -39,6 +38,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* Test the repository converter.
@@ -48,7 +48,7 @@ import java.util.List;
* @todo should reject if dependencies are missing - rely on reporting?
* @todo group metadata
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml","classpath:/spring-context.xml"} )
public class RepositoryConverterTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-indexer/pom.xml b/archiva-modules/archiva-base/archiva-indexer/pom.xml
index 134b1925c..6752ca2dd 100644
--- a/archiva-modules/archiva-base/archiva-indexer/pom.xml
+++ b/archiva-modules/archiva-base/archiva-indexer/pom.xml
@@ -113,8 +113,9 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java
index 0e21d5d88..eaf5cac5e 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractNexusRepositorySearch.java
@@ -48,11 +48,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
import java.util.List;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* @author Olivier Lamy
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractNexusRepositorySearch
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java
index ed33539eb..16024d9a3 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java
@@ -22,14 +22,14 @@ import junit.framework.TestCase;
import org.apache.archiva.indexer.util.SearchUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
import java.util.Arrays;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
/**
* @author Olivier Lamy
*/
-@RunWith( JUnit4.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class NexusRepositorySearchPaginateTest
extends TestCase
{
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java
index cf66e7915..59bf24b25 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java
@@ -24,16 +24,16 @@ import org.apache.archiva.indexer.util.SearchUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class NexusRepositorySearchTest
extends AbstractNexusRepositorySearch
diff --git a/archiva-modules/archiva-base/archiva-model/pom.xml b/archiva-modules/archiva-base/archiva-model/pom.xml
index bc28daf6e..c008802f4 100755
--- a/archiva-modules/archiva-base/archiva-model/pom.xml
+++ b/archiva-modules/archiva-base/archiva-model/pom.xml
@@ -42,8 +42,9 @@
<artifactId>archiva-common</artifactId>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/archiva-modules/archiva-base/archiva-model/src/test/java/org/apache/archiva/model/RepositoryURLTest.java b/archiva-modules/archiva-base/archiva-model/src/test/java/org/apache/archiva/model/RepositoryURLTest.java
index e239a178b..6ed556c2e 100644
--- a/archiva-modules/archiva-base/archiva-model/src/test/java/org/apache/archiva/model/RepositoryURLTest.java
+++ b/archiva-modules/archiva-base/archiva-model/src/test/java/org/apache/archiva/model/RepositoryURLTest.java
@@ -20,12 +20,16 @@ package org.apache.archiva.model;
*/
import junit.framework.TestCase;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* RepositoryURLTest
*
* @version $Id$
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryURLTest
extends TestCase
{
@@ -49,43 +53,51 @@ public class RepositoryURLTest
assertEquals( "Password", expectedPassword, rurl.getPassword() );
}
+ @Test
public void testFileUrlNormal()
{
assertURL( "file:///home/joakim/code/test/this/", "file", NO_HOST, NO_PORT, "/home/joakim/code/test/this/",
NO_USER, NO_PASS );
}
+ @Test
public void testFileUrlShort()
{
assertURL( "file:/home/joakim/code/test/this/", "file", NO_HOST, NO_PORT, "/home/joakim/code/test/this/",
NO_USER, NO_PASS );
}
+ @Test
public void testHttpUrlPathless()
{
assertURL( "http://machine", "http", "machine", NO_PORT, "/", NO_USER, NO_PASS );
}
+ @Test
public void testHttpUrlWithPort()
{
assertURL( "http://machine:8080/", "http", "machine", "8080", "/", NO_USER, NO_PASS );
}
+ @Test
public void testHttpUrlWithUsernamePassword()
{
assertURL( "http://user:pass@machine/secured/", "http", "machine", NO_PORT, "/secured/", "user", "pass" );
}
+ @Test
public void testHttpUrlWithUsernameNoPassword()
{
assertURL( "http://user@machine/secured/", "http", "machine", NO_PORT, "/secured/", "user", NO_PASS );
}
+ @Test
public void testHttpUrlWithUsernamePasswordAndPort()
{
assertURL( "http://user:pass@machine:9090/secured/", "http", "machine", "9090", "/secured/", "user", "pass" );
}
+ @Test
public void testBogusWithPath()
{
// This should not fail. The intent of RepositoryURL is to have it support oddball protocols that
diff --git a/archiva-modules/archiva-base/archiva-policies/pom.xml b/archiva-modules/archiva-base/archiva-policies/pom.xml
index c604832a7..5c756a089 100644
--- a/archiva-modules/archiva-base/archiva-policies/pom.xml
+++ b/archiva-modules/archiva-base/archiva-policies/pom.xml
@@ -81,10 +81,11 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
diff --git a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/CachedFailuresPolicyTest.java b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/CachedFailuresPolicyTest.java
index 2fd8d24cb..c322e2357 100644
--- a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/CachedFailuresPolicyTest.java
+++ b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/CachedFailuresPolicyTest.java
@@ -24,19 +24,19 @@ import org.apache.archiva.policies.urlcache.UrlFailureCache;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.util.Properties;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* CachedFailuresPolicyTest
*
* @version $Id$
*/
-@RunWith( value = SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class CachedFailuresPolicyTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ChecksumPolicyTest.java b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ChecksumPolicyTest.java
index 67dc2cd8a..62d7ae92f 100644
--- a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ChecksumPolicyTest.java
+++ b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ChecksumPolicyTest.java
@@ -26,7 +26,6 @@ import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.BufferedReader;
import java.io.File;
@@ -34,6 +33,7 @@ import java.io.FileReader;
import java.util.Properties;
import javax.inject.Inject;
import javax.inject.Named;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
import static org.junit.Assert.*;
@@ -42,7 +42,7 @@ import static org.junit.Assert.*;
*
* @version $Id$
*/
-@RunWith( value = SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml"} )
public class ChecksumPolicyTest
{
diff --git a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ReleasePolicyTest.java b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ReleasePolicyTest.java
index d99d216d9..35a7555ee 100644
--- a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ReleasePolicyTest.java
+++ b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/ReleasePolicyTest.java
@@ -25,19 +25,19 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.util.Properties;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* ReleasePolicyTest
*
* @version $Id$
*/
-@RunWith( value = SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class ReleasePolicyTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/SnapshotsPolicyTest.java b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/SnapshotsPolicyTest.java
index 4567874d9..6fe09dbf0 100644
--- a/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/SnapshotsPolicyTest.java
+++ b/archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/archiva/policies/SnapshotsPolicyTest.java
@@ -25,19 +25,19 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.util.Properties;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* SnapshotsPolicyTest
*
* @version $Id$
*/
-@RunWith( value = SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class SnapshotsPolicyTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml
index 454b3be1c..1fe13a205 100644
--- a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml
+++ b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml
@@ -62,10 +62,11 @@
<artifactId>commons-logging-api</artifactId>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
- </dependency>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java b/archiva-modules/archiva-base/archiva-proxy-common/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java
index 85dc8d2ca..66d7afd9e 100644
--- a/archiva-modules/archiva-base/archiva-proxy-common/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java
+++ b/archiva-modules/archiva-base/archiva-proxy-common/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java
@@ -24,15 +24,15 @@ import org.apache.maven.wagon.Wagon;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* Test the WagonFactory works through Spring to be bound into the RepositoryProxyConnectors implementation.
*
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } )
public class WagonFactoryTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml
index 5768ccd9c..394034c6f 100644
--- a/archiva-modules/archiva-base/archiva-proxy/pom.xml
+++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml
@@ -129,10 +129,11 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-admin-default</artifactId>
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
index a1f493840..5851cff6f 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
@@ -63,6 +63,7 @@ import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Locale;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
import static org.junit.Assert.*;
@@ -71,7 +72,7 @@ import static org.junit.Assert.*;
*
* @version $Id$
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractProxyTestCase
{
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
index 8af5ea536..a58d8c332 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
@@ -45,7 +45,6 @@ import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.AbstractHandler;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.servlet.ServletException;
@@ -53,6 +52,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
import static org.junit.Assert.*;
@@ -61,7 +61,7 @@ import static org.junit.Assert.*;
*
* @version $Id: ManagedDefaultTransferTest.java 677852 2008-07-18 08:16:24Z brett $
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class HttpProxyTransferTest
{
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
index ca24d008f..595a7dfa5 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
@@ -93,6 +93,12 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java
index 02497556e..a6188d071 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java
@@ -35,16 +35,16 @@ import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
import java.util.List;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* @author Olivier Lamy
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractRepositoryAdminTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml
index b258f78b3..4005a4a9c 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml
+++ b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml
@@ -67,10 +67,11 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>metadata-model</artifactId>
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/AbstractRepositoryLayerTestCase.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/AbstractRepositoryLayerTestCase.java
index 5b192f3c4..9c436fdf3 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/AbstractRepositoryLayerTestCase.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/AbstractRepositoryLayerTestCase.java
@@ -28,17 +28,17 @@ import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.File;
import javax.inject.Inject;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* AbstractRepositoryLayerTestCase
*
* @version $Id$
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractRepositoryLayerTestCase
{
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/RepositoryURLTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/RepositoryURLTest.java
index 83267d14c..f15cafce7 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/RepositoryURLTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/RepositoryURLTest.java
@@ -25,12 +25,16 @@ import org.apache.archiva.model.RepositoryURL;
import java.net.MalformedURLException;
import junit.framework.TestCase;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* RepositoryURLTest
*
* @version $Id$
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryURLTest
extends TestCase
{
@@ -46,7 +50,8 @@ public class RepositoryURLTest
assertEquals( port, url.getPort() );
assertEquals( path, url.getPath() );
}
-
+
+ @Test
public void testProtocolHttp()
throws MalformedURLException
{
@@ -54,6 +59,7 @@ public class RepositoryURLTest
"/path/to/resource.txt" );
}
+ @Test
public void testProtocolWagonWebdav()
throws MalformedURLException
{
@@ -61,6 +67,7 @@ public class RepositoryURLTest
"/path/to/resource.txt" );
}
+ @Test
public void testProtocolHttpWithPort()
throws MalformedURLException
{
@@ -68,6 +75,7 @@ public class RepositoryURLTest
"/path/to/resource.txt" );
}
+ @Test
public void testProtocolHttpWithUsername()
throws MalformedURLException
{
@@ -75,6 +83,7 @@ public class RepositoryURLTest
"/path/to/resource.txt" );
}
+ @Test
public void testProtocolHttpWithUsernamePassword()
throws MalformedURLException
{
@@ -82,6 +91,7 @@ public class RepositoryURLTest
"/path/to/resource.txt" );
}
+ @Test
public void testProtocolHttpWithUsernamePasswordPort()
throws MalformedURLException
{
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/FilenameParserTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/FilenameParserTest.java
index 99e34acab..a2a36f8e9 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/FilenameParserTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/content/FilenameParserTest.java
@@ -20,16 +20,16 @@ package org.apache.archiva.repository.content;
*/
import junit.framework.TestCase;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
/**
* FilenameParserTest
*
* @version $Id$
*/
-@RunWith( JUnit4.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class FilenameParserTest
extends TestCase
{
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java
index 8da14bd08..24cd88fc8 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataReaderTest.java
@@ -25,16 +25,16 @@ import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.xml.XMLException;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
import java.io.File;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
/**
* RepositoryMetadataReaderTest
*
* @version $Id$
*/
-@RunWith( JUnit4.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryMetadataReaderTest
extends TestCase
{
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java
index 373c8de9b..43ed7988a 100644
--- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java
@@ -25,17 +25,17 @@ import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.custommonkey.xmlunit.XMLAssert;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
import java.io.File;
import java.io.StringWriter;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
/**
* RepositoryMetadataWriterTest
*
* @version $Id$
*/
-@RunWith( JUnit4.class )
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class RepositoryMetadataWriterTest
extends TestCase
{
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml
index a1175279a..d19988931 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml
@@ -58,8 +58,9 @@
-->
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
index e36b9fe45..a5d84621e 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryContentConsumersTest.java
@@ -40,7 +40,6 @@ import org.springframework.context.NoSuchMessageException;
import org.springframework.core.env.Environment;
import org.springframework.core.io.Resource;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
@@ -53,13 +52,14 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* RepositoryContentConsumersTest
*
* @version $Id$
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class RepositoryContentConsumersTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java
index 89896838b..8b24abadd 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/java/org/apache/archiva/repository/scanner/RepositoryScannerTest.java
@@ -29,7 +29,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import java.io.File;
@@ -41,13 +40,14 @@ import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
+import org.apache.archiva.test.ArchivaSpringJUnit4ClassRunner;
/**
* RepositoryScannerTest
*
* @version $Id$
*/
-@RunWith( SpringJUnit4ClassRunner.class )
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } )
public class RepositoryScannerTest
extends TestCase
diff --git a/archiva-modules/archiva-base/archiva-transaction/pom.xml b/archiva-modules/archiva-base/archiva-transaction/pom.xml
index 18d6024dc..7ea8aefa0 100644
--- a/archiva-modules/archiva-base/archiva-transaction/pom.xml
+++ b/archiva-modules/archiva-base/archiva-transaction/pom.xml
@@ -52,8 +52,9 @@
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/AbstractFileEventTest.java b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/AbstractFileEventTest.java
index 13ed7327d..4e7c09316 100644
--- a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/AbstractFileEventTest.java
+++ b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/AbstractFileEventTest.java
@@ -29,16 +29,22 @@ import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Before;
+import org.junit.runner.RunWith;
/**
* @version $Id$
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public abstract class AbstractFileEventTest
extends TestCase
{
protected List<Digester> digesters;
@SuppressWarnings( "unchecked" )
+ @Before
+ @Override
public void setUp()
throws Exception
{
diff --git a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java
index d832ec40c..360f64df8 100644
--- a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java
+++ b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CopyFileEventTest.java
@@ -24,6 +24,9 @@ import org.apache.archiva.common.utils.FileUtil;
import java.io.File;
import java.io.IOException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
*/
@@ -40,6 +43,8 @@ public class CopyFileEventTest
private String source, oldChecksum;
+ @Override
+ @Before
public void setUp()
throws Exception
{
@@ -67,7 +72,8 @@ public class CopyFileEventTest
oldChecksum = readFile( testDestChecksum );
}
-
+
+ @Test
public void testCopyCommitRollback()
throws Exception
{
@@ -92,6 +98,7 @@ public class CopyFileEventTest
assertChecksumRollback( testDest );
}
+ @Test
public void testCopyCommitRollbackWithBackup()
throws Exception
{
@@ -126,6 +133,7 @@ public class CopyFileEventTest
assertChecksumRollback( testDest );
}
+ @Test
public void testCreateRollbackCommit()
throws Exception
{
@@ -148,7 +156,9 @@ public class CopyFileEventTest
assertTrue( "Test that the destination contents are copied correctly", source.equals( target ) );
}
- protected void tearDown()
+ @After
+ @Override
+ public void tearDown()
throws Exception
{
super.tearDown();
@@ -156,6 +166,7 @@ public class CopyFileEventTest
FileUtils.deleteDirectory( new File( FileUtil.getBasedir(), "target/transaction-tests" ) );
}
+ @Override
protected void assertChecksumCommit( File file )
throws IOException
{
@@ -166,6 +177,7 @@ public class CopyFileEventTest
assertFalse( "Test that the destination checksum contents are created correctly", oldChecksum.equals( target ) );
}
+ @Override
protected void assertChecksumRollback( File file )
throws IOException
{
diff --git a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java
index 9d23fe9ae..42b2f6245 100644
--- a/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java
+++ b/archiva-modules/archiva-base/archiva-transaction/src/test/java/org/apache/archiva/transaction/CreateFileEventTest.java
@@ -23,6 +23,8 @@ import java.io.File;
import org.apache.commons.io.FileUtils;
import org.apache.archiva.common.utils.FileUtil;
+import org.junit.After;
+import org.junit.Test;
/**
*/
@@ -31,6 +33,7 @@ public class CreateFileEventTest
{
private File testDir = new File( FileUtil.getBasedir(), "target/transaction-tests/create-file" );
+ @Test
public void testCreateCommitRollback()
throws Exception
{
@@ -56,6 +59,7 @@ public class CreateFileEventTest
assertTrue( "target directory still exists", new File( FileUtil.getBasedir(), "target" ).exists() );
}
+ @Test
public void testCreateCommitRollbackWithBackup()
throws Exception
{
@@ -90,6 +94,7 @@ public class CreateFileEventTest
assertChecksumRollback( testFile );
}
+ @Test
public void testCreateRollbackCommit()
throws Exception
{
@@ -110,7 +115,9 @@ public class CreateFileEventTest
assertChecksumCommit( testFile );
}
- protected void tearDown()
+ @Override
+ @After
+ public void tearDown()
throws Exception
{
super.tearDown();
diff --git a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml
index b747595a4..fb800d186 100644
--- a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml
+++ b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml
@@ -53,6 +53,12 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/AbstractArchivaXmlTestCase.java b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/AbstractArchivaXmlTestCase.java
index 490083568..ebd5b0927 100644
--- a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/AbstractArchivaXmlTestCase.java
+++ b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/AbstractArchivaXmlTestCase.java
@@ -22,12 +22,15 @@ package org.apache.archiva.xml;
import java.io.File;
import junit.framework.TestCase;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.runner.RunWith;
/**
* AbstractArchivaXmlTestCase
*
* @version $Id$
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public abstract class AbstractArchivaXmlTestCase
extends TestCase
{
diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntitiesTest.java b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntitiesTest.java
index 96294a53f..d44b6b491 100644
--- a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntitiesTest.java
+++ b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntitiesTest.java
@@ -20,15 +20,20 @@ package org.apache.archiva.xml;
*/
import junit.framework.TestCase;
+import org.apache.archiva.test.ArchivaBlockJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* LatinEntitiesTest
*
* @version $Id$
*/
+@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class LatinEntitiesTest
extends TestCase
{
+ @Test
public void testResolveEntity()
{
// Good Entities.
diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java
index d8fd8493a..0fa4d42bd 100644
--- a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java
+++ b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/LatinEntityResolutionReaderTest.java
@@ -32,6 +32,7 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import java.net.URL;
+import org.junit.Test;
/**
* LatinEntityResolutionReaderTest
@@ -139,7 +140,8 @@ public class LatinEntityResolutionReaderTest
fail( "IOException: " + e.getMessage() );
}
}
-
+
+ @Test
public void testReaderNormalBufsize()
throws IOException
{
@@ -155,6 +157,7 @@ public class LatinEntityResolutionReaderTest
assertProperRead( expected, "no-prolog-with-entities.xml", 4096 );
}
+ @Test
public void testReaderSmallBufsize()
throws IOException
{
@@ -170,6 +173,7 @@ public class LatinEntityResolutionReaderTest
assertProperRead( expected, "no-prolog-with-entities.xml", 1024 );
}
+ @Test
public void testReaderRediculouslyTinyBufsize()
throws IOException
{
@@ -185,6 +189,7 @@ public class LatinEntityResolutionReaderTest
assertProperRead( expected, "no-prolog-with-entities.xml", 32 );
}
+ @Test
public void testReaderHugeBufsize()
throws IOException
{
@@ -200,7 +205,7 @@ public class LatinEntityResolutionReaderTest
assertProperRead( expected, "no-prolog-with-entities.xml", 409600 );
}
-
+ @Test
public void testReaderLeftOver()
throws IOException
{
@@ -225,7 +230,7 @@ public class LatinEntityResolutionReaderTest
}
}
-
+ @Test
public void testNoLatinEntitiesHugeLine()
{
assertProperRead( "commons-codec-1.2.pom", "commons-codec-1.2.pom", 4096 );
diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLReaderTest.java b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLReaderTest.java
index 3d9f1b7fd..0d2d0e7d0 100644
--- a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLReaderTest.java
+++ b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLReaderTest.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.List;
import org.dom4j.Element;
+import org.junit.Test;
/**
* XMLReaderTest
@@ -49,7 +50,8 @@ public class XMLReaderTest
assertTrue( "Contains [" + expectedText + "]", texts.contains( expectedText ) );
}
}
-
+
+ @Test
public void testNoPrologBasicRead()
throws XMLException
{
@@ -60,6 +62,7 @@ public class XMLReaderTest
assertElementTexts( fruits, new String[] { "apple", "cherry", "pear", "peach" } );
}
+ @Test
public void testNoPrologEntitiesRead()
throws XMLException
{
@@ -70,6 +73,7 @@ public class XMLReaderTest
assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
}
+ @Test
public void testNoPrologUtf8Read()
throws XMLException
{
@@ -80,6 +84,7 @@ public class XMLReaderTest
assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
}
+ @Test
public void testPrologUtf8Read()
throws XMLException
{
@@ -91,6 +96,7 @@ public class XMLReaderTest
}
// MRM-1136
+ @Test
public void testProxiedMetadataRead()
throws XMLException
{
diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLWriterTest.java b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLWriterTest.java
index b138a13b6..0b90ac9d5 100644
--- a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLWriterTest.java
+++ b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/archiva/xml/XMLWriterTest.java
@@ -24,6 +24,7 @@ import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import java.io.StringWriter;
+import org.junit.Test;
/**
* XMLWriterTest
@@ -33,6 +34,7 @@ import java.io.StringWriter;
public class XMLWriterTest
extends AbstractArchivaXmlTestCase
{
+ @Test
public void testWrite()
throws Exception
{
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml
index c181bde9c..8dde30207 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml
@@ -91,7 +91,13 @@
<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>
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java
index f684abf15..6eb6059a8 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java
@@ -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
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java
index ffecf55dd..5033b71b4 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java
@@ -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
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml
index 4414e35ad..66828df98 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml
@@ -86,10 +86,11 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorAbstractTest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorAbstractTest.java
index ad5aa6e3c..8da5f354b 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorAbstractTest.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorAbstractTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase1Test.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase1Test.java
index edc804ed4..9a2885662 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase1Test.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase1Test.java
@@ -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
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java
index 625297980..225d3a153 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorPhase2Test.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
index 4518a403b..251ae0a49 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
@@ -225,7 +225,12 @@
<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>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
index a607d17f3..2580f2bf2 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-rss/pom.xml b/archiva-modules/archiva-web/archiva-rss/pom.xml
index a29802b3d..faf93bd14 100644
--- a/archiva-modules/archiva-web/archiva-rss/pom.xml
+++ b/archiva-modules/archiva-web/archiva-rss/pom.xml
@@ -57,6 +57,12 @@
<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>
<scope>test</scope>
diff --git a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/RssFeedGeneratorTest.java b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/RssFeedGeneratorTest.java
index 0eb01b01a..59f32dc78 100644
--- a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/RssFeedGeneratorTest.java
+++ b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/RssFeedGeneratorTest.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java
index 184a85093..04a4db599 100644
--- a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java
+++ b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java
index 846c2011b..c72617248 100644
--- a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java
+++ b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewVersionsOfArtifactRssFeedProcessorTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-security/pom.xml b/archiva-modules/archiva-web/archiva-security/pom.xml
index b44779769..c7ee2cf48 100644
--- a/archiva-modules/archiva-web/archiva-security/pom.xml
+++ b/archiva-modules/archiva-web/archiva-security/pom.xml
@@ -147,6 +147,12 @@
<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>
<scope>test</scope>
diff --git a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
index c80983bf3..1bfc486e0 100644
--- a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
+++ b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/AbstractSecurityTest.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/RoleManagerTest.java b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/RoleManagerTest.java
index 345fc967f..549a9ef88 100644
--- a/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/RoleManagerTest.java
+++ b/archiva-modules/archiva-web/archiva-security/src/test/java/org/apache/archiva/security/RoleManagerTest.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-web-common/pom.xml b/archiva-modules/archiva-web/archiva-web-common/pom.xml
index faf2d0d59..e0be6b22c 100644
--- a/archiva-modules/archiva-web/archiva-web-common/pom.xml
+++ b/archiva-modules/archiva-web/archiva-web-common/pom.xml
@@ -140,6 +140,12 @@
<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>
<scope>test</scope>
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java
index 9a55321c9..039e2f0a0 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/pom.xml b/archiva-modules/archiva-web/archiva-webapp-js/pom.xml
index 35d1a23fb..035db48ab 100644
--- a/archiva-modules/archiva-web/archiva-webapp-js/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webapp-js/pom.xml
@@ -650,7 +650,12 @@
<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>
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/test/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoServiceTest.java b/archiva-modules/archiva-web/archiva-webapp-js/src/test/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoServiceTest.java
index aed5b3f93..53c8ec5a5 100644
--- a/archiva-modules/archiva-web/archiva-webapp-js/src/test/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoServiceTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp-js/src/test/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoServiceTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml
index d65e0da2b..ae764b224 100644
--- a/archiva-modules/archiva-web/archiva-webapp/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml
@@ -875,7 +875,13 @@
<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>
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/AbstractDownloadTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/AbstractDownloadTest.java
index cb7e0e5b2..5cf32d8df 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/AbstractDownloadTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/AbstractDownloadTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadArtifactsTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadArtifactsTest.java
index b7efe7dc8..f01bcf0b2 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadArtifactsTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadArtifactsTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java
index 2870185aa..7aeeaff71 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractActionTestCase.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractActionTestCase.java
index 136be1905..df0ba62e8 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractActionTestCase.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractActionTestCase.java
@@ -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( );
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractWebworkTestCase.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractWebworkTestCase.java
index fd6b6a31c..fc5d14885 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractWebworkTestCase.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/AbstractWebworkTestCase.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/BrowseActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/BrowseActionTest.java
index 9503ccbd4..29b5517d5 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/BrowseActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/BrowseActionTest.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/DeleteArtifactActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/DeleteArtifactActionTest.java
index dcf370ba3..92b0a103e 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/DeleteArtifactActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/DeleteArtifactActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/SearchActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/SearchActionTest.java
index 66ff41598..38c0305cc 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/SearchActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/SearchActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/ShowArtifactActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/ShowArtifactActionTest.java
index 2b2f18428..9376df16b 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/ShowArtifactActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/ShowArtifactActionTest.java
@@ -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 );
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/UploadActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/UploadActionTest.java
index 96c5ee5a7..cdb8788ba 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/UploadActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/UploadActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/AbstractOrganizationInfoActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/AbstractOrganizationInfoActionTest.java
index d4d75809d..9597b5e1a 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/AbstractOrganizationInfoActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/AbstractOrganizationInfoActionTest.java
@@ -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();
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/EditOrganizationInfoActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/EditOrganizationInfoActionTest.java
index 64ae7f8ad..5a709eb4d 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/EditOrganizationInfoActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/EditOrganizationInfoActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/OrganizationInfoActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/OrganizationInfoActionTest.java
index de5adfa19..242906924 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/OrganizationInfoActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/appearance/OrganizationInfoActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java
index df62dd1d0..9ac59722c 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.java
index 783cea8e7..ded32ea66 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/DeleteProxyConnectorActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.java
index 679f548a5..c5ca57865 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/DisableProxyConnectorActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java
index 6350b633b..2f2a2a45e 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorActionTest.java
index 7797ccf3e..cac2a6ac7 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/EnableProxyConnectorActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java
index e76abcec9..b6d042e05 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/ProxyConnectorsActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsActionTest.java
index 702a72ba4..5d23fc348 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/connectors/proxy/SortProxyConnectorsActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/legacy/AddLegacyArtifactPathActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/legacy/AddLegacyArtifactPathActionTest.java
index b0803a6b8..5a5f8f99b 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/legacy/AddLegacyArtifactPathActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/legacy/AddLegacyArtifactPathActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyActionTest.java
index f4aaf278d..041f94922 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/networkproxies/ConfigureNetworkProxyActionTest.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AbstractManagedRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AbstractManagedRepositoryActionTest.java
index 41a3a25e6..892fa54b6 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AbstractManagedRepositoryActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AbstractManagedRepositoryActionTest.java
@@ -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();
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
index 2c0266d2b..46622989c 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddManagedRepositoryActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java
index 65e6c0002..5b279bacf 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/AddRemoteRepositoryActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java
index 8c17ef252..f38910b6b 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteManagedRepositoryActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java
index f810fa856..f2e555cac 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRemoteRepositoryActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.java
index 74976d5e5..81ef1b95b 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/DeleteRepositoryGroupActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java
index 1bb9d6679..641a6e968 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditManagedRepositoryActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.java
index 53ca83b95..99ff981b3 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/EditRemoteRepositoryActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/RepositoriesActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/RepositoriesActionTest.java
index 8840ef534..40bdf94cb 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/RepositoriesActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/RepositoriesActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java
index 8e5bec742..4af239368 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/SortRepositoriesActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/SortRepositoriesActionTest.java
index 79a4b99b2..199ee9067 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/SortRepositoriesActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/repositories/SortRepositoriesActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/scanning/RepositoryScanningActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/scanning/RepositoryScanningActionTest.java
index ce97851c1..ac4be6f53 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/scanning/RepositoryScanningActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/admin/scanning/RepositoryScanningActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/reports/GenerateReportActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/reports/GenerateReportActionTest.java
index 354032e5b..b5e015ec9 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/reports/GenerateReportActionTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/reports/GenerateReportActionTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/startup/BannerTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/startup/BannerTest.java
index c5c64c45a..c4729e77b 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/startup/BannerTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/startup/BannerTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/tags/DependencyTreeTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/tags/DependencyTreeTest.java
index 5c7421c9b..df20e384b 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/tags/DependencyTreeTest.java
+++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/tags/DependencyTreeTest.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml
index d3249fc75..bbf0d30c5 100644
--- a/archiva-modules/archiva-web/archiva-webdav/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml
@@ -185,6 +185,12 @@
</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>
<scope>test</scope>
</dependency>
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
index 67df84d1b..5fb512991 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java
index b8c1f34af..f802b9747 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceLocatorTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceLocatorTest.java
index c0f6ab309..26a895800 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceLocatorTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceLocatorTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java
index 64499ead3..430bbdac8 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionProviderTest.java
@@ -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
{
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionTest.java
index 7431b013a..c2bafe2a2 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavSessionTest.java
@@ -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();
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java
index 3b4dc1a0f..bf907bfaf 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/DavResourceTest.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/MimeTypesLoaderTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/MimeTypesLoaderTest.java
index 36d53492a..2ef6dae6d 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/MimeTypesLoaderTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/MimeTypesLoaderTest.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java
index 56fe9567b..ff4f3b51b 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MimeTypesTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MimeTypesTest.java
index 1c1935490..e48685aa5 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MimeTypesTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MimeTypesTest.java
@@ -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
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/RepositoryPathUtilTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/RepositoryPathUtilTest.java
index 1c0ca5655..0082c1802 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/RepositoryPathUtilTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/RepositoryPathUtilTest.java
@@ -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";
diff --git a/archiva-modules/metadata/metadata-repository-api/pom.xml b/archiva-modules/metadata/metadata-repository-api/pom.xml
index cbe3affaf..482b2590b 100644
--- a/archiva-modules/metadata/metadata-repository-api/pom.xml
+++ b/archiva-modules/metadata/metadata-repository-api/pom.xml
@@ -49,10 +49,11 @@
<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>
diff --git a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
index 2d3c9fe99..10c1486e7 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
@@ -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
diff --git a/archiva-modules/plugins/audit/pom.xml b/archiva-modules/plugins/audit/pom.xml
index 52a4cfecc..6996d45c6 100644
--- a/archiva-modules/plugins/audit/pom.xml
+++ b/archiva-modules/plugins/audit/pom.xml
@@ -37,10 +37,11 @@
<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>
diff --git a/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java b/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java
index 0a39c7738..19333ee14 100644
--- a/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java
+++ b/archiva-modules/plugins/audit/src/test/java/org/apache/archiva/audit/AuditManagerTest.java
@@ -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
{
diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml
index 47de02dea..cb51fa248 100644
--- a/archiva-modules/plugins/maven2-repository/pom.xml
+++ b/archiva-modules/plugins/maven2-repository/pom.xml
@@ -129,8 +129,9 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilderTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilderTest.java
index f0ff71582..39cb331d3 100644
--- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilderTest.java
+++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/dependency/tree/maven2/DependencyTreeBuilderTest.java
@@ -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
diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java
index 20b839d5e..e39361871 100644
--- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java
+++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java
@@ -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
diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/MavenRepositoryMetadataReaderTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/MavenRepositoryMetadataReaderTest.java
index 28b15be1c..d587c2dc0 100644
--- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/MavenRepositoryMetadataReaderTest.java
+++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/MavenRepositoryMetadataReaderTest.java
@@ -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
{
diff --git a/archiva-modules/plugins/metadata-store-file/pom.xml b/archiva-modules/plugins/metadata-store-file/pom.xml
index 951c2e0b4..67ed7a038 100644
--- a/archiva-modules/plugins/metadata-store-file/pom.xml
+++ b/archiva-modules/plugins/metadata-store-file/pom.xml
@@ -56,6 +56,12 @@
<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>
<scope>test</scope>
diff --git a/archiva-modules/plugins/metadata-store-jcr/pom.xml b/archiva-modules/plugins/metadata-store-jcr/pom.xml
index 218bb3923..a4796a78a 100644
--- a/archiva-modules/plugins/metadata-store-jcr/pom.xml
+++ b/archiva-modules/plugins/metadata-store-jcr/pom.xml
@@ -44,10 +44,11 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-testutil</artifactId>
+ <version>${project.version}</version>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
diff --git a/archiva-modules/plugins/problem-reports/pom.xml b/archiva-modules/plugins/problem-reports/pom.xml
index 7dec12dc4..2a7576a1b 100644
--- a/archiva-modules/plugins/problem-reports/pom.xml
+++ b/archiva-modules/plugins/problem-reports/pom.xml
@@ -54,10 +54,11 @@
<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>
diff --git a/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java b/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java
index 75676975e..d1012afe4 100644
--- a/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java
+++ b/archiva-modules/plugins/problem-reports/src/test/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumerTest.java
@@ -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
diff --git a/archiva-modules/plugins/repository-statistics/pom.xml b/archiva-modules/plugins/repository-statistics/pom.xml
index a5832a308..3784367fd 100644
--- a/archiva-modules/plugins/repository-statistics/pom.xml
+++ b/archiva-modules/plugins/repository-statistics/pom.xml
@@ -50,10 +50,11 @@
<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>
diff --git a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java
index b8105daec..9e51faeb9 100644
--- a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java
+++ b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java
@@ -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
{
diff --git a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
index b7e4fae0d..31903a6ca 100644
--- a/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
+++ b/archiva-modules/plugins/repository-statistics/src/test/java/org/apache/archiva/metadata/repository/stats/RepositoryStatisticsManagerTest.java
@@ -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
{
diff --git a/archiva-modules/plugins/stage-repository-merge/pom.xml b/archiva-modules/plugins/stage-repository-merge/pom.xml
index 57ebe1cf1..8e4222520 100644
--- a/archiva-modules/plugins/stage-repository-merge/pom.xml
+++ b/archiva-modules/plugins/stage-repository-merge/pom.xml
@@ -86,6 +86,12 @@
<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>
diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java b/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java
index a5f183c29..a5f864de9 100644
--- a/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java
+++ b/archiva-modules/plugins/stage-repository-merge/src/test/java/org/apache/archiva/stagerepository/merge/Maven2RepositoryMergerTest.java
@@ -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 8ecff37fa..7fc1ee41d 100644
--- 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>