diff options
author | Olivier Lamy <olamy@apache.org> | 2012-10-29 21:00:51 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-10-29 21:00:51 +0000 |
commit | 6f95f668fcb8c766d83d0b5caa4a02d3e02d20a9 (patch) | |
tree | 01b4d1c7bc77ba18ba938fb1761fb5a7496dc2e0 /archiva-modules/plugins/maven2-repository/src | |
parent | c7b2d0af209c5515125571b715a7ca1190425e11 (diff) | |
download | archiva-6f95f668fcb8c766d83d0b5caa4a02d3e02d20a9.tar.gz archiva-6f95f668fcb8c766d83d0b5caa4a02d3e02d20a9.zip |
[MRM-1704] Refactor to remove maven specific part from various repository/metadata apis
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1403507 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins/maven2-repository/src')
4 files changed, 32 insertions, 22 deletions
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java index 057cc10e4..791c8806c 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java @@ -46,8 +46,8 @@ import org.apache.archiva.model.ArchivaRepositoryMetadata; import org.apache.archiva.model.ArtifactReference; import org.apache.archiva.model.SnapshotVersion; import org.apache.archiva.policies.ProxyDownloadException; -import org.apache.archiva.proxy.RepositoryProxyConnectors; import org.apache.archiva.proxy.common.WagonFactory; +import org.apache.archiva.proxy.model.RepositoryProxyConnectors; import org.apache.archiva.reports.RepositoryProblemFacet; import org.apache.archiva.repository.ManagedRepositoryContent; import org.apache.archiva.xml.XMLException; diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/AbstractDefaultRepositoryContentTestCase.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/AbstractDefaultRepositoryContentTestCase.java index 5f6eb669b..c63c8d7bf 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/AbstractDefaultRepositoryContentTestCase.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/AbstractDefaultRepositoryContentTestCase.java @@ -30,13 +30,12 @@ import org.springframework.test.context.ContextConfiguration; import static org.junit.Assert.*; /** - * AbstractDefaultRepositoryContentTestCase - * - * + * AbstractDefaultRepositoryContentTestCase */ @RunWith ( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public abstract class AbstractDefaultRepositoryContentTestCase + extends AbstractRepositoryLayerTestCase { @Test public void testBadPathMissingType() @@ -47,7 +46,8 @@ public abstract class AbstractDefaultRepositoryContentTestCase @Test public void testBadPathReleaseInSnapshotDir() { - assertBadPath( "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar", "non snapshot artifact inside of a snapshot dir" ); + assertBadPath( "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar", + "non snapshot artifact inside of a snapshot dir" ); } @Test @@ -82,10 +82,12 @@ public abstract class AbstractDefaultRepositoryContentTestCase "wrong artifact id" ); } - /** + /** * [MRM-432] Oddball version spec. * Example of an oddball / unusual version spec. + * * @throws org.apache.archiva.repository.layout.LayoutException + * */ @Test public void testGoodButOddVersionSpecGanymedSsh2() @@ -104,7 +106,9 @@ public abstract class AbstractDefaultRepositoryContentTestCase /** * [MRM-432] Oddball version spec. * Example of an oddball / unusual version spec. + * * @throws org.apache.archiva.repository.layout.LayoutException + * */ @Test public void testGoodButOddVersionSpecJavaxComm() @@ -144,7 +148,9 @@ public abstract class AbstractDefaultRepositoryContentTestCase /** * [MRM-432] Oddball version spec. * Example of an oddball / unusual version spec. + * * @throws org.apache.archiva.repository.layout.LayoutException + * */ @Test public void testGoodButOddVersionSpecJavaxPersistence() @@ -241,14 +247,17 @@ public abstract class AbstractDefaultRepositoryContentTestCase String version = "0.3"; String classifier = null; String type = "pom"; - String path = "com/company/department/com.company.department.project/0.3/com.company.department.project-0.3.pom"; + String path = + "com/company/department/com.company.department.project/0.3/com.company.department.project-0.3.pom"; assertLayout( path, groupId, artifactId, version, classifier, type ); } /** * Test the classifier, and java-source type spec. + * * @throws org.apache.archiva.repository.layout.LayoutException + * */ @Test public void testGoodFooLibSources() @@ -266,7 +275,9 @@ public abstract class AbstractDefaultRepositoryContentTestCase /** * A timestamped versioned artifact, should reside in a SNAPSHOT baseversion directory. + * * @throws org.apache.archiva.repository.layout.LayoutException + * */ @Test public void testGoodSnapshotMavenTest() @@ -277,7 +288,8 @@ public abstract class AbstractDefaultRepositoryContentTestCase String version = "3.1-beta-1-20050831.101112-42"; String classifier = null; String type = "jar"; - String path = "org/apache/archiva/test/redonkulous/3.1-beta-1-SNAPSHOT/redonkulous-3.1-beta-1-20050831.101112-42.jar"; + String path = + "org/apache/archiva/test/redonkulous/3.1-beta-1-SNAPSHOT/redonkulous-3.1-beta-1-20050831.101112-42.jar"; assertLayout( path, groupId, artifactId, version, classifier, type ); } @@ -299,7 +311,7 @@ public abstract class AbstractDefaultRepositoryContentTestCase assertLayout( path, groupId, artifactId, version, classifier, type ); } - + /** * [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods. * Example uses "test" in artifact Id, which is also part of the versionKeyword list. @@ -410,8 +422,8 @@ public abstract class AbstractDefaultRepositoryContentTestCase private void assertArtifactReference( ArtifactReference actualReference, String groupId, String artifactId, String version, String classifier, String type ) { - String expectedId = "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":" + classifier - + ":" + type; + String expectedId = + "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":" + classifier + ":" + type; assertNotNull( expectedId + " - Should not be null.", actualReference ); @@ -430,7 +442,8 @@ public abstract class AbstractDefaultRepositoryContentTestCase try { toArtifactReference( path ); - fail( "Should have thrown a LayoutException on the invalid path [" + path + "] because of [" + reason + "]" ); + fail( + "Should have thrown a LayoutException on the invalid path [" + path + "] because of [" + reason + "]" ); } catch ( LayoutException e ) { @@ -462,7 +475,7 @@ public abstract class AbstractDefaultRepositoryContentTestCase assertEquals( "Artifact <" + expectedArtifact + "> to path:", path, toPath( testReference ) ); } - private ArtifactReference createArtifact( String groupId, String artifactId, String version, String classifier, + protected ArtifactReference createArtifact( String groupId, String artifactId, String version, String classifier, String type ) { ArtifactReference artifact = new ArtifactReference(); diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/ManagedDefaultRepositoryContentTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/ManagedDefaultRepositoryContentTest.java index 2e742fbe2..4fc0e7429 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/ManagedDefaultRepositoryContentTest.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/ManagedDefaultRepositoryContentTest.java @@ -49,22 +49,21 @@ import static org.junit.Assert.fail; /** * ManagedDefaultRepositoryContentTest - * - * */ @RunWith ( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public class ManagedDefaultRepositoryContentTest - extends AbstractRepositoryLayerTestCase + extends AbstractDefaultRepositoryContentTestCase { @Inject - @Named( value = "managedRepositoryContent#default" ) + @Named ( value = "managedRepositoryContent#default" ) private ManagedRepositoryContent repoContent; @Inject FileTypes fileTypes; - @Inject @Named(value = "archivaConfiguration#default") + @Inject + @Named ( value = "archivaConfiguration#default" ) ArchivaConfiguration archivaConfiguration; @Before @@ -75,9 +74,7 @@ public class ManagedDefaultRepositoryContentTest ManagedRepository repository = createRepository( "testRepo", "Unit Test Repo", repoDir ); - - FileType fileType = - (FileType) archivaConfiguration.getConfiguration().getRepositoryScanning().getFileTypes().get( 0 ); + FileType fileType = archivaConfiguration.getConfiguration().getRepositoryScanning().getFileTypes().get( 0 ); fileType.addPattern( "**/*.xml" ); assertEquals( FileTypes.ARTIFACTS, fileType.getId() ); diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/ManagedLegacyRepositoryContentTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/ManagedLegacyRepositoryContentTest.java index 6cfc9a150..61640e563 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/ManagedLegacyRepositoryContentTest.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/ManagedLegacyRepositoryContentTest.java @@ -50,7 +50,7 @@ import static org.junit.Assert.*; @RunWith ( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public class ManagedLegacyRepositoryContentTest - extends AbstractRepositoryLayerTestCase + extends AbstractDefaultRepositoryContentTestCase { @Inject @Named( value = "managedRepositoryContent#legacy" ) |