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 2010/02/25 06:57:14 UTC

svn commit: r916137 - in /continuum/trunk: continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/ continuum-webapp/src/main/java/org/apache/maven/continuum/web/ac...

Author: ctan
Date: Thu Feb 25 05:57:13 2010
New Revision: 916137

URL: http://svn.apache.org/viewvc?rev=916137&view=rev
Log:
[CONTINUUM-2604] show the error message only if there are no project groups to choose from when adding ant/shell project.
merge -r 916131 of 1.3.x branch

Modified:
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AntProjectTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ShellProjectTest.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/AddProjectAction.java
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addProject.jsp

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AntProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AntProjectTest.java?rev=916137&r1=916136&r2=916137&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AntProjectTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/AntProjectTest.java Thu Feb 25 05:57:13 2010
@@ -32,8 +32,7 @@
 public class AntProjectTest
     extends AbstractContinuumTest
 {
-    // TODO: seems like a bug, currently giving "Project Group is required and all projects must be in a project group"
-    @Test( enabled = false/*, dependsOnMethods = { "testAddProjectGroup" }*/ )
+    @Test( dependsOnMethods = { "testAddProjectGroup" } )
     public void testAddAntProject()
         throws Exception
     {
@@ -49,7 +48,7 @@
         String TEST_PROJ_GRP_DESCRIPTION = getProperty( "TEST_PROJ_GRP_DESCRIPTION" );
         goToAddAntProjectPage();
         addProject( ANT_NAME, ANT_DESCRIPTION, ANT_VERSION, ANT_SCM_URL, ANT_SCM_USERNAME, ANT_SCM_PASSWORD, ANT_TAG,
-                    false, TEST_PROJ_GRP_NAME, null, true );
+                    false, TEST_PROJ_GRP_NAME, null, true, "ant" );
         assertProjectGroupSummaryPage( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION );
     }
 
@@ -63,9 +62,8 @@
         assertTextPresent( "SCM Url is required and cannot contain null or spaces only" );
     }
 
-    // TODO: disabled due to the above test also being disabled
-    @Test( enabled = false, dependsOnMethods = { "testAddAntProject" } )
-    public void testAddDupliedAntProject()
+    @Test( dependsOnMethods = { "testAddAntProject" } )
+    public void testAddDuplicateAntProject()
         throws Exception
     {
         String ANT_NAME = getProperty( "ANT_NAME" );
@@ -77,7 +75,7 @@
         String ANT_SCM_PASSWORD = getProperty( "ANT_SCM_PASSWORD" );
         goToAddAntProjectPage();
         addProject( ANT_NAME, ANT_DESCRIPTION, ANT_VERSION, ANT_SCM_URL, ANT_SCM_USERNAME, ANT_SCM_PASSWORD, ANT_TAG,
-                    false, null, null, false );
+                    false, null, null, false, "ant" );
         assertTextPresent( "Project name already exist" );
     }
 }

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ShellProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ShellProjectTest.java?rev=916137&r1=916136&r2=916137&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ShellProjectTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ShellProjectTest.java Thu Feb 25 05:57:13 2010
@@ -32,8 +32,6 @@
 public class ShellProjectTest
     extends AbstractContinuumTest
 {
-    // TODO: seems like a bug, currently giving "Project Group is required and all projects must be in a project group", and returning to the Ant add page?
-    @Test( enabled = false )
     public void testAddShellProject()
         throws Exception
     {
@@ -49,7 +47,7 @@
         String DEFAULT_PROJ_GRP_DESCRIPTION = getProperty( "DEFAULT_PROJ_GRP_DESCRIPTION" );
         goToAddShellProjectPage();
         addProject( SHELL_NAME, SHELL_DESCRIPTION, SHELL_VERSION, SHELL_SCM_URL, SHELL_SCM_USERNAME,
-                    SHELL_SCM_PASSWORD, SHELL_TAG, false, DEFAULT_PROJ_GRP_NAME, null, true );
+                    SHELL_SCM_PASSWORD, SHELL_TAG, false, DEFAULT_PROJ_GRP_NAME, null, true, "shell" );
         assertProjectGroupSummaryPage( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION );
     }
 
@@ -63,9 +61,8 @@
         assertTextPresent( "SCM Url is required and cannot contain null or spaces only" );
     }
 
-    // TODO: disabled due to the above test also being disabled
-    @Test( enabled = false, dependsOnMethods = { "testAddShellProject" } )
-    public void testAddDupliedShellProject()
+    @Test( dependsOnMethods = { "testAddShellProject" } )
+    public void testAddDuplicateShellProject()
         throws Exception
     {
         String SHELL_NAME = getProperty( "SHELL_NAME" );
@@ -77,7 +74,7 @@
         String SHELL_SCM_PASSWORD = getProperty( "SHELL_SCM_PASSWORD" );
         goToAddShellProjectPage();
         addProject( SHELL_NAME, SHELL_DESCRIPTION, SHELL_VERSION, SHELL_SCM_URL, SHELL_SCM_USERNAME,
-                    SHELL_SCM_PASSWORD, SHELL_TAG, false, null, null, false );
+                    SHELL_SCM_PASSWORD, SHELL_TAG, false, null, null, false, "shell" );
         assertTextPresent( "Project name already exist" );
     }
 }

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=916137&r1=916136&r2=916137&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 Thu Feb 25 05:57:13 2010
@@ -766,7 +766,7 @@
 
     public void addProject(String name,String description,String version,String scmUrl,String scmUser,
                            String scmPassword,String scmTag,boolean useCache,String projectGroup,
-                           String buildTemplate,boolean success )
+                           String buildTemplate,boolean success,String type )
         throws Exception
     {
         setFieldValue( "projectName", name );
@@ -790,13 +790,14 @@
         }
         submit();
         String title;
+        type = type.substring( 0, 1 ).toUpperCase() + type.substring( 1 ).toLowerCase();
         if ( success )
         {
             title = "Continuum - Project Group";
         }
         else
         {
-            title = "Continuum - Add ";
+            title = "Continuum - Add " + type + " Project";
         }
         waitAddProject( title );
     }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java?rev=916137&r1=916136&r2=916137&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java Thu Feb 25 05:57:13 2010
@@ -87,6 +87,8 @@
 
     private List<BuildDefinitionTemplate> buildDefinitionTemplates;
 
+    private boolean emptyProjectGroups;
+
     public void validate()
     {
         clearErrorsAndMessages();
@@ -104,7 +106,7 @@
             {
                 addActionError( getText( "addProject.scmUrl.required" ) );
             }
-            if ( selectedProjectGroup == 0 )
+            if ( isEmptyProjectGroups() )
             {
                 addActionError( getText( "addProject.projectGroup.required" ) );
             }
@@ -434,4 +436,14 @@
     {
         this.projectDescription = projectDescription;
     }
+
+    public boolean isEmptyProjectGroups()
+    {
+        return emptyProjectGroups;
+    }
+
+    public void setEmptyProjectGroups( boolean emptyProjectGroups )
+    {
+        this.emptyProjectGroups = emptyProjectGroups;
+    }
 }

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addProject.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addProject.jsp?rev=916137&r1=916136&r2=916137&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addProject.jsp (original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addProject.jsp Thu Feb 25 05:57:13 2010
@@ -86,6 +86,14 @@
                               <s:select label="%{getText('projectGroup.name.label')}" name="selectedProjectGroup" list="projectGroups" listKey="id" listValue="name"/>
                             </c:otherwise>
                             </c:choose>
+                            <c:choose>
+                              <c:when test="${!empty projectGroups}">
+                                <s:hidden name="emptyProjectGroups" value="false"/>
+                              </c:when>
+                              <c:otherwise>
+                                <s:hidden name="emptyProjectGroups" value="true"/>
+                              </c:otherwise>
+                            </c:choose>
                             <s:select label="%{getText('add.project.buildDefinitionTemplate')}" name="buildDefinitionTemplateId"
                                        list="buildDefinitionTemplates" listKey="id" listValue="name" headerKey="-1" 
                                        headerValue="%{getText('add.project.defaultBuildDefinition')}"/>