continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r759039 - 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/src/main/mdo/
Date Fri, 27 Mar 2009 07:16:32 GMT
Author: ctan
Date: Fri Mar 27 07:16:31 2009
New Revision: 759039

URL: http://svn.apache.org/viewvc?rev=759039&view=rev
Log:
[CONTINUUM-2106] added BuildQueue during backup/restore 

Submitted By: Jan Ancajas (with slight modification)



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/src/main/mdo/continuum.xml

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=759039&r1=759038&r2=759039&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
Fri Mar 27 07:16:31 2009
@@ -20,6 +20,7 @@
  */
 
 import org.apache.continuum.dao.BuildDefinitionTemplateDao;
+import org.apache.continuum.dao.BuildQueueDao;
 import org.apache.continuum.dao.ContinuumReleaseResultDao;
 import org.apache.continuum.dao.DaoUtils;
 import org.apache.continuum.dao.DirectoryPurgeConfigurationDao;
@@ -39,6 +40,7 @@
 import org.apache.continuum.utils.ProjectSorter;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildDefinitionTemplate;
+import org.apache.maven.continuum.model.project.BuildQueue;
 import org.apache.maven.continuum.model.project.ContinuumDatabase;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.model.project.ProjectGroup;
@@ -145,6 +147,11 @@
      */
     private ContinuumReleaseResultDao releaseResultDao;
 
+    /**
+     * @plexus.requirement
+     */
+    private BuildQueueDao buildQueueDao;
+
     protected static final String BUILDS_XML = "builds.xml";
 
     /**
@@ -171,6 +178,10 @@
         try
         {
             database.setInstallations( installationDao.getAllInstallations() );
+
+            database.setBuildDefinitionTemplates( buildDefinitionTemplateDao.getAllBuildDefinitionTemplate()
);
+
+            database.setBuildQueues( buildQueueDao.getAllBuildQueues() );
         }
         catch ( ContinuumStoreException e )
         {
@@ -178,21 +189,11 @@
         }
         database.setSchedules( scheduleDao.getAllSchedulesByName() );
         database.setProfiles( profileDao.getAllProfilesByName() );
-
         database.setLocalRepositories( localRepositoryDao.getAllLocalRepositories() );
         database.setRepositoryPurgeConfigurations(
             repositoryPurgeConfigurationDao.getAllRepositoryPurgeConfigurations() );
         database.setDirectoryPurgeConfigurations( directoryPurgeConfigurationDao.getAllDirectoryPurgeConfigurations()
);
-
         database.setProjectScmRoots( projectScmRootDao.getAllProjectScmRoots() );
-        try
-        {
-            database.setBuildDefinitionTemplates( buildDefinitionTemplateDao.getAllBuildDefinitionTemplate()
);
-        }
-        catch ( ContinuumStoreException e )
-        {
-        }
-
         database.setContinuumReleaseResults( releaseResultDao.getAllContinuumReleaseResults()
);
 
         ContinuumStaxWriter writer = new ContinuumStaxWriter();
@@ -253,10 +254,17 @@
 
         PlexusJdoUtils.addObject( pmf.getPersistenceManager(), database.getSystemConfiguration()
);
 
+        Map<Integer, BuildQueue> buildQueues = new HashMap<Integer, BuildQueue>();
+        for ( BuildQueue buildQueue : (List<BuildQueue>)database.getBuildQueues() )
+        {
+            buildQueues.put( buildQueue.getId(), buildQueue );
+        }
+
         Map<Integer, Schedule> schedules = new HashMap<Integer, Schedule>();
         for ( Iterator i = database.getSchedules().iterator(); i.hasNext(); )
         {
             Schedule schedule = (Schedule) i.next();
+            schedule.setBuildQueues( getBuildQueuesBySchedule( buildQueues, schedule ) );
 
             schedule = (Schedule) PlexusJdoUtils.addObject( pmf.getPersistenceManager(),
schedule );
             schedules.put( Integer.valueOf( schedule.getId() ), schedule );
@@ -442,4 +450,15 @@
             }
         }
     }
+
+    private List<BuildQueue> getBuildQueuesBySchedule( Map<Integer, BuildQueue>
allBuildQueues, Schedule schedule )
+    {
+        List<BuildQueue> buildQueues = new ArrayList<BuildQueue>();
+
+        for ( BuildQueue buildQueue : (List<BuildQueue>) schedule.getBuildQueues()
)
+        {
+            buildQueues.add( allBuildQueues.get( Integer.valueOf( buildQueue.getId() ) )
);
+        }
+        return buildQueues;
+    }
 }

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=759039&r1=759038&r2=759039&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
Fri Mar 27 07:16:31 2009
@@ -435,6 +435,10 @@
       <description>description1</description>
       <delay>1</delay>
       <cronExpression>cronExpression1</cronExpression>
+      <buildQueues>
+        <buildQueue id="1"></buildQueue>
+        <buildQueue id="2"></buildQueue>
+      </buildQueues>
     </schedule>
     <schedule>
       <id>1</id>
@@ -443,6 +447,9 @@
       <description>description2</description>
       <delay>2</delay>
       <cronExpression>cronExpression2</cronExpression>
+      <buildQueues>
+        <buildQueue id="3"></buildQueue>
+      </buildQueues>
     </schedule>
     <schedule>
       <id>3</id>
@@ -556,4 +563,18 @@
       <releaseGoal>releaseGoal</releaseGoal>
     </continuumReleaseResult>
   </continuumReleaseResults>
+  <buildQueues>
+    <buildQueue>
+      <id>1</id>
+      <name>build queue 1</name>
+    </buildQueue>
+    <buildQueue>
+      <id>2</id>
+      <name>build queue 2</name>
+    </buildQueue>
+    <buildQueue>
+      <id>3</id>
+      <name>build queue 3</name>
+    </buildQueue>
+  </buildQueues>
 </continuumDatabase>

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=759039&r1=759038&r2=759039&view=diff
==============================================================================
--- continuum/trunk/continuum-model/src/main/mdo/continuum.xml (original)
+++ continuum/trunk/continuum-model/src/main/mdo/continuum.xml Fri Mar 27 07:16:31 2009
@@ -126,6 +126,15 @@
           </association>
           <defaultValue>new java.util.ArrayList()</defaultValue>
         </field>
+        <field>
+          <name>buildQueues</name>
+          <version>1.3.2</version>
+          <association java.init="field">
+            <type>BuildQueue</type>
+            <multiplicity>*</multiplicity>
+          </association>
+          <defaultValue>new java.util.ArrayList()</defaultValue>
+        </field>
       </fields>
     </class>
 
@@ -1066,7 +1075,7 @@
           <identifier>true</identifier>
           <type>int</type>
         </field>
-        <field>
+        <field jpox.null-value="default">
           <name>name</name>
           <version>1.1.4+</version>
           <type>String</type>



Mime
View raw message