continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r904302 - in /continuum/branches/continuum-1.3.x: continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/ continuum-release/ continuum-release/src/main/mdo/ continuum-webapp/src/main/java/org/apache/maven/continuum/we...
Date Thu, 28 Jan 2010 23:33:46 GMT
Author: ctan
Date: Thu Jan 28 23:33:45 2010
New Revision: 904302

URL: http://svn.apache.org/viewvc?rev=904302&view=rev
Log:
revert changes made for CONTINUUM-2450. this fix is intended for continuum 1.4.0

Modified:
    continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
    continuum/branches/continuum-1.3.x/continuum-release/pom.xml
    continuum/branches/continuum-1.3.x/continuum-release/src/main/mdo/prepared-releases.mdo
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java?rev=904302&r1=904301&r2=904302&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
Thu Jan 28 23:33:45 2010
@@ -155,7 +155,6 @@
         try
         {
             SlaveBuildAgentTransportClient client = new SlaveBuildAgentTransportClient( new
URL( buildAgentUrl ) );
-
             String releaseId =
                 client.releasePrepare( createProjectMap( project ), createPropertiesMap(
releaseProperties ),
                                        releaseVersion, developmentVersion, environments );
@@ -299,18 +298,6 @@
                                 boolean useReleaseProfile, LocalRepository repository )
         throws ContinuumReleaseException, BuildAgentConfigurationException
     {
-        List<PreparedRelease> releases = getPreparedReleases();
-
-        for ( PreparedRelease release: releases )
-        {
-            if ( release.getReleaseId().equals( releaseId ) )
-            {
-                release.setReleaseType( "perform" );
-                savePreparedReleases( releases );
-                break;
-            }
-        }
-
         String buildAgentUrl = getBuildAgentUrl( releaseId );
 
         if ( !checkBuildAgent( buildAgentUrl ) )
@@ -453,8 +440,6 @@
             String result = client.releaseCleanup( releaseId );
 
             removeFromReleaseInProgress( releaseId );
-            removeFromPreparedReleases( releaseId );
-
             return result;
         }
         catch ( MalformedURLException e )
@@ -649,11 +634,17 @@
     private void addReleasePrepare( String releaseId, String buildAgentUrl, String releaseName
)
         throws ContinuumReleaseException
     {
+        File file = getPreparedReleasesFile();
+
+        if ( !file.exists() )
+        {
+            file.getParentFile().mkdirs();
+        }
+
         PreparedRelease release = new PreparedRelease();
         release.setReleaseId( releaseId );
         release.setBuildAgentUrl( buildAgentUrl );
         release.setReleaseName( releaseName );
-        release.setReleaseType( "prepare" );
 
         List<PreparedRelease> preparedReleases = getPreparedReleases();
 
@@ -661,25 +652,41 @@
         {
             preparedReleases = new ArrayList<PreparedRelease>();
         }
+        else
+        {
+            boolean found = false;
 
-        boolean found = false;
+            for ( PreparedRelease preparedRelease : preparedReleases )
+            {
+                if ( preparedRelease.getReleaseId().equals( release.getReleaseId() ) &&
+                    preparedRelease.getReleaseName().equals( release.getReleaseName() ) )
+                {
+                    preparedRelease.setBuildAgentUrl( release.getBuildAgentUrl() );
+                    found = true;
+                }
+            }
 
-        for ( PreparedRelease preparedRelease : preparedReleases )
-        {
-            if ( preparedRelease.getReleaseId().equals( release.getReleaseId() ) &&
-                 preparedRelease.getReleaseName().equals( release.getReleaseName() ) )
+            if ( !found )
             {
-                preparedRelease.setBuildAgentUrl( release.getBuildAgentUrl() );
-                found = true;
+                preparedReleases.add( release );
             }
         }
 
-        if ( !found )
+        PreparedReleaseModel model = new PreparedReleaseModel();
+        model.setPreparedReleases( preparedReleases );
+
+        try
+        {
+            ContinuumPrepareReleasesModelXpp3Writer writer = new ContinuumPrepareReleasesModelXpp3Writer();
+            FileWriter fileWriter = new FileWriter( file );
+            writer.write( fileWriter, model );
+            fileWriter.flush();
+            fileWriter.close();
+        }
+        catch ( IOException e )
         {
-            preparedReleases.add( release );
+            throw new ContinuumReleaseException( "Failed to write prepared releases in file",
e );
         }
-
-        savePreparedReleases( preparedReleases );
     }
 
     private void addReleaseInProgress( String releaseId, String releaseType, int projectId
)
@@ -741,61 +748,4 @@
         log.info( "Build agent: " + buildAgentUrl + "is either disabled or removed" );
         return false;
     }
-
-    private void removeFromPreparedReleases( String releaseId )
-        throws ContinuumReleaseException
-    {
-        List<PreparedRelease> releases = getPreparedReleases();
-
-        for ( PreparedRelease release : releases )
-        {
-            if ( release.getReleaseId().equals( releaseId ) )
-            {
-                if ( release.getReleaseType().equals( "perform" ) )
-                {
-                    releases.remove( release );
-                    savePreparedReleases( releases );
-                    break;
-                }
-            }
-        }
-    }
-
-    private void savePreparedReleases( List<PreparedRelease> preparedReleases)
-        throws ContinuumReleaseException
-    {
-        File file = getPreparedReleasesFile();
-
-        if ( !file.exists() )
-        {
-            file.getParentFile().mkdirs();
-        }
-
-        PreparedReleaseModel model = new PreparedReleaseModel();
-        model.setPreparedReleases( preparedReleases );
-
-        try
-        {
-            ContinuumPrepareReleasesModelXpp3Writer writer = new ContinuumPrepareReleasesModelXpp3Writer();
-            FileWriter fileWriter = new FileWriter( file );
-            writer.write( fileWriter, model );
-            fileWriter.flush();
-            fileWriter.close();
-        }
-        catch ( IOException e )
-        {
-            throw new ContinuumReleaseException( "Failed to write prepared releases in file",
e );
-        }
-    }
-
-    // for testing
-    public void setBuildResultDao( BuildResultDao buildResultDao )
-    {
-        this.buildResultDao = buildResultDao;
-    }
-
-    public void setConfigurationService( ConfigurationService configurationService )
-    {
-        this.configurationService = configurationService;
-    }
 }
\ No newline at end of file

Modified: continuum/branches/continuum-1.3.x/continuum-release/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-release/pom.xml?rev=904302&r1=904301&r2=904302&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-release/pom.xml (original)
+++ continuum/branches/continuum-1.3.x/continuum-release/pom.xml Thu Jan 28 23:33:45 2010
@@ -121,7 +121,7 @@
           <models>
             <model>src/main/mdo/prepared-releases.mdo</model>
           </models>
-          <version>1.4.0</version>
+          <version>1.0.0</version>
           <useJava5>true</useJava5>
         </configuration>
         <executions>

Modified: continuum/branches/continuum-1.3.x/continuum-release/src/main/mdo/prepared-releases.mdo
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-release/src/main/mdo/prepared-releases.mdo?rev=904302&r1=904301&r2=904302&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-release/src/main/mdo/prepared-releases.mdo
(original)
+++ continuum/branches/continuum-1.3.x/continuum-release/src/main/mdo/prepared-releases.mdo
Thu Jan 28 23:33:45 2010
@@ -29,11 +29,11 @@
   <classes>
     <class rootElement="true" xml.tagName="prepared-releases">
       <name>PreparedReleaseModel</name>
-      <version>1.0.0+</version>
+      <version>1.0.0</version>
       <fields>
         <field>
           <name>preparedReleases</name>
-          <version>1.0.0+</version>
+          <version>1.0.0</version>
           <description></description>
           <required>true</required>
           <association>
@@ -45,36 +45,29 @@
     </class>
     <class>
       <name>PreparedRelease</name>
-      <version>1.0.0+</version>
+      <version>1.0.0</version>
       <fields>
         <field>
           <name>releaseId</name>
-          <version>1.0.0+</version>
+          <version>1.0.0</version>
           <required>true</required>
           <description>release id</description>
           <type>String</type>
         </field>
         <field>
           <name>releaseName</name>
-          <version>1.0.0+</version>
+          <version>1.0.0</version>
           <required>true</required>
           <description>prepared release name</description>
           <type>String</type>
         </field>
         <field>
           <name>buildAgentUrl</name>
-          <version>1.0.0+</version>
+          <version>1.0.0</version>
           <required>true</required>
           <description>build agent url</description>
           <type>String</type>
         </field>
-        <field>
-          <name>releaseType</name>
-          <version>1.4.0+</version>
-          <required>true</required>
-          <description>type of release. possible values are "prepare" or "perform"</description>
-          <type>String</type>
-        </field>
       </fields>
     </class>
   </classes>

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java?rev=904302&r1=904301&r2=904302&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseInProgressAction.java
Thu Jan 28 23:33:45 2010
@@ -94,7 +94,7 @@
                 List<String> args = new ArrayList<String>();
                 args.add( e.getMessage() );
 
-                addActionError( getText( "distributedBuild.releaseInProgress.error", args
) );
+                addActionError( getText( "releaseInProgress.error", args ) );
                 return ERROR;
             }
 



Mime
View raw message