continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1392390 - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/ continuum-api/src/main/java/org/apache/maven/continuum/release/ continuum-core/src/main/java/org/apache/continuum/release/distribu...
Date Mon, 01 Oct 2012 15:25:25 GMT
Author: brett
Date: Mon Oct  1 15:25:24 2012
New Revision: 1392390

URL: http://svn.apache.org/viewvc?rev=1392390&view=rev
Log:
[CONTINUUM-2686] list of previously prepared releases should not depend on build agent state
[CONTINUUM-2687] preparing subsequent releases appends timestamp to ID, but never lists them
for performing

Improve handling of previously prepared releases, allowing multiple versions to be listed
in the prepare releases dialog if prepared sequentially.

Removed:
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectGoalAction.java
Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java
    continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
    continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/releaseProject.jsp

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java?rev=1392390&r1=1392389&r2=1392390&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java
Mon Oct  1 15:25:24 2012
@@ -52,9 +52,13 @@ public interface DistributedReleaseManag
     void removeListener( String releaseId )
         throws ContinuumReleaseException, BuildAgentConfigurationException;
 
+    @Deprecated
     String getPreparedReleaseName( String releaseId )
         throws ContinuumReleaseException;
 
+    Map<String, String> getPreparedReleases( String groupId, String artifactId )
+        throws ContinuumReleaseException;
+
     void releasePerform( int projectId, String releaseId, String goals, String arguments,
boolean useReleaseProfile,
                          LocalRepository repository, String username )
         throws ContinuumReleaseException, BuildAgentConfigurationException;

Modified: continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java?rev=1392390&r1=1392389&r2=1392390&view=diff
==============================================================================
--- continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
(original)
+++ continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/release/ContinuumReleaseManager.java
Mon Oct  1 15:25:24 2012
@@ -23,6 +23,7 @@ import org.apache.continuum.model.releas
 import org.apache.continuum.model.repository.LocalRepository;
 import org.apache.continuum.taskqueue.manager.TaskQueueManagerException;
 import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.shared.release.config.ReleaseDescriptor;
 import org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor;
 
 import java.io.File;
@@ -135,7 +136,9 @@ public interface ContinuumReleaseManager
     void rollback( String releaseId, String workingDirectory, ContinuumReleaseManagerListener
listener )
         throws ContinuumReleaseException;
 
-    Map getPreparedReleases();
+    Map<String, ReleaseDescriptor> getPreparedReleases();
+
+    Map<String, String> getPreparedReleasesForProject( String groupId, String artifactId
);
 
     Map getReleaseResults();
 
@@ -193,5 +196,4 @@ public interface ContinuumReleaseManager
      */
     TaskQueueExecutor getRollbackReleaseTaskQueueExecutor()
         throws TaskQueueManagerException;
-
 }

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java?rev=1392390&r1=1392389&r2=1392390&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
Mon Oct  1 15:25:24 2012
@@ -31,6 +31,7 @@ import org.apache.continuum.release.mode
 import org.apache.continuum.release.model.PreparedReleaseModel;
 import org.apache.continuum.release.model.io.stax.ContinuumPrepareReleasesModelStaxReader;
 import org.apache.continuum.release.model.io.stax.ContinuumPrepareReleasesModelStaxWriter;
+import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.project.BuildResult;
@@ -51,6 +52,7 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -187,7 +189,8 @@ public class DefaultDistributedReleaseMa
                 String releaseId = client.releasePrepare( createProjectMap( project ), releaseProperties,
                                                           releaseVersion, developmentVersion,
environments, username );
 
-                addReleasePrepare( releaseId, buildAgentUrl, releaseVersion.get( releaseId
), "prepare",
+                String key = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId()
);
+                addReleasePrepare( releaseId, buildAgentUrl, releaseVersion.get( key ), "prepare",
                                    releaseProperties.getProperty( "preparation-goals" ),
username );
 
                 addReleaseInProgress( releaseId, "prepare", project.getId(), username );
@@ -374,6 +377,24 @@ public class DefaultDistributedReleaseMa
         }
     }
 
+    public Map<String, String> getPreparedReleases( String groupId, String artifactId
)
+        throws ContinuumReleaseException
+    {
+        String releaseId = ArtifactUtils.versionlessKey( groupId, artifactId );
+
+        Map<String, String> projectPreparedReleases = new LinkedHashMap<String,
String>();
+        for ( PreparedRelease release : getPreparedReleases() )
+        {
+            // get exact match, or one with a timestamp appended
+            String id = release.getReleaseId();
+            if ( id.equals( releaseId ) || id.startsWith( releaseId + ":" ) )
+            {
+                projectPreparedReleases.put( id, release.getReleaseName() );
+            }
+        }
+        return projectPreparedReleases;
+    }
+
     public void releasePerform( int projectId, String releaseId, String goals, String arguments,
                                 boolean useReleaseProfile, LocalRepository repository, String
username )
         throws ContinuumReleaseException, BuildAgentConfigurationException
@@ -744,7 +765,7 @@ public class DefaultDistributedReleaseMa
             }
         }
 
-        return null;
+        return new ArrayList<PreparedRelease>();
     }
 
     private void addReleasePrepare( String releaseId, String buildAgentUrl, String releaseName,
String releaseType,

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java?rev=1392390&r1=1392389&r2=1392390&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
(original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
Mon Oct  1 15:25:24 2012
@@ -24,6 +24,7 @@ import org.apache.continuum.model.releas
 import org.apache.continuum.model.repository.LocalRepository;
 import org.apache.continuum.release.config.ContinuumReleaseDescriptor;
 import org.apache.continuum.taskqueue.manager.TaskQueueManagerException;
+import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.release.tasks.PerformReleaseProjectTask;
 import org.apache.maven.continuum.release.tasks.PrepareReleaseProjectTask;
@@ -48,7 +49,9 @@ import org.codehaus.plexus.taskqueue.exe
 import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
+import java.util.Collections;
 import java.util.Hashtable;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Properties;
 
@@ -101,7 +104,7 @@ public class DefaultContinuumReleaseMana
      *
      * @todo remove static when singleton strategy is working
      */
-    private static Map preparedReleases;
+    private static Map<String, ReleaseDescriptor> preparedReleases;
 
     /**
      * contains results
@@ -124,7 +127,6 @@ public class DefaultContinuumReleaseMana
         throws ContinuumReleaseException
     {
         String releaseId = project.getGroupId() + ":" + project.getArtifactId();
-        String id = releaseId;
 
         ReleaseDescriptor descriptor = getReleaseDescriptor( project, releaseProperties,
relVersions, devVersions,
                                                              environments, workingDirectory,
executable );
@@ -138,7 +140,7 @@ public class DefaultContinuumReleaseMana
         // check if releaseId exists
         while ( getListeners().get( releaseId ) != null )
         {
-            releaseId = id + ":" + String.valueOf( System.currentTimeMillis() );
+            releaseId = releaseId + ":" + String.valueOf( System.currentTimeMillis() );
         }
 
         getListeners().put( releaseId, listener );
@@ -168,7 +170,7 @@ public class DefaultContinuumReleaseMana
                          LocalRepository repository )
         throws ContinuumReleaseException
     {
-        ReleaseDescriptor descriptor = (ReleaseDescriptor) getPreparedReleases().get( releaseId
);
+        ReleaseDescriptor descriptor = getPreparedReleases().get( releaseId );
         if ( descriptor != null )
         {
             perform( releaseId, descriptor, buildDirectory, goals, arguments, useReleaseProfile,
listener, repository );
@@ -248,16 +250,35 @@ public class DefaultContinuumReleaseMana
         }
     }
 
-    public Map getPreparedReleases()
+    public Map<String, ReleaseDescriptor> getPreparedReleases()
     {
         if ( preparedReleases == null )
         {
-            preparedReleases = new Hashtable();
+            preparedReleases = Collections.synchronizedMap( new LinkedHashMap<String,
ReleaseDescriptor>() );
         }
 
         return preparedReleases;
     }
 
+    public Map<String, String> getPreparedReleasesForProject( String groupId, String
artifactId )
+    {
+        String releaseId = ArtifactUtils.versionlessKey( groupId, artifactId );
+
+        Map<String, String> projectPreparedReleases = new LinkedHashMap<String,
String>();
+        Map<String, ReleaseDescriptor> preparedReleases = getPreparedReleases();
+        for ( String key : preparedReleases.keySet() )
+        {
+            // get exact match, or one with a timestamp appended
+            if ( key.equals( releaseId ) || key.startsWith( releaseId + ":" ) )
+            {
+                ReleaseDescriptor descriptor = preparedReleases.get( key );
+
+                projectPreparedReleases.put( key, descriptor.getReleaseVersions().get( releaseId
).toString() );
+            }
+        }
+        return projectPreparedReleases;
+    }
+
     public Map getReleaseResults()
     {
         if ( releaseResults == null )

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java?rev=1392390&r1=1392389&r2=1392390&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ReleaseTest.java
Mon Oct  1 15:25:24 2012
@@ -34,10 +34,15 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.Arrays;
 
-@Test( groups = { "release" } )
+@Test( groups = {"release"} )
 public class ReleaseTest
     extends AbstractBuildAgentsTest
 {
+
+    private static final String RELEASE_BUTTON_TEXT = "Release";
+
+    private static final String PROVIDE_RELEASE_PARAMETERS_TEXT = "Provide Release Parameters";
+
     private String projectGroupName;
 
     private String projectGroupId;
@@ -123,9 +128,70 @@ public class ReleaseTest
 
         removeBuildAgentGroup( releaseBuildAgentGroup );
 
+        // enable agent if disabled
+        goToBuildAgentPage();
+        clickImgWithAlt( "Edit" );
+        enableDisableBuildAgent( buildAgentUrl, true );
+
         disableDistributedBuilds();
     }
 
+    public void testReleasePrepareWithoutInterveningPerform()
+        throws IOException
+    {
+        // CONTINUUM-2687
+        showProjectGroup( projectGroupName, projectGroupId, "" );
+        clickButtonWithValue( RELEASE_BUTTON_TEXT );
+        assertReleaseChoicePage();
+
+        // first attempt
+        releasePrepareProject( "", "", tagBase, tag, releaseVersion, developmentVersion,
releaseBuildEnvironment,
+                               true );
+        clickButtonWithValue( "Done" );
+
+        // second attempt
+        releasePrepareProject( "", "", tagBase, tag, "1.1", "1.2-SNAPSHOT", releaseBuildEnvironment,
true );
+        clickButtonWithValue( "Done" );
+
+        // check prepared releases content (timestamp version)
+        String str = getPreparedReleasesContent();
+        Assert.assertTrue( str.contains( "<releaseId>org.apache.continuum.examples.simple:simple-example:"
) );
+
+        // check that two versions are present
+        Assert.assertEquals( Arrays.asList( getSelenium().getSelectOptions( "preparedReleaseId"
) ), Arrays.asList(
+            "1.0", "1.1", PROVIDE_RELEASE_PARAMETERS_TEXT ) );
+    }
+
+    public void testReleasePrepareWhenAgentGoesDown()
+        throws IOException
+    {
+        // CONTINUUM-2686
+        showProjectGroup( projectGroupName, projectGroupId, "" );
+        clickButtonWithValue( RELEASE_BUTTON_TEXT );
+        assertReleaseChoicePage();
+
+        releasePrepareProject( "", "", tagBase, tag, releaseVersion, developmentVersion,
releaseBuildEnvironment,
+                               true );
+
+        // disable agent
+        goToBuildAgentPage();
+        clickImgWithAlt( "Edit" );
+        enableDisableBuildAgent( buildAgentUrl, false );
+
+        // check prepared releases content
+        String str = getPreparedReleasesContent();
+        Assert.assertTrue( str.contains( "<releaseId>org.apache.continuum.examples.simple:simple-example"
) );
+
+        // go back to release page
+        showProjectGroup( projectGroupName, projectGroupId, "" );
+        clickButtonWithValue( RELEASE_BUTTON_TEXT );
+        assertReleaseChoicePage();
+
+        // check that the version is present
+        Assert.assertEquals( Arrays.asList( getSelenium().getSelectOptions( "preparedReleaseId"
) ), Arrays.asList(
+            "1.0", PROVIDE_RELEASE_PARAMETERS_TEXT ) );
+    }
+
     public void testReleasePrepareProjectWithInvalidUsernamePasswordInDistributedBuilds()
         throws Exception
     {
@@ -133,11 +199,11 @@ public class ReleaseTest
         String releasePassword = "invalid";
 
         showProjectGroup( projectGroupName, projectGroupId, "" );
-        clickButtonWithValue( "Release" );
-        assertReleaseSuccess();
+        clickButtonWithValue( RELEASE_BUTTON_TEXT );
+        assertReleaseChoicePage();
         releasePrepareProject( releaseUsername, releasePassword, tagBase, tag, releaseVersion,
developmentVersion,
                                releaseBuildEnvironment, true );
-        assertPreparedReleasesFileCreated();
+        assertPreparedReleasesFileContainsBuildAgent();
     }
 
     /*
@@ -150,8 +216,8 @@ public class ReleaseTest
 
         showProjectGroup( projectGroupName, projectGroupId, projectGroupId );
 
-        clickButtonWithValue( "Release" );
-        assertReleaseSuccess();
+        clickButtonWithValue( RELEASE_BUTTON_TEXT );
+        assertReleaseChoicePage();
         releasePrepareProject( "", "", tagBase, tag, releaseVersion, developmentVersion,
releaseBuildEnvironment,
                                false );
 
@@ -168,8 +234,8 @@ public class ReleaseTest
 
         showProjectGroup( projectGroupName, projectGroupId, projectGroupId );
 
-        clickButtonWithValue( "Release" );
-        assertReleaseSuccess();
+        clickButtonWithValue( RELEASE_BUTTON_TEXT );
+        assertReleaseChoicePage();
         releasePrepareProject( "", "", tagBase, tag, releaseVersion, developmentVersion,
releaseBuildEnvironment,
                                false );
 
@@ -184,14 +250,14 @@ public class ReleaseTest
     {
         showProjectGroup( projectGroupName, projectGroupId, projectGroupId );
 
-        clickButtonWithValue( "Release" );
-        assertReleaseSuccess();
+        clickButtonWithValue( RELEASE_BUTTON_TEXT );
+        assertReleaseChoicePage();
         releasePrepareProject( "", "", tagBase, tag, releaseVersion, developmentVersion,
"", true );
 
-        assertPreparedReleasesFileCreated();
+        assertPreparedReleasesFileContainsBuildAgent();
     }
 
-    @Test( dependsOnMethods = { "testReleasePrepareProjectWithNoBuildEnvironment" } )
+    @Test( dependsOnMethods = {"testReleasePrepareProjectWithNoBuildEnvironment"} )
     public void testReleasePerformUsingProvidedParametersWithDistributedBuilds()
         throws Exception
     {
@@ -199,11 +265,11 @@ public class ReleaseTest
         String releasePassword = "invalid";
 
         showProjectGroup( projectGroupName, projectGroupId, "" );
-        clickButtonWithValue( "Release" );
-        assertReleaseSuccess();
+        clickButtonWithValue( RELEASE_BUTTON_TEXT );
+        assertReleaseChoicePage();
         releasePerformProjectWithProvideParameters( releaseUsername, releasePassword, tagBase,
tag,
                                                     releaseProjectScmUrl, releaseBuildEnvironment
);
-        assertPreparedReleasesFileCreated();
+        assertPreparedReleasesFileContainsBuildAgent();
     }
 
     private void createBuildEnvAndBuildagentGroup( String projectBuildEnv, String projectAgentGroup
)
@@ -393,9 +459,18 @@ public class ReleaseTest
         }
     }
 
-    private void assertPreparedReleasesFileCreated()
+    private void assertPreparedReleasesFileContainsBuildAgent()
         throws Exception
     {
+        String str = getPreparedReleasesContent();
+
+        Assert.assertTrue( str.contains( "<buildAgentUrl>" + buildAgentUrl + "</buildAgentUrl>"
),
+                           "prepared-releases.xml was not populated" );
+    }
+
+    private String getPreparedReleasesContent()
+        throws IOException
+    {
         File file = new File( "target/conf/prepared-releases.xml" );
         Assert.assertTrue( file.exists(), "prepared-releases.xml was not created" );
 
@@ -413,9 +488,7 @@ public class ReleaseTest
             {
                 str.append( strLine );
             }
-
-            Assert.assertTrue( str.toString().contains( "<buildAgentUrl>" + buildAgentUrl
+ "</buildAgentUrl>" ),
-                               "prepared-releases.xml was not populated" );
+            return str.toString();
         }
         finally
         {

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java?rev=1392390&r1=1392389&r2=1392390&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
Mon Oct  1 15:25:24 2012
@@ -379,7 +379,7 @@ public abstract class AbstractContinuumT
         clickLinkWithText( "Project Group Summary" );
     }
 
-    protected void assertReleaseSuccess()
+    protected void assertReleaseChoicePage()
     {
         assertTextPresent( "Choose Release Goal for " );
         assertTextPresent( "Prepare project for release " );
@@ -623,12 +623,12 @@ public abstract class AbstractContinuumT
         assertElementPresent( "m1PomFile" );
         assertTextPresent( "Project Group" );
         assertElementPresent( "selectedProjectGroup" );
-        assertOptionPresent( "selectedProjectGroup", new String[]{ "Defined by POM", "Default
Project Group" } );
+        assertOptionPresent( "selectedProjectGroup", new String[]{"Defined by POM", "Default
Project Group"} );
         assertTextPresent( "Build Definition Template" );
         assertElementPresent( "buildDefinitionTemplateId" );
         assertOptionPresent( "buildDefinitionTemplateId",
-                             new String[]{ "Default", "Default Ant Template", "Default Maven
1 Template",
-                                 "Default Maven Template", "Default Shell Template" } );
+                             new String[]{"Default", "Default Ant Template", "Default Maven
1 Template",
+                                 "Default Maven Template", "Default Shell Template"} );
         assertButtonWithValuePresent( "Add" );
         assertButtonWithValuePresent( "Cancel" );
     }
@@ -697,12 +697,12 @@ public abstract class AbstractContinuumT
         assertElementPresent( "projectScmUseCache" );
         assertTextPresent( "Project Group" );
         assertElementPresent( "selectedProjectGroup" );
-        assertOptionPresent( "selectedProjectGroup", new String[]{ "Default Project Group"
} );
+        assertOptionPresent( "selectedProjectGroup", new String[]{"Default Project Group"}
);
         assertTextPresent( "Build Definition Template" );
         assertElementPresent( "buildDefinitionTemplateId" );
         assertOptionPresent( "buildDefinitionTemplateId",
-                             new String[]{ "Default", "Default Ant Template", "Default Maven
1 Template",
-                                 "Default Maven Template", "Default Shell Template" } );
+                             new String[]{"Default", "Default Ant Template", "Default Maven
1 Template",
+                                 "Default Maven Template", "Default Shell Template"} );
         assertButtonWithValuePresent( "Add" );
         assertButtonWithValuePresent( "Cancel" );
     }
@@ -965,7 +965,7 @@ public abstract class AbstractContinuumT
     }
 
     @BeforeSuite( alwaysRun = true )
-    @Parameters( { "baseUrl", "browser", "seleniumHost", "seleniumPort" } )
+    @Parameters( {"baseUrl", "browser", "seleniumHost", "seleniumPort"} )
     public void initializeContinuum( @Optional( "http://localhost:9595/continuum" ) String
baseUrl,
                                      @Optional( "*firefox" ) String browser,
                                      @Optional( "localhost" ) String seleniumHost,
@@ -1268,7 +1268,7 @@ public abstract class AbstractContinuumT
             assertElementNotPresent( "xpath=" + xPath );
         }
     }
-    
+
     public static boolean isWindows()
     {
         String os = System.getProperty( "os.name" ).toLowerCase();

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java?rev=1392390&r1=1392389&r2=1392390&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseProjectAction.java
Mon Oct  1 15:25:24 2012
@@ -20,14 +20,13 @@ package org.apache.maven.continuum.web.a
  */
 
 import org.apache.continuum.release.distributed.manager.DistributedReleaseManager;
-import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.release.ContinuumReleaseManager;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
-import org.apache.maven.shared.release.config.ReleaseDescriptor;
 import org.codehaus.plexus.util.StringUtils;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -43,7 +42,7 @@ public class ReleaseProjectAction
 
     private String projectName;
 
-    private String preparedReleaseName;
+    private Map<String, String> preparedReleases;
 
     private String preparedReleaseId;
 
@@ -79,36 +78,27 @@ public class ReleaseProjectAction
 
         project = getContinuum().getProjectWithAllDetails( projectId );
 
-        String releaseId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId()
);
-
         if ( getContinuum().getConfiguration().isDistributedBuildEnabled() )
         {
             DistributedReleaseManager releaseManager = getContinuum().getDistributedReleaseManager();
 
-            preparedReleaseName = releaseManager.getPreparedReleaseName( releaseId );
+            preparedReleases = releaseManager.getPreparedReleases( project.getGroupId(),
project.getArtifactId() );
 
-            if ( StringUtils.isNotBlank( preparedReleaseName ) )
+            if ( !preparedReleases.isEmpty() )
             {
-                preparedReleaseId = releaseId;
-            }
-            else
-            {
-                preparedReleaseName = null;
+                // use last release as default choice
+                preparedReleaseId = new ArrayList<String>( preparedReleases.keySet()
).get(
+                    preparedReleases.size() - 1 );
             }
         }
         else
         {
             ContinuumReleaseManager releaseManager = getContinuum().getReleaseManager();
 
-            Map preparedReleases = releaseManager.getPreparedReleases();
-            if ( preparedReleases.containsKey( releaseId ) )
-            {
-                ReleaseDescriptor descriptor = (ReleaseDescriptor) preparedReleases.get(
releaseId );
-
-                preparedReleaseName = descriptor.getReleaseVersions().get( releaseId ).toString();
+            this.preparedReleases = releaseManager.getPreparedReleasesForProject( project.getGroupId(),
+                                                                                  project.getArtifactId()
);
 
-                preparedReleaseId = releaseId;
-            }
+            preparedReleaseId = new ArrayList<String>( preparedReleases.keySet() ).get(
preparedReleases.size() - 1 );
         }
 
         projectName = project.getName();
@@ -159,16 +149,6 @@ public class ReleaseProjectAction
         this.projectId = projectId;
     }
 
-    public String getPreparedReleaseName()
-    {
-        return preparedReleaseName;
-    }
-
-    public void setPreparedReleaseName( String preparedReleaseName )
-    {
-        this.preparedReleaseName = preparedReleaseName;
-    }
-
     public String getGoal()
     {
         return goal;
@@ -239,4 +219,14 @@ public class ReleaseProjectAction
 
         return projectGroupName;
     }
+
+    public Map<String, String> getPreparedReleases()
+    {
+        return preparedReleases;
+    }
+
+    public void setPreparedReleases( Map<String, String> preparedReleases )
+    {
+        this.preparedReleases = preparedReleases;
+    }
 }

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/releaseProject.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/releaseProject.jsp?rev=1392390&r1=1392389&r2=1392390&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/releaseProject.jsp (original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/releaseProject.jsp Mon Oct
 1 15:25:24 2012
@@ -18,6 +18,7 @@
   --%>
 
 <%@ taglib uri="/struts-tags" prefix="s" %>
+<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
 <html>
   <s:i18n name="localization.Continuum">
     <head>
@@ -37,11 +38,11 @@
           <br/>
           &nbsp;&nbsp;&nbsp;
           <select name="preparedReleaseId">
-            <s:if test="preparedReleaseName != null">
-              <option selected value="<s:property value="preparedReleaseId"/>">
-                <s:property value="preparedReleaseName"/>
+            <c:forEach var="preparedRelease" items="${preparedReleases}">
+              <option selected value="<c:out value="${preparedRelease.key}"/>">
+                <c:out value="${preparedRelease.value}"/>
               </option>
-            </s:if>
+            </c:forEach>
             <option value=""><s:text name="releaseProject.provideReleaseParameters"/></option>
           </select>
           <br/>



Mime
View raw message