]> source.dussan.org Git - archiva.git/commitdiff
MRM-594 store exception to default legacy-path 2 artifact resolution in archiva.xml
authorNicolas De Loof <nicolas@apache.org>
Mon, 10 Dec 2007 14:43:38 +0000 (14:43 +0000)
committerNicolas De Loof <nicolas@apache.org>
Mon, 10 Dec 2007 14:43:38 +0000 (14:43 +0000)
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
archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml
archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java [new file with mode: 0644]

index 62378e4d53f4e071d40426ebf951f2d34d13a4dd..f9609b0786aa34ad0f22eb7ec2663ed960414831 100644 (file)
       <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>
index 69b96712954a678cbe446ec7e3b99d9c660cfe15..0d903b125fb7863ec62df788b982dd77f8898c1b 100644 (file)
@@ -48,7 +48,7 @@
           </description>
           <name>repositories</name>
           <version>1.0.0</version>
-          <association java.generate-add="false" 
+          <association java.generate-add="false"
                        java.generate-remove="false"
                        java.generate-break="false"
                        java.generate-create="false">
             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>
         }
         return map;
     }
-    
+
     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>>();
 
         java.util.Iterator<ProxyConnectorConfiguration> it = proxyConnectors.iterator();
         }
 
         return proxyConnectorMap;
-    }    
+    }
 
     public java.util.Map<String, RemoteRepositoryConfiguration> getRemoteRepositoriesAsMap()
     {
       </codeSegments>
     </class>
 
-    <!-- 
+    <!--
      ____                      _ _
     |  _ \ ___ _ __   ___  ___(_) |_ ___  _ __ _   _
     | |_) / _ \ '_ \ / _ \/ __| | __/ _ \| '__| | | |
       </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>
+
+    <!--
       ____                            _
      / ___|___  _ __  _ __   ___  ___| |_ ___  _ __ ___
     | |   / _ \| '_ \| '_ \ / _ \/ __| __/ _ \| '__/ __|
           <code><![CDATA[
     /**
      * Obtain a specific policy from the underlying connector.
-     * 
+     *
      * @param policyId the policy id to fetch.
      * @param defaultValue the default value for the policy id.
      * @return the configured policy value (or default value if not found).
      * The order id for UNORDERED
      */
     public static final int UNORDERED = 0;
-    
+
     /**
      * 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.
      */
     public static final String POLICY_SNAPSHOTS = "snapshots";
       </fields>
     </class>
 
-    <!-- 
+    <!--
      ____                _
     |  _ \ _ __ _____  _(_) ___  ___
     | |_) | '__/ _ \ \/ / |/ _ \/ __|
       </fields>
     </class>
 
-    <!-- 
+    <!--
      ____                        _
     / ___|  ___ __ _ _ __  _ __ (_)_ __   __ _
     \___ \ / __/ _` | '_ \| '_ \| | '_ \ / _` |
       </fields>
     </class>
 
-    <!--    
-    __        _______ ____    _    ____  ____  
-    \ \      / / ____| __ )  / \  |  _ \|  _ \ 
+    <!--
+    __        _______ ____    _    ____  ____
+    \ \      / / ____| __ )  / \  |  _ \|  _ \
      \ \ /\ / /|  _| |  _ \ / _ \ | |_) | |_) |
-      \ V  V / | |___| |_) / ___ \|  __/|  __/ 
-       \_/\_/  |_____|____/_/   \_\_|   |_|    
-                                               
+      \ V  V / | |___| |_) / ___ \|  __/|  __/
+       \_/\_/  |_____|____/_/   \_\_|   |_|
+
     -->
 
     <class>
index 74e5cad53e492a2e7be72d74f64563b0190285cf..87cf71e92aebb9388cfe39338080a959c8f3c6ee 100644 (file)
     </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>
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 (file)
index 0000000..c8e16dd
--- /dev/null
@@ -0,0 +1,59 @@
+package org.apache.maven.archiva.configuration;\r
+\r
+import junit.framework.TestCase;\r
+\r
+import org.apache.maven.archiva.model.ArtifactReference;\r
+\r
+/*\r
+ * Licensed to the Apache Software Foundation (ASF) under one\r
+ * or more contributor license agreements.  See the NOTICE file\r
+ * distributed with this work for additional information\r
+ * regarding copyright ownership.  The ASF licenses this file\r
+ * to you under the Apache License, Version 2.0 (the\r
+ * "License"); you may not use this file except in compliance\r
+ * with the License.  You may obtain a copy of the License at\r
+ *\r
+ *  http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing,\r
+ * software distributed under the License is distributed on an\r
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
+ * KIND, either express or implied.  See the License for the\r
+ * specific language governing permissions and limitations\r
+ * under the License.\r
+ */\r
+\r
+/**\r
+ * Test the generated LegacyArtifactPath class from Modello. This is primarily to test the hand coded methods.\r
+ */\r
+public class LegacyArtifactPathTest\r
+    extends TestCase\r
+{\r
+\r
+    private LegacyArtifactPath legacyArtifactPath = new LegacyArtifactPath();\r
+\r
+    public void testLegacyArtifactPathWithClassifierResolution()\r
+    {\r
+        legacyArtifactPath.setArtifact( "groupId:artifactId:version:classifier:type" );\r
+\r
+        ArtifactReference artifact = legacyArtifactPath.getArtifactReference();\r
+        assertEquals( "groupId", artifact.getGroupId() );\r
+        assertEquals( "artifactId", artifact.getArtifactId() );\r
+        assertEquals( "version", artifact.getVersion() );\r
+        assertEquals( "classifier", artifact.getClassifier() );\r
+        assertEquals( "type", artifact.getType() );\r
+    }\r
+\r
+\r
+    public void testLegacyArtifactPathWithoutClassifierResolution()\r
+    {\r
+        legacyArtifactPath.setArtifact( "groupId:artifactId:version::type" );\r
+\r
+        ArtifactReference artifact = legacyArtifactPath.getArtifactReference();\r
+        assertEquals( "groupId", artifact.getGroupId() );\r
+        assertEquals( "artifactId", artifact.getArtifactId() );\r
+        assertEquals( "version", artifact.getVersion() );\r
+        assertEquals( null, artifact.getClassifier() );\r
+        assertEquals( "type", artifact.getType() );\r
+    }\r
+}\r