archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1561917 - in /archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test: AuditLogsReportTest.java UserRolesTest.java parent/AbstractArchivaTest.java
Date Tue, 28 Jan 2014 00:57:52 GMT
Author: brett
Date: Tue Jan 28 00:57:51 2014
New Revision: 1561917

URL: http://svn.apache.org/r1561917
Log:
allow user tests to be re-run

Modified:
    archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/AuditLogsReportTest.java
    archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/UserRolesTest.java
    archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java

Modified: archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/AuditLogsReportTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/AuditLogsReportTest.java?rev=1561917&r1=1561916&r2=1561917&view=diff
==============================================================================
--- archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/AuditLogsReportTest.java
(original)
+++ archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/AuditLogsReportTest.java
Tue Jan 28 00:57:51 2014
@@ -147,8 +147,8 @@ public class AuditLogsReportTest
         assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + version +
                                "' was successfully deployed to repository '" + repo + "'"
);
 
-        goToUserManagementPage();
         String username = "testAuditUser";
+        goToUserManagementPage();
         if ( !isLinkPresent( username ) )
         {
             createUserWithRole( username, "Repository Manager - internal", getUserEmail(),
getUserRolePassword() );

Modified: archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/UserRolesTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/UserRolesTest.java?rev=1561917&r1=1561916&r2=1561917&view=diff
==============================================================================
--- archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/UserRolesTest.java
(original)
+++ archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/UserRolesTest.java
Tue Jan 28 00:57:51 2014
@@ -20,11 +20,12 @@ package org.apache.archiva.web.test;
  */
 
 import org.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.testng.annotations.AfterSuite;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 
 @Test( groups = { "userroles" })
-public class UserRolesTest 
+public class UserRolesTest
 	extends AbstractArchivaTest
 {
     @BeforeTest
@@ -33,23 +34,40 @@ public class UserRolesTest 
         loginAsAdmin();
     }
 
+    @AfterSuite
+    public void tearDown()
+    {
+        goToUserManagementPage();
+        String[] usernameProperties =
+            new String[]{ "GUEST_USERNAME", "REGISTERED_USERNAME", "SYSAD_USERNAME", "USERADMIN_USERNAME",
+                "GLOBALREPOMANAGER_USERNAME", "GLOBALREPOOBSERVER_USERNAME", "REPOMANAGER_INTERNAL_USERNAME",
+                "REPOOBSERVER_INTERNAL_USERNAME" };
+        for ( String p : usernameProperties )
+        {
+            String username = getProperty( p );
+
+            if ( isLinkPresent( username ) )
+            {
+                deleteUser( username );
+            }
+        }
+    }
+
     public void testBasicAddDeleteUser()
 	{
 		username = getProperty( "GUEST_USERNAME" );
 		fullname = getProperty( "GUEST_FULLNAME" );
-		
+
 		createUser( username, fullname, getUserEmail(), getUserRolePassword(), true);
-		deleteUser( username, fullname, getUserEmail() );
-        logout();
-        login( getAdminUsername() , getAdminPassword() );
+		deleteUser( username );
 	}
-	
+
 	@Test (dependsOnMethods = { "testBasicAddDeleteUser" } )
 	public void testUserWithGuestRole()
 	{
 		username = getProperty("GUEST_USERNAME");
 		fullname = getProperty("GUEST_FULLNAME");
-		
+
 		createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
 		clickLinkWithText( username );
 		clickLinkWithText( "Edit Roles" );
@@ -59,26 +77,26 @@ public class UserRolesTest 
         logout();
         login(username, getUserRolePassword());
 		changePassword( getUserRolePassword(), getUserRoleNewPassword());
-		
+
 		// this section will be removed if issue from redback after changing password will be fixed.
 		getSelenium().goBack();
         logout();
         //assertTextPresent("You are already logged in.");
-		
+
 		login(username, getUserRoleNewPassword());
 		assertLeftNavMenuWithRole( fullname );
         logout();
         login( getAdminUsername() , getAdminPassword() );
 	}
-	
+
 	@Test (dependsOnMethods = { "testUserWithGuestRole" } )
 	public void testUserWithRegisteredUserRole()
 	{
 		username = getProperty("REGISTERED_USERNAME");
 		fullname = getProperty("REGISTERED_FULLNAME");
-		
+
 		createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
-		clickLinkWithText( username );	
+		clickLinkWithText( username );
 		clickLinkWithText( "Edit Roles" );
 		checkUserRoleWithValue( fullname );
 		clickButtonWithValue( "Submit" );
@@ -86,24 +104,24 @@ public class UserRolesTest 
         logout();
         login(username, getUserRolePassword());
 		changePassword( getUserRolePassword(), getUserRoleNewPassword());
-		
+
 		// this section will be removed if issue from redback after changing password will be fixed.
 		getSelenium().goBack();
         logout();
         //assertTextPresent("You are already logged in.");
-		
+
 		login(username, getUserRoleNewPassword());
 		assertLeftNavMenuWithRole( fullname );
         logout();
         login( getAdminUsername() , getAdminPassword() );
 	}
-	
+
 	@Test (dependsOnMethods = { "testUserWithRegisteredUserRole" } )
 	public void testUserWithSysAdminUserRole()
 	{
 		username = getProperty("SYSAD_USERNAME");
 		fullname = getProperty("SYSAD_FULLNAME");
-		
+
 		createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
 		clickLinkWithText( username );
 		clickLinkWithText( "Edit Roles" );
@@ -113,24 +131,24 @@ public class UserRolesTest 
         logout();
         login(username, getUserRolePassword());
 		changePassword( getUserRolePassword(), getUserRoleNewPassword());
-		
+
 		// this section will be removed if issue from redback after changing password will be fixed.
 		getSelenium().goBack();
         logout();
         //assertTextPresent("You are already logged in.");
-		
+
 		login(username, getUserRoleNewPassword());
 		assertLeftNavMenuWithRole( fullname );
         logout();
         login( getAdminUsername() , getAdminPassword() );
 	}
-	
+
 	@Test (dependsOnMethods = { "testUserWithSysAdminUserRole" } )
 	public void testUserWithUserAdminUserRole()
 	{
 		username = getProperty("USERADMIN_USERNAME");
 		fullname = getProperty("USERADMIN_FULLNAME");
-		
+
 		createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
 		clickLinkWithText( username );
 		clickLinkWithText( "Edit Roles" );
@@ -140,24 +158,24 @@ public class UserRolesTest 
         logout();
         login(username, getUserRolePassword());
 		changePassword( getUserRolePassword(), getUserRoleNewPassword());
-		
+
 		// this section will be removed if issue from redback after changing password will be fixed.
 		getSelenium().goBack();
         logout();
         //assertTextPresent("You are already logged in.");
-		
+
 		login(username, getUserRoleNewPassword());
 		assertLeftNavMenuWithRole( fullname );
         logout();
         login( getAdminUsername() , getAdminPassword() );
 	}
-	
+
 	@Test (dependsOnMethods = { "testUserWithUserAdminUserRole" } )
 	public void testUserWithGlobalRepoManagerRole()
 	{
 		username = getProperty("GLOBALREPOMANAGER_USERNAME");
 		fullname = getProperty("GLOBALREPOMANAGER_FULLNAME");
-		
+
 		createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
 		clickLinkWithText( username );
 		clickLinkWithText( "Edit Roles" );
@@ -167,12 +185,12 @@ public class UserRolesTest 
         logout();
         login(username, getUserRolePassword());
 		changePassword( getUserRolePassword(), getUserRoleNewPassword());
-		
+
 		// this section will be removed if issue from redback after changing password will be fixed.
 		getSelenium().goBack();
         logout();
         //assertTextPresent("You are already logged in.");
-		
+
 		login(username, getUserRoleNewPassword());
 		assertLeftNavMenuWithRole( fullname );
         logout();
@@ -184,7 +202,7 @@ public class UserRolesTest 
 	{
 		username = getProperty("GLOBALREPOOBSERVER_USERNAME");
 		fullname = getProperty("GLOBALREPOOBSERVER_FULLNAME");
-		
+
 		createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
 		clickLinkWithText( username );
 		clickLinkWithText( "Edit Roles" );
@@ -194,18 +212,18 @@ public class UserRolesTest 
         logout();
         login(username, getUserRolePassword());
 		changePassword( getUserRolePassword(), getUserRoleNewPassword());
-		
+
 		// this section will be removed if issue from redback after changing password will be fixed.
 		getSelenium().goBack();
         logout();
         //assertTextPresent("You are already logged in.");
-		
+
 		login(username, getUserRoleNewPassword());
 		assertLeftNavMenuWithRole( fullname );
         logout();
         login( getAdminUsername() , getAdminPassword() );
 	}
-	
+
 	@Test (dependsOnMethods = { "testUserWithGlobalRepoObserverRole" } )
 	public void testUserWithRepoManagerInternalRole()
 	{
@@ -217,12 +235,12 @@ public class UserRolesTest 
         logout();
         login(username, getUserRolePassword());
 		changePassword( getUserRolePassword(), getUserRoleNewPassword());
-		
+
 		// this section will be removed if issue from redback after changing password will be fixed.
 		getSelenium().goBack();
         logout();
         //assertTextPresent("You are already logged in.");
-		
+
 		login(username, getUserRoleNewPassword());
 		assertLeftNavMenuWithRole( fullname );
         logout();
@@ -255,7 +273,7 @@ public class UserRolesTest 
 		clickLinkWithText("Logout");
 		login( getAdminUsername() , getAdminPassword() );
 	}*/
-	
+
 	@Test (dependsOnMethods = { "testUserWithRepoManagerInternalRole" } )
 	public void testUserWithRepoObserverInternalRole()
 	{
@@ -267,12 +285,12 @@ public class UserRolesTest 
         logout();
         login(username, getUserRolePassword());
 		changePassword( getUserRolePassword(), getUserRoleNewPassword());
-		
+
 		// this section will be removed if issue from redback after changing password will be fixed.
 		getSelenium().goBack();
         logout();
         //assertTextPresent("You are already logged in.");
-		
+
 		login(username, getUserRoleNewPassword());
 		assertLeftNavMenuWithRole( fullname );
         logout();

Modified: archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java?rev=1561917&r1=1561916&r2=1561917&view=diff
==============================================================================
--- archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
(original)
+++ archiva/branches/archiva-1.3.x/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
Tue Jan 28 00:57:51 2014
@@ -275,19 +275,12 @@ public abstract class AbstractArchivaTes
         }
     }
 
-    public void deleteUser( String userName, String fullName, String emailAdd )
+    public void deleteUser( String userName )
     {
-        deleteUser( userName, fullName, emailAdd, false, false );
-    }
-
-    public void deleteUser( String userName, String fullName, String emailAd, boolean validated,
boolean locked )
-    {
-        String[] columnValues = { userName, fullName, emailAd };
-        //clickLinkWithText( "userlist" );
-        clickLinkWithXPath( "//table[@id='ec_table']/tbody[2]/tr[3]/td[7]/a/img" );
+        clickLinkWithXPath( "//tr[.//a[text()='" + userName + "']]/td/a[@title='delete user']"
);
         assertDeleteUserPage( userName );
         submit();
-        assertElementNotPresent( XPathExpressionUtil.getTableRow( columnValues ) );
+        assertLinkNotPresent( userName );
     }
 
     public void login( String username, String password )



Mime
View raw message