mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
124236 amorarasu: Merged 5.0.N (5.0.4) to 5.1.N (5.1.2) (PARTIAL MERGE) 124190 amorarasu: Merged V4.2-BUG-FIX (4.2.7) to 5.0.N (5.0.4) 124132 arebegea: MNT-15573 : Site finder slow for a user who's member of many sites - added a new method to InvitationService to make use of the limit in the searchInvitation - sent and used the 200 limit from the site-finder.get.js in the script/ScriptInvitationService.java and passed the new parameter - for searchModeratedInvitations and searchNominatedInvitations methods of InvitationServiceImpl.java I added the use of the limit parameter - added some comments on ActivitiWorkflowEngine.java and TaskComponent.java to inform developers about the performance issues and possible improvement - added junit tests git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@124277 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1142,6 +1142,10 @@ public abstract class AbstractInvitationServiceImplTest extends BaseAlfrescoSpri
|
||||
List<Invitation> resFive = invitationService.searchInvitation(crit1);
|
||||
assertEquals("user one does not have 2 nominated", 2, resFive.size());
|
||||
|
||||
// now limit the search to 1 returned value
|
||||
List<Invitation> limitRes = invitationService.searchInvitation(crit1, 1);
|
||||
assertEquals("user one does not have 1 nominated", 1, limitRes.size());
|
||||
|
||||
/**
|
||||
* Search with an empty criteria - should find all open invitations
|
||||
*/
|
||||
@@ -1149,6 +1153,10 @@ public abstract class AbstractInvitationServiceImplTest extends BaseAlfrescoSpri
|
||||
invitationService.searchInvitation(crit2);
|
||||
assertTrue("search everything returned 0 elements", resFive.size() > 0);
|
||||
|
||||
// now search everything but limit the results to 3
|
||||
invitationService.searchInvitation(crit2, 3);
|
||||
assertTrue("search everything returned 0 or more than 3 elements", resFive.size() > 0 && resFive.size() <=3);
|
||||
|
||||
InvitationSearchCriteriaImpl crit3 = new InvitationSearchCriteriaImpl();
|
||||
crit3.setInviter(USER_MANAGER);
|
||||
crit3.setInvitationType(InvitationSearchCriteria.InvitationType.NOMINATED);
|
||||
@@ -1156,6 +1164,51 @@ public abstract class AbstractInvitationServiceImplTest extends BaseAlfrescoSpri
|
||||
List<Invitation> res3 = invitationService.searchInvitation(crit3);
|
||||
assertEquals("user one does not have 2 nominated", 2, res3.size());
|
||||
|
||||
//now limit the search to 1 result
|
||||
res3 = invitationService.searchInvitation(crit3, 1);
|
||||
assertEquals("user one does not have 1 nominated", 1, res3.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* test that the search limiter works
|
||||
*/
|
||||
public void testSearchInvitationWithLimit() throws Exception
|
||||
{
|
||||
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
|
||||
String resourceName = SITE_SHORT_NAME_INVITE;
|
||||
String inviteeRole = SiteModel.SITE_COLLABORATOR;
|
||||
String serverPath = "wibble";
|
||||
String acceptUrl = "froob";
|
||||
String rejectUrl = "marshmallow";
|
||||
|
||||
authenticationComponent.setCurrentUser(USER_MANAGER);
|
||||
|
||||
// Create 10 invites
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
invitationService
|
||||
.inviteNominated(USER_ONE, resourceType, resourceName, inviteeRole, serverPath, acceptUrl, rejectUrl);
|
||||
}
|
||||
|
||||
// Invite USER_TWO
|
||||
NominatedInvitation inviteForUserTwo = invitationService.inviteNominated(USER_TWO, resourceType, resourceName,
|
||||
inviteeRole, serverPath, acceptUrl, rejectUrl);
|
||||
|
||||
InvitationSearchCriteriaImpl query = new InvitationSearchCriteriaImpl();
|
||||
query.setInvitee(USER_TWO);
|
||||
|
||||
// search all of them
|
||||
List<Invitation> results = invitationService.searchInvitation(query, 0);
|
||||
assertEquals(1, results.size());
|
||||
assertEquals(inviteForUserTwo.getInviteId(), results.get(0).getInviteId());
|
||||
|
||||
query = new InvitationSearchCriteriaImpl();
|
||||
query.setInvitee(USER_ONE);
|
||||
|
||||
final int MAX_SEARCH = 3;
|
||||
// only search for the first MAX_SEARCH
|
||||
results = invitationService.searchInvitation(query, MAX_SEARCH);
|
||||
assertEquals(MAX_SEARCH, results.size());
|
||||
}
|
||||
|
||||
public void disabled_test100Invites() throws Exception
|
||||
@@ -1175,7 +1228,7 @@ public abstract class AbstractInvitationServiceImplTest extends BaseAlfrescoSpri
|
||||
invitationService.inviteNominated(USER_ONE, resourceType, resourceName, inviteeRole, serverPath, acceptUrl, rejectUrl);
|
||||
}
|
||||
|
||||
// Invite USER_TWO
|
||||
// Invite USER_TWO
|
||||
NominatedInvitation invite = invitationService.inviteNominated(USER_TWO, resourceType, resourceName, inviteeRole, serverPath, acceptUrl, rejectUrl);
|
||||
|
||||
InvitationSearchCriteriaImpl query = new InvitationSearchCriteriaImpl();
|
||||
|
Reference in New Issue
Block a user