continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1412064 - in /continuum/trunk/continuum-webapp-test/src/test: resources/ testng/org/apache/continuum/web/test/ testng/org/apache/continuum/web/test/parent/
Date Wed, 21 Nov 2012 11:36:25 GMT
Author: brett
Date: Wed Nov 21 11:36:24 2012
New Revision: 1412064

URL: http://svn.apache.org/viewvc?rev=1412064&view=rev
Log:
Ant build definition tests

Modified:
    continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties
    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/DistributedBuildTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java

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=1412064&r1=1412063&r2=1412064&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties (original)
+++ continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties Wed Nov 21
11:36:24 2012
@@ -66,7 +66,7 @@ MAVEN2_QUEUE_TEST_POM_PROJECT_GROUP_DESC
 
 # Ant projects to load
 
-ANT_NAME=Ant Project
+ANT_NAME=Sample Ant Project
 ANT_DESCRIPTION=This is a sample Ant Project used for testing
 ANT_VERSION=1.0.0-SNAPSHOT
 ANT_TAG=

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=1412064&r1=1412063&r2=1412064&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 11:36:24 2012
@@ -32,11 +32,10 @@ import java.util.regex.Pattern;
  * @author José Morales Martínez
  * @version $Id$
  */
-@Test( groups = { "buildDefinition" } )
+@Test( groups = {"buildDefinition"} )
 public class BuildDefinitionTest
     extends AbstractAdminTest
 {
-
     private String defaultProjectGroupName;
 
     private String defaultProjectGroupId;
@@ -59,6 +58,20 @@ public class BuildDefinitionTest
 
     private String projectName;
 
+    private String antProjectName;
+
+    private String antProjectDescription;
+
+    private String antProjectVersion;
+
+    private String antProjectTag;
+
+    private String antScmUrl;
+
+    private String antScmUsername;
+
+    private String antScmPassword;
+
     private String buildDefinitionId;
 
     @BeforeClass
@@ -73,6 +86,14 @@ public class BuildDefinitionTest
         String pomUsername = getProperty( "MAVEN2_POM_USERNAME" );
         String pomPassword = getProperty( "MAVEN2_POM_PASSWORD" );
 
+        antProjectName = getProperty( "ANT_NAME" );
+        antProjectDescription = getProperty( "ANT_DESCRIPTION" );
+        antProjectVersion = getProperty( "ANT_VERSION" );
+        antProjectTag = getProperty( "ANT_TAG" );
+        antScmUrl = getProperty( "ANT_SCM_URL" );
+        antScmUsername = getProperty( "ANT_SCM_USERNAME" );
+        antScmPassword = getProperty( "ANT_SCM_PASSWORD" );
+
         loginAsAdmin();
         addProjectGroup( projectGroupName, projectGroupId, projectGroupDescription, true,
false );
         clickLinkWithText( projectGroupName );
@@ -80,6 +101,12 @@ public class BuildDefinitionTest
         {
             addMavenTwoProject( projectPomUrl, pomUsername, pomPassword, projectGroupName,
true );
         }
+        if ( !isLinkPresent( antProjectName ) )
+        {
+            goToAddAntProjectPage();
+            addProject( antProjectName, antProjectDescription, antProjectVersion, antScmUrl,
antScmUsername,
+                        antScmPassword, antProjectTag, projectGroupName, true, "ant" );
+        }
     }
 
     @BeforeMethod
@@ -163,7 +190,8 @@ public class BuildDefinitionTest
         goToGroupBuildDefinitionPage( projectGroupName, projectGroupId, projectGroupDescription
);
         clickButtonWithValue( "Add" );
         addEditGroupBuildDefinition( projectGroupName, buildDefinitionPomName, buildDefinitionGoals,
-                                     buildDefinitionArguments, buildDefinitionDescription,
true, false, true );
+                                     buildDefinitionArguments, buildDefinitionDescription,
true, false, true,
+                                     MAVEN_PROJECT_TYPE );
     }
 
     public void testAddNotDefaultGroupBuildDefinition()
@@ -172,10 +200,11 @@ public class BuildDefinitionTest
         goToGroupBuildDefinitionPage( projectGroupName, projectGroupId, projectGroupDescription
);
         clickButtonWithValue( "Add" );
         addEditGroupBuildDefinition( projectGroupName, buildDefinitionPomName, buildDefinitionGoals,
-                                     buildDefinitionArguments, buildDefinitionDescription,
false, false, false );
+                                     buildDefinitionArguments, buildDefinitionDescription,
false, false, false,
+                                     MAVEN_PROJECT_TYPE );
     }
 
-    @Test( dependsOnMethods = { "testAddNotDefaultGroupBuildDefinition" } )
+    @Test( dependsOnMethods = {"testAddNotDefaultGroupBuildDefinition"} )
     public void testEditGroupBuildDefinition()
         throws Exception
     {
@@ -186,16 +215,18 @@ public class BuildDefinitionTest
         goToGroupBuildDefinitionPage( projectGroupName, projectGroupId, projectGroupDescription
);
         clickImgWithAlt( "Edit" );
         addEditGroupBuildDefinition( projectGroupName, newPom, newGoals, newArguments, newDescription,
false, false,
-                                     false );
+                                     false, MAVEN_PROJECT_TYPE );
         clickImgWithAlt( "Edit" );
         addEditGroupBuildDefinition( projectGroupName, buildDefinitionPomName, buildDefinitionGoals,
-                                     buildDefinitionArguments, buildDefinitionDescription,
true, true, false );
+                                     buildDefinitionArguments, buildDefinitionDescription,
true, true, false,
+                                     MAVEN_PROJECT_TYPE );
         clickImgWithAlt( "Edit" );
         addEditGroupBuildDefinition( projectGroupName, buildDefinitionPomName, buildDefinitionGoals,
-                                     buildDefinitionArguments, buildDefinitionDescription,
false, true, false );
+                                     buildDefinitionArguments, buildDefinitionDescription,
false, true, false,
+                                     MAVEN_PROJECT_TYPE );
     }
 
-    @Test( dependsOnMethods = { "testEditGroupBuildDefinition" } )
+    @Test( dependsOnMethods = {"testEditGroupBuildDefinition"} )
     public void testDeleteGroupBuildDefinition()
         throws Exception
     {
@@ -213,7 +244,7 @@ public class BuildDefinitionTest
         goToProjectInformationPage( projectGroupName, projectName );
         clickLinkWithXPath( "//input[contains(@id,'buildDefinition')]" );
         addEditGroupBuildDefinition( null, buildDefinitionPomName, buildDefinitionGoals,
buildDefinitionArguments,
-                                     buildDefinitionDescription, false, false, false );
+                                     buildDefinitionDescription, false, false, false, MAVEN_PROJECT_TYPE
);
         String value = getSelenium().getAttribute(
             "xpath=(//a[contains(@href,'removeProjectBuildDefinition')])[last()]/@href" );
         Matcher m = Pattern.compile( "^.*buildDefinitionId=([0-9]+).*$" ).matcher( value
);
@@ -228,10 +259,11 @@ public class BuildDefinitionTest
         clickLinkWithXPath( "//input[contains(@id,'buildDefinition')]" );
         addEditGroupBuildDefinition( null, buildDefinitionPomName,
                                      "clean org.apache.maven.plugins:maven-compile-plugin:2.4:compile",
-                                     buildDefinitionArguments, buildDefinitionDescription,
false, false, false );
+                                     buildDefinitionArguments, buildDefinitionDescription,
false, false, false,
+                                     MAVEN_PROJECT_TYPE );
     }
 
-    @Test( dependsOnMethods = { "testAddNotDefaultProjectBuildDefinition" } )
+    @Test( dependsOnMethods = {"testAddNotDefaultProjectBuildDefinition"} )
     public void testDeleteProjectBuildDefinition()
         throws Exception
     {
@@ -246,4 +278,41 @@ public class BuildDefinitionTest
 
         assertElementNotPresent( locator );
     }
+
+    public void testAddNotDefaultProjectBuildDefinitionAnt()
+        throws Exception
+    {
+        goToProjectInformationPage( projectGroupName, antProjectName );
+        clickLinkWithXPath( "//input[contains(@id,'buildDefinition')]" );
+        addEditGroupBuildDefinition( null, "build-other.xml", "package", "", "other build
file", false, false,
+                                     false, ANT_PROJECT_TYPE );
+    }
+
+    // TODO: needs to be fixed
+    @Test(enabled = false)
+    public void testAddNotDefaultProjectBuildDefinitionAntWithPathBuildFile()
+        throws Exception
+    {
+        goToProjectInformationPage( projectGroupName, antProjectName );
+        clickLinkWithXPath( "//input[contains(@id,'buildDefinition')]" );
+        addEditGroupBuildDefinition( null, "Quartz/build.xml", "package", "", "build file
with path", false, false,
+                                     false, ANT_PROJECT_TYPE );
+    }
+
+    // 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 );
+
+        assertTextPresent( "Build file contains invalid characters" );
+
+        // confirm error page contains the right fields still
+        assertTextPresent( "Ant build filename*:" );
+        assertTextPresent( "Targets:" );
+    }
 }

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/DistributedBuildTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/DistributedBuildTest.java?rev=1412064&r1=1412063&r2=1412064&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/DistributedBuildTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/DistributedBuildTest.java
Wed Nov 21 11:36:24 2012
@@ -195,7 +195,7 @@ public class DistributedBuildTest
 
         goToGroupBuildDefinitionPage( projectGroupName, projectGroupId, projectGroupDescription
);
         clickImgWithAlt( "Edit" );
-        assertAddEditBuildDefinitionPage();
+        assertAddEditBuildDefinitionPage( "maven2" );
         selectValue( "profileId", buildEnvName );
         submit();
         assertGroupBuildDefinitionPage( projectGroupName );

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=1412064&r1=1412063&r2=1412064&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 11:36:24 2012
@@ -38,6 +38,10 @@ public abstract class AbstractContinuumT
 
     protected static final String SHARED_SECRET = "continuum1234";
 
+    protected static final String ANT_PROJECT_TYPE = "ant";
+
+    protected static final String MAVEN_PROJECT_TYPE = "maven";
+
     // ////////////////////////////////////
     // Create Admin User
     // ////////////////////////////////////
@@ -410,12 +414,24 @@ public abstract class AbstractContinuumT
         isButtonWithValuePresent( "Delete" );
     }
 
-    protected void assertAddEditBuildDefinitionPage()
+    protected void assertAddEditBuildDefinitionPage( String type )
     {
         assertTextPresent( "Add/Edit Build Definition" );
-        assertTextPresent( "POM filename*:" );
+        if ( MAVEN_PROJECT_TYPE.equals( type ) )
+        {
+            assertTextPresent( "POM filename*:" );
+            assertTextPresent( "Goals:" );
+        }
+        else if ( ANT_PROJECT_TYPE.equals( type ) )
+        {
+            assertTextPresent( "Ant build filename*:" );
+            assertTextPresent( "Targets:" );
+        }
+        else
+        {
+            throw new UnsupportedOperationException( "check not implemented for type: " +
type );
+        }
         assertElementPresent( "buildFile" );
-        assertTextPresent( "Goals:" );
         assertElementPresent( "goals" );
         assertTextPresent( "Arguments:" );
         assertElementPresent( "arguments" );
@@ -437,9 +453,10 @@ public abstract class AbstractContinuumT
 
     protected void addEditGroupBuildDefinition( String groupName, String buildFile, String
goals, String arguments,
                                                 String description, boolean buildFresh, boolean
alwaysBuild,
-                                                boolean isDefault )
+                                                boolean isDefault, String type )
     {
-        assertAddEditBuildDefinitionPage();
+        assertAddEditBuildDefinitionPage( type );
+
         // Enter values into Add Build Definition fields, and submit
         setFieldValue( "buildFile", buildFile );
         setFieldValue( "goals", goals );
@@ -733,6 +750,8 @@ public abstract class AbstractContinuumT
             title = "Continuum - Add " + type + " Project";
         }
         waitAddProject( title );
+
+        assertLinkPresent( name );
     }
 
     protected void waitAddProject( String title )



Mime
View raw message