From: Brett Porter Date: Tue, 25 Mar 2008 13:43:18 +0000 (+0000) Subject: [MRM-664] Cannot download a strut-module artifact in a Legacy repository X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=04b7767087630fc77931880a51797e7f2d3c808b;p=archiva.git [MRM-664] Cannot download a strut-module artifact in a Legacy repository - there seemed to be no reason to rename type from . to - apart from cosmetics so this was changed to allow - in extensions git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches@640811 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java index 17702a192..5c9300b70 100644 --- a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java +++ b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java @@ -64,7 +64,7 @@ public class ArtifactExtensionMapping } // Return type - return type.replace( '-', '.' ); + return type; } /** diff --git a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java index e43bf073f..7c14233ba 100644 --- a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java +++ b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java @@ -152,7 +152,7 @@ public class DefaultPathParser implements PathParser case '.': // We have an dual extension possibility. String extension = parser.remaining() + '.' + parser.getExtension(); - artifact.setType( extension.replace( '.', '-' ) ); + artifact.setType( extension ); break; case 0: // End of the filename, only a simple extension left. - Set the type. diff --git a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java index 0acea93af..fa49e5d14 100644 --- a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java +++ b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java @@ -41,7 +41,7 @@ public class FilenameParser private static final Pattern mavenPluginPattern = Pattern.compile( "(maven-.*-plugin)|(.*-maven-plugin)" ); private static final Pattern extensionPattern = - Pattern.compile( "(\\.tar\\.gz$)|(\\.tar\\.bz2$)|(\\.[a-z0-9]*$)", Pattern.CASE_INSENSITIVE ); + Pattern.compile( "(\\.tar\\.gz$)|(\\.tar\\.bz2$)|(\\.[\\-a-z0-9]*$)", Pattern.CASE_INSENSITIVE ); private static final Pattern SNAPSHOT_PATTERN = Pattern.compile( "^([0-9]{8}\\.[0-9]{6}-[0-9]+)(.*)$" ); diff --git a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java index 5b0e103fe..6da1ce21e 100644 --- a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java +++ b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java @@ -1,5 +1,24 @@ package org.apache.maven.archiva.repository.content; +/* + * 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. + */ + import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase; @@ -63,7 +82,7 @@ public class DefaultPathParserTest String artifactId = "example-presentation"; String version = "3.2"; String classifier = null; - String type = "xml-zip"; + String type = "xml.zip"; String path = "org/project/example-presentation/3.2/example-presentation-3.2.xml.zip"; assertLayout( path, groupId, artifactId, version, classifier, type ); diff --git a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java index 1ab8c807a..f911f4e8c 100644 --- a/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java +++ b/archiva-1.0.x/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java @@ -358,6 +358,16 @@ public class RepositoryRequestTest repoRequest.toNativePath( "mygroup/ejbs/myejb-1.0.jar", repository ) ); } + public void testNativePathPomLegacyToLegacyStrutsModule() + throws Exception + { + ManagedRepositoryContent repository = createManagedRepo( "legacy" ); + + // Test (pom) legacy to default + assertEquals( "WebPortal/struts-modules/eventsDB-1.2.3.struts-module", + repoRequest.toNativePath( "WebPortal/struts-modules/eventsDB-1.2.3.struts-module", repository ) ); + } + public void testNativePathSupportFileLegacyToDefault() throws Exception {