continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1369756 [3/3] - in /continuum/trunk/continuum-webapp-test: ./ src/test/java/org/apache/continuum/web/test/ src/test/resources/ src/test/testng/org/apache/continuum/web/test/ src/test/testng/org/apache/continuum/web/test/listener/ src/test/...
Date Mon, 06 Aug 2012 09:24:57 GMT
Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractUserRolesManagementTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractUserRolesManagementTest.java?rev=1369756&r1=1369755&r2=1369756&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractUserRolesManagementTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractUserRolesManagementTest.java
Mon Aug  6 09:24:56 2012
@@ -1,47 +1,30 @@
 package org.apache.continuum.web.test.parent;
 
-import java.io.File;
-
 public abstract class AbstractUserRolesManagementTest
     extends AbstractAdminTest
 {
 	protected String username;
 	protected String fullname;
 
-	public String getUserEmail()
+	protected String getUserEmail()
 	{
-		String email = getProperty( "USERROLE_EMAIL" );
-		return email;
+        return getProperty( "USERROLE_EMAIL" );
 	}
 
-	public String getUserRolePassword()
+	protected String getUserRolePassword()
 	{
-		String password = getProperty( "USERROLE_PASSWORD" );
-		return password;
+        return getProperty( "USERROLE_PASSWORD" );
 	}
 
-	public String getUserRoleNewPassword()
+	protected String getUserRoleNewPassword()
 	{
-		String password_new = getProperty( "NEW_USERROLE_PASSWORD" );
-		return password_new;
+        return getProperty( "NEW_USERROLE_PASSWORD" );
 	}
 
-	public String getBasedir()
-    {
-        String basedir = System.getProperty( "basedir" );
-
-        if ( basedir == null )
-        {
-            basedir = new File( "" ).getAbsolutePath();
-        }
-
-        return basedir;
-    }
-
-	////////////////////////////
+    ////////////////////////////
 	// Assertions
 	////////////////////////////
-	public void assertCreateUserPage()
+    protected void assertCreateUserPage()
 	{
 		assertPage( "[Admin] User Create" );
 		assertTextPresent( "[Admin] User Create" );
@@ -58,7 +41,7 @@ public abstract class AbstractUserRolesM
 		assertButtonWithValuePresent( "Create User" );
 	}
 
-	public void assertUserRolesPage()
+	protected void assertUserRolesPage()
 	{
 		assertPage( "[Admin] User Edit" );
 		assertTextPresent( "[Admin] User Roles" );
@@ -68,7 +51,7 @@ public abstract class AbstractUserRolesM
 				assertTextPresent( userroles );
 	}
 
-	   public void assertCreatedUserInfo( String username )
+	   protected void assertCreatedUserInfo( String username )
     {
         selectValue( "name=ec_rd", "50" );
         waitPage();
@@ -76,122 +59,123 @@ public abstract class AbstractUserRolesM
         clickLinkWithText( "Edit Roles" );
     }
 
-	public void assertUserRoleCheckBoxPresent( String value )
+	void assertUserRoleCheckBoxPresent( String value )
     {
     	getSelenium().isElementPresent( "xpath=//input[@id='addRolesToUser_addNDSelectedRoles'
and @name='addNDSelectedRoles' and @value='"+ value + "']" );
     }
 
-    public void assertResourceRolesCheckBoxPresent( String value )
+    void assertResourceRolesCheckBoxPresent( String value )
     {
     	getSelenium().isElementPresent( "xpath=//input[@name='addDSelectedRoles' and @value='"
+ value + "']" );
     }
 
-    public void checkUserRoleWithValue( String value )
+    protected void checkUserRoleWithValue( String value )
     {
     	assertUserRoleCheckBoxPresent( value );
     	getSelenium().click( "xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles'
and @value='"+ value + "']" );
     }
 
-    public void checkResourceRoleWithValue( String value )
+    protected void checkResourceRoleWithValue( String value )
     {
     	assertResourceRolesCheckBoxPresent( value );
     	getSelenium().click( "xpath=//input[@name='addDSelectedRoles' and @value='" + value
+ "']" );
     }
 
-	public void assertLeftNavMenuWithRole( String role )
+	protected void assertLeftNavMenuWithRole( String role )
 	{
-		if( role == "System Administrator" )
+		if( "System Administrator".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Maven Project,Maven 1.x Project,Ant Project,Shell
Project,Local Repositories,Purge Configurations,Schedules,Installations,Build Environments,Queues,Build
Definition Templates,Configuration,Appearance,Users,Roles,Build Queue";
     		String[] arrayNavMenu = navMenu.split( "," );
     		for( String navmenu : arrayNavMenu )
     			assertLinkPresent( navmenu );
     	}
-    	else if( role == "User Administrator" )
+    	else if( "User Administrator".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Users,Roles";
     		String[] arrayNavMenu = navMenu.split( "," );
     		for( String navmenu : arrayNavMenu )
     			assertLinkPresent( navmenu );
     	}
-    	else if( role == "Continuum Group Project Administrator" )
+    	else if( "Continuum Group Project Administrator".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Maven Project,Maven 1.x Project,Ant Project,Shell
Project,Schedules,Queues,Users,Roles";
     		String[] arrayNavMenu = navMenu.split( "," );
     		for( String navmenu : arrayNavMenu )
     			assertLinkPresent( navmenu );
     	}
-    	else if( role == "Continuum Group Project Developer" )
+    	else if( "Continuum Group Project Developer".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Queues";
     		String[] arrayNavMenu = navMenu.split( "," );
     		for( String navmenu : arrayNavMenu )
     			assertLinkPresent( navmenu );
     	}
-    	else if( role == "Continuum Group Project User" )
+    	else if( "Continuum Group Project User".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Queues";
     		String[] arrayNavMenu = navMenu.split( "," );
     		for( String navmenu : arrayNavMenu )
     			assertLinkPresent( navmenu );
     	}
-    	else if( role == "Continuum Manage Build Environments" )
+    	else if( "Continuum Manage Build Environments".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Build Environments";
     		String[] arrayNavMenu = navMenu.split( "," );
     		for( String navmenu : arrayNavMenu )
     			assertLinkPresent( navmenu );
     	}
-    	else if( role == "Continuum Manage Build Templates" )
+    	else if( "Continuum Manage Build Templates".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Build Definition Templates";
     		String[] arrayNavMenu = navMenu.split( "," );
     		for( String navmenu : arrayNavMenu )
     			assertLinkPresent( navmenu );
     	}
-    	else if( role == "Continuum Manage Installations" )
+    	else if( "Continuum Manage Installations".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Installations";
     		String[] arrayNavMenu = navMenu.split( "," );
     		for( String navmenu : arrayNavMenu )
     			assertLinkPresent( navmenu );
     	}
-    	else if( role == "Continuum Manage Local Repositories" )
+    	else if( "Continuum Manage Local Repositories".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Local Repositories";
     		String[] arrayNavMenu = navMenu.split( "," );
     		for( String navmenu : arrayNavMenu )
     			assertLinkPresent( navmenu );
     	}
-    	else if( role == "Continuum Manage Purging" )
+    	else if( "Continuum Manage Purging".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Purge Configurations";
     		String[] arrayNavMenu = navMenu.split( "," );
     		for( String navmenu : arrayNavMenu )
     			assertLinkPresent( navmenu );
     	}
-    	else if( role == "Continuum Manage Queues" )
+    	else if( "Continuum Manage Queues".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Queues";
     		String[] arrayNavMenu = navMenu.split( "," );
     		for( String navmenu : arrayNavMenu )
     			assertLinkPresent( navmenu );
     	}
-    	else if( role == "Continuum Manage Scheduling" )
+    	else if( "Continuum Manage Scheduling".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Schedules";
     		String[] arrayNavMenu = navMenu.split( "," );
     		for( String navmenu : arrayNavMenu )
     			assertLinkPresent( navmenu );
     	}
-    	else if( role == "Project Administrator - Default Project Group" )
+    	else if( "Project Administrator - Default Project Group".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Queues,Users,Roles";
     		String[] arrayNavMenu = navMenu.split( "," );
     		for( String navmenu : arrayNavMenu )
     			assertLinkPresent( navmenu );
     	}
-    	else if( role == "Project Developer - Default Project Group" || role == "Project User
- Default Project Group" )
+    	else if( "Project Developer - Default Project Group".equals( role ) ||
+            "Project User - Default Project Group".equals( role ) )
     	{
     		String navMenu = "About,Show Project Groups,Queues";
     		String[] arrayNavMenu = navMenu.split( "," );
@@ -210,16 +194,16 @@ public abstract class AbstractUserRolesM
 
 	}
 
-    public void assertDeleteUserPage( String username )
+    void assertDeleteUserPage( String username )
     {
-        assertPage( "[Admin] User Delete" ); //TODO
+        assertPage( "[Admin] User Delete" );
         assertTextPresent( "[Admin] User Delete" );
         assertTextPresent( "The following user will be deleted:" );
         assertTextPresent( "Username: " + username );
         assertButtonWithValuePresent( "Delete User" );
     }
 
-	public void assertProjectAdministratorAccess()
+	protected void assertProjectAdministratorAccess()
     {
         assertLinkPresent( "About" );
         assertLinkPresent( "Show Project Groups" );
@@ -245,7 +229,7 @@ public abstract class AbstractUserRolesM
 	/////////////////////////////////////////
 	// User Roles Management
 	/////////////////////////////////////////
-    public void changePassword( String oldPassword, String newPassword )
+    protected void changePassword( String oldPassword, String newPassword )
 	{
 		assertPage( "Change Password" );
 		setFieldValue( "existingPassword", oldPassword );
@@ -254,13 +238,12 @@ public abstract class AbstractUserRolesM
 		clickButtonWithValue( "Change Password" );
 	}
 
-	public void createUser( String userName, String fullName, String email, String password,
boolean valid )
+	protected void createUser( String userName, String fullName, String email, String password
)
 	{
-		createUser( userName, fullName, email, password, password, valid );
+		createUser( userName, fullName, email, password, password );
 	}
 
-	private void createUser( String userName, String fullName, String emailAd, String password,
String confirmPassword,
-                             boolean valid )
+	private void createUser( String userName, String fullName, String emailAd, String password,
String confirmPassword )
 	{
 		loginAsAdmin();
 		clickLinkWithText( "Users" );
@@ -275,77 +258,10 @@ public abstract class AbstractUserRolesM
 
         assertUserRolesPage( );
         clickButtonWithValue( "Submit" );
-
-        /*if (valid )
-        {
-        	String[] columnValues = {userName, fullName, emailAd};
-            assertElementPresent( XPathExpressionUtil.getTableRow( columnValues ) );
-        }
-        else
-        {
-            assertCreateUserPage();
-        }*/
 	}
 
 
-    public void login( String username, String password, boolean valid, String assertReturnPage
)
-	{
-        if ( isLinkPresent( "Login" ) )
-	    {
-            goToLoginPage();
-
-            submitLoginPage( username, password, false, valid, assertReturnPage );
-	    }
-    }
-
-    public void submitLoginPage( String username, String password )
-    {
-        submitLoginPage( username, password, false, true, "Login Page" );
-    }
-
-    public void submitLoginPage( String username, String password, boolean validUsernamePassword
)
-    {
-        submitLoginPage( username, password, false, validUsernamePassword, "Login Page" );
-    }
-
-    public void submitLoginPage( String username, String password, boolean rememberMe, boolean
validUsernamePassword,
-                                 String assertReturnPage )
-    {
-        assertLoginPage();
-        setFieldValue( "username", username );
-        setFieldValue( "password", password );
-        if ( rememberMe )
-        {
-            checkField( "rememberMe" );
-        }
-        clickButtonWithValue( "Login" );
-
-        if ( validUsernamePassword )
-        {
-            assertTextPresent( "Current User:" );
-            assertTextPresent( username );
-            assertLinkPresent( "Edit Details" );
-            assertLinkPresent( "Logout" );
-        }
-        else
-        {
-            if ( "Login Page".equals( assertReturnPage ) )
-            {
-                assertLoginPage();
-            }
-            else
-            {
-                assertPage( assertReturnPage );
-            }
-        }
-    }
-
-	public void deleteUser( String userName, String fullName, String emailAdd )
-    {
-        deleteUser( userName, fullName, emailAdd, false, false );
-    }
-
-    public void deleteUser( String userName, String fullName, String emailAd, boolean validated,
boolean locked )
+    protected void deleteUser( String userName )
     {
 	    //clickLinkWithText( "userlist" );
         clickLinkWithXPath( "//table[@id='ec_table']/tbody[2]/tr[3]/td[7]/a/img" );



Mime
View raw message