archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nico...@apache.org
Subject svn commit: r602916 - in /maven/archiva/trunk/archiva-base/archiva-configuration: ./ src/main/mdo/ src/main/resources/org/apache/maven/archiva/configuration/ src/test/java/org/apache/maven/archiva/configuration/
Date Mon, 10 Dec 2007 14:43:39 GMT
Author: nicolas
Date: Mon Dec 10 06:43:38 2007
New Revision: 602916

URL: http://svn.apache.org/viewvc?rev=602916&view=rev
Log:
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.

Added:
    maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java
Modified:
    maven/archiva/trunk/archiva-base/archiva-configuration/pom.xml
    maven/archiva/trunk/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
    maven/archiva/trunk/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml

Modified: maven/archiva/trunk/archiva-base/archiva-configuration/pom.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-configuration/pom.xml?rev=602916&r1=602915&r2=602916&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-configuration/pom.xml (original)
+++ maven/archiva/trunk/archiva-base/archiva-configuration/pom.xml Mon Dec 10 06:43:38 2007
@@ -37,6 +37,10 @@
       <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>
     </dependency>

Modified: maven/archiva/trunk/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo?rev=602916&r1=602915&r2=602916&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
(original)
+++ maven/archiva/trunk/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
Mon Dec 10 06:43:38 2007
@@ -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">
@@ -106,6 +106,17 @@
           </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>
           <association>
@@ -156,10 +167,10 @@
         }
         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();
@@ -181,7 +192,7 @@
         }
 
         return proxyConnectorMap;
-    }    
+    }
 
     public java.util.Map<String, RemoteRepositoryConfiguration> getRemoteRepositoriesAsMap()
     {
@@ -247,7 +258,7 @@
       </codeSegments>
     </class>
 
-    <!-- 
+    <!--
      ____                      _ _
     |  _ \ ___ _ __   ___  ___(_) |_ ___  _ __ _   _
     | |_) / _ \ '_ \ / _ \/ __| | __/ _ \| '__| | | |
@@ -430,7 +441,58 @@
       </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>
+
+    <!--
       ____                            _
      / ___|___  _ __  _ __   ___  ___| |_ ___  _ __ ___
     | |   / _ \| '_ \| '_ \ / _ \/ __| __/ _ \| '__/ __|
@@ -519,7 +581,7 @@
           <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).
@@ -568,10 +630,10 @@
      * 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";
@@ -624,7 +686,7 @@
       </fields>
     </class>
 
-    <!-- 
+    <!--
      ____                _
     |  _ \ _ __ _____  _(_) ___  ___
     | |_) | '__/ _ \ \/ / |/ _ \/ __|
@@ -692,7 +754,7 @@
       </fields>
     </class>
 
-    <!-- 
+    <!--
      ____                        _
     / ___|  ___ __ _ _ __  _ __ (_)_ __   __ _
     \___ \ / __/ _` | '_ \| '_ \| | '_ \ / _` |
@@ -809,13 +871,13 @@
       </fields>
     </class>
 
-    <!--    
-    __        _______ ____    _    ____  ____  
-    \ \      / / ____| __ )  / \  |  _ \|  _ \ 
+    <!--
+    __        _______ ____    _    ____  ____
+    \ \      / / ____| __ )  / \  |  _ \|  _ \
      \ \ /\ / /|  _| |  _ \ / _ \ | |_) | |_) |
-      \ V  V / | |___| |_) / ___ \|  __/|  __/ 
-       \_/\_/  |_____|____/_/   \_\_|   |_|    
-                                               
+      \ V  V / | |___| |_) / ___ \|  __/|  __/
+       \_/\_/  |_____|____/_/   \_\_|   |_|
+
     -->
 
     <class>

Modified: maven/archiva/trunk/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml?rev=602916&r1=602915&r2=602916&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml
(original)
+++ maven/archiva/trunk/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml
Mon Dec 10 06:43:38 2007
@@ -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>

Added: maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java?rev=602916&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java
(added)
+++ maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java
Mon Dec 10 06:43:38 2007
@@ -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() );
+    }
+}



Mime
View raw message