continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1412074 - 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/webapp/WEB-INF/jsp/
Date Wed, 21 Nov 2012 12:15:39 GMT
Author: brett
Date: Wed Nov 21 12:15:38 2012
New Revision: 1412074

URL: http://svn.apache.org/viewvc?rev=1412074&view=rev
Log:
[CONTINUUM-2692] if Ant build definition validation fails, return to correct screen

executor is only populated on the original input, but buildDefinitionType is always present.
Conservative fix that checks either, though executor could probably be removed. Need to confirm
if there are edge cases where it might differ.

Modified:
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildDefinitionEdit.jsp

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java?rev=1412074&r1=1412073&r2=1412074&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java
Wed Nov 21 12:15:38 2012
@@ -191,7 +191,7 @@ public class BuildDefinitionTest
         clickButtonWithValue( "Add" );
         addEditGroupBuildDefinition( projectGroupName, buildDefinitionPomName, buildDefinitionGoals,
                                      buildDefinitionArguments, buildDefinitionDescription,
true, false, true,
-                                     MAVEN_PROJECT_TYPE );
+                                     MAVEN_PROJECT_TYPE, true );
     }
 
     public void testAddNotDefaultGroupBuildDefinition()
@@ -201,7 +201,7 @@ public class BuildDefinitionTest
         clickButtonWithValue( "Add" );
         addEditGroupBuildDefinition( projectGroupName, buildDefinitionPomName, buildDefinitionGoals,
                                      buildDefinitionArguments, buildDefinitionDescription,
false, false, false,
-                                     MAVEN_PROJECT_TYPE );
+                                     MAVEN_PROJECT_TYPE, true );
     }
 
     @Test( dependsOnMethods = {"testAddNotDefaultGroupBuildDefinition"} )
@@ -215,15 +215,15 @@ public class BuildDefinitionTest
         goToGroupBuildDefinitionPage( projectGroupName, projectGroupId, projectGroupDescription
);
         clickImgWithAlt( "Edit" );
         addEditGroupBuildDefinition( projectGroupName, newPom, newGoals, newArguments, newDescription,
false, false,
-                                     false, MAVEN_PROJECT_TYPE );
+                                     false, MAVEN_PROJECT_TYPE, true );
         clickImgWithAlt( "Edit" );
         addEditGroupBuildDefinition( projectGroupName, buildDefinitionPomName, buildDefinitionGoals,
                                      buildDefinitionArguments, buildDefinitionDescription,
true, true, false,
-                                     MAVEN_PROJECT_TYPE );
+                                     MAVEN_PROJECT_TYPE, true );
         clickImgWithAlt( "Edit" );
         addEditGroupBuildDefinition( projectGroupName, buildDefinitionPomName, buildDefinitionGoals,
                                      buildDefinitionArguments, buildDefinitionDescription,
false, true, false,
-                                     MAVEN_PROJECT_TYPE );
+                                     MAVEN_PROJECT_TYPE, true );
     }
 
     @Test( dependsOnMethods = {"testEditGroupBuildDefinition"} )
@@ -244,7 +244,7 @@ public class BuildDefinitionTest
         goToProjectInformationPage( projectGroupName, projectName );
         clickLinkWithXPath( "//input[contains(@id,'buildDefinition')]" );
         addEditGroupBuildDefinition( null, buildDefinitionPomName, buildDefinitionGoals,
buildDefinitionArguments,
-                                     buildDefinitionDescription, false, false, false, MAVEN_PROJECT_TYPE
);
+                                     buildDefinitionDescription, false, false, false, MAVEN_PROJECT_TYPE,
true );
         String value = getSelenium().getAttribute(
             "xpath=(//a[contains(@href,'removeProjectBuildDefinition')])[last()]/@href" );
         Matcher m = Pattern.compile( "^.*buildDefinitionId=([0-9]+).*$" ).matcher( value
);
@@ -260,7 +260,7 @@ public class BuildDefinitionTest
         addEditGroupBuildDefinition( null, buildDefinitionPomName,
                                      "clean org.apache.maven.plugins:maven-compile-plugin:2.4:compile",
                                      buildDefinitionArguments, buildDefinitionDescription,
false, false, false,
-                                     MAVEN_PROJECT_TYPE );
+                                     MAVEN_PROJECT_TYPE, true );
     }
 
     @Test( dependsOnMethods = {"testAddNotDefaultProjectBuildDefinition"} )
@@ -284,8 +284,8 @@ public class BuildDefinitionTest
     {
         goToProjectInformationPage( projectGroupName, antProjectName );
         clickLinkWithXPath( "//input[contains(@id,'buildDefinition')]" );
-        addEditGroupBuildDefinition( null, "build-other.xml", "package", "", "other build
file", false, false,
-                                     false, ANT_PROJECT_TYPE );
+        addEditGroupBuildDefinition( null, "build-other.xml", "package", "", "other build
file", false, false, false,
+                                     ANT_PROJECT_TYPE, true );
     }
 
     public void testAddNotDefaultProjectBuildDefinitionAntWithPathBuildFile()
@@ -294,18 +294,16 @@ public class BuildDefinitionTest
         goToProjectInformationPage( projectGroupName, antProjectName );
         clickLinkWithXPath( "//input[contains(@id,'buildDefinition')]" );
         addEditGroupBuildDefinition( null, "Quartz/path\\build.xml", "package", "", "build
file with path", false,
-                                     false, false, ANT_PROJECT_TYPE );
+                                     false, false, ANT_PROJECT_TYPE, true );
     }
 
-    // TODO: needs to be fixed
-    @Test(enabled = false)
     public void testAddNotDefaultProjectBuildDefinitionAntWithInvalidBuildFile()
         throws Exception
     {
         goToProjectInformationPage( projectGroupName, antProjectName );
         clickLinkWithXPath( "//input[contains(@id,'buildDefinition')]" );
         addEditGroupBuildDefinition( null, "<script>alert('xss');</script>",
"package", "", "invalid build file",
-                                     false, false, false, ANT_PROJECT_TYPE );
+                                     false, false, false, ANT_PROJECT_TYPE, false );
 
         assertTextPresent( "Build file contains invalid characters" );
 

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=1412074&r1=1412073&r2=1412074&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
Wed Nov 21 12:15:38 2012
@@ -453,7 +453,7 @@ public abstract class AbstractContinuumT
 
     protected void addEditGroupBuildDefinition( String groupName, String buildFile, String
goals, String arguments,
                                                 String description, boolean buildFresh, boolean
alwaysBuild,
-                                                boolean isDefault, String type )
+                                                boolean isDefault, String type, boolean success
)
     {
         assertAddEditBuildDefinitionPage( type );
 
@@ -509,13 +509,20 @@ public abstract class AbstractContinuumT
 
         submit();
 
-        if ( groupName != null )
+        if ( !success )
         {
-            assertGroupBuildDefinitionPage( groupName );
+            assertAddEditBuildDefinitionPage( type );
         }
         else
         {
-            assertProjectInformationPage();
+            if ( groupName != null )
+            {
+                assertGroupBuildDefinitionPage( groupName );
+            }
+            else
+            {
+                assertProjectInformationPage();
+            }
         }
     }
 

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildDefinitionEdit.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildDefinitionEdit.jsp?rev=1412074&r1=1412073&r2=1412074&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildDefinitionEdit.jsp (original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildDefinitionEdit.jsp Wed
Nov 21 12:15:38 2012
@@ -45,20 +45,20 @@
               <c:when test="${empty actionErrors}">
                 <table>
                   <tbody>
-                    <s:if test="executor == 'ant'">
+                    <s:if test="executor == 'ant' or buildDefinitionType == 'ant'">
                       <s:textfield label="%{getText('buildDefinition.buildFile.ant.label')}"
name="buildFile"  required="true"/>
                     </s:if>
-                    <s:elseif test="executor == 'shell'">
+                    <s:elseif test="executor == 'shell' or buildDefinitionType == 'shell'">
                       <s:textfield label="%{getText('buildDefinition.buildFile.shell.label')}"
name="buildFile" required="true"/>
                     </s:elseif>
                     <s:else>
                       <s:textfield label="%{getText('buildDefinition.buildFile.maven.label')}"
name="buildFile" required="true"/>
                     </s:else>
     
-                    <s:if test="executor == 'ant'">
+                    <s:if test="executor == 'ant' or buildDefinitionType == 'ant'">
                       <s:textfield label="%{getText('buildDefinition.goals.ant.label')}"
name="goals"/>
                     </s:if>
-                    <s:elseif test="executor == 'shell'">
+                    <s:elseif test="executor == 'shell' or buildDefinitionType == 'shell'">
                     </s:elseif>
                     <s:else>
                       <s:textfield label="%{getText('buildDefinition.goals.maven.label')}"
name="goals"/>
@@ -79,7 +79,7 @@
                     <s:select label="%{getText('buildDefinition.profile.label')}" name="profileId"
list="profiles" listValue="name"
                                listKey="id" headerKey="-1" headerValue=""/>
                     <s:select label="%{getText('buildDefinition.type.label')}" name="buildDefinitionType"
list="buildDefinitionTypes"/>
-                    <s:if test="executor != 'ant' || executor != 'shell'">
+                    <s:if test="executor != 'ant' && executor != 'shell'">
                         <s:select label="%{getText('buildDefinition.updatePolicy.label')}"
name="updatePolicy" list="buildDefinitionUpdatePolicies"/>
                     </s:if>
                     <s:textfield label="%{getText('buildDefinition.description.label')}"
name="description" />



Mime
View raw message