diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java index 729b01688..0e1ae2511 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java @@ -92,7 +92,25 @@ public class ArtifactManagementTest addArtifact( groupId , artifactId, getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() ); assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion() + "' was successfully deployed to repository 'internal'" ); } - + + @Test( groups = "requiresUpload" ) + public void testDotNetTypes() + { + addArtifact( getGroupId(), "testDotNetTypes", getVersion(), "library", getArtifactFilePath(), + getRepositoryId() ); + assertTextPresent( "Artifact 'test:testDotNetTypes:1.0' was successfully deployed to repository 'internal'" ); + getSelenium().open( baseUrl + "/browse/" + getGroupId() + "/testDotNetTypes/" + getVersion() ); + waitPage(); + + assertTextPresent( "library" ); + String basePath = + "/archiva/repository/internal/" + getGroupId() + "/testDotNetTypes/" + getVersion() + "/testDotNetTypes-" + + getVersion(); + assertLinkPresent( ".NET Library" ); + assertElementPresent( "//a[@href='" + basePath + ".dll']" ); + assertElementPresent( "//a[@href='" + basePath + ".pom']" ); + } + //MRM-747 @Test(groups = "requiresUpload") public void testAddArtifactBlockRedeployments() diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index 9edf9a8ff..e27a14479 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -29,6 +29,10 @@ war Archiva Web :: Application + + org.apache.archiva + npanday-support + org.apache.archiva repository-statistics diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp index 637af13dc..ad484deb1 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp @@ -178,6 +178,11 @@ JavaDoc Archive + + + .NET Library + + <%-- TODO: other NPanday types, and move this code into the plugin somehow --%> <%-- Must be last so that the above get picked up if possible --%> diff --git a/archiva-modules/plugins/npanday-support/pom.xml b/archiva-modules/plugins/npanday-support/pom.xml new file mode 100644 index 000000000..878ad4d58 --- /dev/null +++ b/archiva-modules/plugins/npanday-support/pom.xml @@ -0,0 +1,37 @@ + + + + + 4.0.0 + + plugins + org.apache.archiva + 1.4-SNAPSHOT + + npanday-support + NPanday Support for Archiva + + + org.apache.archiva + maven2-repository + + + diff --git a/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/NPandayArtifactMappingProvider.java b/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/NPandayArtifactMappingProvider.java new file mode 100644 index 000000000..800ec7c59 --- /dev/null +++ b/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/NPandayArtifactMappingProvider.java @@ -0,0 +1,74 @@ +package org.apache.archiva.plugins.npanday; + +/* + * 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.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider; + +import java.util.HashMap; +import java.util.Map; + +/** + * @plexus.component role="org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider" role-hint="npanday" + */ +public class NPandayArtifactMappingProvider + implements ArtifactMappingProvider +{ + private final Map classifierAndExtensionToTypeMap; + + private final Map typeToExtensionMap; + + public NPandayArtifactMappingProvider() + { + classifierAndExtensionToTypeMap = new HashMap(); + + // TODO: this could be one of many - we need to look up the artifact metadata from the POM instead + // should do this anyway so that plugins don't compete for providing an extension + classifierAndExtensionToTypeMap.put( "dll", "library" ); + + classifierAndExtensionToTypeMap.put( "netmodule", "module" ); + classifierAndExtensionToTypeMap.put( "exe", "winexe" ); + classifierAndExtensionToTypeMap.put( "tests:jar", "test-jar" ); + + typeToExtensionMap = new HashMap(); + typeToExtensionMap.put( "library", "dll" ); + typeToExtensionMap.put( "asp", "dll" ); + typeToExtensionMap.put( "gac", "dll" ); + typeToExtensionMap.put( "gac_generic", "dll" ); + typeToExtensionMap.put( "gac_msil", "dll" ); + typeToExtensionMap.put( "gac_32", "dll" ); + typeToExtensionMap.put( "netplugin", "dll" ); + typeToExtensionMap.put( "visual-studio-addin", "dll" ); + typeToExtensionMap.put( "module", "netmodule" ); + typeToExtensionMap.put( "exe.config", "exe.config" ); + typeToExtensionMap.put( "winexe", "exe" ); + typeToExtensionMap.put( "nar", "nar" ); + } + + public String mapClassifierAndExtensionToType( String classifier, String ext ) + { + // we don't need classifier + return classifierAndExtensionToTypeMap.get( ext ); + } + + public String mapTypeToExtension( String type ) + { + return typeToExtensionMap.get( type ); + } +} diff --git a/archiva-modules/plugins/pom.xml b/archiva-modules/plugins/pom.xml index a564ac416..364a14fb6 100644 --- a/archiva-modules/plugins/pom.xml +++ b/archiva-modules/plugins/pom.xml @@ -32,5 +32,7 @@ repository-statistics problem-reports audit + + npanday-support \ No newline at end of file diff --git a/pom.xml b/pom.xml index 851b5a9ce..e2b28f8ed 100644 --- a/pom.xml +++ b/pom.xml @@ -334,6 +334,11 @@ archiva-checksum 1.4-SNAPSHOT + + org.apache.archiva + npanday-support + 1.4-SNAPSHOT + org.apache.archiva archiva-common