continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r834714 - in /continuum/trunk: continuum-webapp-test/src/test/resources/ continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/
Date Tue, 10 Nov 2009 23:47:27 GMT
Author: ctan
Date: Tue Nov 10 23:47:26 2009
New Revision: 834714

URL: http://svn.apache.org/viewvc?rev=834714&view=rev
Log:
[CONTINUUM-2387] fixed members tab for groups that start or end with the same string
merge -r 834712:834713 of 1.3.x branch

Modified:
    continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ProjectGroupTest.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java

Modified: continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties?rev=834714&r1=834713&r2=834714&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties (original)
+++ continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties Tue Nov 10
23:47:26 2009
@@ -113,10 +113,13 @@
 # Test properties for testProjectGroupMembers
 TEST_PROJ_GRP_NAME_ONE=Group
 TEST_PROJ_GRP_ID_ONE=Group Id
-TEST_PROJ_GRP_DESCRIPTION_ONE=Project group for members test
-TEST_PROJ_GRP_NAME_TWO=Group-Two
-TEST_PROJ_GRP_ID_TWO=Group Id Two
-TEST_PROJ_GRP_DESCRIPTION_TWO=Project group two for members test
+TEST_PROJ_GRP_DESCRIPTION_ONE=First project group for members test
+TEST_PROJ_GRP_NAME_TWO=Group My
+TEST_PROJ_GRP_ID_TWO=Group Id My
+TEST_PROJ_GRP_DESCRIPTION_TWO=Second project group for members test
+TEST_PROJ_GRP_NAME_THREE = My Group
+TEST_PROJ_GRP_ID_THREE=My Group Id
+TEST_PROJ_GRP_DESCRIPTION_THREE=Third project group for members test
 
 ########################
 # notifier group 

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ProjectGroupTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ProjectGroupTest.java?rev=834714&r1=834713&r2=834714&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ProjectGroupTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ProjectGroupTest.java
Tue Nov 10 23:47:26 2009
@@ -175,6 +175,9 @@
         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" );
+        String GRP_NAME_THREE = getProperty( "TEST_PROJ_GRP_NAME_THREE" );
+        String GRP_ID_THREE = getProperty( "TEST_PROJ_GRP_ID_THREE" );
+        String GRP_DESCRIPTION_THREE = getProperty( "TEST_PROJ_GRP_DESCRIPTION_THREE" );
 
         addProjectGroup( GRP_NAME_ONE, GRP_ID_ONE, GRP_DESCRIPTION_ONE, true );
         assertLinkPresent( GRP_NAME_ONE );
@@ -182,23 +185,37 @@
         addProjectGroup( GRP_NAME_TWO, GRP_ID_TWO, GRP_DESCRIPTION_TWO, true );
         assertLinkPresent( GRP_NAME_TWO );
 
+        addProjectGroup( GRP_NAME_THREE, GRP_ID_THREE, GRP_DESCRIPTION_THREE, true );
+        assertLinkPresent( GRP_NAME_THREE );
+
         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 );
+        createAndAddUserAsDeveloperToGroup( "username4", "user4", "user4@something.com",
"password123", GRP_NAME_THREE );
 
         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" );
+        assertUserNotPresent( "username4", "user4", "user4@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" );
+        assertUserNotPresent( "username4", "user4", "user4@something.com" );
+
+        showMembers( GRP_NAME_THREE, GRP_ID_THREE, GRP_DESCRIPTION_THREE );
+        assertUserNotPresent( "username1", "user1", "user1@something.com" );
+        assertUserNotPresent( "username2", "user2", "user2@something.com" );
+        assertUserNotPresent( "username3", "user3", "user3@something.com" );
+        assertUserPresent( "username4", "user4", "user4@something.com" );
 
         removeProjectGroup( GRP_NAME_ONE );
         assertLinkNotPresent( GRP_NAME_ONE );
         removeProjectGroup( GRP_NAME_TWO );
         assertLinkNotPresent( GRP_NAME_TWO );
+        removeProjectGroup( GRP_NAME_THREE );
+        assertLinkNotPresent( GRP_NAME_THREE );
     }
 }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java?rev=834714&r1=834713&r2=834714&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
Tue Nov 10 23:47:26 2009
@@ -30,6 +30,7 @@
 import java.util.Map;
 
 import org.apache.commons.collections.ComparatorUtils;
+import org.apache.commons.lang.StringUtils;
 import org.apache.continuum.buildmanager.BuildManagerException;
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.model.project.ProjectScmRoot;
@@ -54,7 +55,6 @@
 import org.codehaus.plexus.redback.role.RoleManager;
 import org.codehaus.plexus.redback.role.RoleManagerException;
 import org.codehaus.plexus.redback.users.User;
-import org.codehaus.plexus.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -692,8 +692,9 @@
             List<String> roleNames = new ArrayList<String>();
             for ( Role r : roles )
             {
-                int index = r.getName().indexOf( projectGroup.getName() );
-                if ( index > -1 && r.getName().substring( index ).trim().equals(
projectGroup.getName() ) )
+                String projectGroupName = StringUtils.substringAfter( r.getName(), "-" ).trim();
+
+                if ( projectGroupName.equals( group.getName() ) )
                 {
                     roleNames.add( r.getName() );
                 }



Mime
View raw message