continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r834357 [5/7] - in /continuum/branches/continuum-1.3.x/continuum-webapp-test: ./ src/site/ src/site/apt/ src/test/it/org/apache/continuum/web/test/ src/test/resources/ src/test/testng/config/ src/test/testng/org/apache/continuum/web/test/ s...
Date Tue, 10 Nov 2009 05:38:03 GMT
Modified: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ProjectGroupTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ProjectGroupTest.java?rev=834357&r1=834356&r2=834357&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ProjectGroupTest.java (original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ProjectGroupTest.java Tue Nov 10 05:38:01 2009
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.continuum.web.test.parent.AbstractContinuumTest;
 import org.testng.annotations.Test;
 
 /**
@@ -35,56 +36,53 @@
     public void testAddProjectGroup()
         throws Exception
     {
-        String TEST_PROJ_GRP_NAME = p.getProperty( "TEST_PROJ_GRP_NAME" );
-        String TEST_PROJ_GRP_ID = p.getProperty( "TEST_PROJ_GRP_ID" );
-        String TEST_PROJ_GRP_DESCRIPTION = p.getProperty( "TEST_PROJ_GRP_DESCRIPTION" );
+        String TEST_PROJ_GRP_NAME = getProperty( "TEST_PROJ_GRP_NAME" );
+        String TEST_PROJ_GRP_ID = getProperty( "TEST_PROJ_GRP_ID" );
+        String TEST_PROJ_GRP_DESCRIPTION = getProperty( "TEST_PROJ_GRP_DESCRIPTION" );
 
-        addProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION, true);
+        addProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION, true );
         showProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION );
     }
 
     public void testAddProjectGroup2()
         throws Exception
     {
-        String TEST2_PROJ_GRP_NAME = p.getProperty( "TEST2_PROJ_GRP_NAME" );
-        String TEST2_PROJ_GRP_ID = p.getProperty( "TEST2_PROJ_GRP_ID" );
-        String TEST2_PROJ_GRP_DESCRIPTION = p.getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
+        String TEST2_PROJ_GRP_NAME = getProperty( "TEST2_PROJ_GRP_NAME" );
+        String TEST2_PROJ_GRP_ID = getProperty( "TEST2_PROJ_GRP_ID" );
+        String TEST2_PROJ_GRP_DESCRIPTION = getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
 
-        addProjectGroup( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION, true);
-        showProjectGroup( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION);
+        addProjectGroup( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION, true );
+        showProjectGroup( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION );
     }
 
     @Test( dependsOnMethods = { "testAddMavenTwoProjectFromRemoteSourceToNonDefaultProjectGroup" } )
     public void testMoveProject()
         throws Exception
     {
-        String TEST_PROJ_GRP_NAME = p.getProperty( "TEST_PROJ_GRP_NAME" );
-        String TEST_PROJ_GRP_ID = p.getProperty( "TEST_PROJ_GRP_ID" );
-        String TEST_PROJ_GRP_DESCRIPTION = p.getProperty( "TEST_PROJ_GRP_DESCRIPTION" );
-        String DEFAULT_PROJ_GRP_NAME = p.getProperty( "DEFAULT_PROJ_GRP_NAME" );
-        String DEFAULT_PROJ_GRP_ID = p.getProperty( "DEFAULT_PROJ_GRP_NAME" );
-        String DEFAULT_PROJ_GRP_DESCRIPTION = p.getProperty( "DEFAULT_PROJ_GRP_NAME" );
+        String TEST_PROJ_GRP_NAME = getProperty( "TEST_PROJ_GRP_NAME" );
+        String TEST_PROJ_GRP_ID = getProperty( "TEST_PROJ_GRP_ID" );
+        String TEST_PROJ_GRP_DESCRIPTION = getProperty( "TEST_PROJ_GRP_DESCRIPTION" );
+        String DEFAULT_PROJ_GRP_NAME = getProperty( "DEFAULT_PROJ_GRP_NAME" );
+        String DEFAULT_PROJ_GRP_ID = getProperty( "DEFAULT_PROJ_GRP_NAME" );
+        String DEFAULT_PROJ_GRP_DESCRIPTION = getProperty( "DEFAULT_PROJ_GRP_NAME" );
+        String M2_PROJ_GRP_NAME = getProperty( "M2_PROJ_GRP_NAME" );
 
         // move the project of the test project group to the default project group
-        moveProjectToProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION,
+        moveProjectToProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION, M2_PROJ_GRP_NAME,
                                    DEFAULT_PROJ_GRP_NAME );
-        showProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION );
-        assertTextNotPresent( "Member Projects" );
         showProjectGroup( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION );
         assertTextPresent( "Member Projects" );
-        // Restore project to test test project group
+        // Restore project to test project group
         moveProjectToProjectGroup( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION,
-                                   TEST_PROJ_GRP_NAME );
+                                   M2_PROJ_GRP_NAME, TEST_PROJ_GRP_NAME );
         showProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION );
         assertTextPresent( "Member Projects" );
-        showProjectGroup( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION );
-        assertTextNotPresent( "Member Projects" );
     }
 
     public void testAddProjectGroupWithEmptyString()
         throws Exception
     {
-        addProjectGroup( "", "", "", false);
+        addProjectGroup( "", "", "", false );
         assertTextPresent( "Project Group Name is required." );
         assertTextPresent( "Project Group ID is required." );
     }
@@ -92,7 +90,7 @@
     public void testAddProjectGroupWithWhitespaceString()
         throws Exception
     {
-        addProjectGroup( " ", " ", " ", false);
+        addProjectGroup( " ", " ", " ", false );
         assertTextPresent( "Project Group Name cannot contain spaces only." );
         assertTextPresent( "Project Group ID cannot contain spaces only." );
     }
@@ -104,15 +102,16 @@
         final String sNewProjectName = "New Project Group Name";
         final String sNewProjectDescription = "New Project Group Description";
 
-        String TEST2_PROJ_GRP_NAME = p.getProperty( "TEST2_PROJ_GRP_NAME" );
-        String TEST2_PROJ_GRP_ID = p.getProperty( "TEST2_PROJ_GRP_ID" );
-        String TEST2_PROJ_GRP_DESCRIPTION = p.getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
+        String TEST2_PROJ_GRP_NAME = getProperty( "TEST2_PROJ_GRP_NAME" );
+        String TEST2_PROJ_GRP_ID = getProperty( "TEST2_PROJ_GRP_ID" );
+        String TEST2_PROJ_GRP_DESCRIPTION = getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
 
         editProjectGroup( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION, sNewProjectName,
                           sNewProjectDescription );
         assertProjectGroupSummaryPage( sNewProjectName, TEST2_PROJ_GRP_ID, sNewProjectDescription );
 
-        editProjectGroup( sNewProjectName, TEST2_PROJ_GRP_ID, sNewProjectDescription, TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_DESCRIPTION);
+        editProjectGroup( sNewProjectName, TEST2_PROJ_GRP_ID, sNewProjectDescription, TEST2_PROJ_GRP_NAME,
+                          TEST2_PROJ_GRP_DESCRIPTION );
         assertProjectGroupSummaryPage( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION );
     }
 
@@ -121,26 +120,85 @@
         throws Exception
     {
 
-        String TEST2_PROJ_GRP_NAME = p.getProperty( "TEST2_PROJ_GRP_NAME" );
-        String TEST2_PROJ_GRP_ID = p.getProperty( "TEST2_PROJ_GRP_ID" );
-        String TEST2_PROJ_GRP_DESCRIPTION = p.getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
-
-        // TODO: BUG: Operations Result is a blank page
-        //editProjectGroup( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION, "",
-        //                  TEST2_PROJ_GRP_DESCRIPTION + "_2" );
-        //assertTextPresent( "Project Group Name required." );
+        String TEST2_PROJ_GRP_NAME = getProperty( "TEST2_PROJ_GRP_NAME" );
+        String TEST2_PROJ_GRP_ID = getProperty( "TEST2_PROJ_GRP_ID" );
+        String TEST2_PROJ_GRP_DESCRIPTION = getProperty( "TEST2_PROJ_GRP_DESCRIPTION" );
+        editProjectGroup( TEST2_PROJ_GRP_NAME, TEST2_PROJ_GRP_ID, TEST2_PROJ_GRP_DESCRIPTION, " ",
+                          TEST2_PROJ_GRP_DESCRIPTION );
+        assertTextPresent( "Project Group Name cannot contain spaces only" );
     }
 
-    @Test( dependsOnMethods = { "testAddMavenTwoProjectFromRemoteSourceToNonDefaultProjectGroup" } )
+    @Test( dependsOnMethods = { "testAddMavenTwoProject" } )
     public void testProjectGroupAllBuildSuccess()
         throws Exception
     {
-        String TEST_PROJ_GRP_NAME = p.getProperty( "TEST_PROJ_GRP_NAME" );
-        String TEST_PROJ_GRP_ID = p.getProperty( "TEST_PROJ_GRP_ID" );
-        String TEST_PROJ_GRP_DESCRIPTION = p.getProperty( "TEST_PROJ_GRP_DESCRIPTION" );
-
-        buildProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION );
+        String M2_PROJ_GRP_NAME = getProperty( "M2_PROJ_GRP_NAME" );
+        String M2_PROJ_GRP_ID = getProperty( "M2_PROJ_GRP_ID" );
+        String M2_PROJ_GRP_DESCRIPTION = getProperty( "M2_PROJ_GRP_DESCRIPTION" );
+        buildProjectGroup( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, M2_PROJ_GRP_DESCRIPTION, M2_PROJ_GRP_NAME );
         clickButtonWithValue( "Release" );
         assertReleaseSuccess();
     }
+
+    @Test( dependsOnMethods = { "testAddProjectGroup" } )
+    public void testDeleteProjectGroup()
+        throws Exception
+    {
+        String TEST_GRP_NAME = getProperty( "TEST_DELETE_GRP_NAME" );
+        String TEST_GRP_ID = getProperty( "TEST_DELETE_GRP_ID" );
+        String TEST_GRP_DESCRIPTION = getProperty( "TEST_DELETE_GRP_DESCRIPTION" );
+        
+        // delete group - delete icon
+        addProjectGroup( TEST_GRP_NAME, TEST_GRP_ID, TEST_GRP_DESCRIPTION, true );
+        assertLinkPresent( TEST_GRP_NAME );
+        clickLinkWithXPath( "//tbody/tr['0']/td['4']/a/img[@alt='Delete Group']" );
+        assertTextPresent( "Project Group Removal" );
+        clickButtonWithValue( "Delete" );
+        assertProjectGroupsSummaryPage();
+        assertLinkNotPresent( TEST_GRP_NAME );
+        
+        // delete group - "Delete Group" button
+        addProjectGroup( TEST_GRP_NAME, TEST_GRP_ID, TEST_GRP_DESCRIPTION, true );
+        assertLinkPresent( TEST_GRP_NAME );
+        removeProjectGroup( TEST_GRP_NAME );
+        assertLinkNotPresent( TEST_GRP_NAME );
+        assertProjectGroupsSummaryPage();
+        assertLinkNotPresent( TEST_GRP_NAME );
+    }
+
+    public void testProjectGroupMembers()
+        throws Exception
+    {
+        String GRP_NAME_ONE = getProperty( "TEST_PROJ_GRP_NAME_ONE" );
+        String GRP_ID_ONE = getProperty( "TEST_PROJ_GRP_ID_ONE" );
+        String GRP_DESCRIPTION_ONE = getProperty( "TEST_PROJ_GRP_DESCRIPTION_ONE" );
+        String GRP_NAME_TWO = getProperty( "TEST_PROJ_GRP_NAME_TWO" );
+        String GRP_ID_TWO = getProperty( "TEST_PROJ_GRP_ID_TWO" );
+        String GRP_DESCRIPTION_TWO = getProperty( "TEST_PROJ_GRP_DESCRIPTION_TWO" );
+
+        addProjectGroup( GRP_NAME_ONE, GRP_ID_ONE, GRP_DESCRIPTION_ONE, true );
+        assertLinkPresent( GRP_NAME_ONE );
+
+        addProjectGroup( GRP_NAME_TWO, GRP_ID_TWO, GRP_DESCRIPTION_TWO, true );
+        assertLinkPresent( GRP_NAME_TWO );
+
+        createAndAddUserAsDeveloperToGroup( "username1", "user1", "user1@something.com", "password123", GRP_NAME_ONE );
+        createAndAddUserAsDeveloperToGroup( "username2", "user2", "user2@something.com", "password123", GRP_NAME_ONE );
+        createAndAddUserAsDeveloperToGroup( "username3", "user3", "user3@something.com", "password123", GRP_NAME_TWO );
+
+        showMembers( GRP_NAME_ONE, GRP_ID_ONE, GRP_DESCRIPTION_ONE );
+        assertUserPresent( "username1", "user1", "user1@something.com" );
+        assertUserPresent( "username2", "user2", "user2@something.com" );
+        assertUserNotPresent( "username3", "user3", "user3@something.com" );
+
+        showMembers( GRP_NAME_TWO, GRP_ID_TWO, GRP_DESCRIPTION_TWO );
+        assertUserNotPresent( "username1", "user1", "user1@something.com" );
+        assertUserNotPresent( "username2", "user2", "user2@something.com" );
+        assertUserPresent( "username3", "user3", "user3@something.com" );
+
+        removeProjectGroup( GRP_NAME_ONE );
+        assertLinkNotPresent( GRP_NAME_ONE );
+        removeProjectGroup( GRP_NAME_TWO );
+        assertLinkNotPresent( GRP_NAME_TWO );
+    }
 }

Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/PurgeTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/PurgeTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/PurgeTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/PurgeTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,110 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.continuum.web.test.parent.AbstractPurgeTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author José Morales Martínez
+ * @version $Id$
+ */
+@Test( groups = { "purge" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class PurgeTest
+    extends AbstractPurgeTest
+{
+    public void testAddRepositoryPurge()
+    {
+        String PURGE_REPOSITORY_DESCRIPTION = getProperty( "PURGE_REPOSITORY_DESCRIPTION" );
+        String PURGE_REPOSITORY_DAYS = getProperty( "PURGE_REPOSITORY_DAYS" );
+        String PURGE_REPOSITORY_RETETION = getProperty( "PURGE_REPOSITORY_RETETION" );
+        goToAddRepositoryPurge();
+        addEditRepositoryPurge( PURGE_REPOSITORY_DAYS, PURGE_REPOSITORY_RETETION, PURGE_REPOSITORY_DESCRIPTION, true );
+    }
+
+    public void testAddInvalidRepositoryPurge()
+    {
+        String PURGE_REPOSITORY_DESCRIPTION = getProperty( "PURGE_REPOSITORY_DESCRIPTION" );
+        goToAddRepositoryPurge();
+        addEditRepositoryPurge( "", "", PURGE_REPOSITORY_DESCRIPTION, false );
+        assertTextPresent( "Retention Count must be greater than 0." );
+    }
+
+    @Test( dependsOnMethods = { "testAddRepositoryPurge" } )
+    public void testEditRepositoryPurge()
+    {
+        String PURGE_REPOSITORY_DESCRIPTION = getProperty( "PURGE_REPOSITORY_DESCRIPTION" );
+        String PURGE_REPOSITORY_DAYS = getProperty( "PURGE_REPOSITORY_DAYS" );
+        String PURGE_REPOSITORY_RETETION = getProperty( "PURGE_REPOSITORY_RETETION" );
+        String newDescription = "new_description";
+        String newDays = "45";
+        String newRetention = "4";
+        goToEditRepositoryPurge( PURGE_REPOSITORY_DAYS, PURGE_REPOSITORY_RETETION, PURGE_REPOSITORY_DESCRIPTION );
+        addEditRepositoryPurge( newDays, newRetention, newDescription, true );
+        goToEditRepositoryPurge( newDays, newRetention, newDescription );
+        addEditRepositoryPurge( PURGE_REPOSITORY_DAYS, PURGE_REPOSITORY_RETETION, PURGE_REPOSITORY_DESCRIPTION, true );
+    }
+
+    @Test( dependsOnMethods = { "testEditRepositoryPurge" } )
+    public void testDeleteRepositoryPurge()
+    {
+        String PURGE_REPOSITORY_DESCRIPTION = getProperty( "PURGE_REPOSITORY_DESCRIPTION" );
+        removeRepositoryPurge( PURGE_REPOSITORY_DESCRIPTION );
+    }
+
+    public void testAddDirectoryPurge()
+    {
+        String PURGE_DIRECTORY_DESCRIPTION = getProperty( "PURGE_DIRECTORY_DESCRIPTION" );
+        String PURGE_DIRECTORY_DAYS = getProperty( "PURGE_DIRECTORY_DAYS" );
+        String PURGE_DIRECTORY_RETETION = getProperty( "PURGE_DIRECTORY_RETETION" );
+        goToAddDirectoryPurge();
+        addEditDirectoryPurge( PURGE_DIRECTORY_DAYS, PURGE_DIRECTORY_RETETION, PURGE_DIRECTORY_DESCRIPTION, true );
+    }
+
+    public void testAddInvalidDirectoryPurge()
+    {
+        String PURGE_DIRECTORY_DESCRIPTION = getProperty( "PURGE_DIRECTORY_DESCRIPTION" );
+        goToAddDirectoryPurge();
+        addEditDirectoryPurge( "", "", PURGE_DIRECTORY_DESCRIPTION, false );
+        assertTextPresent( "Retention Count must be greater than 0." );
+    }
+
+    @Test( dependsOnMethods = { "testAddDirectoryPurge" } )
+    public void testEditDirectoryPurge()
+    {
+        String PURGE_DIRECTORY_DESCRIPTION = getProperty( "PURGE_DIRECTORY_DESCRIPTION" );
+        String PURGE_DIRECTORY_DAYS = getProperty( "PURGE_DIRECTORY_DAYS" );
+        String PURGE_DIRECTORY_RETETION = getProperty( "PURGE_DIRECTORY_RETETION" );
+        String newDescription = "new_description";
+        String newDays = "45";
+        String newRetention = "4";
+        goToEditDirectoryPurge( PURGE_DIRECTORY_DAYS, PURGE_DIRECTORY_RETETION, PURGE_DIRECTORY_DESCRIPTION );
+        addEditDirectoryPurge( newDays, newRetention, newDescription, true );
+        goToEditDirectoryPurge( newDays, newRetention, newDescription );
+        addEditDirectoryPurge( PURGE_DIRECTORY_DAYS, PURGE_DIRECTORY_RETETION, PURGE_DIRECTORY_DESCRIPTION, true );
+    }
+
+    @Test( dependsOnMethods = { "testEditDirectoryPurge" } )
+    public void testDeleteDirectoryPurge()
+    {
+        String PURGE_DIRECTORY_DESCRIPTION = getProperty( "PURGE_DIRECTORY_DESCRIPTION" );
+        removeDirectoryPurge( PURGE_DIRECTORY_DESCRIPTION );
+    }
+}

Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,153 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.continuum.web.test.parent.AbstractBuildQueueTest;
+import org.testng.annotations.Test;
+import org.apache.continuum.web.test.ScheduleTest;
+
+
+/**
+ * @author José Morales Martínez
+ * @version $Id$
+ */
+
+
+@Test( groups = { "queue" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class QueueTest
+    extends AbstractBuildQueueTest
+{
+
+    public void testAddBuildQueue()
+    {
+        setMaxBuildQueue( 2 );
+        String BUILD_QUEUE_NAME = getProperty( "BUILD_QUEUE_NAME" );
+        addBuildQueue( BUILD_QUEUE_NAME, true );
+    }
+
+	@Test( dependsOnMethods = { "testAddBuildQueue" } ) //"testDeleteBuildQueue" } )
+    public void testQueuePageWithoutBuild()
+    {
+        clickAndWait( "link=Queues"  );
+        assertPage( "Continuum - Build Queue" );
+        assertTextPresent( "Nothing is building" );
+        assertTextNotPresent( "Project Name* Build Definition" );
+        assertTextPresent( "Current Build" );
+	    assertTextPresent( "Build Queue" );
+	    assertTextPresent( "Current Checkout" );
+	    assertTextPresent( "Checkout Queue " );
+	    assertTextPresent( "Current Prepare Build" );
+	    assertTextPresent( "Prepare Build Queue" );
+    }
+
+	@Test( dependsOnMethods = { "testAddBuildQueue", "testAddSchedule" } )
+    public void testAddBuildQueueToSchedule()
+  {
+	    ScheduleTest sched = new ScheduleTest();
+
+	    String SCHEDULE_NAME = getProperty( "SCHEDULE_NAME" );
+        String SCHEDULE_DESCRIPTION = getProperty( "SCHEDULE_DESCRIPTION" );
+        String SCHEDULE_EXPR_SECOND = getProperty( "SCHEDULE_EXPR_SECOND" );
+        String SCHEDULE_EXPR_MINUTE = getProperty( "SCHEDULE_EXPR_MINUTE" );
+        String SCHEDULE_EXPR_HOUR = getProperty( "SCHEDULE_EXPR_HOUR" );
+        String SCHEDULE_EXPR_DAY_MONTH = getProperty( "SCHEDULE_EXPR_DAY_MONTH" );
+        String SCHEDULE_EXPR_MONTH = getProperty( "SCHEDULE_EXPR_MONTH" );
+        String SCHEDULE_EXPR_DAY_WEEK = getProperty( "SCHEDULE_EXPR_DAY_WEEK" );
+        String SCHEDULE_EXPR_YEAR = getProperty( "SCHEDULE_EXPR_YEAR" );
+        String SCHEDULE_MAX_TIME = getProperty( "SCHEDULE_MAX_TIME" );
+        String SCHEDULE_PERIOD = getProperty( "SCHEDULE_PERIOD" );
+
+        String BUILD_QUEUE_NAME = getProperty( "BUILD_QUEUE_NAME" );
+
+
+      sched.goToEditSchedule( SCHEDULE_NAME, SCHEDULE_DESCRIPTION, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE,
+              SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_DAY_WEEK,
+              SCHEDULE_EXPR_YEAR, SCHEDULE_MAX_TIME, SCHEDULE_PERIOD );
+	  getSelenium().addSelection("saveSchedule_availableBuildQueuesIds", "label="+BUILD_QUEUE_NAME);
+	  getSelenium().click("//input[@value='->']");
+	  submit();
+
+  }
+
+	@Test( dependsOnMethods = { "testAddBuildQueue" } )
+    public void testAddNotAllowedBuildQueue()
+    {
+        setMaxBuildQueue( 1 );
+        String secodQueue = "second_queue_name";
+        addBuildQueue( secodQueue, false );
+        assertTextPresent( "You are only allowed 1 number of builds in parallel." );
+    }
+
+    @Test( dependsOnMethods = { "testAddBuildQueue" } )
+    public void testAddAlreadyExistBuildQueue()
+    {
+        setMaxBuildQueue( 3 );
+        String BUILD_QUEUE_NAME = getProperty( "BUILD_QUEUE_NAME" );
+        addBuildQueue( BUILD_QUEUE_NAME, false );
+        assertTextPresent( "Build queue name already exists." );
+    }
+
+    @Test( dependsOnMethods = { "testAddAlreadyExistBuildQueue" } )
+    public void testAddEmptyBuildQueue()
+    {
+        setMaxBuildQueue( 3 );
+        addBuildQueue( "", false );
+        assertTextPresent( "You must define a name" );
+    }
+
+    @Test( dependsOnMethods = { "testAddBuildQueueToSchedule" } )
+    public void testDeleteBuildQueue()
+    {
+        goToBuildQueuePage();
+        String BUILD_QUEUE_NAME = getProperty( "BUILD_QUEUE_NAME" );
+        removeBuildQueue( BUILD_QUEUE_NAME );
+        assertTextNotPresent( BUILD_QUEUE_NAME );
+    }
+
+
+    @Test( dependsOnMethods = { "testAddMavenTwoProject" } )
+    public void testQueuePageWithProjectCurrentlyBuilding()
+        throws Exception
+    {
+    	//build a project
+        String M2_PROJ_GRP_NAME = getProperty( "M2_PROJ_GRP_NAME" );
+        String M2_PROJ_GRP_ID = getProperty( "M2_PROJ_GRP_ID" );
+        String M2_PROJ_GRP_DESCRIPTION = getProperty( "M2_PROJ_GRP_DESCRIPTION" );
+        buildProjectForQueuePageTest( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, M2_PROJ_GRP_DESCRIPTION, M2_PROJ_GRP_NAME );
+
+        //check queue page while building
+    	clickAndWait( "link=Queues" );
+	    assertPage( "Continuum - Build Queue" );
+	    assertTextPresent( "Current Build" );
+	    assertTextPresent( "Build Queue" );
+	    assertTextPresent( "Current Checkout" );
+	    assertTextPresent( "Checkout Queue " );
+	    assertTextPresent( "Current Prepare Build" );
+	    assertTextPresent( "Prepare Build Queue" );
+	    assertElementPresent("//table[@id='ec_table']/tbody/tr/td[4]");
+	    assertTextPresent( M2_PROJ_GRP_NAME );
+	    getSelenium().goBack();
+	    getSelenium().refresh();
+        waitPage();
+	    waitForElementPresent( "//img[@alt='Success']" );
+	    Thread.sleep( 10000 );
+    }
+
+ }

Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ScheduleTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,144 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.continuum.web.test.parent.AbstractScheduleTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author José Morales Martínez
+ * @version $Id$
+ */
+@Test( groups = { "schedule" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class ScheduleTest
+    extends AbstractScheduleTest
+{
+    public void testAddScheduleNoBuildQueueToBeUsed()
+    {
+        String SCHEDULE_NAME = getProperty( "SCHEDULE_NAME" );
+        String SCHEDULE_DESCRIPTION = getProperty( "SCHEDULE_DESCRIPTION" );
+        String SCHEDULE_EXPR_SECOND = getProperty( "SCHEDULE_EXPR_SECOND" );
+        String SCHEDULE_EXPR_MINUTE = getProperty( "SCHEDULE_EXPR_MINUTE" );
+        String SCHEDULE_EXPR_HOUR = getProperty( "SCHEDULE_EXPR_HOUR" );
+        String SCHEDULE_EXPR_DAY_MONTH = getProperty( "SCHEDULE_EXPR_DAY_MONTH" );
+        String SCHEDULE_EXPR_MONTH = getProperty( "SCHEDULE_EXPR_MONTH" );
+        String SCHEDULE_EXPR_DAY_WEEK = getProperty( "SCHEDULE_EXPR_DAY_WEEK" );
+        String SCHEDULE_EXPR_YEAR = getProperty( "SCHEDULE_EXPR_YEAR" );
+        String SCHEDULE_MAX_TIME = getProperty( "SCHEDULE_MAX_TIME" );
+        String SCHEDULE_PERIOD = getProperty( "SCHEDULE_PERIOD" );
+        goToAddSchedule();
+        addEditSchedule( SCHEDULE_NAME, SCHEDULE_DESCRIPTION, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE,
+                         SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_DAY_WEEK,
+                         SCHEDULE_EXPR_YEAR, SCHEDULE_MAX_TIME, SCHEDULE_PERIOD, false, false );
+	assertTextPresent( "Used Build Queues cannot be empty" );
+    }
+
+    @Test( dependsOnMethods = { "testAddScheduleNoBuildQueueToBeUsed" } )
+    public void testAddSchedule()
+    {
+        String SCHEDULE_NAME = getProperty( "SCHEDULE_NAME" );
+        String SCHEDULE_DESCRIPTION = getProperty( "SCHEDULE_DESCRIPTION" );
+        String SCHEDULE_EXPR_SECOND = getProperty( "SCHEDULE_EXPR_SECOND" );
+        String SCHEDULE_EXPR_MINUTE = getProperty( "SCHEDULE_EXPR_MINUTE" );
+        String SCHEDULE_EXPR_HOUR = getProperty( "SCHEDULE_EXPR_HOUR" );
+        String SCHEDULE_EXPR_DAY_MONTH = getProperty( "SCHEDULE_EXPR_DAY_MONTH" );
+        String SCHEDULE_EXPR_MONTH = getProperty( "SCHEDULE_EXPR_MONTH" );
+        String SCHEDULE_EXPR_DAY_WEEK = getProperty( "SCHEDULE_EXPR_DAY_WEEK" );
+        String SCHEDULE_EXPR_YEAR = getProperty( "SCHEDULE_EXPR_YEAR" );
+        String SCHEDULE_MAX_TIME = getProperty( "SCHEDULE_MAX_TIME" );
+        String SCHEDULE_PERIOD = getProperty( "SCHEDULE_PERIOD" );
+        goToAddSchedule();
+        addEditSchedule( SCHEDULE_NAME, SCHEDULE_DESCRIPTION, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE,
+                         SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_DAY_WEEK,
+                         SCHEDULE_EXPR_YEAR, SCHEDULE_MAX_TIME, SCHEDULE_PERIOD, true, true );
+    }
+
+    public void testAddInvalidSchedule()
+    {
+        goToAddSchedule();
+        addEditSchedule( "", "", "", "", "", "", "", "", "", "", "", true, false );
+        assertTextPresent( "Invalid cron expression value(s)" );
+        assertTextPresent( "Name is required and cannot contain spaces only" );
+        assertTextPresent( "Description is required and cannot contain spaces only" );
+    }
+
+    @Test( dependsOnMethods = { "testAddSchedule" } )
+    public void testAddDuplicatedSchedule()
+    {
+        String SCHEDULE_NAME = getProperty( "SCHEDULE_NAME" );
+        String SCHEDULE_DESCRIPTION = getProperty( "SCHEDULE_DESCRIPTION" );
+        String SCHEDULE_EXPR_SECOND = getProperty( "SCHEDULE_EXPR_SECOND" );
+        String SCHEDULE_EXPR_MINUTE = getProperty( "SCHEDULE_EXPR_MINUTE" );
+        String SCHEDULE_EXPR_HOUR = getProperty( "SCHEDULE_EXPR_HOUR" );
+        String SCHEDULE_EXPR_DAY_MONTH = getProperty( "SCHEDULE_EXPR_DAY_MONTH" );
+        String SCHEDULE_EXPR_MONTH = getProperty( "SCHEDULE_EXPR_MONTH" );
+        String SCHEDULE_EXPR_DAY_WEEK = getProperty( "SCHEDULE_EXPR_DAY_WEEK" );
+        String SCHEDULE_EXPR_YEAR = getProperty( "SCHEDULE_EXPR_YEAR" );
+        String SCHEDULE_MAX_TIME = getProperty( "SCHEDULE_MAX_TIME" );
+        String SCHEDULE_PERIOD = getProperty( "SCHEDULE_PERIOD" );
+        goToAddSchedule();
+        addEditSchedule( SCHEDULE_NAME, SCHEDULE_DESCRIPTION, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE,
+                         SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_DAY_WEEK,
+                         SCHEDULE_EXPR_YEAR, SCHEDULE_MAX_TIME, SCHEDULE_PERIOD, true, false );
+        assertTextPresent( "A Schedule with the same name already exists" );
+    }
+
+    @Test( dependsOnMethods = { "testAddDuplicatedSchedule" } )
+    public void testEditSchedule()
+    {
+        String SCHEDULE_NAME = getProperty( "SCHEDULE_NAME" );
+        String SCHEDULE_DESCRIPTION = getProperty( "SCHEDULE_DESCRIPTION" );
+        String SCHEDULE_EXPR_SECOND = getProperty( "SCHEDULE_EXPR_SECOND" );
+        String SCHEDULE_EXPR_MINUTE = getProperty( "SCHEDULE_EXPR_MINUTE" );
+        String SCHEDULE_EXPR_HOUR = getProperty( "SCHEDULE_EXPR_HOUR" );
+        String SCHEDULE_EXPR_DAY_MONTH = getProperty( "SCHEDULE_EXPR_DAY_MONTH" );
+        String SCHEDULE_EXPR_MONTH = getProperty( "SCHEDULE_EXPR_MONTH" );
+        String SCHEDULE_EXPR_DAY_WEEK = getProperty( "SCHEDULE_EXPR_DAY_WEEK" );
+        String SCHEDULE_EXPR_YEAR = getProperty( "SCHEDULE_EXPR_YEAR" );
+        String SCHEDULE_MAX_TIME = getProperty( "SCHEDULE_MAX_TIME" );
+        String SCHEDULE_PERIOD = getProperty( "SCHEDULE_PERIOD" );
+        String name = "new_name";
+        String description = "new_description";
+        String second = "1";
+        String minute = "20";
+        String hour = "15";
+        String dayMonth = "20";
+        String month = "9";
+        String dayWeek = "?";
+        String year = "";
+        String maxTime = "9000";
+        String period = "0";
+        goToEditSchedule( SCHEDULE_NAME, SCHEDULE_DESCRIPTION, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE,
+                          SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_DAY_WEEK,
+                          SCHEDULE_EXPR_YEAR, SCHEDULE_MAX_TIME, SCHEDULE_PERIOD );
+        addEditSchedule( name, description, second, minute, hour, dayMonth, month, dayWeek, year, maxTime, period, false, true );
+        goToEditSchedule( name, description, second, minute, hour, dayMonth, month, dayWeek, year, maxTime, period );
+        addEditSchedule( SCHEDULE_NAME, SCHEDULE_DESCRIPTION, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE,
+                         SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_DAY_WEEK,
+                         SCHEDULE_EXPR_YEAR, SCHEDULE_MAX_TIME, SCHEDULE_PERIOD, false, true );
+    }
+
+    @Test( dependsOnMethods = { "testEditSchedule" } )
+    public void testDeleteSchedule()
+    {
+        String SCHEDULE_NAME = getProperty( "SCHEDULE_NAME" );
+        removeSchedule( SCHEDULE_NAME );
+    }
+}

Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/SetupSelenium.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/SetupSelenium.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/SetupSelenium.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/SetupSelenium.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,98 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.continuum.web.test.parent.AbstractContinuumTest;
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Optional;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+/**
+ * Based on SetupSelenium of Wendy Smoak test.
+ * 
+ * @author José Morales Martínez
+ * @version $Id$
+ */
+@Test( groups = { "setup" }, alwaysRun = true )
+public class SetupSelenium
+    extends AbstractContinuumTest
+{
+    @Override
+    @AfterTest
+    public void close()
+        throws Exception
+    {
+        super.close();
+    }
+
+    @Override
+    @BeforeSuite
+    public void open()
+        throws Exception
+    {
+        super.open();
+    }
+
+    @BeforeTest
+    @Parameters( { "baseUrl", "browser", "seleniumHost", "seleniumPort" } )
+    public void initializeContinuum( String baseUrl, String browser, @Optional( "localhost" ) String seleniumHost,
+                                     @Optional( "4444" ) int seleniumPort )
+        throws Exception
+    {
+        super.open( baseUrl, browser, seleniumHost, seleniumPort );
+        Assert.assertNotNull( getSelenium(), "Selenium is not initialized" );
+        getSelenium().open( baseUrl );
+        String title = getSelenium().getTitle();
+        if ( title.equals( "Create Admin User" ) )
+        {
+            assertCreateAdmin();
+            String fullname = getProperty( "ADMIN_FULLNAME" );
+            String username = getProperty( "ADMIN_USERNAME" );
+            String mail = getProperty( "ADMIN_MAIL" );
+            String password = getProperty( "ADMIN_PASSWORD" );
+            submitAdminData( fullname, mail, password );
+            assertAutenticatedPage( username );
+            assertEditConfigurationPage();
+            postAdminUserCreation();
+            clickLinkWithText( "Logout" );
+        }
+    }
+
+    private void postAdminUserCreation()
+    {
+        if ( getTitle().endsWith( "Continuum - Configuration" ) )
+        {
+            String workingDir = getFieldValue( "configuration_workingDirectory" );
+            String buildOutputDir = getFieldValue( "configuration_buildOutputDirectory" );
+            String releaseOutputDir = getFieldValue( "configuration_releaseOutputDirectory" );
+            String locationDir = "target/data";
+            String data = "data";
+            setFieldValue( "workingDirectory", workingDir.replaceFirst( data, locationDir ) );
+            setFieldValue( "buildOutputDirectory", buildOutputDir.replaceFirst( data, locationDir ) );
+            setFieldValue( "releaseOutputDirectory", releaseOutputDir.replaceFirst( data, locationDir ) );
+            setFieldValue( "baseUrl", baseUrl );
+            submit();
+        }
+    }
+}
\ No newline at end of file

Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ShellProjectTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ShellProjectTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ShellProjectTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ShellProjectTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,80 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.continuum.web.test.parent.AbstractContinuumTest;
+import org.testng.annotations.Test;
+
+/**
+ * Based on AddShellProjectTestCase of Emmanuel Venisse.
+ *
+ * @author José Morales Martínez
+ * @version $Id$
+ */
+@Test( groups = { "shellProject" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+public class ShellProjectTest
+    extends AbstractContinuumTest
+{
+    public void testAddShellProject()
+        throws Exception
+    {
+        String SHELL_NAME = getProperty( "SHELL_NAME" );
+        String SHELL_DESCRIPTION = getProperty( "SHELL_DESCRIPTION" );
+        String SHELL_VERSION = getProperty( "SHELL_VERSION" );
+        String SHELL_TAG = getProperty( "SHELL_TAG" );
+        String SHELL_SCM_URL = getProperty( "SHELL_SCM_URL" );
+        String SHELL_SCM_USERNAME = getProperty( "SHELL_SCM_USERNAME" );
+        String SHELL_SCM_PASSWORD = getProperty( "SHELL_SCM_PASSWORD" );
+        String DEFAULT_PROJ_GRP_NAME = getProperty( "DEFAULT_PROJ_GRP_NAME" );
+        String DEFAULT_PROJ_GRP_ID = getProperty( "DEFAULT_PROJ_GRP_ID" );
+        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 );
+        assertProjectGroupSummaryPage( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION );
+    }
+
+    public void testSubmitEmptyForm()
+    {
+        goToAddShellProjectPage();
+        submit();
+        assertAddProjectPage( "shell" );
+        assertTextPresent( "Name is required and cannot contain null or spaces only" );
+        assertTextPresent( "Version is required and cannot contain null or spaces only" );
+        assertTextPresent( "SCM Url is required and cannot contain null or spaces only" );
+    }
+
+    @Test( dependsOnMethods = { "testAddShellProject" } )
+    public void testAddDupliedShellProject()
+        throws Exception
+    {
+        String SHELL_NAME = getProperty( "SHELL_NAME" );
+        String SHELL_DESCRIPTION = getProperty( "SHELL_DESCRIPTION" );
+        String SHELL_VERSION = getProperty( "SHELL_VERSION" );
+        String SHELL_TAG = getProperty( "SHELL_TAG" );
+        String SHELL_SCM_URL = getProperty( "SHELL_SCM_URL" );
+        String SHELL_SCM_USERNAME = getProperty( "SHELL_SCM_USERNAME" );
+        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 );
+        assertTextPresent( "Project name already exist" );
+    }
+}

Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,627 @@
+package org.apache.continuum.web.test;
+
+import org.apache.continuum.web.test.parent.AbstractUserRolesManagementTest;
+import org.testng.annotations.Test;
+
+@Test( groups = { "userroles" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }, sequential = true )
+public class UserRolesManagementTest
+    extends AbstractUserRolesManagementTest
+{
+    public void testBasicAddDeleteUser()
+    {
+        username = getProperty( "GUEST_USERNAME" );
+        fullname = getProperty( "GUEST_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        deleteUser( username, fullname, getUserEmail() );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+    
+    /*
+     * GUEST USER ROLE
+     * Guest Role could only view the About Page. Project Groups should not be shown when clicking
+     * Show Project Group link.
+    */
+    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
+    public void testAddUserWithGuestRole()
+    {
+        username = getProperty( "GUEST_USERNAME" );
+        fullname = getProperty( "GUEST_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        //checkUserRoleWithValue( fullname );
+        clickLinkWithLocator( "addRolesToUser_addNDSelectedRoles", false );
+        clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        //assertTextPresent( "Password successfully changed" );        
+        clickLinkWithText( "Logout" );
+    }
+
+    @Test( dependsOnMethods = { "testAddUserWithGuestRole" } )
+    public void testGuestUserRoleFunction()
+    {
+        username = getProperty( "GUEST_USERNAME" );
+        fullname = getProperty( "GUEST_FULLNAME" );
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        goToAboutPage();
+        clickLinkWithText( "Show Project Groups" );
+        assertTextPresent( "Project Groups list is empty" );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+
+    /*
+     * REGISTERED USER ROLE
+     * Registered User Role could only view the About Page. Project Groups should not be shown when clicking
+     * Show Project Group link.
+    */
+    @Test( dependsOnMethods = { "testBasicAddDeleteUser" , "testGuestUserRoleFunction" } )
+    public void testAddUserWithRegisteredUserRole()
+    {
+        username = getProperty( "REGISTERED_USERNAME" );
+        fullname = getProperty( "REGISTERED_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkUserRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+
+        clickLinkWithText( "Logout" );
+        // assertTextPresent("You are already logged in.");
+    }
+
+    @Test( dependsOnMethods = { "testAddUserWithRegisteredUserRole" } )
+    public void testRegisteredRoleFunction()
+    {
+        username = getProperty( "REGISTERED_USERNAME" );
+        fullname = getProperty( "REGISTERED_FULLNAME" );
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        goToAboutPage();
+        clickLinkWithText( "Show Project Groups" );
+        assertTextPresent( "Project Groups list is empty." );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    /*
+     * SYSTEM ADMINISTRATOR ROLE
+     * Has access to all functions in the application.
+     *
+     * The following tests only asserts elements that could be shown 
+     * when system admin user is logged in since the user that is used 
+     * to test the other functionalities is a system admin user.
+     */
+    @Test( dependsOnMethods = { "testBasicAddDeleteUser" , "testRegisteredRoleFunction" } )
+    public void testAddUserWithSystemAdminRole()
+    {
+        username = getProperty( "SYSAD_USERNAME" );
+        fullname = getProperty( "SYSAD_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkUserRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+
+        clickLinkWithText( "Logout" );
+    }
+
+    @Test( dependsOnMethods = { "testAddUserWithSystemAdminRole" } )
+    public void testSystemAdminRoleFunction()
+    {
+	    username = getProperty( "SYSAD_USERNAME" );
+        fullname = getProperty( "SYSAD_FULLNAME" );
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Show Project Groups" );
+        assertTextNotPresent( "Project Groups list is empty." );
+        assertLinkPresent( "Default Project Group" );
+	
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    /* 
+     * USER ADMIN ROLE
+     * User Admin role could only add/edit/delete users and can view user Roles. Cannot view Project Groups
+     * but can assign a User to a project.
+     *
+     */
+    @Test( dependsOnMethods = { "testBasicAddDeleteUser" , "testSystemAdminRoleFunction" } )
+    public void testAddUserWithUserAdminRole()
+    {
+        username = getProperty( "USERADMIN_USERNAME" );
+        fullname = getProperty( "USERADMIN_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkUserRoleWithValue( fullname );
+		clickButtonWithValue( "Submit" );
+
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+
+        clickLinkWithText( "Logout" );
+    }
+    
+    @Test( dependsOnMethods = { "testAddUserWithUserAdminRole" } )
+    public void testUserAdminFunction()
+    {
+        username = getProperty( "USERADMIN_USERNAME" );
+        fullname = getProperty( "USERADMIN_FULLNAME" );
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Show Project Groups" );
+        assertTextPresent( "Project Groups list is empty." );
+        // add user
+        clickLinkWithText( "Users" );
+        clickButtonWithValue( "Create New User" );
+	    assertCreateUserPage();
+	    setFieldValue( "user.username", "guest0" );
+        setFieldValue( "user.fullName", "guest0" );
+        setFieldValue( "user.email", "guest0@guest0.com" );
+        setFieldValue( "user.password", "pass" );
+        setFieldValue( "user.confirmPassword", "pass" );
+        submit();
+        assertUserRolesPage( );
+        clickButtonWithValue( "Submit" );
+        selectValue( "name=ec_rd", "50" );
+        waitPage();
+        // delete user	
+        deleteUser( "guest0", "guest0", "guest0@guest0.com" );	
+        // TODO edit user
+
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    /*
+     * CONTINUUM GROUP PROJECT ADMIN
+     * - Can Add/Edit/Delete Project Group, can Add/Edit/Delete projects, can assign Users
+     *    roles to existing projects, can add/edit/delete schedules, can view existing roles for the
+     *    projects, can build/release projects
+     * - Cannot add users, --- --- ---
+     */
+    @Test( dependsOnMethods = { "testBasicAddDeleteUser" , "testUserAdminFunction" } )
+    public void testAddUserWithContinuumGroupProjectAdminRole()
+    {
+        username = getProperty( "GROUPPROJECTADMIN_USERNAME" );
+        fullname = getProperty( "GROUPPROJECTADMIN_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkUserRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+
+        // enable distributed build
+        clickLinkWithText( "Configuration" );
+        clickLinkWithLocator( "configuration_distributedBuildEnabled", false );
+        clickButtonWithValue( "Save" );
+
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+
+	    assertProjectAdministratorAccess();
+
+        clickLinkWithText( "Logout" );
+
+        login( getAdminUsername(), getAdminPassword() );
+        // disable distributed build
+        clickLinkWithText( "Configuration" );
+        clickLinkWithLocator( "configuration_distributedBuildEnabled", false );
+        clickButtonWithValue( "Save" );
+
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRoleNewPassword() );
+        assertProjectAdministratorAccess();
+
+        clickLinkWithText( "Logout" );
+    }
+
+    @Test( dependsOnMethods = { "testAddUserWithContinuumGroupProjectAdminRole" } )
+    public void testContinuumGroupProjectAdmin_AddProjectGroup() throws Exception
+    {
+        username = getProperty( "GROUPPROJECTADMIN_USERNAME" );
+        fullname = getProperty( "GROUPPROJECTADMIN_FULLNAME" );
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Show Project Groups" );
+        assertTextNotPresent( "Project Groups list is empty." );
+        // test add project group
+        clickButtonWithValue( "Add Project Group" );
+        setFieldValue( "name", "Test Group" );
+        setFieldValue( "groupId", "Test Group" );
+        setFieldValue( "description", "testing project group" );
+        submit();
+    }
+
+    @Test( dependsOnMethods = { "testContinuumGroupProjectAdmin_AddProjectGroup" } )
+    public void testContinuumGroupProjectAdmin_AddProjectToProjectGroup() throws Exception
+    {
+        clickLinkWithText( "Test Group" );
+        clickButtonWithValue( "Add" );	
+        assertAddMavenTwoProjectPage();
+        setFieldValue( "m2PomUrl", "https://svn.apache.org/repos/asf/continuum/sandbox/continuum-build-queue-test-data/pom.xml" );
+        clickButtonWithValue( "Add" );
+        String title;
+        boolean success = true;
+        if ( success )
+        {
+            title = "Continuum - Project Group";
+        }
+        else
+        {
+            title = "Continuum - Add Maven 2 Project";
+        }
+        waitAddProject( title );
+        assertTextPresent( "ContinuumBuildQueueTestData" );
+    }
+    
+    @Test( dependsOnMethods = { "testContinuumGroupProjectAdmin_AddProjectToProjectGroup" } )
+    public void testContinuumGroupProjectAdmin_BuildProject() throws Exception
+    {
+        buildProjectGroup( "Test Group", "Test Group", "testing project group", "ContinuumBuildQueueTestData" );
+    }
+
+    @Test( dependsOnMethods = { "testContinuumGroupProjectAdmin_BuildProject" } )
+    public void testContinuumGroupProjectAdmin_AssignUserToAGroup()
+    {
+        clickLinkWithText( "Users" );
+        clickLinkWithText( "guest1" );
+        clickLinkWithText( "Edit Roles" );
+        checkUserRoleWithValue( "Guest" );
+        checkResourceRoleWithValue( "Project Developer - Test Group" );
+        submit();
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    /*
+     * Uncomment the lines below to release a Project provided that you add
+     * the values under RELEASE A PROJECT in testng.properties file (project's pom url, access to project to be released.)
+    	
+    @Test( dependsOnMethods = { "testContinuumGroupProjectAdmin_AssignUserToAGroup" } )
+    public void testContinuumGroupProjectAdmin_ReleaseProject() throws Exception
+    {
+	String projectUrl = getProperty( "PROJECT_URL_TO_BE_RELEASED" );
+	String projectName = getProperty( "PROJECT_NAME_TO_BE_RELEASED" );
+	String projectUsername = getProperty( "PROJECT_USERNAME" );
+	String projectPassword = getProperty( "PROJECT_USERNAME" );
+	// add a project group
+	clickLinkWithText( "Show Project Groups" );
+	clickButtonWithValue( "Add Project Group" );
+	setFieldValue( "name", "Project Group" );
+        setFieldValue( "groupId", "Project Group" );
+        setFieldValue( "description", "project group for projects to be released" );
+	submit();
+	// add a project to a project group
+	clickLinkWithText( "Project Group" );
+	clickButtonWithValue( "Add" );
+	assertAddMavenTwoProjectPage();
+	setFieldValue( "m2PomUrl", projectUrl );
+	// set username and password here
+	setFieldValue( "scmUsername", projectUsername );
+	setFieldValue( "scmPassword", projectPassword );
+	clickButtonWithValue( "Add" );
+	String title;
+	boolean success = true;
+	if ( success )
+        {
+            title = "Continuum - Project Group";
+        }
+        else
+        {
+            title = "Continuum - Add Maven 2 Project";
+        }
+        waitAddProject( title );
+	// build the project added in the project group
+	buildProjectGroup( "Project Group", "Project Group", "project group for projects to be released", projectName );
+	// release the project
+	clickButtonWithValue( "Release" );
+	clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+    */
+
+    @Test( dependsOnMethods = { "testContinuumGroupProjectAdmin_BuildProject" } )
+    public void testUserWithContinuumGroupProjectDeveloperRole()
+    {
+        username = getProperty( "GROUPPROJECTDEVELOPER_USERNAME" );
+        fullname = getProperty( "GROUPPROJECTDEVELOPER_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkUserRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    @Test( dependsOnMethods = { "testUserWithContinuumGroupProjectDeveloperRole" } )
+    public void testUserWithContinuumGroupProjectUserRole()
+    {
+        username = getProperty( "GROUPPROJECTUSER_USERNAME" );
+        fullname = getProperty( "GROUPPROJECTUSER_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkUserRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    @Test( dependsOnMethods = { "testUserWithContinuumGroupProjectUserRole" } )
+    public void testUserWithContinuumManageBuildEnvironmentRole()
+    {
+        username = getProperty( "MANAGEBUILDENVIRONMENT_USERNAME" );
+        fullname = getProperty( "MANAGEBUILDENVIRONMENT_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkUserRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );	
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    @Test( dependsOnMethods = { "testUserWithContinuumManageBuildEnvironmentRole" } )
+    public void testUserWithContinuumManageBuildTemplatesRole()
+    {
+        username = getProperty( "MANAGEBUILDTEMPLATES_USERNAME" );
+        fullname = getProperty( "MANAGEBUILDTEMPLATES_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkUserRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    @Test( dependsOnMethods = { "testUserWithContinuumManageBuildTemplatesRole" } )
+    public void testUserWithContinuumManageInstallationsRole()
+    {
+        username = getProperty( "MANAGEINSTALLATIONS_USERNAME" );
+        fullname = getProperty( "MANAGEINSTALLATIONS_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkUserRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    @Test( dependsOnMethods = { "testUserWithContinuumManageInstallationsRole" } )
+    public void testUserWithContinuumManageLocalRepoRole()
+    {
+        username = getProperty( "MANAGELOCALREPOS_USERNAME" );
+        fullname = getProperty( "MANAGELOCALREPOS_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkUserRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    @Test( dependsOnMethods = { "testUserWithContinuumManageLocalRepoRole" } )
+    public void testUserWithContinuumManagePurgingRole()
+    {
+        username = getProperty( "MANAGEPURGING_USERNAME" );
+        fullname = getProperty( "MANAGEPURGING_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkUserRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    @Test( dependsOnMethods = { "testUserWithContinuumManagePurgingRole" } )
+    public void testUserWithContinuumManageQueuesRole()
+    {
+        username = getProperty( "MANAGEQUEUES_USERNAME" );
+        fullname = getProperty( "MANAGEQUEUES_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkUserRoleWithValue( fullname );
+	    clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    @Test( dependsOnMethods = { "testUserWithContinuumManageQueuesRole" } )
+    public void testUserWithContinuumManageSchedulingRole()
+    {
+        username = getProperty( "MANAGESCHEDULING_USERNAME" );
+        fullname = getProperty( "MANAGESCHEDULING_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkUserRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    @Test( dependsOnMethods = { "testUserWithContinuumManageSchedulingRole" } )
+    public void testUserWithProjectAdminDefaultProjectGroup()
+    {
+        username = getProperty( "PROJECTADMINISTRATOR_DEFAULTPROJECTGROUP_USERNAME" );
+        fullname = getProperty( "PROJECTADMINISTRATOR_DEFAULTPROJECTGROUP_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkResourceRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    @Test( dependsOnMethods = { "testUserWithProjectAdminDefaultProjectGroup" } )
+    public void testUserWithProjectDevDefaultProjectGroup()
+    {
+        username = getProperty( "PROJECTDEVELOPER_DEFAULTPROJECTGROUP_USERNAME" );
+        fullname = getProperty( "PROJECTDEVELOPER_DEFAULTPROJECTGROUP_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkResourceRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    @Test( dependsOnMethods = { "testUserWithProjectDevDefaultProjectGroup" } )
+    public void testUserWithProjectUserDefaultProjectGroup()
+    {
+        username = getProperty( "PROJECTUSER_DEFAULTPROJECTGROUP_USERNAME" );
+        fullname = getProperty( "PROJECTUSER_DEFAULTPROJECTGROUP_FULLNAME" );
+
+        createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
+        assertCreatedUserInfo( username );
+        checkResourceRoleWithValue( fullname );
+        clickButtonWithValue( "Submit" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRolePassword() );
+        changePassword( getUserRolePassword(), getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
+        clickLinkWithText( "Logout" );
+
+        login( username, getUserRoleNewPassword() );
+        assertLeftNavMenuWithRole( fullname );
+        clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+}

Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/XPathExpressionUtil.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/XPathExpressionUtil.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/XPathExpressionUtil.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/XPathExpressionUtil.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,245 @@
+package org.apache.continuum.web.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Utility class for creating xpath expressions
+ */
+public class XPathExpressionUtil
+{
+    public static final String CONTAINS = "contains";
+
+    public static final String AND = " and ";
+
+    public static final String CURRENT_NODE = "./";
+
+    public static final String PARENT_NODE = "../";
+
+    public static final String GRANDPARENT_NODE = "../../";
+
+    public static final String ELEMENT_ANY_LEVEL = "//";
+
+    public static final String TABLE_COLUMN = "td";
+
+    public static final String TABLE_ROW = "tr";
+
+    public static final String START_NODE_TEST = "[";
+
+    public static final String END_NODE_TEST = "]";
+
+    public static final String ANCHOR = "a";
+
+    public static final String IMG = "img";
+
+    public static final String LIST = "ul";
+
+    public static final String LINE = "li";
+
+    public static String getList( String[] values )
+    {
+        String xpathExpression = "";
+
+        if ( values.length > 0 )
+        {
+            xpathExpression += ELEMENT_ANY_LEVEL;
+            xpathExpression += LIST;
+            xpathExpression += START_NODE_TEST;
+
+            for (int nIndex = 0; nIndex < values.length; nIndex++ )
+            {
+                xpathExpression += ( ( nIndex > 0 ) ? AND : "" );
+                xpathExpression += contains( LINE + position( nIndex + 1 ), values[nIndex] );
+            }
+
+            xpathExpression += END_NODE_TEST;
+        }
+
+        return xpathExpression;
+    }
+
+    /**
+     * expression for acquiring an element in one of the table columns
+     *
+     * @param element      the node element
+     * @param elementIndex column index of the element, used for skipping
+     * @param columnValues the values to be matched in each column, element column is included
+     * @return
+     */
+    public static String getColumnElement( String element, int elementIndex, String[] columnValues )
+    {
+        return getColumnElement( element, elementIndex, null, columnValues );
+    }
+
+    /**
+     * expression for acquiring an element in one of the table columns
+     *
+     * @param element      the node element
+     * @param elementIndex column index of the element, used for skipping
+     * @param elementValue the matched element value
+     * @param columnValues the values to be matched in each column, element column is included
+     * @return
+     */
+    public static String getColumnElement( String element, int elementIndex, String elementValue,
+                                           String[] columnValues )
+    {
+        return getColumnElement( element, elementIndex, elementValue, "TEXT", columnValues );
+    }
+
+    /**
+     * expression for acquiring an element in one of the table columns
+     *
+     * @param element      the node element
+     * @param elementIndex column index of the element, used for skipping
+     * @param imageName the matched image name
+     * @param columnValues the values to be matched in each column, element column is included
+     * @return
+     */
+    public static String getImgColumnElement( String element, int elementIndex, String imageName,
+                                           String[] columnValues )
+    {
+        return getColumnElement( element, elementIndex, imageName, IMG, columnValues );
+    }
+
+    /**
+     * expression for acquiring an element in one of the table columns
+     *
+     * @param element      the node element
+     * @param elementIndex column index of the element, used for skipping
+     * @param imageName the matched image name
+     * @param columnValues the values to be matched in each column, element column is included
+     * @return
+     */
+    private static String getColumnElement( String element, int elementIndex, String elementValue,
+                                            String elementValueType, String[] columnValues )
+    {
+        String xpathExpression = null;
+
+        if ( ( columnValues != null ) && ( columnValues.length > 0 ) )
+        {
+            xpathExpression = ELEMENT_ANY_LEVEL + element;
+            xpathExpression += START_NODE_TEST;
+
+            if ( elementValue != null )
+            {
+                if ( "TEXT".equals( elementValueType ) )
+                {
+                    xpathExpression += contains( elementValue );
+                    xpathExpression += ( columnValues.length > 0 ) ? AND : "";
+                }
+            }
+
+            // we are two levels below the table row element ( tr/td/<element> )
+            xpathExpression += matchColumns( GRANDPARENT_NODE, columnValues, elementIndex );
+
+            xpathExpression += END_NODE_TEST;
+        }
+
+        if ( IMG.equals( elementValueType ) )
+        {
+            xpathExpression += "/img[contains(@src, '" + elementValue + "')]";
+        }
+
+        return xpathExpression;
+    }
+
+    /**
+     * expression for acquiring the table row that matches all column values with the same order
+     * as the list
+     *
+     * @param columnValues the matched list of columnValues
+     * @return
+     */
+    public static String getTableRow( String[] columnValues )
+    {
+        String xpathExpression = null;
+
+        if ( ( columnValues != null ) && ( columnValues.length > 0 ) )
+        {
+            xpathExpression = new String( ELEMENT_ANY_LEVEL + TABLE_ROW + START_NODE_TEST );
+            xpathExpression += matchColumns( columnValues );
+            xpathExpression += END_NODE_TEST;
+        }
+
+        return xpathExpression;
+    }
+
+    private static String matchColumns( String[] columnValues )
+    {
+        return matchColumns( columnValues, -1 );
+    }
+
+    private static String matchColumns( String[] columnValues, int skipIndex )
+    {
+        return matchColumns( null, columnValues, skipIndex );
+    }
+
+    private static String matchColumns( String parent, String[] columnValues, int skipIndex )
+    {
+        String xpathExpression = "";
+
+        for ( int nIndex = 0; nIndex < columnValues.length; nIndex++ )
+        {
+            if ( ( skipIndex != nIndex ) || ( skipIndex == -1 ) )
+            {
+                // prepend "and" if index > 0
+                xpathExpression += ( ( nIndex > 0 ) ? AND : "" );
+                xpathExpression += contains( parent, TABLE_COLUMN + position( nIndex + 1 ), columnValues[nIndex] );
+            }
+        }
+
+        return xpathExpression;
+    }
+
+    private static String position( int nIndex )
+    {
+        return new String( "[" + nIndex + "]" );
+    }
+
+    private static String contains( String parent, String element, String matchedString )
+    {
+        String finalElement = ( parent != null ) ? parent : "";
+        finalElement += element;
+
+        return contains( finalElement, matchedString );
+    }
+
+    private static String contains( String matchedString )
+    {
+        return contains( ".", matchedString );
+    }
+
+    private static String contains( String axis, String matchedString )
+    {
+        return new String( CONTAINS + "(" + axis + "," + "'" + matchedString + "')" );
+    }
+
+    private static String equals( String parent, String element, String matchedString )
+    {
+        String finalElement = ( parent != null ) ? parent : "";
+        finalElement += element;
+
+        return equals( finalElement, matchedString );
+    }
+
+    private static String equals( String axis, String matchedString )
+    {
+        return new String( axis + "==" + "'" + matchedString + "'" );
+    }
+}
\ No newline at end of file

Added: continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/listener/CaptureScreenShotsListener.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/listener/CaptureScreenShotsListener.java?rev=834357&view=auto
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/listener/CaptureScreenShotsListener.java (added)
+++ continuum/branches/continuum-1.3.x/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/listener/CaptureScreenShotsListener.java Tue Nov 10 05:38:01 2009
@@ -0,0 +1,101 @@
+package org.apache.continuum.web.test.listener;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.regex.Pattern;
+
+import org.apache.continuum.web.test.parent.AbstractSeleniumTest;
+import org.testng.ITestResult;
+import org.testng.TestListenerAdapter;
+
+public class CaptureScreenShotsListener
+    extends TestListenerAdapter
+{
+    @Override
+    public void onTestFailure( ITestResult tr )
+    {
+        captureError( tr );
+        System.out.println( "Test " + tr.getName() + " -> Failed" );
+        super.onTestFailure( tr );
+    }
+
+    @Override
+    public void onTestSuccess( ITestResult tr )
+    {
+        System.out.println( "Test " + tr.getName() + " -> Success" );
+        super.onTestFailure( tr );
+    }
+
+    private void captureError( ITestResult tr )
+    {
+        try
+        {
+            captureScreenshot( tr );
+        }
+        catch ( RuntimeException e )
+        {
+            System.out.println( "Error when take screenshot for test " + tr.getName() );
+            e.printStackTrace();
+        }
+    }
+
+    // captureAssertionError() creates a 'target/screenshots' directory and saves '.png' page screenshot of the
+    // encountered error
+    private void captureScreenshot( ITestResult tr )
+    {
+        File f = new File( "" );
+        String filePath = f.getAbsolutePath();
+        Date d = new Date();
+        SimpleDateFormat sdf = new SimpleDateFormat( "yyyy.MM.dd-HH_mm_ss" );
+        String time = sdf.format( d );
+        String fs = File.separator;
+        File targetPath = new File( filePath + fs + "target" + fs + "screenshots" );
+        targetPath.mkdir();
+        String cName = tr.getTestClass().getName();
+        StackTraceElement stackTrace[] = tr.getThrowable().getStackTrace();
+        int index = getStackTraceIndexOfCallingClass( cName, stackTrace );
+        String methodName = stackTrace[index].getMethodName();
+        int lNumber = stackTrace[index].getLineNumber();
+        String lineNumber = Integer.toString( lNumber );
+        String className = cName.substring( cName.lastIndexOf( '.' ) + 1 );
+        String fileName =
+            targetPath.toString() + fs + methodName + "(" + className + ".java_" + lineNumber + ")-" + time + ".png";
+        AbstractSeleniumTest.getSelenium().windowMaximize();
+        AbstractSeleniumTest.getSelenium().captureEntirePageScreenshot( fileName, "" );
+    }
+
+    private int getStackTraceIndexOfCallingClass( String nameOfClass, StackTraceElement stackTrace[] )
+    {
+        boolean match = false;
+        int i = 0;
+        do
+        {
+            String className = stackTrace[i].getClassName();
+            match = Pattern.matches( nameOfClass, className );
+            i++;
+        }
+        while ( match == false );
+        i--;
+        return i;
+    }
+}



Mime
View raw message