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 )
|
||||||
|
@ -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,7 +72,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,7 +89,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -111,7 +111,7 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
* 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,7 +135,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,11 +167,12 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
{
|
{
|
||||||
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,11 +184,12 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
{
|
{
|
||||||
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,7 +225,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,7 +258,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -272,7 +274,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -287,7 +289,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -302,7 +304,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -317,16 +319,17 @@ 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
|
||||||
|
@ -336,14 +339,14 @@ public abstract class AbstractLegacyRepositoryContentTestCase
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
|
@ -71,7 +71,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +88,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,7 +105,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,7 +127,7 @@ public class LegacyPathParserTest
|
||||||
* 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,7 +151,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,11 +183,12 @@ public class LegacyPathParserTest
|
||||||
{
|
{
|
||||||
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -199,11 +200,12 @@ public class LegacyPathParserTest
|
||||||
{
|
{
|
||||||
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,7 +241,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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,7 +274,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -288,7 +290,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -303,7 +305,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -318,7 +320,7 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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 )
|
||||||
|
|
|
@ -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( "[" );
|
||||||
|
|
|
@ -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