]> source.dussan.org Git - archiva.git/commitdiff
[MRM-211] fix proxy tests for legacy, and correct handling of Maven 1.x plugins
authorBrett Porter <brett@apache.org>
Sun, 16 Sep 2007 03:30:54 +0000 (03:30 +0000)
committerBrett Porter <brett@apache.org>
Sun, 16 Sep 2007 03:30:54 +0000 (03:30 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@576029 13f79535-47bb-0310-9956-ffa450edef68

archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java
archiva-base/archiva-proxy/src/test/repositories/legacy-proxied/org.apache.maven.test/plugins/get-legacy-plugin-1.0.jar [new file with mode: 0644]
archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractArtifactExtensionMapping.java

index 1c436287cb757f3fb0ba6741e6c8682b7dbf0688..08163e452a34e329b83a345cf0613bccd87a1f6a 100644 (file)
@@ -376,7 +376,34 @@ public class ManagedDefaultTransferTest
         setupTestableManagedRepository( path );
 
         File expectedFile = new File( managedDefaultDir, path );
-        ArtifactReference artifact = createArtifactReference( "default", path );
+        ArtifactReference artifact = createArtifactReference( "legacy", legacyPath );
+
+        expectedFile.delete();
+        assertFalse( expectedFile.exists() );
+
+        // Configure Connector (usually done within archiva.xml configuration)
+        saveConnector( ID_DEFAULT_MANAGED, ID_LEGACY_PROXIED, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED,
+                       SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+
+        File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+        File proxiedFile = new File( REPOPATH_PROXIED_LEGACY, legacyPath );
+        assertFileEquals( expectedFile, downloadedFile, proxiedFile );
+        assertNoTempFiles( expectedFile );
+    }
+
+    public void testLegacyRequestPluginConvertedToDefaultPathInManagedRepo()
+        throws Exception
+    {
+        // Check that a Maven1 legacy request is translated to a maven2 path in
+        // the managed repository.
+
+        String legacyPath = "org.apache.maven.test/plugins/get-legacy-plugin-1.0.jar";
+        String path = "org/apache/maven/test/get-legacy-plugin/1.0/get-legacy-plugin-1.0.jar";
+        setupTestableManagedRepository( path );
+
+        File expectedFile = new File( managedDefaultDir, path );
+        ArtifactReference artifact = createArtifactReference( "legacy", legacyPath );
 
         expectedFile.delete();
         assertFalse( expectedFile.exists() );
diff --git a/archiva-base/archiva-proxy/src/test/repositories/legacy-proxied/org.apache.maven.test/plugins/get-legacy-plugin-1.0.jar b/archiva-base/archiva-proxy/src/test/repositories/legacy-proxied/org.apache.maven.test/plugins/get-legacy-plugin-1.0.jar
new file mode 100644 (file)
index 0000000..77dbb78
--- /dev/null
@@ -0,0 +1 @@
+get-default-layout-1.0.jar
index f95a62707d509337f20a4415ad05eb79eda72d9e..cedbb7b41ca675a05e9b50ecc174fc5a3e438850 100644 (file)
@@ -23,7 +23,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 /**
- * AbstractArtifactExtensionMapping 
+ * AbstractArtifactExtensionMapping
  *
  * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
  * @version $Id$
@@ -44,6 +44,7 @@ public abstract class AbstractArtifactExtensionMapping
         typeToExtensionMap.put( "javadoc", "jar" );
         typeToExtensionMap.put( "aspect", "jar" );
         typeToExtensionMap.put( "uberjar", "jar" );
+        typeToExtensionMap.put( "plugin", "jar" );
         typeToExtensionMap.put( "maven-plugin", "jar" );
         typeToExtensionMap.put( "maven-archetype", "jar" );
     }