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> <groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-policies</artifactId> <artifactId>archiva-policies</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-model</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.codehaus.plexus</groupId> <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId> <artifactId>plexus-component-api</artifactId>

View File

@ -48,7 +48,7 @@
</description> </description>
<name>repositories</name> <name>repositories</name>
<version>1.0.0</version> <version>1.0.0</version>
<association java.generate-add="false" <association java.generate-add="false"
java.generate-remove="false" java.generate-remove="false"
java.generate-break="false" java.generate-break="false"
java.generate-create="false"> java.generate-create="false">
@ -105,6 +105,17 @@
The list of network proxies to use for outgoing requests. The list of network proxies to use for outgoing requests.
</description> </description>
</field> </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> <field>
<name>repositoryScanning</name> <name>repositoryScanning</name>
<version>1.0.0+</version> <version>1.0.0+</version>
@ -156,10 +167,10 @@
} }
return map; return map;
} }
public java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> getProxyConnectorAsMap() public java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> getProxyConnectorAsMap()
{ {
java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap = java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap =
new java.util.HashMap<String, java.util.List<ProxyConnectorConfiguration>>(); new java.util.HashMap<String, java.util.List<ProxyConnectorConfiguration>>();
java.util.Iterator<ProxyConnectorConfiguration> it = proxyConnectors.iterator(); java.util.Iterator<ProxyConnectorConfiguration> it = proxyConnectors.iterator();
@ -181,7 +192,7 @@
} }
return proxyConnectorMap; return proxyConnectorMap;
} }
public java.util.Map<String, RemoteRepositoryConfiguration> getRemoteRepositoriesAsMap() public java.util.Map<String, RemoteRepositoryConfiguration> getRemoteRepositoriesAsMap()
{ {
@ -247,7 +258,7 @@
</codeSegments> </codeSegments>
</class> </class>
<!-- <!--
____ _ _ ____ _ _
| _ \ ___ _ __ ___ ___(_) |_ ___ _ __ _ _ | _ \ ___ _ __ ___ ___(_) |_ ___ _ __ _ _
| |_) / _ \ '_ \ / _ \/ __| | __/ _ \| '__| | | | | |_) / _ \ '_ \ / _ \/ __| | __/ _ \| '__| | | |
@ -430,7 +441,58 @@
</fields> </fields>
</class> </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>
<!--
____ _ ____ _
/ ___|___ _ __ _ __ ___ ___| |_ ___ _ __ ___ / ___|___ _ __ _ __ ___ ___| |_ ___ _ __ ___
| | / _ \| '_ \| '_ \ / _ \/ __| __/ _ \| '__/ __| | | / _ \| '_ \| '_ \ / _ \/ __| __/ _ \| '__/ __|
@ -519,7 +581,7 @@
<code><![CDATA[ <code><![CDATA[
/** /**
* Obtain a specific policy from the underlying connector. * Obtain a specific policy from the underlying connector.
* *
* @param policyId the policy id to fetch. * @param policyId the policy id to fetch.
* @param defaultValue the default value for the policy id. * @param defaultValue the default value for the policy id.
* @return the configured policy value (or default value if not found). * @return the configured policy value (or default value if not found).
@ -568,10 +630,10 @@
* The order id for UNORDERED * The order id for UNORDERED
*/ */
public static final int UNORDERED = 0; public static final int UNORDERED = 0;
/** /**
* The policy key {@link #getPolicies()} for snapshot handling. * The policy key {@link #getPolicies()} for snapshot handling.
* See {@link org.apache.maven.archiva.policies.SnapshotsPolicy} * See {@link org.apache.maven.archiva.policies.SnapshotsPolicy}
* for details on potential values to this policy key. * for details on potential values to this policy key.
*/ */
public static final String POLICY_SNAPSHOTS = "snapshots"; public static final String POLICY_SNAPSHOTS = "snapshots";
@ -624,7 +686,7 @@
</fields> </fields>
</class> </class>
<!-- <!--
____ _ ____ _
| _ \ _ __ _____ _(_) ___ ___ | _ \ _ __ _____ _(_) ___ ___
| |_) | '__/ _ \ \/ / |/ _ \/ __| | |_) | '__/ _ \ \/ / |/ _ \/ __|
@ -692,7 +754,7 @@
</fields> </fields>
</class> </class>
<!-- <!--
____ _ ____ _
/ ___| ___ __ _ _ __ _ __ (_)_ __ __ _ / ___| ___ __ _ _ __ _ __ (_)_ __ __ _
\___ \ / __/ _` | '_ \| '_ \| | '_ \ / _` | \___ \ / __/ _` | '_ \| '_ \| | '_ \ / _` |
@ -809,13 +871,13 @@
</fields> </fields>
</class> </class>
<!-- <!--
__ _______ ____ _ ____ ____ __ _______ ____ _ ____ ____
\ \ / / ____| __ ) / \ | _ \| _ \ \ \ / / ____| __ ) / \ | _ \| _ \
\ \ /\ / /| _| | _ \ / _ \ | |_) | |_) | \ \ /\ / /| _| | _ \ / _ \ | |_) | |_) |
\ V V / | |___| |_) / ___ \| __/| __/ \ V V / | |___| |_) / ___ \| __/| __/
\_/\_/ |_____|____/_/ \_\_| |_| \_/\_/ |_____|____/_/ \_\_| |_|
--> -->
<class> <class>

View File

@ -71,6 +71,13 @@
</proxyConnector> </proxyConnector>
</proxyConnectors> </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> <repositoryScanning>
<fileTypes> <fileTypes>
<fileType> <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() );
}
}