mirror of https://github.com/apache/archiva.git
[MRM-596]
applied patch submitted by nicolas de loof - remove the assertion that legacy path have no classifier. Simply have no way to support unstandard classifiers. - automatically use "-javadoc" and "-sources" classifiers for path with types "javadoc.jars" and "java-sources". Check for the classifier to be detected in the version string and remove it. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@596620 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4edbcd1a9d
commit
9cc410a27c
|
@ -35,10 +35,6 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractLegacyRepositoryContent
|
public abstract class AbstractLegacyRepositoryContent
|
||||||
{
|
{
|
||||||
private static final String DIR_JAVADOC = "javadoc.jars";
|
|
||||||
|
|
||||||
private static final String DIR_JAVA_SOURCE = "java-sources";
|
|
||||||
|
|
||||||
private static final String PATH_SEPARATOR = "/";
|
private static final String PATH_SEPARATOR = "/";
|
||||||
|
|
||||||
private static final Map<String, String> typeToDirectoryMap;
|
private static final Map<String, String> typeToDirectoryMap;
|
||||||
|
@ -50,6 +46,7 @@ public abstract class AbstractLegacyRepositoryContent
|
||||||
typeToDirectoryMap.put( ArtifactExtensionMapping.MAVEN_PLUGIN, "plugin" );
|
typeToDirectoryMap.put( ArtifactExtensionMapping.MAVEN_PLUGIN, "plugin" );
|
||||||
typeToDirectoryMap.put( "distribution-tgz", "distribution" );
|
typeToDirectoryMap.put( "distribution-tgz", "distribution" );
|
||||||
typeToDirectoryMap.put( "distribution-zip", "distribution" );
|
typeToDirectoryMap.put( "distribution-zip", "distribution" );
|
||||||
|
typeToDirectoryMap.put( "javadoc", "javadoc.jar" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactReference toArtifactReference( String path )
|
public ArtifactReference toArtifactReference( String path )
|
||||||
|
@ -57,7 +54,7 @@ public abstract class AbstractLegacyRepositoryContent
|
||||||
{
|
{
|
||||||
return LegacyPathParser.toArtifactReference( path );
|
return LegacyPathParser.toArtifactReference( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toPath( ArchivaArtifact reference )
|
public String toPath( ArchivaArtifact reference )
|
||||||
{
|
{
|
||||||
if ( reference == null )
|
if ( reference == null )
|
||||||
|
@ -104,21 +101,6 @@ public abstract class AbstractLegacyRepositoryContent
|
||||||
|
|
||||||
private String getDirectory( String classifier, String type )
|
private String getDirectory( String classifier, String type )
|
||||||
{
|
{
|
||||||
// Special Cases involving type + classifier
|
|
||||||
if ( "jar".equals( type ) && StringUtils.isNotBlank( classifier ) )
|
|
||||||
{
|
|
||||||
if ( "sources".equals( classifier ) )
|
|
||||||
{
|
|
||||||
return DIR_JAVA_SOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( "javadoc".equals( classifier ) )
|
|
||||||
{
|
|
||||||
return DIR_JAVADOC;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Special Cases involving only type.
|
|
||||||
String dirname = (String) typeToDirectoryMap.get( type );
|
String dirname = (String) typeToDirectoryMap.get( type );
|
||||||
|
|
||||||
if ( dirname != null )
|
if ( dirname != null )
|
||||||
|
|
|
@ -157,6 +157,19 @@ public class LegacyPathParser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String classifier = ArtifactClassifierMapping.getClassifier( artifact.getType() );
|
||||||
|
if ( classifier != null )
|
||||||
|
{
|
||||||
|
String version = artifact.getVersion();
|
||||||
|
if ( ! version.endsWith( "-" + classifier ) )
|
||||||
|
{
|
||||||
|
throw new LayoutException( INVALID_ARTIFACT_PATH + expectedType + " artifacts must use the classifier " + classifier );
|
||||||
|
}
|
||||||
|
version = version.substring( 0, version.length() - classifier.length() - 1 );
|
||||||
|
artifact.setVersion( version );
|
||||||
|
artifact.setClassifier( classifier );
|
||||||
|
}
|
||||||
|
|
||||||
return artifact;
|
return artifact;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,13 +72,13 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "ch.ethz.ganymed/jars/ganymed-ssh2-build210.jar";
|
String path = "ch.ethz.ganymed/jars/ganymed-ssh2-build210.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [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 LayoutException
|
* @throws LayoutException
|
||||||
*/
|
*/
|
||||||
public void testGoodButOddVersionSpecJavaxComm()
|
public void testGoodButOddVersionSpecJavaxComm()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
|
@ -89,13 +89,13 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "javax/jars/comm-3.0-u1.jar";
|
String path = "javax/jars/comm-3.0-u1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [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 LayoutException
|
* @throws LayoutException
|
||||||
*/
|
*/
|
||||||
public void testGoodButOddVersionSpecJavaxPersistence()
|
public void testGoodButOddVersionSpecJavaxPersistence()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
|
@ -106,12 +106,12 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "javax.persistence/jars/ejb-3.0-public_review.jar";
|
String path = "javax.persistence/jars/ejb-3.0-public_review.jar";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The version id of "public_review" can cause problems. is it part of
|
* The version id of "public_review" can cause problems. is it part of
|
||||||
* the version spec? or the classifier?
|
* the version spec? or the classifier?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGoodCommonsLang()
|
public void testGoodCommonsLang()
|
||||||
|
@ -123,7 +123,7 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "commons-lang/jars/commons-lang-2.1.jar";
|
String path = "commons-lang/jars/commons-lang-2.1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGoodDerby()
|
public void testGoodDerby()
|
||||||
|
@ -135,16 +135,16 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "org.apache.derby/jars/derby-10.2.2.0.jar";
|
String path = "org.apache.derby/jars/derby-10.2.2.0.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the ejb-client type spec.
|
* Test the ejb-client type spec.
|
||||||
* Type specs are not a 1 to 1 map to the extension.
|
* Type specs are not a 1 to 1 map to the extension.
|
||||||
* This tests that effect.
|
* This tests that effect.
|
||||||
* @throws LayoutException
|
* @throws LayoutException
|
||||||
*/
|
*/
|
||||||
/* TODO: Re-enabled in the future.
|
/* TODO: Re-enabled in the future.
|
||||||
public void testGoodFooEjbClient()
|
public void testGoodFooEjbClient()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
{
|
{
|
||||||
|
@ -160,34 +160,36 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the classifier.
|
* Test the classifier.
|
||||||
* @throws LayoutException
|
* @throws LayoutException
|
||||||
*/
|
*/
|
||||||
public void testGoodFooLibJavadoc()
|
public void testGoodFooLibJavadoc()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
{
|
{
|
||||||
String groupId = "com.foo.lib";
|
String groupId = "com.foo.lib";
|
||||||
String artifactId = "foo-lib";
|
String artifactId = "foo-lib";
|
||||||
String version = "2.1-alpha-1-javadoc";
|
String version = "2.1-alpha-1";
|
||||||
String type = "javadoc";
|
String type = "javadoc";
|
||||||
String path = "com.foo.lib/javadocs/foo-lib-2.1-alpha-1-javadoc.jar";
|
String classifier = "javadoc";
|
||||||
|
String path = "com.foo.lib/javadoc.jars/foo-lib-2.1-alpha-1-javadoc.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, classifier, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the classifier, and java-source type spec.
|
* Test the classifier, and java-source type spec.
|
||||||
* @throws LayoutException
|
* @throws LayoutException
|
||||||
*/
|
*/
|
||||||
public void testGoodFooLibSources()
|
public void testGoodFooLibSources()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
{
|
{
|
||||||
String groupId = "com.foo.lib";
|
String groupId = "com.foo.lib";
|
||||||
String artifactId = "foo-lib";
|
String artifactId = "foo-lib";
|
||||||
String version = "2.1-alpha-1-sources";
|
String version = "2.1-alpha-1";
|
||||||
String type = "java-source"; // oddball type-spec (should result in jar extension)
|
String type = "java-source"; // oddball type-spec (should result in jar extension)
|
||||||
|
String classifier = "sources";
|
||||||
String path = "com.foo.lib/java-sources/foo-lib-2.1-alpha-1-sources.jar";
|
String path = "com.foo.lib/java-sources/foo-lib-2.1-alpha-1-sources.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, classifier, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGoodFooTool()
|
public void testGoodFooTool()
|
||||||
|
@ -199,7 +201,7 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "com.foo/jars/foo-tool-1.0.jar";
|
String path = "com.foo/jars/foo-tool-1.0.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGoodGeronimoEjbSpec()
|
public void testGoodGeronimoEjbSpec()
|
||||||
|
@ -211,7 +213,7 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "org.apache.geronimo.specs/jars/geronimo-ejb_2.1_spec-1.0.1.jar";
|
String path = "org.apache.geronimo.specs/jars/geronimo-ejb_2.1_spec-1.0.1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGoodLdapClientsPom()
|
public void testGoodLdapClientsPom()
|
||||||
|
@ -223,12 +225,12 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String type = "pom";
|
String type = "pom";
|
||||||
String path = "directory-clients/poms/ldap-clients-0.9.1-SNAPSHOT.pom";
|
String path = "directory-clients/poms/ldap-clients-0.9.1-SNAPSHOT.pom";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A timestamped versioned artifact, should reside in a SNAPSHOT baseversion directory.
|
* A timestamped versioned artifact, should reside in a SNAPSHOT baseversion directory.
|
||||||
* @throws LayoutException
|
* @throws LayoutException
|
||||||
*/
|
*/
|
||||||
public void testGoodSnapshotMavenTest()
|
public void testGoodSnapshotMavenTest()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
|
@ -239,7 +241,7 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "org.apache.archiva.test/jars/redonkulous-3.1-beta-1-20050831.101112-42.jar";
|
String path = "org.apache.archiva.test/jars/redonkulous-3.1-beta-1-20050831.101112-42.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -256,9 +258,9 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
|
|
||||||
String path = "maven/poms/maven-test-plugin-1.8.2.pom";
|
String path = "maven/poms/maven-test-plugin-1.8.2.pom";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
* [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.
|
* Example uses "test" in artifact Id, which is also part of the versionKeyword list.
|
||||||
|
@ -272,9 +274,9 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String type = "maven-plugin";
|
String type = "maven-plugin";
|
||||||
String path = "maven/plugins/maven-test-plugin-1.8.2.jar";
|
String path = "maven/plugins/maven-test-plugin-1.8.2.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
||||||
*/
|
*/
|
||||||
|
@ -287,9 +289,9 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String type = "maven-plugin";
|
String type = "maven-plugin";
|
||||||
String path = "avalon-meta/plugins/avalon-meta-plugin-1.1.jar";
|
String path = "avalon-meta/plugins/avalon-meta-plugin-1.1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
||||||
*/
|
*/
|
||||||
|
@ -302,9 +304,9 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String type = "maven-plugin";
|
String type = "maven-plugin";
|
||||||
String path = "cactus/plugins/cactus-maven-1.7dev-20040815.jar";
|
String path = "cactus/plugins/cactus-maven-1.7dev-20040815.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
||||||
*/
|
*/
|
||||||
|
@ -317,33 +319,34 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
String type = "maven-plugin";
|
String type = "maven-plugin";
|
||||||
String path = "geronimo/plugins/geronimo-packaging-plugin-1.0.1.jar";
|
String path = "geronimo/plugins/geronimo-packaging-plugin-1.0.1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a roundtrip through the layout routines to determine success.
|
* Perform a roundtrip through the layout routines to determine success.
|
||||||
|
* @param classifier TODO
|
||||||
*/
|
*/
|
||||||
private void assertLayout( String path, String groupId, String artifactId, String version, 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, type );
|
ArtifactReference expectedArtifact = createArtifact( groupId, artifactId, version, classifier, type );
|
||||||
|
|
||||||
// --- Artifact Tests.
|
// --- Artifact Tests.
|
||||||
// Artifact to Path
|
// Artifact to Path
|
||||||
assertEquals( "Artifact <" + expectedArtifact + "> to path:", path, toPath( expectedArtifact ) );
|
assertEquals( "Artifact <" + expectedArtifact + "> to path:", path, toPath( expectedArtifact ) );
|
||||||
|
|
||||||
// --- Artifact Reference Tests
|
// --- Artifact Reference Tests
|
||||||
|
|
||||||
// Path to Artifact Reference.
|
// Path to Artifact Reference.
|
||||||
ArtifactReference testReference = toArtifactReference( path );
|
ArtifactReference testReference = toArtifactReference( path );
|
||||||
assertArtifactReference( testReference, groupId, artifactId, version, type );
|
assertArtifactReference( testReference, groupId, artifactId, version, classifier, type );
|
||||||
|
|
||||||
// And back again, using test Reference from previous step.
|
// And back again, using test Reference from previous step.
|
||||||
assertEquals( "Artifact <" + expectedArtifact + "> to path:", path, toPath( testReference ) );
|
assertEquals( "Artifact <" + expectedArtifact + "> to path:", path, toPath( testReference ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertArtifactReference( ArtifactReference actualReference, String groupId, String artifactId,
|
private void assertArtifactReference( ArtifactReference actualReference, String groupId, String artifactId,
|
||||||
String version, String type )
|
String version, String classifier, String type )
|
||||||
{
|
{
|
||||||
String expectedId = "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":" + type;
|
String expectedId = "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":" + type;
|
||||||
|
|
||||||
|
@ -352,17 +355,17 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
assertEquals( expectedId + " - Group ID", groupId, actualReference.getGroupId() );
|
assertEquals( expectedId + " - Group ID", groupId, actualReference.getGroupId() );
|
||||||
assertEquals( expectedId + " - Artifact ID", artifactId, actualReference.getArtifactId() );
|
assertEquals( expectedId + " - Artifact ID", artifactId, actualReference.getArtifactId() );
|
||||||
assertEquals( expectedId + " - Version ID", version, actualReference.getVersion() );
|
assertEquals( expectedId + " - Version ID", version, actualReference.getVersion() );
|
||||||
|
assertEquals( expectedId + " - classifier", classifier, actualReference.getClassifier() );
|
||||||
assertEquals( expectedId + " - Type", type, actualReference.getType() );
|
assertEquals( expectedId + " - Type", type, actualReference.getType() );
|
||||||
// legacy has no classifier.
|
|
||||||
assertNull( expectedId + " - classifier", actualReference.getClassifier() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ArtifactReference createArtifact( String groupId, String artifactId, String version, 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 );
|
||||||
artifact.setArtifactId( artifactId );
|
artifact.setArtifactId( artifactId );
|
||||||
artifact.setVersion( version );
|
artifact.setVersion( version );
|
||||||
|
artifact.setClassifier( classifier );
|
||||||
artifact.setType( type );
|
artifact.setType( type );
|
||||||
assertNotNull( artifact );
|
assertNotNull( artifact );
|
||||||
return artifact;
|
return artifact;
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase;
|
||||||
import org.apache.maven.archiva.repository.layout.LayoutException;
|
import org.apache.maven.archiva.repository.layout.LayoutException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LegacyPathParserTest
|
* LegacyPathParserTest
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
@ -58,9 +58,9 @@ public class LegacyPathParserTest
|
||||||
{
|
{
|
||||||
assertBadPath( "org.apache.maven.test/jars/artifactId-1.0.war", "wrong package extension" );
|
assertBadPath( "org.apache.maven.test/jars/artifactId-1.0.war", "wrong package extension" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error
|
* [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error
|
||||||
*/
|
*/
|
||||||
public void testGoodButDualExtensions()
|
public void testGoodButDualExtensions()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
|
@ -71,13 +71,13 @@ public class LegacyPathParserTest
|
||||||
String type = "distribution-zip";
|
String type = "distribution-zip";
|
||||||
String path = "org.project/zips/example-presentation-3.2.xml.zip";
|
String path = "org.project/zips/example-presentation-3.2.xml.zip";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [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 LayoutException
|
* @throws LayoutException
|
||||||
*/
|
*/
|
||||||
public void testGoodButOddVersionSpecGanymedSsh2()
|
public void testGoodButOddVersionSpecGanymedSsh2()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
|
@ -88,13 +88,13 @@ public class LegacyPathParserTest
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "ch.ethz.ganymed/jars/ganymed-ssh2-build210.jar";
|
String path = "ch.ethz.ganymed/jars/ganymed-ssh2-build210.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [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 LayoutException
|
* @throws LayoutException
|
||||||
*/
|
*/
|
||||||
public void testGoodButOddVersionSpecJavaxComm()
|
public void testGoodButOddVersionSpecJavaxComm()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
|
@ -105,13 +105,13 @@ public class LegacyPathParserTest
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "javax/jars/comm-3.0-u1.jar";
|
String path = "javax/jars/comm-3.0-u1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [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 LayoutException
|
* @throws LayoutException
|
||||||
*/
|
*/
|
||||||
public void testGoodButOddVersionSpecJavaxPersistence()
|
public void testGoodButOddVersionSpecJavaxPersistence()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
|
@ -122,12 +122,12 @@ public class LegacyPathParserTest
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "javax.persistence/jars/ejb-3.0-public_review.jar";
|
String path = "javax.persistence/jars/ejb-3.0-public_review.jar";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The version id of "public_review" can cause problems. is it part of
|
* The version id of "public_review" can cause problems. is it part of
|
||||||
* the version spec? or the classifier?
|
* the version spec? or the classifier?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGoodCommonsLang()
|
public void testGoodCommonsLang()
|
||||||
|
@ -139,7 +139,7 @@ public class LegacyPathParserTest
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "commons-lang/jars/commons-lang-2.1.jar";
|
String path = "commons-lang/jars/commons-lang-2.1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGoodDerby()
|
public void testGoodDerby()
|
||||||
|
@ -151,16 +151,16 @@ public class LegacyPathParserTest
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "org.apache.derby/jars/derby-10.2.2.0.jar";
|
String path = "org.apache.derby/jars/derby-10.2.2.0.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the ejb-client type spec.
|
* Test the ejb-client type spec.
|
||||||
* Type specs are not a 1 to 1 map to the extension.
|
* Type specs are not a 1 to 1 map to the extension.
|
||||||
* This tests that effect.
|
* This tests that effect.
|
||||||
* @throws LayoutException
|
* @throws LayoutException
|
||||||
*/
|
*/
|
||||||
/* TODO: Re-enabled in the future.
|
/* TODO: Re-enabled in the future.
|
||||||
public void testGoodFooEjbClient()
|
public void testGoodFooEjbClient()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
{
|
{
|
||||||
|
@ -176,34 +176,36 @@ public class LegacyPathParserTest
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the classifier.
|
* Test the classifier.
|
||||||
* @throws LayoutException
|
* @throws LayoutException
|
||||||
*/
|
*/
|
||||||
public void testGoodFooLibJavadoc()
|
public void testGoodFooLibJavadoc()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
{
|
{
|
||||||
String groupId = "com.foo.lib";
|
String groupId = "com.foo.lib";
|
||||||
String artifactId = "foo-lib";
|
String artifactId = "foo-lib";
|
||||||
String version = "2.1-alpha-1-javadoc";
|
String version = "2.1-alpha-1";
|
||||||
String type = "javadoc";
|
String type = "javadoc";
|
||||||
String path = "com.foo.lib/javadocs/foo-lib-2.1-alpha-1-javadoc.jar";
|
String classifier = "javadoc";
|
||||||
|
String path = "com.foo.lib/javadoc.jars/foo-lib-2.1-alpha-1-javadoc.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, classifier, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the classifier, and java-source type spec.
|
* Test the classifier, and java-source type spec.
|
||||||
* @throws LayoutException
|
* @throws LayoutException
|
||||||
*/
|
*/
|
||||||
public void testGoodFooLibSources()
|
public void testGoodFooLibSources()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
{
|
{
|
||||||
String groupId = "com.foo.lib";
|
String groupId = "com.foo.lib";
|
||||||
String artifactId = "foo-lib";
|
String artifactId = "foo-lib";
|
||||||
String version = "2.1-alpha-1-sources";
|
String version = "2.1-alpha-1";
|
||||||
String type = "java-source"; // oddball type-spec (should result in jar extension)
|
String type = "java-source"; // oddball type-spec (should result in jar extension)
|
||||||
|
String classifier= "sources";
|
||||||
String path = "com.foo.lib/java-sources/foo-lib-2.1-alpha-1-sources.jar";
|
String path = "com.foo.lib/java-sources/foo-lib-2.1-alpha-1-sources.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, classifier, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGoodFooTool()
|
public void testGoodFooTool()
|
||||||
|
@ -215,7 +217,7 @@ public class LegacyPathParserTest
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "com.foo/jars/foo-tool-1.0.jar";
|
String path = "com.foo/jars/foo-tool-1.0.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGoodGeronimoEjbSpec()
|
public void testGoodGeronimoEjbSpec()
|
||||||
|
@ -227,7 +229,7 @@ public class LegacyPathParserTest
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "org.apache.geronimo.specs/jars/geronimo-ejb_2.1_spec-1.0.1.jar";
|
String path = "org.apache.geronimo.specs/jars/geronimo-ejb_2.1_spec-1.0.1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGoodLdapClientsPom()
|
public void testGoodLdapClientsPom()
|
||||||
|
@ -239,12 +241,12 @@ public class LegacyPathParserTest
|
||||||
String type = "pom";
|
String type = "pom";
|
||||||
String path = "directory-clients/poms/ldap-clients-0.9.1-SNAPSHOT.pom";
|
String path = "directory-clients/poms/ldap-clients-0.9.1-SNAPSHOT.pom";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A timestamped versioned artifact, should reside in a SNAPSHOT baseversion directory.
|
* A timestamped versioned artifact, should reside in a SNAPSHOT baseversion directory.
|
||||||
* @throws LayoutException
|
* @throws LayoutException
|
||||||
*/
|
*/
|
||||||
public void testGoodSnapshotMavenTest()
|
public void testGoodSnapshotMavenTest()
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
|
@ -255,7 +257,7 @@ public class LegacyPathParserTest
|
||||||
String type = "jar";
|
String type = "jar";
|
||||||
String path = "org.apache.archiva.test/jars/redonkulous-3.1-beta-1-20050831.101112-42.jar";
|
String path = "org.apache.archiva.test/jars/redonkulous-3.1-beta-1-20050831.101112-42.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -272,9 +274,9 @@ public class LegacyPathParserTest
|
||||||
|
|
||||||
String path = "maven/poms/maven-test-plugin-1.8.2.pom";
|
String path = "maven/poms/maven-test-plugin-1.8.2.pom";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
* [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.
|
* Example uses "test" in artifact Id, which is also part of the versionKeyword list.
|
||||||
|
@ -288,9 +290,9 @@ public class LegacyPathParserTest
|
||||||
String type = "maven-plugin";
|
String type = "maven-plugin";
|
||||||
String path = "maven/plugins/maven-test-plugin-1.8.2.jar";
|
String path = "maven/plugins/maven-test-plugin-1.8.2.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
||||||
*/
|
*/
|
||||||
|
@ -303,9 +305,9 @@ public class LegacyPathParserTest
|
||||||
String type = "maven-plugin";
|
String type = "maven-plugin";
|
||||||
String path = "avalon-meta/plugins/avalon-meta-plugin-1.1.jar";
|
String path = "avalon-meta/plugins/avalon-meta-plugin-1.1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
||||||
*/
|
*/
|
||||||
|
@ -318,9 +320,9 @@ public class LegacyPathParserTest
|
||||||
String type = "maven-plugin";
|
String type = "maven-plugin";
|
||||||
String path = "cactus/plugins/cactus-maven-1.7dev-20040815.jar";
|
String path = "cactus/plugins/cactus-maven-1.7dev-20040815.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
* [MRM-562] Artifact type "maven-plugin" is not detected correctly in .toArtifactReference() methods.
|
||||||
*/
|
*/
|
||||||
|
@ -333,22 +335,23 @@ public class LegacyPathParserTest
|
||||||
String type = "maven-plugin";
|
String type = "maven-plugin";
|
||||||
String path = "geronimo/plugins/geronimo-packaging-plugin-1.0.1.jar";
|
String path = "geronimo/plugins/geronimo-packaging-plugin-1.0.1.jar";
|
||||||
|
|
||||||
assertLayout( path, groupId, artifactId, version, type );
|
assertLayout( path, groupId, artifactId, version, null, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a path to artifact reference lookup, and verify the results.
|
* Perform a path to artifact reference lookup, and verify the results.
|
||||||
|
* @param classifier TODO
|
||||||
*/
|
*/
|
||||||
private void assertLayout( String path, String groupId, String artifactId, String version, String type )
|
private void assertLayout( String path, String groupId, String artifactId, String version, String classifier, String type )
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
{
|
{
|
||||||
// Path to Artifact Reference.
|
// Path to Artifact Reference.
|
||||||
ArtifactReference testReference = LegacyPathParser.toArtifactReference( path );
|
ArtifactReference testReference = LegacyPathParser.toArtifactReference( path );
|
||||||
assertArtifactReference( testReference, groupId, artifactId, version, type );
|
assertArtifactReference( testReference, groupId, artifactId, version, classifier, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertArtifactReference( ArtifactReference actualReference, String groupId, String artifactId,
|
private void assertArtifactReference( ArtifactReference actualReference, String groupId, String artifactId,
|
||||||
String version, String type )
|
String version, String classifier, String type )
|
||||||
{
|
{
|
||||||
String expectedId = "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":" + type;
|
String expectedId = "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":" + type;
|
||||||
|
|
||||||
|
@ -357,9 +360,8 @@ public class LegacyPathParserTest
|
||||||
assertEquals( expectedId + " - Group ID", groupId, actualReference.getGroupId() );
|
assertEquals( expectedId + " - Group ID", groupId, actualReference.getGroupId() );
|
||||||
assertEquals( expectedId + " - Artifact ID", artifactId, actualReference.getArtifactId() );
|
assertEquals( expectedId + " - Artifact ID", artifactId, actualReference.getArtifactId() );
|
||||||
assertEquals( expectedId + " - Version ID", version, actualReference.getVersion() );
|
assertEquals( expectedId + " - Version ID", version, actualReference.getVersion() );
|
||||||
|
assertEquals( expectedId + " - classifier", classifier, actualReference.getClassifier() );
|
||||||
assertEquals( expectedId + " - Type", type, actualReference.getType() );
|
assertEquals( expectedId + " - Type", type, actualReference.getType() );
|
||||||
// legacy has no classifier.
|
|
||||||
assertNull( expectedId + " - classifier", actualReference.getClassifier() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertBadPath( String path, String reason )
|
protected void assertBadPath( String path, String reason )
|
||||||
|
|
|
@ -34,7 +34,7 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ManagedLegacyRepositoryContentTest
|
* ManagedLegacyRepositoryContentTest
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
@ -49,8 +49,8 @@ public class ManagedLegacyRepositoryContentTest
|
||||||
{
|
{
|
||||||
assertVersions( "org.apache.maven", "testing", new String[] {
|
assertVersions( "org.apache.maven", "testing", new String[] {
|
||||||
"UNKNOWN",
|
"UNKNOWN",
|
||||||
"1.0-javadoc",
|
// "1.0-javadoc",
|
||||||
"1.0-sources",
|
// "1.0-sources",
|
||||||
"1.0",
|
"1.0",
|
||||||
"1.0-20050611.112233-1" } );
|
"1.0-20050611.112233-1" } );
|
||||||
}
|
}
|
||||||
|
@ -59,8 +59,8 @@ public class ManagedLegacyRepositoryContentTest
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertVersions( "org.apache.maven", "testing", "1.0", new String[] {
|
assertVersions( "org.apache.maven", "testing", "1.0", new String[] {
|
||||||
"1.0-javadoc",
|
// "1.0-javadoc",
|
||||||
"1.0-sources",
|
// "1.0-sources",
|
||||||
"1.0",
|
"1.0",
|
||||||
"1.0-20050611.112233-1" } );
|
"1.0-20050611.112233-1" } );
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ public class ManagedLegacyRepositoryContentTest
|
||||||
public void testGetRelatedArtifacts()
|
public void testGetRelatedArtifacts()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
ArtifactReference reference = createArtifact( "org.apache.maven", "testing", "1.0", "jar" );
|
ArtifactReference reference = createArtifact( "org.apache.maven", "testing", "1.0", null, "jar" );
|
||||||
|
|
||||||
Set<ArtifactReference> related = repoContent.getRelatedArtifacts( reference );
|
Set<ArtifactReference> related = repoContent.getRelatedArtifacts( reference );
|
||||||
assertNotNull( related );
|
assertNotNull( related );
|
||||||
|
@ -129,7 +129,7 @@ public class ManagedLegacyRepositoryContentTest
|
||||||
"org.apache.maven/java-sources/testing-1.0-sources.jar",
|
"org.apache.maven/java-sources/testing-1.0-sources.jar",
|
||||||
"org.apache.maven/jars/testing-1.0-20050611.112233-1.jar",
|
"org.apache.maven/jars/testing-1.0-20050611.112233-1.jar",
|
||||||
"org.apache.maven/poms/testing-1.0.pom",
|
"org.apache.maven/poms/testing-1.0.pom",
|
||||||
"org.apache.maven/javadocs/testing-1.0-javadoc.jar" };
|
"org.apache.maven/javadoc.jars/testing-1.0-javadoc.jar" };
|
||||||
|
|
||||||
StringBuffer relatedDebugString = new StringBuffer();
|
StringBuffer relatedDebugString = new StringBuffer();
|
||||||
relatedDebugString.append( "[" );
|
relatedDebugString.append( "[" );
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.maven.archiva.repository.layout.LayoutException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RepositoryRequestTest
|
* RepositoryRequestTest
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
@ -112,8 +112,8 @@ public class RepositoryRequestTest
|
||||||
public void testValidLegacyCommonsLangJavadoc()
|
public void testValidLegacyCommonsLangJavadoc()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertValid( "commons-lang/jars/commons-lang-2.1-javadoc.jar", "commons-lang", "commons-lang", "2.1-javadoc",
|
assertValid( "commons-lang/javadoc.jars/commons-lang-2.1-javadoc.jar", "commons-lang", "commons-lang", "2.1",
|
||||||
null, "javadoc" );
|
"javadoc", "javadoc" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testValidDefaultCommonsLangJavadoc()
|
public void testValidDefaultCommonsLangJavadoc()
|
||||||
|
|
Loading…
Reference in New Issue