mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
57055: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3) 56523: Merged HEAD-BUG-FIX to V4.2-BUG-FIX (4.2.1) 56443: (MNT-9756) ALF-19225: Made post feeds cleanup to be executed in the unit test tear down method, to clean Pending, Error and etc. feeds. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61689 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -37,7 +37,6 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
import org.alfresco.repo.activities.post.lookup.PostLookup;
|
import org.alfresco.repo.activities.post.lookup.PostLookup;
|
||||||
import org.alfresco.repo.domain.activities.ActivityFeedDAO;
|
import org.alfresco.repo.domain.activities.ActivityFeedDAO;
|
||||||
@@ -134,7 +133,7 @@ public abstract class FeedTaskProcessor
|
|||||||
}
|
}
|
||||||
catch(JSONException je)
|
catch(JSONException je)
|
||||||
{
|
{
|
||||||
logger.error("Skipping activity post " + activityPost.getId() + " due to invalid activity data: " + je);
|
logger.error("Skipping activity post " + activityPost.getId() + " due to invalid activity data: ", je);
|
||||||
updatePostStatus(activityPost.getId(), ActivityPostEntity.STATUS.ERROR);
|
updatePostStatus(activityPost.getId(), ActivityPostEntity.STATUS.ERROR);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -195,7 +194,7 @@ public abstract class FeedTaskProcessor
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
logger.error("Skipping activity post " + activityPost.getId() + " since failed to get recipients: " + e);
|
logger.error("Skipping activity post " + activityPost.getId() + " since failed to get recipients: ", e);
|
||||||
updatePostStatus(activityPost.getId(), ActivityPostEntity.STATUS.ERROR);
|
updatePostStatus(activityPost.getId(), ActivityPostEntity.STATUS.ERROR);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@@ -155,6 +155,7 @@ public class SubscriptionServiceActivitiesTest
|
|||||||
{
|
{
|
||||||
// We put the scheduler in standby mode BeforeClass. Now we must restore it.
|
// We put the scheduler in standby mode BeforeClass. Now we must restore it.
|
||||||
QUARTZ_SCHEDULER.start();
|
QUARTZ_SCHEDULER.start();
|
||||||
|
AuthenticationUtil.clearCurrentSecurityContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before public void createTestSites() throws Exception
|
@Before public void createTestSites() throws Exception
|
||||||
@@ -171,6 +172,7 @@ public class SubscriptionServiceActivitiesTest
|
|||||||
modSite2 = testSites.createSite("sitePreset", "mod2" + guid, "", "", SiteVisibility.MODERATED, ADMIN);
|
modSite2 = testSites.createSite("sitePreset", "mod2" + guid, "", "", SiteVisibility.MODERATED, ADMIN);
|
||||||
log.debug("Created some test sites...");
|
log.debug("Created some test sites...");
|
||||||
|
|
||||||
|
AuthenticationUtil.clearCurrentSecurityContext();
|
||||||
// test site cleanup is handled automatically by the JUnit Rule.
|
// test site cleanup is handled automatically by the JUnit Rule.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2012
|
* Copyright (C) 2005-2013
|
||||||
Alfresco Software Limited.
|
Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
@@ -20,9 +20,12 @@
|
|||||||
package org.alfresco.util.test.junitrules;
|
package org.alfresco.util.test.junitrules;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.domain.activities.ActivityPostDAO;
|
||||||
|
import org.alfresco.repo.domain.activities.ActivityPostEntity;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.repo.site.SiteModel;
|
import org.alfresco.repo.site.SiteModel;
|
||||||
@@ -70,6 +73,7 @@ public class TemporarySites extends AbstractPersonRule
|
|||||||
{
|
{
|
||||||
final RetryingTransactionHelper transactionHelper = (RetryingTransactionHelper) appContextRule.getApplicationContext().getBean("retryingTransactionHelper");
|
final RetryingTransactionHelper transactionHelper = (RetryingTransactionHelper) appContextRule.getApplicationContext().getBean("retryingTransactionHelper");
|
||||||
final SiteService siteService = appContextRule.getApplicationContext().getBean("siteService", SiteService.class);
|
final SiteService siteService = appContextRule.getApplicationContext().getBean("siteService", SiteService.class);
|
||||||
|
final ActivityPostDAO postDAO = appContextRule.getApplicationContext().getBean("postDAO", ActivityPostDAO.class);
|
||||||
|
|
||||||
// Run as admin to ensure all sites can be deleted irrespective of which user created them.
|
// Run as admin to ensure all sites can be deleted irrespective of which user created them.
|
||||||
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||||
@@ -96,6 +100,15 @@ public class TemporarySites extends AbstractPersonRule
|
|||||||
deletePerson(username);
|
deletePerson(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean all the post feeds
|
||||||
|
int deletedCnt = 0;
|
||||||
|
Date keepDate = new Date(System.currentTimeMillis() + (120 * 1000L));
|
||||||
|
for (ActivityPostEntity.STATUS status : ActivityPostEntity.STATUS.values())
|
||||||
|
{
|
||||||
|
deletedCnt += postDAO.deletePosts(keepDate, status);
|
||||||
|
}
|
||||||
|
log.debug("Deleted " + deletedCnt + " post feeds.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user