archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r639273 - in /maven/archiva/trunk: archiva-base/archiva-model/src/main/mdo/ archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/ arch...
Date Thu, 20 Mar 2008 12:56:39 GMT
Author: brett
Date: Thu Mar 20 05:56:34 2008
New Revision: 639273

URL: http://svn.apache.org/viewvc?rev=639273&view=rev
Log:
[MNG-734] fix plugin-level metadata handling
Merged from: r639260

Added:
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/
      - copied from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-not-on-remotes/
      - copied from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-not-on-remotes/
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-not-on-remotes/maven-metadata.xml
      - copied unchanged from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-not-on-remotes/maven-metadata.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-local-on-remote/
      - copied from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-local-on-remote/
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml
      - copied unchanged from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-multiple-repos/
      - copied from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-multiple-repos/
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml
      - copied unchanged from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-project-metadata/
      - copied from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-project-metadata/
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-project-metadata/maven-metadata.xml
      - copied unchanged from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-project-metadata/maven-metadata.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/
      - copied from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-default-layout/
      - copied from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-default-layout/
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml
      - copied unchanged from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-found-in-proxy/
      - copied from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-found-in-proxy/
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-found-in-proxy/maven-metadata.xml
      - copied unchanged from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-found-in-proxy/maven-metadata.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-local-on-remote/
      - copied from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-local-on-remote/
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml
      - copied unchanged from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-multiple-repos/
      - copied from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-multiple-repos/
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml
      - copied unchanged from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/
      - copied from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-default-layout/
      - copied from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-default-layout/
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml
      - copied unchanged from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-on-multiple-repos/
      - copied from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-on-multiple-repos/
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml
      - copied unchanged from r639260, maven/archiva/branches/archiva-1.0.x/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml
Modified:
    maven/archiva/trunk/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
    maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataWriter.java
    maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletProxiedMetadataTestCase.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletNoProxyMetadataTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletNoProxyTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedMetadataLocalOnlyTest.java
    maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedMetadataRemoteOnlyTest.java

Modified: maven/archiva/trunk/archiva-base/archiva-model/src/main/mdo/archiva-base.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-model/src/main/mdo/archiva-base.xml?rev=639273&r1=639272&r2=639273&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-model/src/main/mdo/archiva-base.xml (original)
+++ maven/archiva/trunk/archiva-base/archiva-model/src/main/mdo/archiva-base.xml Thu Mar 20 05:56:34 2008
@@ -641,6 +641,20 @@
           </association>
         </field>
         <field>
+          <name>plugins</name>
+          <identifier>false</identifier>
+          <version>1.0.0+</version>
+          <required>false</required>
+          <description>
+            The available plugins.
+          </description>
+          <association stash.part="true"
+                       jpox.join="false">
+            <type>Plugin</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+        <field>
           <name>availableVersions</name>
           <identifier>false</identifier>
           <version>1.0.0+</version>
@@ -764,6 +778,45 @@
           ]]></code>
         </codeSegment>
       </codeSegments>
+    </class>
+
+    <class stash.storable="true"
+           jpox.not-persisted-fields="modelEncoding"
+           jpox.table="REPOSITORY_METADATA_PLUGINS">
+      <name>Plugin</name>
+      <description>The Plugin</description>
+      <version>1.0.0+</version>
+      <fields>
+        <field stash.maxSize="20"
+               jpox.column="PLUGIN_PREFIX">
+          <name>prefix</name>
+          <type>String</type>
+          <identifier>false</identifier>
+          <required>true</required>
+          <description>
+            The prefix for a plugin
+          </description>
+        </field>
+        <field
+               jpox.column="PLUGIN_ARTIFACT_ID">
+          <name>artifactId</name>
+          <type>String</type>
+          <identifier>true</identifier>
+          <required>true</required>
+          <description>
+            The artifactId for a plugin
+          </description>
+        </field>
+        <field jpox.column="PLUGIN_NAME">
+          <name>name</name>
+          <type>String</type>
+          <identifier>false</identifier>
+          <required>true</required>
+          <description>
+            The name for a plugin
+          </description>
+        </field>
+      </fields>
     </class>
 
 

Modified: maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java?rev=639273&r1=639272&r2=639273&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java Thu Mar 20 05:56:34 2008
@@ -22,6 +22,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.common.utils.VersionUtil;
 import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
+import org.apache.maven.archiva.model.Plugin;
 import org.apache.maven.archiva.model.ProjectReference;
 import org.apache.maven.archiva.model.SnapshotVersion;
 import org.apache.maven.archiva.model.VersionedReference;
@@ -123,7 +124,7 @@
 
         wagonMockControl.replay();
 
-        assertFetchProject( requestedResource );
+        assertFetchProjectOrGroup( requestedResource );
 
         wagonMockControl.verify();
 
@@ -148,7 +149,7 @@
         assertResourceNotFound( requestedResource );
 
         // No proxy setup, nothing fetched, failure expected.
-        assertFetchProjectFailed( requestedResource );
+        assertFetchProjectOrGroupFailed( requestedResource );
 
         // No local artifactId, and no fetch, should equal no metadata file downloaded / created / updated.
         assertResourceNotFound( requestedResource );
@@ -164,7 +165,7 @@
         assertResourceExists( requestedResource );
 
         // No proxy setup, nothing fetched from remote, but local exists.
-        assertFetchProject( requestedResource );
+        assertFetchProjectOrGroup( requestedResource );
 
         // Nothing fetched.  Should only contain contents of what is in the repository.
         // A metadata update is not performed in this use case.  Local metadata content is only
@@ -190,7 +191,7 @@
         assertNoRepoMetadata( ID_PROXIED2, requestedResource );
 
         // Two proxies setup, metadata fetched from both remotes.
-        assertFetchProject( requestedResource );
+        assertFetchProjectOrGroup( requestedResource );
 
         // Nothing fetched.  Should only contain contents of what is in the repository.
         assertProjectMetadataContents( requestedResource, new String[] { "1.0", "1.0.1" }, "1.0.1", "1.0.1" );
@@ -216,7 +217,7 @@
         assertNoRepoMetadata( ID_PROXIED2, requestedResource );
 
         // Two proxies setup, nothing fetched from remotes, local does not exist.
-        assertFetchProjectFailed( requestedResource );
+        assertFetchProjectOrGroupFailed( requestedResource );
 
         // Nothing fetched.  Nothing should exist.
         assertResourceNotFound( requestedResource );
@@ -239,7 +240,7 @@
         assertNoRepoMetadata( ID_PROXIED1, requestedResource );
 
         // One proxy setup, metadata fetched from remote, local does not exist.
-        assertFetchProject( requestedResource );
+        assertFetchProjectOrGroup( requestedResource );
 
         // Remote fetched.  Local created/updated.
         assertProjectMetadataContents( requestedResource, new String[] { "1.0.5" }, "1.0.5", "1.0.5" );
@@ -264,7 +265,7 @@
         assertNoRepoMetadata( ID_PROXIED2, requestedResource );
 
         // Two proxies setup, metadata fetched from both remotes.
-        assertFetchProject( requestedResource );
+        assertFetchProjectOrGroup( requestedResource );
 
         // metadata fetched from both repos, and merged with local version.
         assertProjectMetadataContents( requestedResource, new String[] { "1.0", "1.0.1", "2.0" }, "2.0", "2.0" );
@@ -290,7 +291,7 @@
         assertNoRepoMetadata( ID_PROXIED2, requestedResource );
 
         // Two proxies setup, metadata fetch from remotes fail (because they dont exist).
-        assertFetchProject( requestedResource );
+        assertFetchProjectOrGroup( requestedResource );
 
         // metadata not fetched from both repos, and local version exists.
         // Since there was no updated metadata content from a remote/proxy, a metadata update on
@@ -315,7 +316,7 @@
         assertNoRepoMetadata( ID_PROXIED1, requestedResource );
 
         // One proxy setup, metadata fetched from remote, local exists.
-        assertFetchProject( requestedResource );
+        assertFetchProjectOrGroup( requestedResource );
 
         // Remote fetched.  Local updated.
         assertProjectMetadataContents( requestedResource, new String[] { "1.0.8", "1.0.22", "2.0" }, "2.0", "2.0" );
@@ -416,7 +417,7 @@
 
         assertResourceNotFound( requestedResource );
 
-        assertFetchProjectFailed( requestedResource );
+        assertFetchProjectOrGroupFailed( requestedResource );
 
         assertResourceNotFound( requestedResource );
         assertNoRepoMetadata( ID_PROXIED1, requestedResource );
@@ -704,13 +705,197 @@
         assertRepoSnapshotMetadataContents( ID_PROXIED1, requestedResource, "20050831", "101112", 1 );
     }
 
+    public void testGetGroupMetadataNotProxiedNotLocal()
+        throws Exception
+    {
+        // The artifactId "get-default-metadata-nonexistant" does not exist (intentionally).
+        String requestedResource = "org/apache/maven/test/groups/get-default-metadata-nonexistant/maven-metadata.xml";
+        setupTestableManagedRepository( requestedResource );
+
+        assertResourceNotFound( requestedResource );
+
+        // No proxy setup, nothing fetched, failure expected.
+        assertFetchProjectOrGroupFailed( requestedResource );
+
+        // No local artifactId, and no fetch, should equal no metadata file downloaded / created / updated.
+        assertResourceNotFound( requestedResource );
+    }
+
+    public void testGetGroupMetadataNotProxiedOnLocal()
+        throws Exception
+    {
+        // Project metadata that exists and has multiple versions
+        String requestedResource = "org/apache/maven/test/groups/get-project-metadata/maven-metadata.xml";
+        setupTestableManagedRepository( requestedResource );
+
+        assertResourceExists( requestedResource );
+
+        // No proxy setup, nothing fetched from remote, but local exists.
+        assertFetchProjectOrGroup( requestedResource );
+
+        // Nothing fetched.  Should only contain contents of what is in the repository.
+        // A metadata update is not performed in this use case.  Local metadata content is only
+        // updated via the metadata updater consumer.
+        assertGroupMetadataContents( requestedResource, new String[] { "plugin1" } );
+    }
+
+    public void testGetGroupMetadataProxiedNotLocalMultipleRemotes()
+        throws Exception
+    {
+        // Project metadata that does not exist locally, but has multiple versions in remote repos
+        String requestedResource = "org/apache/maven/test/groups/get-default-layout/maven-metadata.xml";
+        setupTestableManagedRepository( requestedResource );
+
+        // Configure Connector (usually done within archiva.xml configuration)
+        saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+                       SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO );
+        saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+                       SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO );
+
+        assertResourceNotFound( requestedResource );
+        assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+        assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+        // Two proxies setup, metadata fetched from both remotes.
+        assertFetchProjectOrGroup( requestedResource );
+
+        // Nothing fetched.  Should only contain contents of what is in the repository.
+        assertGroupMetadataContents( requestedResource, new String[] { "plugin2", "plugin1" } );
+        assertRepoGroupMetadataContents( ID_PROXIED1, requestedResource, new String[] { "plugin1" } );
+        assertRepoGroupMetadataContents( ID_PROXIED2, requestedResource, new String[] { "plugin2" } );
+    }
+
+    public void testGetGroupsMetadataProxiedNotLocalNotRemote()
+        throws Exception
+    {
+        // Non-existant project metadata that does not exist locally and doesn't exist on remotes.
+        String requestedResource = "org/apache/maven/test/groups/get-bogus-artifact/maven-metadata.xml";
+        setupTestableManagedRepository( requestedResource );
+
+        // Configure Connector (usually done within archiva.xml configuration)
+        saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+                       SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO );
+        saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+                       SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO );
+
+        assertResourceNotFound( requestedResource );
+        assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+        assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+        // Two proxies setup, nothing fetched from remotes, local does not exist.
+        assertFetchProjectOrGroupFailed( requestedResource );
+
+        // Nothing fetched.  Nothing should exist.
+        assertResourceNotFound( requestedResource );
+        assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+        assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+    }
+
+    public void testGetGroupMetadataProxiedNotLocalOnRemote()
+        throws Exception
+    {
+        // New project metadata that does not exist locally but exists on remote.
+        String requestedResource = "org/apache/maven/test/groups/get-found-in-proxy/maven-metadata.xml";
+        setupTestableManagedRepository( requestedResource );
+
+        // Configure Connector (usually done within archiva.xml configuration)
+        saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+                       SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO );
+
+        assertResourceNotFound( requestedResource );
+        assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+
+        // One proxy setup, metadata fetched from remote, local does not exist.
+        assertFetchProjectOrGroup( requestedResource );
+
+        // Remote fetched.  Local created/updated.
+        assertGroupMetadataContents( requestedResource, new String[] { "plugin3" } );
+        assertRepoGroupMetadataContents( ID_PROXIED1, requestedResource, new String[] { "plugin3" } );
+    }
+
+    public void testGetGroupMetadataProxiedOnLocalMultipleRemote()
+        throws Exception
+    {
+        // Project metadata that exist locally, and has multiple versions in remote repos
+        String requestedResource = "org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml";
+        setupTestableManagedRepository( requestedResource );
+
+        // Configure Connector (usually done within archiva.xml configuration)
+        saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+                       SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO );
+        saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+                       SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO );
+
+        assertGroupMetadataContents( requestedResource, new String[] { "plugin1" } );
+        assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+        assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+        // Two proxies setup, metadata fetched from both remotes.
+        assertFetchProjectOrGroup( requestedResource );
+
+        // metadata fetched from both repos, and merged with local version.
+        assertGroupMetadataContents( requestedResource, new String[] { "plugin1", "plugin2", "plugin4" } );
+        assertRepoGroupMetadataContents( ID_PROXIED1, requestedResource, new String[] { "plugin1", "plugin4" } );
+        assertRepoGroupMetadataContents( ID_PROXIED2, requestedResource, new String[] { "plugin1", "plugin2" } );
+    }
+
+    public void testGetGroupMetadataProxiedOnLocalNotRemote()
+        throws Exception
+    {
+        // Project metadata that exist locally, and does not exist in remote repos.
+        String requestedResource = "org/apache/maven/test/groups/get-not-on-remotes/maven-metadata.xml";
+        setupTestableManagedRepository( requestedResource );
+
+        // Configure Connector (usually done within archiva.xml configuration)
+        saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+                       SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO );
+        saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+                       SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO );
+
+        assertGroupMetadataContents( requestedResource, new String[] { "plugin5" } );
+        assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+        assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+        // Two proxies setup, metadata fetch from remotes fail (because they dont exist).
+        assertFetchProjectOrGroup( requestedResource );
+
+        // metadata not fetched from both repos, and local version exists.
+        // Since there was no updated metadata content from a remote/proxy, a metadata update on
+        // the local file never ran.  Local only updates are performed via the metadata updater consumer.
+        assertGroupMetadataContents( requestedResource, new String[] { "plugin5" } );
+        assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+        assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+    }
+
+    public void testGetGroupMetadataProxiedOnLocalOnRemote()
+        throws Exception
+    {
+        // Project metadata that exist locally and exists on remote.
+        String requestedResource = "org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml";
+        setupTestableManagedRepository( requestedResource );
+
+        // Configure Connector (usually done within archiva.xml configuration)
+        saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+                       SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO );
+
+        assertGroupMetadataContents( requestedResource, new String[] { "plugin6", "plugin7" } );
+        assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+
+        // One proxy setup, metadata fetched from remote, local exists.
+        assertFetchProjectOrGroup( requestedResource );
+
+        // Remote fetched.  Local updated.
+        assertGroupMetadataContents( requestedResource, new String[] { "plugin6", "plugin7", "plugin4" } );
+        assertRepoGroupMetadataContents( ID_PROXIED1, requestedResource, new String[] { "plugin7", "plugin4" } );
+    }
+
     /**
      * Transfer the metadata file.
      *
      * @param requestedResource the requested resource
      * @throws Exception
      */
-    private void assertFetchProject( String requestedResource )
+    private void assertFetchProjectOrGroup( String requestedResource )
         throws Exception
     {
         File expectedFile = new File( managedDefaultDir, requestedResource );
@@ -735,7 +920,7 @@
      * @param requestedResource the requested resource
      * @throws Exception
      */
-    private void assertFetchProjectFailed( String requestedResource )
+    private void assertFetchProjectOrGroupFailed( String requestedResource )
         throws Exception
     {
         File expectedFile = new File( managedDefaultDir, requestedResource );
@@ -848,6 +1033,64 @@
 
         File actualFile = new File( managedDefaultDir, proxiedFile );
         assertFalse( "Repo specific metadata should not exist: " + actualFile, actualFile.exists() );
+    }
+
+    private void assertGroupMetadataContents( String requestedResource, String expectedPlugins[] )
+        throws Exception
+    {
+        File actualFile = new File( managedDefaultDir, requestedResource );
+        assertTrue( "Snapshot Metadata should exist: " + requestedResource, actualFile.exists() );
+
+        ProjectReference actualMetadata = createGroupReference( requestedResource );
+
+        assertGroupMetadata( actualFile, actualMetadata, expectedPlugins );
+    }
+
+    private ProjectReference createGroupReference( String requestedResource )
+        throws RepositoryMetadataException
+    {
+        ProjectReference projectReference = createProjectReference( requestedResource );
+        projectReference.setGroupId( projectReference.getGroupId() + "." + projectReference.getArtifactId() );
+        projectReference.setArtifactId( null );
+        return projectReference;
+    }
+
+    private void assertRepoGroupMetadataContents( String proxiedRepoId, String requestedResource,
+                                                  String expectedPlugins[] )
+        throws Exception
+    {
+        String proxiedFile = metadataTools.getRepositorySpecificName( proxiedRepoId, requestedResource );
+
+        File actualFile = new File( managedDefaultDir, proxiedFile );
+        assertTrue( "Repo Specific Group Metadata should exist: " + requestedResource, actualFile.exists() );
+
+        ProjectReference actualMetadata = createGroupReference( requestedResource );
+
+        assertGroupMetadata( actualFile, actualMetadata, expectedPlugins );
+    }
+
+    private void assertGroupMetadata( File actualFile, ProjectReference actualMetadata, String expectedPlugins[] )
+        throws Exception
+    {
+        // Build expected metadata XML
+        StringWriter expectedMetadataXml = new StringWriter();
+        ArchivaRepositoryMetadata m = new ArchivaRepositoryMetadata();
+        m.setGroupId( actualMetadata.getGroupId() );
+
+        for ( String pluginId : expectedPlugins )
+        {
+            Plugin p = new Plugin();
+            p.setPrefix( pluginId );
+            p.setArtifactId( pluginId + "-maven-plugin" );
+            p.setName( "The " + pluginId + " Plugin" );
+            m.getPlugins().add( p );
+        }
+
+        m.setModelEncoding( null );
+        RepositoryMetadataWriter.write( m, expectedMetadataXml );
+
+        // Compare the file to the actual contents.
+        assertMetadataEquals( expectedMetadataXml.toString(), actualFile );
     }
 
     /**

Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java?rev=639273&r1=639272&r2=639273&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java Thu Mar 20 05:56:34 2008
@@ -30,6 +30,7 @@
 import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
 import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
 import org.apache.maven.archiva.model.ArtifactReference;
+import org.apache.maven.archiva.model.Plugin;
 import org.apache.maven.archiva.model.ProjectReference;
 import org.apache.maven.archiva.model.SnapshotVersion;
 import org.apache.maven.archiva.model.VersionedReference;
@@ -56,6 +57,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -394,14 +396,16 @@
     }
 
     /**
-     * Update the metadata to represent the all versions of
-     * the provided groupId:artifactId project reference,
+     * Update the metadata to represent the all versions/plugins of
+     * the provided groupId:artifactId project or group reference,
      * based off of information present in the repository,
      * the maven-metadata.xml files, and the proxy/repository specific
      * metadata file contents.
      *
+     * We must treat this as a group or a project metadata file as there is no way to know in advance
+     *
      * @param managedRepository the managed repository where the metadata is kept.
-     * @param reference         the versioned referencfe to update.
+     * @param reference         the reference to update.
      * @throws LayoutException
      * @throws RepositoryMetadataException
      * @throws IOException
@@ -421,6 +425,19 @@
         // Gather up all versions found in the managed repository.
         Set<String> allVersions = managedRepository.getVersions( reference );
 
+        // Gather up all plugins found in the managed repository.
+        // TODO: do we know this information instead?
+//        Set<Plugin> allPlugins = managedRepository.getPlugins( reference );
+        Set<Plugin> allPlugins;
+        if ( metadataFile.exists() )
+        {
+            allPlugins = new LinkedHashSet<Plugin>( RepositoryMetadataReader.read( metadataFile ).getPlugins() );
+        }
+        else
+        {
+            allPlugins = new LinkedHashSet<Plugin>();
+        }
+
         // Does this repository have a set of remote proxied repositories?
         Set<String> proxiedRepoIds = this.proxies.get( managedRepository.getId() );
 
@@ -436,6 +453,7 @@
                 if ( proxyMetadata != null )
                 {
                     allVersions.addAll( proxyMetadata.getAvailableVersions() );
+                    allPlugins.addAll( proxyMetadata.getPlugins() );
                     long proxyLastUpdated = getLastUpdated( proxyMetadata );
 
                     lastUpdated = Math.max( lastUpdated, proxyLastUpdated );
@@ -443,47 +461,55 @@
             }
         }
 
-        if ( allVersions.size() == 0 )
+        if ( !allVersions.isEmpty() )
         {
-            throw new IOException( "No versions found for reference." );
-        }
-
-        // Sort the versions
-        List<String> sortedVersions = new ArrayList<String>( allVersions );
-        Collections.sort( sortedVersions, VersionComparator.getInstance() );
+            // Sort the versions
+            List<String> sortedVersions = new ArrayList<String>( allVersions );
+            Collections.sort( sortedVersions, VersionComparator.getInstance() );
 
-        // Split the versions into released and snapshots.
-        List<String> releasedVersions = new ArrayList<String>();
-        List<String> snapshotVersions = new ArrayList<String>();
+            // Split the versions into released and snapshots.
+            List<String> releasedVersions = new ArrayList<String>();
+            List<String> snapshotVersions = new ArrayList<String>();
 
-        for ( String version : sortedVersions )
-        {
-            if ( VersionUtil.isSnapshot( version ) )
+            for ( String version : sortedVersions )
             {
-                snapshotVersions.add( version );
+                if ( VersionUtil.isSnapshot( version ) )
+                {
+                    snapshotVersions.add( version );
+                }
+                else
+                {
+                    releasedVersions.add( version );
+                }
             }
-            else
+
+            Collections.sort( releasedVersions, VersionComparator.getInstance() );
+            Collections.sort( snapshotVersions, VersionComparator.getInstance() );
+
+            String latestVersion = sortedVersions.get( sortedVersions.size() - 1 );
+            String releaseVersion = null;
+
+            if ( CollectionUtils.isNotEmpty( releasedVersions ) )
             {
-                releasedVersions.add( version );
+                releaseVersion = releasedVersions.get( releasedVersions.size() - 1 );
             }
-        }
-
-        Collections.sort( releasedVersions, VersionComparator.getInstance() );
-        Collections.sort( snapshotVersions, VersionComparator.getInstance() );
 
-        String latestVersion = sortedVersions.get( sortedVersions.size() - 1 );
-        String releaseVersion = null;
+            // Add the versions to the metadata model.
+            metadata.setAvailableVersions( sortedVersions );
 
-        if ( CollectionUtils.isNotEmpty( releasedVersions ) )
-        {
-            releaseVersion = releasedVersions.get( releasedVersions.size() - 1 );
+            metadata.setLatestVersion( latestVersion );
+            metadata.setReleasedVersion( releaseVersion );
         }
+        else
+        {
+            // Add the plugins to the metadata model.
+            metadata.setPlugins( new ArrayList<Plugin>( allPlugins ) );
 
-        // Add the versions to the metadata model.
-        metadata.setAvailableVersions( sortedVersions );
+            // artifact ID was actually the last part of the group
+            metadata.setGroupId( metadata.getGroupId() + "." + metadata.getArtifactId() );
+            metadata.setArtifactId( null );
+        }
 
-        metadata.setLatestVersion( latestVersion );
-        metadata.setReleasedVersion( releaseVersion );
         if ( lastUpdated > 0 )
         {
             metadata.setLastUpdatedTimestamp( toLastUpdatedDate( lastUpdated ) );

Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java?rev=639273&r1=639272&r2=639273&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java Thu Mar 20 05:56:34 2008
@@ -21,6 +21,7 @@
 
 import org.apache.commons.lang.math.NumberUtils;
 import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
+import org.apache.maven.archiva.model.Plugin;
 import org.apache.maven.archiva.model.SnapshotVersion;
 import org.apache.maven.archiva.xml.XMLException;
 import org.apache.maven.archiva.xml.XMLReader;
@@ -76,6 +77,15 @@
                     snapshot.setBuildNumber( NumberUtils.toInt( tmp ) );
                 }
                 metadata.setSnapshotVersion( snapshot );
+            }
+
+            for ( Element plugin : xml.getElementList( "//metadata/plugins/plugin" ) )
+            {
+                Plugin p = new Plugin();
+                p.setPrefix( plugin.elementTextTrim( "prefix" ) );
+                p.setArtifactId( plugin.elementTextTrim( "artifactId" ) );
+                p.setName( plugin.elementTextTrim( "name" ) );
+                metadata.addPlugin( p );
             }
 
             return metadata;

Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataWriter.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataWriter.java?rev=639273&r1=639272&r2=639273&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataWriter.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataWriter.java Thu Mar 20 05:56:34 2008
@@ -23,6 +23,7 @@
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
+import org.apache.maven.archiva.model.Plugin;
 import org.apache.maven.archiva.xml.XMLException;
 import org.apache.maven.archiva.xml.XMLWriter;
 import org.dom4j.Document;
@@ -34,6 +35,7 @@
 import java.io.IOException;
 import java.io.Writer;
 import java.util.Iterator;
+import java.util.List;
 
 /**
  * RepositoryMetadataWriter 
@@ -73,8 +75,20 @@
         doc.setRootElement( root );
 
         root.addElement( "groupId" ).setText( metadata.getGroupId() );
-        root.addElement( "artifactId" ).setText( metadata.getArtifactId() );
+        addOptionalElementText( root, "artifactId", metadata.getArtifactId() );
         addOptionalElementText( root, "version", metadata.getVersion() );
+
+        if ( CollectionUtils.isNotEmpty( metadata.getPlugins() ) )
+        {
+            Element plugins = root.addElement( "plugins" );
+            for ( Plugin plugin : (List<Plugin>)metadata.getPlugins() )
+            {
+                Element p = plugins.addElement( "plugin" );
+                p.addElement( "prefix" ).setText( plugin.getPrefix() );
+                p.addElement( "artifactId" ).setText( plugin.getArtifactId() );
+                addOptionalElementText( p, "name", plugin.getName() );
+            }
+        }
 
         if ( CollectionUtils.isNotEmpty( metadata.getAvailableVersions() )
             || StringUtils.isNotBlank( metadata.getReleasedVersion() )

Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java?rev=639273&r1=639272&r2=639273&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java (original)
+++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/metadata/MetadataToolsTest.java Thu Mar 20 05:56:34 2008
@@ -37,6 +37,7 @@
 import org.custommonkey.xmlunit.Diff;
 import org.xml.sax.SAXException;
 
+import javax.xml.parsers.ParserConfigurationException;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -44,8 +45,6 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.xml.parsers.ParserConfigurationException;
-
 /**
  * MetadataToolsTest
  *
@@ -114,19 +113,20 @@
         assertMetadataPath( "commons-lang/commons-lang/maven-metadata-central.xml", convertedName );
     }
 
-    public void testUpdateProjectBadArtifact()
-        throws Exception
-    {
-        try
-        {
-            assertUpdatedProjectMetadata( "bad_artifact", null );
-            fail( "Should have thrown an IOException on a bad artifact." );
-        }
-        catch ( IOException e )
-        {
-            // Expected path
-        }
-    }
+    // TODO: replace with group tests
+//    public void testUpdateProjectBadArtifact()
+//        throws Exception
+//    {
+//        try
+//        {
+//            assertUpdatedProjectMetadata( "bad_artifact", null );
+//            fail( "Should have thrown an IOException on a bad artifact." );
+//        }
+//        catch ( IOException e )
+//        {
+//            // Expected path
+//        }
+//    }
 
     public void testUpdateProjectMissingMultipleVersions()
         throws Exception

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletProxiedMetadataTestCase.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletProxiedMetadataTestCase.java?rev=639273&r1=639272&r2=639273&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletProxiedMetadataTestCase.java (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/AbstractRepositoryServletProxiedMetadataTestCase.java Thu Mar 20 05:56:34 2008
@@ -23,7 +23,6 @@
 import com.meterware.httpunit.HttpUnitOptions;
 import com.meterware.httpunit.WebRequest;
 import com.meterware.httpunit.WebResponse;
-
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
 import org.custommonkey.xmlunit.DetailedDiff;
@@ -139,6 +138,34 @@
                 buf.append( "    </versions>\n" );
             }
             buf.append( "  </versioning>\n" );
+        }
+        buf.append( "</metadata>" );
+
+        return buf.toString();
+    }
+
+    protected String createGroupMetadata( String groupId, String[] plugins )
+    {
+        StringBuffer buf = new StringBuffer();
+
+        buf.append( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n" );
+        buf.append( "<metadata>\n" );
+        buf.append( "  <groupId>" ).append( groupId ).append( "</groupId>\n" );
+
+        boolean hasPlugins = !ArrayUtils.isEmpty( plugins );
+
+        if ( hasPlugins )
+        {
+            buf.append( "  <plugins>\n" );
+            for ( String plugin : plugins )
+            {
+                buf.append( "    <plugin>\n" );
+                buf.append( "      <prefix>" ).append( plugin ).append( "</prefix>\n" );
+                buf.append( "      <artifactId>" ).append( plugin + "-maven-plugin" ).append( "</artifactId>\n" );
+                buf.append( "      <name>" ).append( "The " + plugin + " Plugin" ).append( "</name>\n" );
+                buf.append( "    </plugin>\n" );
+            }
+            buf.append( "  </plugins>\n" );
         }
         buf.append( "</metadata>" );
 

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletNoProxyMetadataTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletNoProxyMetadataTest.java?rev=639273&r1=639272&r2=639273&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletNoProxyMetadataTest.java (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletNoProxyMetadataTest.java Thu Mar 20 05:56:34 2008
@@ -22,7 +22,6 @@
 import com.meterware.httpunit.GetMethodWebRequest;
 import com.meterware.httpunit.WebRequest;
 import com.meterware.httpunit.WebResponse;
-
 import org.apache.commons.io.FileUtils;
 
 import java.io.File;
@@ -59,6 +58,24 @@
     {
         String commonsLangMetadata = "commons-lang/commons-lang/maven-metadata.xml";
         String expectedMetadataContents = "metadata-for-commons-lang-version-for-project";
+
+        File checksumFile = new File( repoRootInternal, commonsLangMetadata );
+        checksumFile.getParentFile().mkdirs();
+
+        FileUtils.writeStringToFile( checksumFile, expectedMetadataContents, null );
+
+        WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata );
+        WebResponse response = sc.getResponse( request );
+        assertResponseOK( response );
+
+        assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
+    }
+
+    public void testGetGroupMetadataDefaultLayout()
+        throws Exception
+    {
+        String commonsLangMetadata = "commons-lang/maven-metadata.xml";
+        String expectedMetadataContents = "metadata-for-commons-lang-group";
 
         File checksumFile = new File( repoRootInternal, commonsLangMetadata );
         checksumFile.getParentFile().mkdirs();

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletNoProxyTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletNoProxyTest.java?rev=639273&r1=639272&r2=639273&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletNoProxyTest.java (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletNoProxyTest.java Thu Mar 20 05:56:34 2008
@@ -22,7 +22,6 @@
 import com.meterware.httpunit.GetMethodWebRequest;
 import com.meterware.httpunit.WebRequest;
 import com.meterware.httpunit.WebResponse;
-
 import org.apache.commons.io.FileUtils;
 
 import java.io.File;
@@ -94,6 +93,24 @@
     {
         String commonsLangMetadata = "commons-lang/commons-lang/maven-metadata.xml";
         String expectedMetadataContents = "dummy-project-metadata";
+
+        File metadataFile = new File( repoRootInternal, commonsLangMetadata );
+        metadataFile.getParentFile().mkdirs();
+
+        FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, null );
+
+        WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata );
+        WebResponse response = sc.getResponse( request );
+        assertResponseOK( response );
+
+        assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
+    }
+
+    public void testGetNoProxyGroupMetadataDefaultLayout()
+        throws Exception
+    {
+        String commonsLangMetadata = "commons-lang/maven-metadata.xml";
+        String expectedMetadataContents = "dummy-group-metadata";
 
         File metadataFile = new File( repoRootInternal, commonsLangMetadata );
         metadataFile.getParentFile().mkdirs();

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedMetadataLocalOnlyTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedMetadataLocalOnlyTest.java?rev=639273&r1=639272&r2=639273&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedMetadataLocalOnlyTest.java (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedMetadataLocalOnlyTest.java Thu Mar 20 05:56:34 2008
@@ -95,4 +95,24 @@
         // --- Verification
         assertExpectedMetadata( expectedMetadata, actualMetadata );
     }
+
+    public void testGetProxiedGroupMetadataLocalOnly()
+        throws Exception
+    {
+        // --- Setup
+        setupSnapshotsRemoteRepo();
+        setupPrivateSnapshotsRemoteRepo();
+        setupCleanInternalRepo();
+
+        String path = "org/apache/archiva/maven-metadata.xml";
+        String expectedMetadata = createGroupMetadata( "org.apache.archiva", new String[] { "archivatest-maven-plugin" } );
+
+        populateRepo( repoRootInternal, path, expectedMetadata );
+
+        // --- Execution
+        String actualMetadata = requestMetadataOK( path );
+
+        // --- Verification
+        assertExpectedMetadata( expectedMetadata, actualMetadata );
+    }
 }

Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedMetadataRemoteOnlyTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedMetadataRemoteOnlyTest.java?rev=639273&r1=639272&r2=639273&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedMetadataRemoteOnlyTest.java (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedMetadataRemoteOnlyTest.java Thu Mar 20 05:56:34 2008
@@ -139,4 +139,28 @@
         // --- Verification
         assertExpectedMetadata( expectedMetadata, actualMetadata );
     }
+
+    public void testGetProxiedGroupMetadataRemoteOnly()
+        throws Exception
+    {
+        // --- Setup
+        setupSnapshotsRemoteRepo();
+        setupPrivateSnapshotsRemoteRepo();
+        setupCleanInternalRepo();
+
+        String path = "org/apache/archiva/maven-metadata.xml";
+        String expectedMetadata = createGroupMetadata( "org.apache.archiva", new String[] { "archivatest-maven-plugin" } );
+
+        File managedFile = populateRepo( remoteSnapshots, path, expectedMetadata );
+
+        setupConnector( REPOID_INTERNAL, remoteSnapshots );
+        setupConnector( REPOID_INTERNAL, remotePrivateSnapshots );
+        saveConfiguration();
+
+        // --- Execution
+        String actualMetadata = requestMetadataOK( path );
+
+        // --- Verification
+        assertExpectedMetadata( expectedMetadata, actualMetadata );
+    }
 }



Mime
View raw message