Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

99691: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud)
      99496: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.2)
         99400: Merged DEV to V4.2-BUG-FIX (4.2.5)
            99360 : MNT-13234 : Duplicate activities in activities feed
               - Added check for avoid duplicate activities
               - Added test


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@100483 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-03-27 22:52:23 +00:00
parent cfa04ebc70
commit 9034d57c09

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
* Copyright (C) 2005-2015 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -578,6 +578,50 @@ public class SiteActivitySystemTest extends TestCase
// TODO - add more (eg. other non-admin user activities)
}
public void testMNT13234() throws Exception
{
// as admin
String ticket = callLoginWebScript(WEBSCRIPT_ENDPOINT, ADMIN_USER, ADMIN_PW);
assertNotNull(ticket);
// create users (should contain uppercase letter)
String testid = ""+System.currentTimeMillis();
String user1 = "User1_" + testid;
String user2 = "User2_" + testid;
createUser(ticket, user1, USER_PW);
createUser(ticket, user2, USER_PW);
addFollower(user1, user2, ticket);
// create site and add memberships
String site1 = "test_site1_" + testid;
createSite(site1, true, ticket);
addMembership(site1, user1, ticket, SiteModel.SITE_CONSUMER);
addMembership(site1, user2, ticket, SiteModel.SITE_CONSUMER);
Thread.sleep(DELAY_MSECS);
addFeedControl(user1, site1, null, ticket);
getUserFeed(user1, ticket, true, 2);
}
private void addFollower(String follower, String user, String ticket) throws Exception
{
// Build the JSON follow request data
JSONArray jsonArray = new JSONArray();
jsonArray.put(user);
String url = WEBSCRIPT_ENDPOINT + "/api/subscriptions/" + follower + "/follow";
String response = callPostWebScript(url, ticket, jsonArray.toString());
if (logger.isDebugEnabled())
{
logger.debug("follow: " + follower + " - " + user);
logger.debug("--------------");
logger.debug(url);
logger.debug(response);
}
}
private void addMembership(String siteId, String userName, String ticket, String role) throws Exception
{
// Build the JSON membership object