]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1645] mvn archetype:generate -DarchetypeCatalog (archetype-catalog.xml) failing...
authorOlivier Lamy <olamy@apache.org>
Mon, 30 Jul 2012 14:39:31 +0000 (14:39 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 30 Jul 2012 14:39:31 +0000 (14:39 +0000)
Submitted by Charles Kim.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1367107 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/RepositoryRequest.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java

index 93b6af4ee3140b9f2f649bb48bc5cc05f2935526..dcf825031659da465c6b47f6ebecd3ab1d798a2f 100644 (file)
@@ -103,6 +103,17 @@ public class RepositoryRequest
         return requestedPath.endsWith( "/" + MetadataTools.MAVEN_METADATA );
     }
 
+    /**
+     * 
+     * @param requestedPath
+     * @return true if the requestedPath is likely an archetype catalog request.
+     */
+    public boolean isArchetypeCatalog( String requestedPath )
+    {
+       //TODO: Make it static final String
+       return requestedPath.endsWith( "/archetype-catalog.xml");
+    }
+    
     /**
      * <p>
      * Tests the path to see if it conforms to the expectations of a support file request.
index 6b4d395da22e3551fe1e15e0b072f1afe12e33e0..b7d6e27d02f5097683ad7207fcc2a3fc3450e521 100644 (file)
@@ -688,6 +688,14 @@ public class ArchivaDavResourceFactory
             return connectors.fetchMetatadaFromProxies( managedRepository, path ) != null;
         }
 
+        // Is it an Archetype Catalog?
+        if ( repositoryRequest.isArchetypeCatalog( path ) )
+        {
+            File proxiedFile = connectors.fetchFromProxies( managedRepository, path );
+
+            return ( proxiedFile != null );
+        }
+        
         // Not any of the above? Then it's gotta be an artifact reference.
         try
         {
index 3e9981f011b2e958ebd63080136d417505d780d2..68b9b581fc6150c7afc43c65925ad1587241e268 100644 (file)
@@ -241,6 +241,9 @@ public class ArchivaDavResourceFactoryTest
                           "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
             repoContentFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( INTERNAL_REPO ),
                                                        internalRepo );
+            repoRequestControl.expectAndReturn(
+                    repoRequest.isArchetypeCatalog( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
+                    false );
 
             archivaConfigurationControl.replay();
             requestControl.replay();
@@ -309,6 +312,9 @@ public class ArchivaDavResourceFactoryTest
                                           internalRepo ),
                 new File( config.findManagedRepositoryById( INTERNAL_REPO ).getLocation(),
                           "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
+            repoRequestControl.expectAndReturn(
+                    repoRequest.isArchetypeCatalog( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
+                    false );
 
             archivaConfigurationControl.replay();
             requestControl.replay();
@@ -387,6 +393,10 @@ public class ArchivaDavResourceFactoryTest
                 new File( config.findManagedRepositoryById( LOCAL_MIRROR_REPO ).getLocation(),
                           "target/test-classes/internal/org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ).getPath() );
 
+            repoRequestControl.expectAndReturn(
+                    repoRequest.isArchetypeCatalog( "org/apache/archiva/archiva/1.2-SNAPSHOT/archiva-1.2-SNAPSHOT.jar" ),
+                    false , 2);
+
             archivaConfigurationControl.replay();
             requestControl.replay();
             repoContentFactoryControl.replay();