You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ct...@apache.org on 2009/04/15 01:55:48 UTC

svn commit: r765015 - in /continuum/trunk: continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/ continuum-data-management/data-management-jdo/src/test/resources/ continuum-model/ continuum-model/src/main/md...

Author: ctan
Date: Tue Apr 14 23:55:48 2009
New Revision: 765015

URL: http://svn.apache.org/viewvc?rev=765015&view=rev
Log:
[CONTINUUM-2171] merge -r 765013:765014 of 1.3.x branch


Modified:
    continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
    continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml
    continuum/trunk/continuum-model/pom.xml
    continuum/trunk/continuum-model/src/main/mdo/continuum.xml
    continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildDefinitionDaoImpl.java

Modified: continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java?rev=765015&r1=765014&r2=765015&view=diff
==============================================================================
--- continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java (original)
+++ continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java Tue Apr 14 23:55:48 2009
@@ -40,6 +40,7 @@
 import javax.jdo.PersistenceManagerFactory;
 import javax.xml.stream.XMLStreamException;
 
+import org.apache.continuum.dao.BuildDefinitionDao;
 import org.apache.continuum.dao.BuildDefinitionTemplateDao;
 import org.apache.continuum.dao.BuildQueueDao;
 import org.apache.continuum.dao.ContinuumReleaseResultDao;
@@ -152,6 +153,11 @@
      */
     private BuildQueueDao buildQueueDao;
 
+    /**
+     * @plexus.requirement
+     */
+    private BuildDefinitionDao buildDefinitionDao;
+
     protected static final String BUILDS_XML = "builds.xml";
 
     /**
@@ -182,6 +188,8 @@
             database.setBuildDefinitionTemplates( buildDefinitionTemplateDao.getAllBuildDefinitionTemplate() );
 
             database.setBuildQueues( buildQueueDao.getAllBuildQueues() );
+
+            database.setBuildDefinitions( buildDefinitionDao.getAllBuildDefinitions() );
         }
         catch ( ContinuumStoreException e )
         {
@@ -305,6 +313,23 @@
             profiles.put( Integer.valueOf( profile.getId() ), profile );
         }
 
+        Map<Integer, BuildDefinition> buildDefinitions = new HashMap<Integer, BuildDefinition>();
+        for ( BuildDefinition buildDefinition : (List<BuildDefinition>) database.getBuildDefinitions() )
+        {
+            if ( buildDefinition.getSchedule() != null )
+            {
+                buildDefinition.setSchedule( schedules.get( Integer.valueOf( buildDefinition.getSchedule().getId() ) ) );
+            }
+
+            if ( buildDefinition.getProfile() != null )
+            {
+                buildDefinition.setProfile( profiles.get( Integer.valueOf( buildDefinition.getProfile().getId() ) ) );
+            }
+
+            buildDefinition = (BuildDefinition) PlexusJdoUtils.addObject( pmf.getPersistenceManager(), buildDefinition );
+            buildDefinitions.put( Integer.valueOf( buildDefinition.getId() ), buildDefinition );
+        }
+
         Map<Integer, LocalRepository> localRepositories = new HashMap<Integer, LocalRepository>();
         for ( LocalRepository localRepository : (List<LocalRepository>) database.getLocalRepositories() )
         {
@@ -318,14 +343,15 @@
         {
             ProjectGroup projectGroup = (ProjectGroup) i.next();
 
-            // first, we must map up any schedules, etc.
-            processBuildDefinitions( projectGroup.getBuildDefinitions(), schedules, profiles );
+            projectGroup.setBuildDefinitions( processBuildDefinitions( projectGroup.getBuildDefinitions(),
+                                                                       buildDefinitions ) );
 
             for ( Iterator j = projectGroup.getProjects().iterator(); j.hasNext(); )
             {
                 Project project = (Project) j.next();
 
-                processBuildDefinitions( project.getBuildDefinitions(), schedules, profiles );
+                project.setBuildDefinitions( processBuildDefinitions( project.getBuildDefinitions(), 
+                                                                      buildDefinitions ) );
             }
 
             if ( projectGroup.getLocalRepository() != null )
@@ -434,7 +460,7 @@
 
         for ( BuildDefinitionTemplate template : (List<BuildDefinitionTemplate>) database.getBuildDefinitionTemplates() )
         {
-            template.setBuildDefinitions( null );
+            template.setBuildDefinitions( processBuildDefinitions( template.getBuildDefinitions(), buildDefinitions ) );
 
             template = 
                 (BuildDefinitionTemplate) PlexusJdoUtils.addObject( pmf.getPersistenceManager(), template );
@@ -459,23 +485,17 @@
         return groupProjects;
     }
 
-    private static void processBuildDefinitions( List buildDefinitions, Map<Integer, Schedule> schedules,
-                                                 Map<Integer, Profile> profiles )
+    private List<BuildDefinition> processBuildDefinitions( List<BuildDefinition> buildDefinitions, 
+                                                 Map<Integer, BuildDefinition> buildDefs )
     {
-        for ( Iterator i = buildDefinitions.iterator(); i.hasNext(); )
+        List<BuildDefinition> buildDefsList = new ArrayList<BuildDefinition>();
+        
+        for ( BuildDefinition buildDefinition : buildDefinitions )
         {
-            BuildDefinition def = (BuildDefinition) i.next();
-
-            if ( def.getSchedule() != null )
-            {
-                def.setSchedule( schedules.get( Integer.valueOf( def.getSchedule().getId() ) ) );
-            }
-
-            if ( def.getProfile() != null )
-            {
-                def.setProfile( profiles.get( Integer.valueOf( def.getProfile().getId() ) ) );
-            }
+            buildDefsList.add( buildDefs.get( Integer.valueOf( buildDefinition.getId() ) ) );
         }
+
+        return buildDefsList;
     }
 
     private List<BuildQueue> getBuildQueuesBySchedule( Map<Integer, BuildQueue> allBuildQueues, Schedule schedule )

Modified: continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml?rev=765015&r1=765014&r2=765015&view=diff
==============================================================================
--- continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml (original)
+++ continuum/trunk/continuum-data-management/data-management-jdo/src/test/resources/expected.xml Tue Apr 14 23:55:48 2009
@@ -25,8 +25,8 @@
               <buildNumber>1</buildNumber>
               <state>1</state>
               <trigger>1</trigger>
-              <startTime>1164693625928</startTime>
-              <endTime>1164693626928</endTime>
+              <startTime>1239696188773</startTime>
+              <endTime>1239696189773</endTime>
               <error>error1</error>
               <success>true</success>
               <exitCode>1</exitCode>
@@ -38,7 +38,7 @@
                   <change>
                     <author>author1.1</author>
                     <comment>comment1.1</comment>
-                    <date>1164693625935</date>
+                    <date>1239696188774</date>
                     <files>
                       <file>
                         <name>name1.1.1</name>
@@ -57,7 +57,7 @@
                   <change>
                     <author>author1.2</author>
                     <comment>comment1.2</comment>
-                    <date>1164693625936</date>
+                    <date>1239696188774</date>
                     <files>
                       <file>
                         <name>name1.2.1</name>
@@ -82,8 +82,8 @@
               <buildNumber>2</buildNumber>
               <state>2</state>
               <trigger>2</trigger>
-              <startTime>1164693627928</startTime>
-              <endTime>1164693628928</endTime>
+              <startTime>1239696190773</startTime>
+              <endTime>1239696191773</endTime>
               <error>error2</error>
               <exitCode>2</exitCode>
             </buildResult>
@@ -95,7 +95,7 @@
               <change>
                 <author>authorCO1.1</author>
                 <comment>commentCO1.1</comment>
-                <date>1164693625936</date>
+                <date>1239696188774</date>
                 <files>
                   <file>
                     <name>nameCO1.1.1</name>
@@ -114,7 +114,7 @@
               <change>
                 <author>authorCO1.2</author>
                 <comment>commentCO1.2</comment>
-                <date>1164693625936</date>
+                <date>1239696188774</date>
                 <files>
                   <file>
                     <name>nameCO1.2.1</name>
@@ -167,7 +167,7 @@
           </notifiers>
           <buildDefinitions>
             <buildDefinition>
-              <id>1</id>
+              <id>3</id>
               <goals>goals11</goals>
               <arguments>arguments11</arguments>
               <buildFile>buildFile11</buildFile>
@@ -175,7 +175,7 @@
               <profile id="2"></profile>
             </buildDefinition>
             <buildDefinition>
-              <id>2</id>
+              <id>4</id>
               <goals>goals12</goals>
               <arguments>arguments12</arguments>
               <buildFile>buildFile12</buildFile>
@@ -202,8 +202,8 @@
               <buildNumber>3</buildNumber>
               <state>3</state>
               <trigger>3</trigger>
-              <startTime>1164693629928</startTime>
-              <endTime>1164693630928</endTime>
+              <startTime>1239696192773</startTime>
+              <endTime>1239696193773</endTime>
               <error>error3</error>
               <success>true</success>
               <exitCode>3</exitCode>
@@ -215,7 +215,7 @@
                   <change>
                     <author>author3.1</author>
                     <comment>comment3.1</comment>
-                    <date>1164693625936</date>
+                    <date>1239696188774</date>
                     <files>
                       <file>
                         <name>name3.1.1</name>
@@ -234,7 +234,7 @@
                   <change>
                     <author>author3.2</author>
                     <comment>comment3.2</comment>
-                    <date>1164693625936</date>
+                    <date>1239696188774</date>
                     <files>
                       <file>
                         <name>name3.2.1</name>
@@ -302,7 +302,7 @@
           </notifiers>
           <buildDefinitions>
             <buildDefinition>
-              <id>3</id>
+              <id>5</id>
               <goals>goals13</goals>
               <arguments>arguments13</arguments>
               <buildFile>buildFile13</buildFile>
@@ -310,7 +310,7 @@
               <profile id="1"></profile>
             </buildDefinition>
             <buildDefinition>
-              <id>8</id>
+              <id>6</id>
               <goals>deploy</goals>
             </buildDefinition>
           </buildDefinitions>
@@ -341,7 +341,7 @@
       </notifiers>
       <buildDefinitions>
         <buildDefinition>
-          <id>4</id>
+          <id>2</id>
           <goals>goals1</goals>
           <arguments>arguments1</arguments>
           <buildFile>buildFile1</buildFile>
@@ -371,7 +371,7 @@
       </notifiers>
       <buildDefinitions>
         <buildDefinition>
-          <id>5</id>
+          <id>7</id>
           <goals>goals2</goals>
           <arguments>arguments2</arguments>
           <buildFile>buildFile2</buildFile>
@@ -379,7 +379,7 @@
           <profile id="1"></profile>
         </buildDefinition>
         <buildDefinition>
-          <id>6</id>
+          <id>8</id>
           <goals>goals3</goals>
           <arguments>arguments3</arguments>
           <buildFile>buildFile3</buildFile>
@@ -387,7 +387,7 @@
           <profile id="2"></profile>
         </buildDefinition>
         <buildDefinition>
-          <id>7</id>
+          <id>9</id>
           <goals>deploy</goals>
         </buildDefinition>
       </buildDefinitions>
@@ -421,7 +421,7 @@
     </installation>
     <installation>
       <type>maven2</type>
-      <varValue>/usr/local/maven-2.0-alpha-3</varValue>    
+      <varValue>/usr/local/maven-2.0-alpha-3</varValue>
       <varName>M2_HOME</varName>
       <name>Maven 2.0 alpha 3</name>
       <installationId>2</installationId>
@@ -606,4 +606,70 @@
       <name>build queue 3</name>
     </buildQueue>
   </buildQueues>
+  <buildDefinitions>
+    <buildDefinition>
+      <id>1</id>
+      <goals>goals14</goals>
+      <arguments>arguments14</arguments>
+      <buildFile>buildFile14</buildFile>
+      <schedule id="2"></schedule>
+      <profile id="1"></profile>
+    </buildDefinition>
+    <buildDefinition>
+      <id>2</id>
+      <goals>goals1</goals>
+      <arguments>arguments1</arguments>
+      <buildFile>buildFile1</buildFile>
+      <schedule id="1"></schedule>
+      <profile id="1"></profile>
+    </buildDefinition>
+    <buildDefinition>
+      <id>3</id>
+      <goals>goals11</goals>
+      <arguments>arguments11</arguments>
+      <buildFile>buildFile11</buildFile>
+      <schedule id="2"></schedule>
+      <profile id="2"></profile>
+    </buildDefinition>
+    <buildDefinition>
+      <id>4</id>
+      <goals>goals12</goals>
+      <arguments>arguments12</arguments>
+      <buildFile>buildFile12</buildFile>
+      <schedule id="1"></schedule>
+      <profile id="2"></profile>
+    </buildDefinition>
+    <buildDefinition>
+      <id>5</id>
+      <goals>goals13</goals>
+      <arguments>arguments13</arguments>
+      <buildFile>buildFile13</buildFile>
+      <schedule id="1"></schedule>
+      <profile id="1"></profile>
+    </buildDefinition>
+    <buildDefinition>
+      <id>6</id>
+      <goals>deploy</goals>
+    </buildDefinition>
+    <buildDefinition>
+      <id>7</id>
+      <goals>goals2</goals>
+      <arguments>arguments2</arguments>
+      <buildFile>buildFile2</buildFile>
+      <schedule id="2"></schedule>
+      <profile id="1"></profile>
+    </buildDefinition>
+    <buildDefinition>
+      <id>8</id>
+      <goals>goals3</goals>
+      <arguments>arguments3</arguments>
+      <buildFile>buildFile3</buildFile>
+      <schedule id="2"></schedule>
+      <profile id="2"></profile>
+    </buildDefinition>
+    <buildDefinition>
+      <id>9</id>
+      <goals>deploy</goals>
+    </buildDefinition>
+  </buildDefinitions>
 </continuumDatabase>

Modified: continuum/trunk/continuum-model/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-model/pom.xml?rev=765015&r1=765014&r2=765015&view=diff
==============================================================================
--- continuum/trunk/continuum-model/pom.xml (original)
+++ continuum/trunk/continuum-model/pom.xml Tue Apr 14 23:55:48 2009
@@ -63,7 +63,7 @@
           </execution>
         </executions>
         <configuration>
-          <version>1.3.2</version>
+          <version>1.3.3</version>
           <packageWithVersion>false</packageWithVersion>
           <model>src/main/mdo/continuum.xml</model>
         </configuration>

Modified: continuum/trunk/continuum-model/src/main/mdo/continuum.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-model/src/main/mdo/continuum.xml?rev=765015&r1=765014&r2=765015&view=diff
==============================================================================
--- continuum/trunk/continuum-model/src/main/mdo/continuum.xml (original)
+++ continuum/trunk/continuum-model/src/main/mdo/continuum.xml Tue Apr 14 23:55:48 2009
@@ -128,13 +128,21 @@
         </field>
         <field>
           <name>buildQueues</name>
-          <version>1.3.2</version>
+          <version>1.3.2+</version>
           <association java.init="field">
             <type>BuildQueue</type>
             <multiplicity>*</multiplicity>
           </association>
           <defaultValue>new java.util.ArrayList()</defaultValue>
         </field>
+        <field>
+          <name>buildDefinitions</name>
+          <version>1.3.3+</version>
+          <association java.init="field">
+            <type>BuildDefinition</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
       </fields>
     </class>
 

Modified: continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildDefinitionDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildDefinitionDaoImpl.java?rev=765015&r1=765014&r2=765015&view=diff
==============================================================================
--- continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildDefinitionDaoImpl.java (original)
+++ continuum/trunk/continuum-store/src/main/java/org/apache/continuum/dao/BuildDefinitionDaoImpl.java Tue Apr 14 23:55:48 2009
@@ -44,6 +44,7 @@
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
  * @version $Id$
+ * @plexus.component role="org.apache.continuum.dao.BuildDefinitionDao"
  */
 @Repository("buildDefinitionDao")
 public class BuildDefinitionDaoImpl