From 5c89de0ca6a3e1f5d57e34d129dd915550ef860e Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Mon, 10 Dec 2007 14:43:38 +0000 Subject: [PATCH] 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 --- archiva-base/archiva-configuration/pom.xml | 4 + .../src/main/mdo/configuration.mdo | 96 +++++++++++++++---- .../archiva/configuration/default-archiva.xml | 7 ++ .../configuration/LegacyArtifactPathTest.java | 59 ++++++++++++ 4 files changed, 149 insertions(+), 17 deletions(-) create mode 100644 archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java diff --git a/archiva-base/archiva-configuration/pom.xml b/archiva-base/archiva-configuration/pom.xml index 62378e4d5..f9609b078 100644 --- a/archiva-base/archiva-configuration/pom.xml +++ b/archiva-base/archiva-configuration/pom.xml @@ -36,6 +36,10 @@ org.apache.maven.archiva archiva-policies + + org.apache.maven.archiva + archiva-model + org.codehaus.plexus plexus-component-api diff --git a/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo index 69b967129..0d903b125 100644 --- a/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo +++ b/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo @@ -48,7 +48,7 @@ repositories 1.0.0 - @@ -105,6 +105,17 @@ The list of network proxies to use for outgoing requests. + + legacyArtifactPaths + 1.0.0+ + + LegacyArtifactPath + * + + + The list of custom legacy path to artifact. + + repositoryScanning 1.0.0+ @@ -156,10 +167,10 @@ } return map; } - + public java.util.Map> getProxyConnectorAsMap() { - java.util.Map> proxyConnectorMap = + java.util.Map> proxyConnectorMap = new java.util.HashMap>(); java.util.Iterator it = proxyConnectors.iterator(); @@ -181,7 +192,7 @@ } return proxyConnectorMap; - } + } public java.util.Map getRemoteRepositoriesAsMap() { @@ -247,7 +258,7 @@ - diff --git a/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml b/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml index 74e5cad53..87cf71e92 100644 --- a/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml +++ b/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml @@ -71,6 +71,13 @@ + + + jaxen/jars/jaxen-1.0-FCS-full.jar + jaxen:jaxen:1.0-FCS:full:jar + + + diff --git a/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java new file mode 100644 index 000000000..c8e16ddc9 --- /dev/null +++ b/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java @@ -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() ); + } +} -- 2.39.5