continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jzurb...@apache.org
Subject svn commit: r809964 - in /continuum/trunk/continuum-webapp/src: main/java/org/apache/maven/continuum/web/action/AddProjectAction.java test/java/org/apache/maven/continuum/web/action/AddProjectActionTest.java
Date Tue, 01 Sep 2009 10:49:09 GMT
Author: jzurbano
Date: Tue Sep  1 10:49:09 2009
New Revision: 809964

URL: http://svn.apache.org/viewvc?rev=809964&view=rev
Log:
[CONTINUUM-2347] - "Project Group is required and all projects must be in a project group"
is displayed when adding Ant/Shell Projects
merge r 809962:809963 from 1.3.x branch


Modified:
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
    continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddProjectActionTest.java

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=809964&r1=809963&r2=809964&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
Tue Sep  1 10:49:09 2009
@@ -66,7 +66,7 @@
 
     private Collection<ProjectGroup> projectGroups;
 
-    private int selectedProjectGroup;
+    private static int selectedProjectGroup;
 
     private String projectGroupName;
 
@@ -144,6 +144,11 @@
             addActionError( authzE.getMessage() );
             return REQUIRES_AUTHORIZATION;
         }
+        
+        if ( this.getSelectedProjectGroup() == 0 )
+        {
+            return INPUT;
+        }
 
         String projectNameTrim = projectName.trim();
         String versionTrim = projectVersion.trim();
@@ -221,6 +226,8 @@
         }
 
         projectGroups = new ArrayList<ProjectGroup>();
+        
+        selectedProjectGroup = 0;
 
         Collection<ProjectGroup> allProjectGroups = getContinuum().getAllProjectGroups();
 

Modified: continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddProjectActionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddProjectActionTest.java?rev=809964&r1=809963&r2=809964&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddProjectActionTest.java
(original)
+++ continuum/trunk/continuum-webapp/src/test/java/org/apache/maven/continuum/web/action/AddProjectActionTest.java
Tue Sep  1 10:49:09 2009
@@ -20,11 +20,13 @@
  */
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import org.apache.maven.continuum.web.action.stub.AddProjectActionStub;
 import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.jmock.Mock;
 import org.jmock.MockObjectTestCase;
 
@@ -45,6 +47,12 @@
         action = new AddProjectActionStub();
         continuumMock = new Mock( Continuum.class );
         action.setContinuum( (Continuum) continuumMock.proxy() );
+        
+        Collection<ProjectGroup> projectGroups = new ArrayList<ProjectGroup>();
+        ProjectGroup projectGroup = new ProjectGroup();
+        projectGroups.add( projectGroup );
+        
+        action.setProjectGroups( projectGroups );
     }
 
     public void testAddProjectNullValues()
@@ -57,6 +65,30 @@
         action.validate();
     }
     
+   /**
+     * Test add of project with no project groups available
+     *
+     * @throws Exception
+     */
+    public void testAddProjectNoProjectGroups()
+        throws Exception
+    {
+        Collection<ProjectGroup> projectGroups = new ArrayList<ProjectGroup>();
+        
+        String scmUrl = "scm:svn:http://project/scm/url/test/build.xml";
+        action.setProjectGroups( projectGroups );
+        
+        List<Project> projects = createProjectList();
+        
+        action.setProjectName( "Ant Test Project" );
+        action.setProjectVersion( "1.0-SNAPSHOT" );
+        action.setProjectScmUrl( scmUrl );
+        action.setProjectType( "ant" );
+        action.setBuildDefintionTemplateId( 1 );
+        
+        assertEquals( action.add(), "input" );
+    }
+    
     /**
      * Test add of Ant project
      *



Mime
View raw message