fix unit test and spring declaration

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1403510 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-10-29 21:01:29 +00:00
parent 6aed2d4781
commit 7e8b82411a
3 changed files with 23 additions and 8 deletions

View File

@ -32,7 +32,7 @@
org.apache.archiva.repository.content.maven2,org.apache.archiva.repository.content.legacy"/> org.apache.archiva.repository.content.maven2,org.apache.archiva.repository.content.legacy"/>
<bean name="pathParser#legacy" class="org.apache.archiva.repository.content.LegacyPathParser"> <bean name="pathParser#legacy" class="org.apache.archiva.repository.content.legacy.LegacyPathParser">
<constructor-arg> <constructor-arg>
<ref bean="archivaConfiguration#default"/> <ref bean="archivaConfiguration#default"/>
</constructor-arg> </constructor-arg>

View File

@ -30,12 +30,11 @@ import static org.junit.Assert.*;
/** /**
* AbstractLegacyRepositoryContentTestCase * AbstractLegacyRepositoryContentTestCase
*
*
*/ */
@RunWith ( ArchivaSpringJUnit4ClassRunner.class ) @RunWith ( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) @ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public abstract class AbstractLegacyRepositoryContentTestCase public abstract class AbstractLegacyRepositoryContentTestCase
extends AbstractRepositoryLayerTestCase
{ {
@Test @Test
public void testBadPathArtifactIdMissingA() public void testBadPathArtifactIdMissingA()
@ -71,7 +70,9 @@ public abstract class AbstractLegacyRepositoryContentTestCase
/** /**
* [MRM-432] Oddball version spec. * [MRM-432] Oddball version spec.
* Example of an oddball / unusual version spec. * Example of an oddball / unusual version spec.
*
* @throws org.apache.archiva.repository.layout.LayoutException * @throws org.apache.archiva.repository.layout.LayoutException
*
*/ */
@Test @Test
public void testGoodButOddVersionSpecGanymedSsh2() public void testGoodButOddVersionSpecGanymedSsh2()
@ -89,7 +90,9 @@ public abstract class AbstractLegacyRepositoryContentTestCase
/** /**
* [MRM-432] Oddball version spec. * [MRM-432] Oddball version spec.
* Example of an oddball / unusual version spec. * Example of an oddball / unusual version spec.
*
* @throws org.apache.archiva.repository.layout.LayoutException * @throws org.apache.archiva.repository.layout.LayoutException
*
*/ */
@Test @Test
public void testGoodButOddVersionSpecJavaxComm() public void testGoodButOddVersionSpecJavaxComm()
@ -107,7 +110,9 @@ public abstract class AbstractLegacyRepositoryContentTestCase
/** /**
* [MRM-432] Oddball version spec. * [MRM-432] Oddball version spec.
* Example of an oddball / unusual version spec. * Example of an oddball / unusual version spec.
*
* @throws org.apache.archiva.repository.layout.LayoutException * @throws org.apache.archiva.repository.layout.LayoutException
*
*/ */
@Test @Test
public void testGoodButOddVersionSpecJavaxPersistence() public void testGoodButOddVersionSpecJavaxPersistence()
@ -175,7 +180,9 @@ public abstract class AbstractLegacyRepositoryContentTestCase
/** /**
* Test the classifier. * Test the classifier.
*
* @throws org.apache.archiva.repository.layout.LayoutException * @throws org.apache.archiva.repository.layout.LayoutException
*
*/ */
@Test @Test
public void testGoodFooLibJavadoc() public void testGoodFooLibJavadoc()
@ -193,7 +200,9 @@ public abstract class AbstractLegacyRepositoryContentTestCase
/** /**
* Test the classifier, and java-source type spec. * Test the classifier, and java-source type spec.
*
* @throws org.apache.archiva.repository.layout.LayoutException * @throws org.apache.archiva.repository.layout.LayoutException
*
*/ */
@Test @Test
public void testGoodFooLibSources() public void testGoodFooLibSources()
@ -250,7 +259,9 @@ public abstract class AbstractLegacyRepositoryContentTestCase
/** /**
* A timestamped versioned artifact, should reside in a SNAPSHOT baseversion directory. * A timestamped versioned artifact, should reside in a SNAPSHOT baseversion directory.
*
* @throws org.apache.archiva.repository.layout.LayoutException * @throws org.apache.archiva.repository.layout.LayoutException
*
*/ */
@Test @Test
public void testGoodSnapshotMavenTest() public void testGoodSnapshotMavenTest()
@ -367,9 +378,11 @@ public abstract class AbstractLegacyRepositoryContentTestCase
/** /**
* Perform a roundtrip through the layout routines to determine success. * Perform a roundtrip through the layout routines to determine success.
*
* @param classifier TODO * @param classifier TODO
*/ */
private void assertLayout( String path, String groupId, String artifactId, String version, String classifier, String type ) private void assertLayout( String path, String groupId, String artifactId, String version, String classifier,
String type )
throws LayoutException throws LayoutException
{ {
ArtifactReference expectedArtifact = createArtifact( groupId, artifactId, version, classifier, type ); ArtifactReference expectedArtifact = createArtifact( groupId, artifactId, version, classifier, type );
@ -402,7 +415,8 @@ public abstract class AbstractLegacyRepositoryContentTestCase
assertEquals( expectedId + " - Type", type, actualReference.getType() ); assertEquals( expectedId + " - Type", type, actualReference.getType() );
} }
protected ArtifactReference createArtifact( String groupId, String artifactId, String version, String classifier, String type ) protected ArtifactReference createArtifact( String groupId, String artifactId, String version, String classifier,
String type )
{ {
ArtifactReference artifact = new ArtifactReference(); ArtifactReference artifact = new ArtifactReference();
artifact.setGroupId( groupId ); artifact.setGroupId( groupId );
@ -419,7 +433,8 @@ public abstract class AbstractLegacyRepositoryContentTestCase
try try
{ {
toArtifactReference( path ); 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 ) catch ( LayoutException e )
{ {

View File

@ -37,7 +37,7 @@ import javax.inject.Named;
@RunWith ( ArchivaSpringJUnit4ClassRunner.class ) @RunWith ( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) @ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
public class RemoteDefaultRepositoryContentTest public class RemoteDefaultRepositoryContentTest
extends AbstractRepositoryLayerTestCase extends AbstractDefaultRepositoryContentTestCase
{ {
@Inject @Inject
@Named ( value = "remoteRepositoryContent#default" ) @Named ( value = "remoteRepositoryContent#default" )