You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by br...@apache.org on 2006/12/28 03:18:59 UTC

svn commit: r490628 - in /maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test: AbstractContinuumTestCase.java AccountSecurityTest.java AddMavenTwoProjectTest.java SchedulesPageTest.java

Author: brett
Date: Wed Dec 27 18:18:58 2006
New Revision: 490628

URL: http://svn.apache.org/viewvc?view=rev&rev=490628
Log:
fix all continuum web tests

Modified:
    maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java
    maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AccountSecurityTest.java
    maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTest.java
    maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/SchedulesPageTest.java

Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java?view=diff&rev=490628&r1=490627&r2=490628
==============================================================================
--- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java (original)
+++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AbstractContinuumTestCase.java Wed Dec 27 18:18:58 2006
@@ -441,30 +441,30 @@
     }
 
     public void tearDown()
+        throws Exception
     {
-        try
-        {
-            goToLoginPage();
-
-            submitLoginPage( adminUsername, adminPassword );
+        login( adminUsername, adminPassword );
 
-            goToProjectGroupsSummaryPage();
+        goToProjectGroupsSummaryPage();
 
-            if ( isLinkPresent( TEST_PROJ_GRP_NAME ) )
-            {
-                removeProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION );
-            }
-            if ( isLinkPresent( DEFAULT_PROJ_GRP_NAME ) &&
-                "0".equals( getCellValueFromTable( "ec_table", 1, 2 ) ) == false )
-            {
-                removeProjectGroup( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION );
-                addProjectGroup( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION );
-            }
+        if ( isLinkPresent( TEST_PROJ_GRP_NAME ) )
+        {
+            removeProjectGroup( TEST_PROJ_GRP_NAME, TEST_PROJ_GRP_ID, TEST_PROJ_GRP_DESCRIPTION );
+        }
+        // TODO: clean this up
+        if ( isLinkPresent( "Apache Maven" ) )
+        {
+            removeProjectGroup( "Apache Maven", "org.apache.maven", "Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information." );
+        }
+        if ( isLinkPresent( "Maven One Project" ) )
+        {
+            removeProjectGroup( "Maven One Project", "maven-one-project", "This is a sample Maven One Project." );
         }
-        catch ( Exception e )
+        if ( isLinkPresent( DEFAULT_PROJ_GRP_NAME ) &&
+            "0".equals( getCellValueFromTable( "ec_table", 1, 2 ) ) == false )
         {
-            // TODO! should be rethrowing this, but the tearDown in the parent doesn't allow it
-            e.printStackTrace();
+            removeProjectGroup( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION );
+            addProjectGroup( DEFAULT_PROJ_GRP_NAME, DEFAULT_PROJ_GRP_ID, DEFAULT_PROJ_GRP_DESCRIPTION );
         }
 
         super.tearDown();

Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AccountSecurityTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AccountSecurityTest.java?view=diff&rev=490628&r1=490627&r2=490628
==============================================================================
--- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AccountSecurityTest.java (original)
+++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AccountSecurityTest.java Wed Dec 27 18:18:58 2006
@@ -22,10 +22,10 @@
     extends AbstractAuthenticatedAccessTestCase
 {
     public final String SIMPLE_POM = getBasedir() + "/target/test-classes/unit/simple-project/pom.xml";
-    
+
     // create user fields
-    public static final String CREATE_FORM_USERNAME_FIELD = "userCreateForm_user_username";    
-    
+    public static final String CREATE_FORM_USERNAME_FIELD = "userCreateForm_user_username";
+
     public static final String CREATE_FORM_FULLNAME_FIELD = "userCreateForm_user_fullName";
 
     public static final String CREATE_FORM_EMAILADD_FIELD = "userCreateForm_user_email";
@@ -39,7 +39,7 @@
     public static final String CONFIRM_PASSWORD_FIELD = "user.confirmPassword";
 
     // user account 1
-    public static final String CUSTOM_USERNAME = "custom";
+    public static final String CUSTOM_USERNAME = "custom1";
 
     public static final String CUSTOM_USERNAME2 = "custom2";
 
@@ -65,13 +65,43 @@
         return super.adminPassword;
     }
 
+    public void tearDown()
+        throws Exception
+    {
+        login( adminUsername, adminPassword );
+
+        clickLinkWithText( "Users" );
+
+        String[] users = {CUSTOM_USERNAME, CUSTOM_USERNAME2, CUSTOM_USERNAME3, CUSTOM_USERNAME4, CUSTOM_USERNAME5};
+
+        for ( int i = 0; i < users.length; i++ )
+        {
+            String[] columns = new String[]{users[i], CUSTOM_FULLNAME, CUSTOM_EMAILADD};
+            if ( isElementPresent( XPathExpressionUtil.getTableRow( columns ) ) )
+            {
+                if ( i == 4 )
+                {
+                    // TODO! this is due to a bug where roles are not removed with the user, so remove them by hand
+                    clickLinkWithText( CUSTOM_USERNAME5 );
+                    checkField( "removeRolesFromUser_removeSelectedRolesSystem Administrator" );
+                    clickButtonWithValue( "Remove Selected Roles" );
+                }
+
+                deleteUser( users[i], CUSTOM_FULLNAME, CUSTOM_EMAILADD );
+            }
+        }
+
+        logout();
+
+        super.tearDown();
+    }
+
     public void testBasicUserAddDelete()
     {
         createUser( CUSTOM_USERNAME, CUSTOM_FULLNAME, CUSTOM_EMAILADD, CUSTOM_PASSWORD, true );
 
         // delete custom user
         deleteUser( CUSTOM_USERNAME, CUSTOM_FULLNAME, CUSTOM_EMAILADD );
-        logout();
     }
 
     public void testPasswordConfirmation()
@@ -194,8 +224,7 @@
             else
             {
                 // on the 3rd try, account is locked and we are returned to the Group Summary Page
-                login( this.CUSTOM_USERNAME4, this.CUSTOM_PASSWORD + "error", false,
-                             "Continuum - Group Summary" );
+                login( this.CUSTOM_USERNAME4, this.CUSTOM_PASSWORD + "error", false, "Continuum - Group Summary" );
                 assertTextPresent( "Account Locked" );
             }
         }
@@ -205,31 +234,31 @@
         deleteUser( CUSTOM_USERNAME4, CUSTOM_FULLNAME, CUSTOM_EMAILADD, false, true );
         logout();
     }
-       
+
     public void testDefaultRolesOfNewSystemAdministrator()
     {
         // initialize
-        createUser( CUSTOM_USERNAME5, CUSTOM_FULLNAME, CUSTOM_EMAILADD, CUSTOM_PASSWORD, true);
-                      
+        createUser( CUSTOM_USERNAME5, CUSTOM_FULLNAME, CUSTOM_EMAILADD, CUSTOM_PASSWORD, true );
+
         // upgrade the role of the user to system administrator
         //TODO: check Permanent/validated/locked columns
-        String[] columnValues = { CUSTOM_USERNAME5, CUSTOM_FULLNAME, CUSTOM_EMAILADD };
+        String[] columnValues = {CUSTOM_USERNAME5, CUSTOM_FULLNAME, CUSTOM_EMAILADD};
         clickLinkWithText( CUSTOM_USERNAME5 );
-                        
+
         checkField( "addRolesToUser_addSelectedRolesSystem Administrator" );
         clickButtonWithValue( "Add Selected Roles" );
 
         // verify roles        
-        String[] roleList = { "System Administrator",
-                              "User Administrator",
-                              "Continuum Group Project Administrator",
-                              "Project Developer - Default Project Group",
-                              "Project User - Default Project Group" };
-        
+        String[] roleList = {"Project User - Maven One Project", "Project Developer - Test Project Group Name",
+            "User Administrator", "System Administrator", "Project Developer - Maven One Project",
+            "Project Developer - Default Project Group", "Project Developer - Apache Maven",
+            "Project User - Apache Maven", "Project User - Default Project Group",
+            "Continuum Group Project Administrator", "Project User - Test Project Group Name"};
+
         assertElementPresent( XPathExpressionUtil.getList( roleList ) );
         deleteUser( CUSTOM_USERNAME5, CUSTOM_FULLNAME, CUSTOM_EMAILADD );
     }
-    
+
     private void createUser( String userName, String fullName, String emailAdd, String password, boolean valid )
     {
         createUser( userName, fullName, emailAdd, password, password, valid );
@@ -275,8 +304,7 @@
     private void deleteUser( String userName, String fullName, String emailAdd, boolean validated, boolean locked )
     {
         //TODO: Add permanent/validated/locked values
-        String[] columnValues =
-            {userName, fullName, emailAdd};
+        String[] columnValues = {userName, fullName, emailAdd};
 
         clickLinkWithText( "Users" );
 

Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTest.java?view=diff&rev=490628&r1=490627&r2=490628
==============================================================================
--- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTest.java (original)
+++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/AddMavenTwoProjectTest.java Wed Dec 27 18:18:58 2006
@@ -35,7 +35,9 @@
 
         addMavenTwoProject( TEST_POM_URL, TEST_POM_USERNAME, TEST_POM_PASSWORD, TEST_PROJ_GRP_NAME, true );
 
-        assertCellValueFromTable( "1", "ec_table", 1, 2 );
+        assertCellValueFromTable( TEST_PROJ_GRP_NAME, "ec_table", 2, 0 );
+        assertCellValueFromTable( TEST_PROJ_GRP_ID, "ec_table", 2, 1 );
+        assertCellValueFromTable( "1", "ec_table", 2, 2 );
     }
 
     /**

Modified: maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/SchedulesPageTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/SchedulesPageTest.java?view=diff&rev=490628&r1=490627&r2=490628
==============================================================================
--- maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/SchedulesPageTest.java (original)
+++ maven/continuum/trunk/continuum-webapp-test/src/test/it/org/apache/continuum/web/test/SchedulesPageTest.java Wed Dec 27 18:18:58 2006
@@ -373,6 +373,7 @@
     }
 
     public void tearDown()
+        throws Exception
     {
         logout();