Author: brett
Date: Thu Mar 11 04:43:23 2010
New Revision: 921687

URL: http://svn.apache.org/viewvc?rev=921687&view=rev
Log:
[MRM-1361] add support for NPanday artifact types. Currently requires some hard 
coding into webapp and tests, but removing the plugin from the webapp would 
safely disable the functionality.

Added:
    archiva/trunk/archiva-modules/plugins/npanday-support/   (with props)
    archiva/trunk/archiva-modules/plugins/npanday-support/pom.xml   (with props)
    archiva/trunk/archiva-modules/plugins/npanday-support/src/
    archiva/trunk/archiva-modules/plugins/npanday-support/src/main/
    archiva/trunk/archiva-modules/plugins/npanday-support/src/main/java/
    archiva/trunk/archiva-modules/plugins/npanday-support/src/main/java/org/
    
archiva/trunk/archiva-modules/plugins/npanday-support/src/main/java/org/apache/
    
archiva/trunk/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/
    
archiva/trunk/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/
    
archiva/trunk/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/
    
archiva/trunk/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/NPandayArtifactMappingProvider.java
   (with props)
Modified:
    
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml
    
archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp
    archiva/trunk/archiva-modules/plugins/pom.xml
    archiva/trunk/pom.xml

Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java?rev=921687&r1=921686&r2=921687&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java
 Thu Mar 11 04:43:23 2010
@@ -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( "<type>library</type>" );
+        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()

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml?rev=921687&r1=921686&r2=921687&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/pom.xml Thu Mar 11 
04:43:23 2010
@@ -31,6 +31,10 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.archiva</groupId>
+      <artifactId>npanday-support</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
       <artifactId>repository-statistics</artifactId>
     </dependency>
     <dependency>

Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp?rev=921687&r1=921686&r2=921687&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp
 Thu Mar 11 04:43:23 2010
@@ -178,6 +178,11 @@
                   <c:url var="imageUrl" 
value="/images/download-type-other.png"/>
                   <c:set var="packageName">JavaDoc Archive</c:set>
                 </c:when>
+                <c:when test="${a.type == 'library'}">
+                  <c:url var="imageUrl" 
value="/images/download-type-other.png"/>
+                  <c:set var="packageName">.NET Library</c:set>
+                </c:when>
+                <%-- TODO: other NPanday types, and move this code into the 
plugin somehow --%>
                 <%-- Must be last so that the above get picked up if possible 
--%>
                 <c:when test="${a.type == 'jar'}">
                   <c:url var="imageUrl" value="/images/download-type-jar.png"/>

Propchange: archiva/trunk/archiva-modules/plugins/npanday-support/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Mar 11 04:43:23 2010
@@ -0,0 +1 @@
+*.iml

Added: archiva/trunk/archiva-modules/plugins/npanday-support/pom.xml
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/plugins/npanday-support/pom.xml?rev=921687&view=auto
==============================================================================
--- archiva/trunk/archiva-modules/plugins/npanday-support/pom.xml (added)
+++ archiva/trunk/archiva-modules/plugins/npanday-support/pom.xml Thu Mar 11 
04:43:23 2010
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd"; 
xmlns="http://maven.apache.org/POM/4.0.0";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>plugins</artifactId>
+    <groupId>org.apache.archiva</groupId>
+    <version>1.4-SNAPSHOT</version>
+  </parent>
+  <artifactId>npanday-support</artifactId>
+  <name>NPanday Support for Archiva</name>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>maven2-repository</artifactId>
+    </dependency>
+  </dependencies>
+</project>

Propchange: archiva/trunk/archiva-modules/plugins/npanday-support/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
archiva/trunk/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/NPandayArtifactMappingProvider.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/NPandayArtifactMappingProvider.java?rev=921687&view=auto
==============================================================================
--- 
archiva/trunk/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/NPandayArtifactMappingProvider.java
 (added)
+++ 
archiva/trunk/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/NPandayArtifactMappingProvider.java
 Thu Mar 11 04:43:23 2010
@@ -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<String, String> classifierAndExtensionToTypeMap;
+
+    private final Map<String, String> typeToExtensionMap;
+
+    public NPandayArtifactMappingProvider()
+    {
+        classifierAndExtensionToTypeMap = new HashMap<String, String>();
+
+        // 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<String, String>();
+        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 );
+    }
+}

Propchange: 
archiva/trunk/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/NPandayArtifactMappingProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: archiva/trunk/archiva-modules/plugins/pom.xml
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/plugins/pom.xml?rev=921687&r1=921686&r2=921687&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/plugins/pom.xml (original)
+++ archiva/trunk/archiva-modules/plugins/pom.xml Thu Mar 11 04:43:23 2010
@@ -32,5 +32,7 @@
     <module>repository-statistics</module>
     <module>problem-reports</module>
     <module>audit</module>
+    <!-- TODO: eventually not a core plugin, needs to be moved to a separate 
tree, with it's own Selenium tests -->
+    <module>npanday-support</module>
   </modules>
 </project>
\ No newline at end of file

Modified: archiva/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/archiva/trunk/pom.xml?rev=921687&r1=921686&r2=921687&view=diff
==============================================================================
--- archiva/trunk/pom.xml (original)
+++ archiva/trunk/pom.xml Thu Mar 11 04:43:23 2010
@@ -336,6 +336,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.archiva</groupId>
+        <artifactId>npanday-support</artifactId>
+        <version>1.4-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.archiva</groupId>
         <artifactId>archiva-common</artifactId>
         <version>1.4-SNAPSHOT</version>
       </dependency>


Reply via email to