]> source.dussan.org Git - archiva.git/commitdiff
[MRM-694]
authorMaria Odea B. Ching <oching@apache.org>
Fri, 18 Apr 2008 04:38:48 +0000 (04:38 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Fri, 18 Apr 2008 04:38:48 +0000 (04:38 +0000)
changes by Nap Ramirez, Maria Catherine Tan, Henry Isidro, Brett Porter and myself

-add repositoryGroups in configuration
-updated ArchivaConfiguration and added test for this change

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

archiva-modules/archiva-base/archiva-configuration/pom.xml
archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java
archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo
archiva-modules/archiva-base/archiva-configuration/src/test/conf/conf-single-list-elements.xml
archiva-modules/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/ArchivaConfigurationTest.java

index f5bb1c9f762e81e168fae50005a6720aa55a448d..3833eddf0e733b8e0c58cef644385015523c537b 100644 (file)
@@ -87,7 +87,7 @@
           </execution>
         </executions>
         <configuration>
-          <version>1.1.0</version>
+          <version>1.2.0</version>
           <model>src/main/mdo/configuration.mdo</model>
         </configuration>
       </plugin>
index cc863653198a7aad0aaa860f7885a7a0f99d81b9..2e86bde8d9cd39c14026a20ec77b416df4ebeee0 100644 (file)
@@ -416,7 +416,7 @@ public class DefaultArchivaConfiguration
                 if ( key.startsWith( "repositories" ) || key.startsWith( "proxyConnectors" )
                     || key.startsWith( "networkProxies" ) || key.startsWith( "repositoryScanning" )
                     || key.startsWith( "databaseScanning" ) || key.startsWith( "remoteRepositories" )
-                    || key.startsWith( "managedRepositories" ) )
+                    || key.startsWith( "managedRepositories" ) || key.startsWith( "repositoryGroups" ) )
                 {
                     foundList = true;
                 }
@@ -455,6 +455,10 @@ public class DefaultArchivaConfiguration
         {
             section.removeSubset( "legacyArtifactPaths" );
         }
+        if ( configuration.getRepositoryGroups().isEmpty() )           
+        {
+            section.removeSubset( "repositoryGroups" );
+        }
         if ( configuration.getRepositoryScanning() != null )
         {
             if ( configuration.getRepositoryScanning().getKnownContentConsumers().isEmpty() )
index 77367438406fde41c28ca8fe580bad4a6bd5a94c..041e3b8f2eb870d2a8e4da9c302c324d2beb1a86 100644 (file)
             <multiplicity>*</multiplicity>
           </association>
         </field>
+        <field>
+          <name>repositoryGroups</name>
+          <version>1.2.0+</version>
+          <association>
+            <type>RepositoryGroupConfiguration</type>
+            <multiplicity>*</multiplicity>
+          </association>
+          <description>The list of repository groups.</description>
+        </field>
         <field>
           <name>managedRepositories</name>
           <version>1.0.0+</version>
         </codeSegment>
       </codeSegments>
     </class>
+    <class>
+      <name>RepositoryGroupConfiguration</name>
+      <version>1.2.0+</version>
+      <fields>
+        <field>
+          <name>id</name>
+          <version>1.2.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>The id of the repository group.</description>
+        </field>
+        <field>
+          <name>repositories</name>
+          <version>1.2.0+</version>
+          <association>
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+          <description>The list of repository ids under the group.</description>          
+        </field>
+      </fields>
+    </class>
 
     <!--
       ____                            _
index a7bb686d88f32ac182d6740d968a95523c8ba67d..3e3d4dc97795a5358bf7dca3b3dd0013cc4852f7 100644 (file)
 
 <configuration>
   <version>2</version>
+  <repositoryGroups>
+    <repositoryGroup>
+      <id>default</id>
+      <repositories>
+        <repository>snapshots</repository>
+      </repositories>
+    </repositoryGroup>
+  </repositoryGroups>
   <managedRepositories>
     <managedRepository>
       <id>snapshots</id>
index 82b79fc939b13ee6239c17e8fbdd8014c5a78ac4..1143a671c31a5a2135e026a8a5c5a7e1b774a0bf 100644 (file)
@@ -686,7 +686,12 @@ public class ArchivaConfigurationTest
             (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-remove-central" );
 
         Configuration configuration = archivaConfiguration.getConfiguration();
-
+       
+        RepositoryGroupConfiguration repositoryGroup = ( RepositoryGroupConfiguration ) configuration.getRepositoryGroups().get( 0 );
+        assertNotNull( repositoryGroup );
+        configuration.removeRepositoryGroup( repositoryGroup );
+        assertTrue( configuration.getRepositoryGroups().isEmpty() );
+        
         RemoteRepositoryConfiguration repository = configuration.getRemoteRepositoriesAsMap().get( "central" );
         assertNotNull( repository );
         configuration.removeRemoteRepository( repository );
@@ -740,6 +745,7 @@ public class ArchivaConfigurationTest
             (ArchivaConfiguration) lookup( ArchivaConfiguration.class.getName(), "test-read-saved" );
         configuration = archivaConfiguration.getConfiguration();
         assertNull( configuration.getRemoteRepositoriesAsMap().get( "central" ) );
+        assertTrue( configuration.getRepositoryGroups().isEmpty() );
         assertNull( configuration.getManagedRepositoriesAsMap().get( "snapshots" ) );
         assertTrue( configuration.getProxyConnectors().isEmpty() );
         assertNull( configuration.getNetworkProxiesAsMap().get( "proxy" ) );