continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r905508 - in /continuum/trunk: continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/ continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/ continuum-webapp-test/src/test/resources/ continuum-...
Date Tue, 02 Feb 2010 04:03:20 GMT
Author: ctan
Date: Tue Feb  2 04:03:00 2010
New Revision: 905508

URL: http://svn.apache.org/viewvc?rev=905508&view=rev
Log:
[CONTINUUM-2451] update prepared-releases.xml and set releaseId in the ReleasePerform action
when doing the release with provide parameters option. releaseId is not set properly so the
ReleaseInProgress action doesn't know what release to show and where to retrieve the release
information because the prepared-releases.xml was not updated

Modified:
    continuum/trunk/continuum-api/src/main/java/org/apache/continuum/release/distributed/manager/DistributedReleaseManager.java
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
    continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties
    continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.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/AbstractReleaseTest.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java

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=905508&r1=905507&r2=905508&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
Tue Feb  2 04:03:00 2010
@@ -56,8 +56,8 @@
     void releasePerform( int projectId, String releaseId, String goals, String arguments,
boolean useReleaseProfile, LocalRepository repository, String username )
         throws ContinuumReleaseException, BuildAgentConfigurationException;
 
-    void releasePerformFromScm( int projectId, String goals, String arguments, boolean useReleaseProfile,
LocalRepository repository, 
-                                String scmUrl, String scmUsername, String scmPassword, String
scmTag, String scmTagBase, Map environments, String username )
+    String releasePerformFromScm( int projectId, String goals, String arguments, boolean
useReleaseProfile, LocalRepository repository, 
+                                  String scmUrl, String scmUsername, String scmPassword,
String scmTag, String scmTagBase, Map environments, String username )
         throws ContinuumReleaseException, BuildAgentConfigurationException;
 
     void releaseRollback( String releaseId, int projectId )

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=905508&r1=905507&r2=905508&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
Tue Feb  2 04:03:00 2010
@@ -160,7 +160,7 @@
                 client.releasePrepare( createProjectMap( project ), createPropertiesMap(
releaseProperties ),
                                        releaseVersion, developmentVersion, environments,
username );
 
-            addReleasePrepare( releaseId, buildAgentUrl, releaseVersion.get( releaseId )
);
+            addReleasePrepare( releaseId, buildAgentUrl, releaseVersion.get( releaseId ),
"prepare" );
 
             addReleaseInProgress( releaseId, "prepare", project.getId(), username );
 
@@ -357,9 +357,9 @@
         }
     }
 
-    public void releasePerformFromScm( int projectId, String goals, String arguments, boolean
useReleaseProfile,
-                                       LocalRepository repository, String scmUrl, String
scmUsername,
-                                       String scmPassword, String scmTag, String scmTagBase,
Map environments, String username )
+    public String releasePerformFromScm( int projectId, String goals, String arguments, boolean
useReleaseProfile,
+                                         LocalRepository repository, String scmUrl, String
scmUsername,
+                                         String scmPassword, String scmTag, String scmTagBase,
Map environments, String username )
         throws ContinuumReleaseException, BuildAgentConfigurationException
     {
         BuildResult buildResult = buildResultDao.getLatestBuildResultForProject( projectId
);
@@ -398,7 +398,10 @@
                 client.releasePerformFromScm( goals, arguments, useReleaseProfile, map, scmUrl,
scmUsername,
                                               scmPassword, scmTag, scmTagBase, environments,
username );
 
+            addReleasePrepare( releaseId, buildAgentUrl, scmTag, "perform" );
             addReleaseInProgress( releaseId, "perform", projectId, username );
+
+            return releaseId;
         }
         catch ( MalformedURLException e )
         {
@@ -648,14 +651,14 @@
         return null;
     }
 
-    private void addReleasePrepare( String releaseId, String buildAgentUrl, String releaseName
)
+    private void addReleasePrepare( String releaseId, String buildAgentUrl, String releaseName,
String releaseType )
         throws ContinuumReleaseException
     {
         PreparedRelease release = new PreparedRelease();
         release.setReleaseId( releaseId );
         release.setBuildAgentUrl( buildAgentUrl );
         release.setReleaseName( releaseName );
-        release.setReleaseType( "prepare" );
+        release.setReleaseType( releaseType );
 
         List<PreparedRelease> preparedReleases = getPreparedReleases();
 
@@ -790,15 +793,4 @@
             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/trunk/continuum-webapp-test/src/test/resources/testng.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties?rev=905508&r1=905507&r2=905508&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties (original)
+++ continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties Tue Feb  2
04:03:00 2010
@@ -38,6 +38,7 @@
 M2_DELETE_PROJ_TAG=simple-example-1.0
 M2_DELETE_PROJ_RELEASE_VERSION=1.0
 M2_DELETE_PROJ_DEVELOPMENT_VERSION=1.1-SNAPSHOT
+M2_DELETE_PROJ_TAGBASE_PERFORM=https://svn.apache.org/repos/asf/continuum/sandbox/tags
 
 # SCM element is missing from pom
 NOT_SCM_POM_URL=http://svn.apache.org/repos/asf/continuum/trunk/continuum-webapp-test/src/test/resources/unit/maven-two-projects/missing-scm-element-pom.xml

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml?rev=905508&r1=905507&r2=905508&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/config/testng.xml Tue Feb  2 04:03:00
2010
@@ -49,6 +49,8 @@
         <include name="mavenOneProject" />
         <include name="antProject"/>
         <include name="shellProject"/>
+        <include name="agent"/>
+        <include name="release"/>
         <include name="buildDefinition" />
         <include name="notifier"/>
         <include name="myAccount" />
@@ -61,8 +63,6 @@
         <include name="buildEnvironment" />
         <include name="buildDefinitionTemplate" />
         <include name="userroles"/>
-        <include name="agent"/>
-        <include name="release"/>
       </run>
     </groups>
     <packages>

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java?rev=905508&r1=905507&r2=905508&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildAgentsTest.java
Tue Feb  2 04:03:00 2010
@@ -23,7 +23,7 @@
 import org.testng.annotations.Test;
 import org.apache.continuum.web.test.parent.AbstractBuildAgentsTest;
 
-@Test( groups = { "agent" }, dependsOnMethods = { "testDeleteBuildDefinitionTemplate" } )
+@Test( groups = { "agent" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
 public class BuildAgentsTest
     extends AbstractBuildAgentsTest
 {
@@ -60,7 +60,7 @@
         disableDistributedBuilds();
     }
 
-    @Test( dependsOnMethods = { "testAddBuildAgent" } )
+    @Test( dependsOnMethods = { "testAddBuildAgent", "testReleasePerformUsingProvideParamtersWithDistributedBuilds"
} )
     public void testEditBuildAgent()
     {
         String BUILD_AGENT_NAME = getProperty( "BUILD_AGENT_NAME" );

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=905508&r1=905507&r2=905508&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
Tue Feb  2 04:03:00 2010
@@ -19,14 +19,9 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-
 import org.apache.continuum.web.test.parent.AbstractReleaseTest;
 import org.testng.annotations.Test;
-import org.testng.Assert;
 
 @Test( groups = { "release" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
 public class ReleaseTest
@@ -53,22 +48,31 @@
         assertReleaseSuccess();
         releasePrepareProject( M2_PROJ_USERNAME, M2_PROJ_PASSWORD, M2_PROJ_TAGBASE, M2_PROJ_TAG,
                                M2_PROJ_RELEASE_VERSION, M2_PROJ_DEVELOPMENT_VERSION, false
);
+        assertPreparedReleasesFileCreated();
+        disableDistributedBuilds();
+    }
 
-        File file = new File( "target/conf/prepared-releases.xml" );
-        Assert.assertTrue( file.exists(), "prepared-releases.xml was not created" );
-
-        FileInputStream fis = new FileInputStream( file );
-        BufferedReader reader = new BufferedReader( new InputStreamReader( fis ) );
+    @Test( dependsOnMethods = { "testReleasePrepareProjectWithInvalidUsernamePasswordInDistributedBuilds"
} )
+    public void testReleasePerformUsingProvideParamtersWithDistributedBuilds()
+        throws Exception
+    {
+        String M2_PROJ_GRP_NAME = getProperty( "M2_DELETE_PROJ_GRP_NAME" );
+        String M2_PROJ_GRP_ID = getProperty( "M2_DELETE_PROJ_GRP_ID" );
 
-        String BUILD_AGENT_URL = getProperty( "BUILD_AGENT_NAME2" );
-        String strLine;
-        StringBuffer str = new StringBuffer();
-        while( ( strLine = reader.readLine() ) != null )
-        {
-            str.append( strLine );
-        }
+        String M2_PROJ_USERNAME = "invalid";
+        String M2_PROJ_PASSWORD = "invalid";
+        String M2_PROJ_TAGBASE = getProperty( "M2_DELETE_PROJ_TAGBASE_PERFORM" );
+        String M2_PROJ_TAG = getProperty( "M2_DELETE_PROJ_TAG" );
+        String M2_PROJ_SCM_URL = getProperty( "M2_DELETE_PROJ_GRP_SCM_ROOT_URL" );
 
-        Assert.assertTrue( str.toString().contains( "<buildAgentUrl>" + BUILD_AGENT_URL
+ "</buildAgentUrl>" ), "prepared-releases.xml was not populated" );
+        init();
+        enableDistributedBuilds();
+        showProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, "" );
+        clickButtonWithValue( "Release" );
+        assertReleaseSuccess();
+        releasePerformProjectWithProvideParameters( M2_PROJ_USERNAME, M2_PROJ_PASSWORD, M2_PROJ_TAGBASE,
M2_PROJ_TAG, 
+                                                    M2_PROJ_SCM_URL, false );
+        assertPreparedReleasesFileCreated();
         disableDistributedBuilds();
     }
 

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractReleaseTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractReleaseTest.java?rev=905508&r1=905507&r2=905508&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractReleaseTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractReleaseTest.java
Tue Feb  2 04:03:00 2010
@@ -1,5 +1,12 @@
 package org.apache.continuum.web.test.parent;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+
+import org.testng.Assert;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -35,21 +42,22 @@
         setFieldValue( "devVersions", developmentVersion );
         submit();
 
-        while ( !isButtonWithValuePresent( "Done" ) )
-        {
-            Thread.sleep( 10000 );
-        }
-
-        assertButtonWithValuePresent( "Rollback changes" );
+        assertRelease( success );
+    }
 
-        if ( success )
-        {
-            assertImgWithAltNotPresent( "Error" );
-        }
-        else
-        {
-            assertImgWithAlt( "Error" );
-        }
+    public void releasePerformProjectWithProvideParameters( String username, String password,
String tagBase, String tag, String scmUrl, boolean success )
+        throws Exception
+    {
+        goToReleasePerformProvideParametersPage();
+        setFieldValue( "scmUrl", scmUrl );
+        setFieldValue( "scmUsername", username );
+        setFieldValue( "scmPassword", password );
+        setFieldValue( "scmTag", tag );
+        setFieldValue( "scmTagBase", tagBase );
+        setFieldValue( "goals", "clean deploy" );
+        submit();
+    
+        assertRelease( success );
     }
 
     public void goToReleasePreparePage()
@@ -59,6 +67,13 @@
         assertReleasePreparePage();
     }
 
+    public void goToReleasePerformProvideParametersPage()
+    {
+        clickLinkWithLocator( "//input[@name='goal' and @value='perform']", false );
+        submit();
+        assertReleasePerformProvideParametersPage();
+    }
+
     public void assertReleasePreparePage()
     {
         assertPage( "Continuum - Release Project" );
@@ -76,4 +91,60 @@
         assertTextPresent( "Next Development Version" );
         assertButtonWithValuePresent( "Submit" );
     }
+
+    public void assertReleasePerformProvideParametersPage()
+    {
+        assertPage( "Continuum - Perform Project Release" );
+        assertTextPresent( "Perform Project Release" );
+        assertTextPresent( "Release Perform Parameters" );
+        assertTextPresent( "SCM Connection URL" );
+        assertTextPresent( "SCM Username" );
+        assertTextPresent( "SCM Password" );
+        assertTextPresent( "SCM Tag" );
+        assertTextPresent( "SCM Tag Base" );
+        assertTextPresent( "Maven Arguments" );
+        assertTextPresent( "Arguments" );
+        assertTextPresent( "Build Environment" );
+        assertButtonWithValuePresent( "Submit" );
+    }
+
+    public void assertRelease( boolean success )
+        throws Exception
+    {
+        while ( !isButtonWithValuePresent( "Done" ) && !isTextPresent( "Release Error"
) )
+        {
+            Thread.sleep( 10000 );
+        }
+    
+        assertButtonWithValuePresent( "Rollback changes" );
+    
+        if ( success )
+        {
+            assertImgWithAltNotPresent( "Error" );
+        }
+        else
+        {
+            assertImgWithAlt( "Error" );
+        }
+    }
+
+    public void assertPreparedReleasesFileCreated()
+        throws Exception
+    {
+        File file = new File( "target/conf/prepared-releases.xml" );
+        Assert.assertTrue( file.exists(), "prepared-releases.xml was not created" );
+
+        FileInputStream fis = new FileInputStream( file );
+        BufferedReader reader = new BufferedReader( new InputStreamReader( fis ) );
+
+        String BUILD_AGENT_URL = getProperty( "BUILD_AGENT_NAME2" );
+        String strLine;
+        StringBuffer str = new StringBuffer();
+        while( ( strLine = reader.readLine() ) != null )
+        {
+            str.append( strLine );
+        }
+
+        Assert.assertTrue( str.toString().contains( "<buildAgentUrl>" + BUILD_AGENT_URL
+ "</buildAgentUrl>" ), "prepared-releases.xml was not populated" );
+    }
 }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java?rev=905508&r1=905507&r2=905508&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
Tue Feb  2 04:03:00 2010
@@ -299,8 +299,8 @@
 
             try
             {
-                releaseManager.releasePerformFromScm( projectId, goals, arguments, useReleaseProfile,
repository, scmUrl, 
-                                                      scmUsername, scmPassword, scmTag, scmTagBase,
environments, getPrincipal() );
+                releaseId = releaseManager.releasePerformFromScm( projectId, goals, arguments,
useReleaseProfile, repository, scmUrl, 
+                                                                  scmUsername, scmPassword,
scmTag, scmTagBase, environments, getPrincipal() );
             }
             catch ( BuildAgentConfigurationException e )
             {



Mime
View raw message