MRM-594 store exception to default legacy-path 2 artifact resolution in archiva.xml

Default configuration includes jaxen-1.0-FCS-full.jar, used by some core maven1 plugins.

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@602916 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nicolas De Loof 2007-12-10 14:43:38 +00:00
parent 9599934e22
commit 5c89de0ca6
4 changed files with 149 additions and 17 deletions

View File

@ -36,6 +36,10 @@
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-policies</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-model</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>

View File

@ -105,6 +105,17 @@
The list of network proxies to use for outgoing requests.
</description>
</field>
<field>
<name>legacyArtifactPaths</name>
<version>1.0.0+</version>
<association>
<type>LegacyArtifactPath</type>
<multiplicity>*</multiplicity>
</association>
<description>
The list of custom legacy path to artifact.
</description>
</field>
<field>
<name>repositoryScanning</name>
<version>1.0.0+</version>
@ -430,6 +441,57 @@
</fields>
</class>
<class>
<name>LegacyArtifactPath</name>
<version>1.0.0+</version>
<fields>
<field>
<name>path</name>
<version>1.0.0+</version>
<type>String</type>
<required>true</required>
<description>
The legacy path.
</description>
</field>
<field>
<name>artifact</name>
<version>1.0.0+</version>
<type>String</type>
<required>true</required>
<description>
The artifact reference, as " [groupId] : [artifactId] : [version] : [classifier] : [type] ".
</description>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>1.0.0+</version>
<code><![CDATA[
public boolean match( String path )
{
return path.equals( this.path );
}
public org.apache.maven.archiva.model.ArtifactReference getArtifactReference()
{
org.apache.maven.archiva.model.ArtifactReference reference = new org.apache.maven.archiva.model.ArtifactReference();
String[] parts = artifact.split( ":" );
reference.setGroupId( parts[0] );
reference.setArtifactId( parts[1] );
reference.setVersion( parts[2] );
if ( parts[3].length() > 0 )
{
reference.setClassifier( parts[3] );
}
reference.setType( parts[4] );
return reference;
}
]]></code>
</codeSegment>
</codeSegments>
</class>
<!--
____ _
/ ___|___ _ __ _ __ ___ ___| |_ ___ _ __ ___

View File

@ -71,6 +71,13 @@
</proxyConnector>
</proxyConnectors>
<legacyArtifactPaths>
<legacyArtifactPath>
<path>jaxen/jars/jaxen-1.0-FCS-full.jar</path>
<artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact>
</legacyArtifactPath>
</legacyArtifactPaths>
<repositoryScanning>
<fileTypes>
<fileType>

View File

@ -0,0 +1,59 @@
package org.apache.maven.archiva.configuration;
import junit.framework.TestCase;
import org.apache.maven.archiva.model.ArtifactReference;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Test the generated LegacyArtifactPath class from Modello. This is primarily to test the hand coded methods.
*/
public class LegacyArtifactPathTest
extends TestCase
{
private LegacyArtifactPath legacyArtifactPath = new LegacyArtifactPath();
public void testLegacyArtifactPathWithClassifierResolution()
{
legacyArtifactPath.setArtifact( "groupId:artifactId:version:classifier:type" );
ArtifactReference artifact = legacyArtifactPath.getArtifactReference();
assertEquals( "groupId", artifact.getGroupId() );
assertEquals( "artifactId", artifact.getArtifactId() );
assertEquals( "version", artifact.getVersion() );
assertEquals( "classifier", artifact.getClassifier() );
assertEquals( "type", artifact.getType() );
}
public void testLegacyArtifactPathWithoutClassifierResolution()
{
legacyArtifactPath.setArtifact( "groupId:artifactId:version::type" );
ArtifactReference artifact = legacyArtifactPath.getArtifactReference();
assertEquals( "groupId", artifact.getGroupId() );
assertEquals( "artifactId", artifact.getArtifactId() );
assertEquals( "version", artifact.getVersion() );
assertEquals( null, artifact.getClassifier() );
assertEquals( "type", artifact.getType() );
}
}