Reverse Merge attempt at merging from V4.1-BUG-FIX (will do it again)

AND record only merge the original commits 59231,59239 and reverse merge 59262 that took place on V4.1-BUG-FIX   
   59237: Merged V4.1-BUG-FIX (4.1.8) to V4.2-BUG-FIX (4.2.1)
      59231: MNT-10237: Merged V4.1.6 (4.1.6.4) to V4.1-BUG-FIX (4.1.8)
         58895: MNT-10109: Merged DEV to PATCHES/V4.1.6 (4.1.6.4)
            58855: MNT-10109: Permissions are not restored when a deleted site is recovered from the trashcan
               - Fix unit tests failure by purging archived sites. Forbid new site creation if site group already exists.
            58871: MNT-10109: Permissions are not restored when a deleted site is recovered from the trashcan
               - Return beforePurgeNode callback binding to Site class.
         58947: MNT-10109: PATCHES/V4.1.6 (4.1.6.4)
            58946: MNT-10109: Permissions are not restored when a deleted site is recovered from the trashcan
               - Fix test failures by purging deleted sites from trashcan so that sitename can be reused. Change SiteServiceImplTest to avoid database deadlock.
         58949: MNT-10109: PATCHES/V4.1.6 (4.1.6.4)
            58948: MNT-10109: Permissions are not restored when a deleted site is recovered from the trashcan
               - Fix test failures by purging deleted sites from trashcan so that sitename can be reused.
   59240: Merged V4.1-BUG-FIX (4.1.8) to V4.2-BUG-FIX (4.2.1)
      59239: MNT-10237: Permissions are not restored when a deleted site is recovered from the trashcan
         - The merge of the HF commit on 4.1.6 removed a variable that was not being used, but
           was being used in later versions.
   59241: MNT-10237: Permissions are not restored when a deleted site is recovered from the trashcan
      - Correct error in merge from V4.1-BUG-FIX to V4.2-BUG-FIX


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/V4.2-BUG-FIX/root@59266 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2013-12-22 08:16:06 +00:00
parent 7f69061f29
commit 44c236573e
10 changed files with 22 additions and 128 deletions

View File

@@ -21,7 +21,6 @@ package org.alfresco.repo.web.scripts;
import java.text.MessageFormat;
import java.util.List;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
@@ -72,7 +71,6 @@ public class ReadOnlyTransactionInGetRestApiTest extends BaseWebScriptTest
private SiteService siteService;
private NodeService nodeService;
private TransactionService transactionService;
private NodeArchiveService nodeArchiveService;
private NodeRef testSiteNodeRef;
private String testSiteNodeRefString;
@@ -88,17 +86,14 @@ public class ReadOnlyTransactionInGetRestApiTest extends BaseWebScriptTest
this.siteService = (SiteService)appContext.getBean("SiteService");
this.nodeService = (NodeService)appContext.getBean("NodeService");
this.transactionService = (TransactionService)appContext.getBean("TransactionService");
this.nodeArchiveService = (NodeArchiveService)getServer().getApplicationContext().getBean("nodeArchiveService");
// set admin as current user
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
// delete the test site if it's still hanging around from previous runs
SiteInfo site = siteService.getSite(TEST_SITE_NAME);
if (site != null)
if (siteService.getSite(TEST_SITE_NAME) != null)
{
siteService.deleteSite(TEST_SITE_NAME);
nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(site.getNodeRef()));
}
// create the test site, this should create a site but it won't have any containers created
@@ -120,7 +115,6 @@ public class ReadOnlyTransactionInGetRestApiTest extends BaseWebScriptTest
{
super.tearDown();
SiteInfo site = siteService.getSite(TEST_SITE_NAME);
// use retrying transaction to delete the site
this.transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>()
{
@@ -133,7 +127,6 @@ public class ReadOnlyTransactionInGetRestApiTest extends BaseWebScriptTest
return null;
}
});
nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(site.getNodeRef()));
AuthenticationUtil.clearCurrentSecurityContext();
}

View File

@@ -24,7 +24,6 @@ import java.util.Collections;
import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.site.SiteModel;
@@ -62,7 +61,6 @@ public class BlogServiceTest extends BaseWebScriptTest
private AuthenticationComponent authenticationComponent;
private PersonService personService;
private SiteService siteService;
private NodeArchiveService nodeArchiveService;
private static final String USER_ONE = "UserOneSecondToo";
private static final String USER_TWO = "UserTwoSecondToo";
@@ -93,7 +91,6 @@ public class BlogServiceTest extends BaseWebScriptTest
this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent");
this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService");
this.siteService = (SiteService)getServer().getApplicationContext().getBean("SiteService");
this.nodeArchiveService = (NodeArchiveService)getServer().getApplicationContext().getBean("nodeArchiveService");
// Authenticate as user
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
@@ -126,14 +123,8 @@ public class BlogServiceTest extends BaseWebScriptTest
// admin user required to delete things
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
SiteInfo siteInfo = this.siteService.getSite(SITE_SHORT_NAME_BLOG);
if (siteInfo != null)
{
// delete invite site
siteService.deleteSite(SITE_SHORT_NAME_BLOG);
nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(siteInfo.getNodeRef()));
}
// delete invite site
siteService.deleteSite(SITE_SHORT_NAME_BLOG);
// delete the users
personService.deletePerson(USER_ONE);

View File

@@ -25,7 +25,6 @@ import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.calendar.CalendarServiceImpl;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.site.SiteModel;
@@ -68,7 +67,6 @@ public class CalendarRestApiTest extends BaseWebScriptTest
private PersonService personService;
private NodeService nodeService;
private SiteService siteService;
private NodeArchiveService nodeArchiveService;
private static final String USER_ONE = "UserOneSecondToo";
private static final String USER_TWO = "UserTwoSecondToo";
@@ -102,7 +100,6 @@ public class CalendarRestApiTest extends BaseWebScriptTest
this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService");
this.nodeService = (NodeService)getServer().getApplicationContext().getBean("NodeService");
this.siteService = (SiteService)getServer().getApplicationContext().getBean("SiteService");
this.nodeArchiveService = (NodeArchiveService)getServer().getApplicationContext().getBean("nodeArchiveService");
// Authenticate as user
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
@@ -139,13 +136,8 @@ public class CalendarRestApiTest extends BaseWebScriptTest
// admin user required to delete user
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
SiteInfo siteInfo = this.siteService.getSite(SITE_SHORT_NAME_CALENDAR);
if (siteInfo != null)
{
// delete invite site
siteService.deleteSite(SITE_SHORT_NAME_CALENDAR);
nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(siteInfo.getNodeRef()));
}
// delete invite site
siteService.deleteSite(SITE_SHORT_NAME_CALENDAR);
// delete the users
deleteUser(USER_ONE);

View File

@@ -29,7 +29,6 @@ import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.model.ForumModel;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -79,7 +78,6 @@ public class DiscussionRestApiTest extends BaseWebScriptTest
private SiteService siteService;
private NodeService nodeService;
private NodeService internalNodeService;
private NodeArchiveService nodeArchiveService;
private static final String USER_ONE = "UserOneThird";
private static final String USER_TWO = "UserTwoThird";
@@ -111,7 +109,6 @@ public class DiscussionRestApiTest extends BaseWebScriptTest
this.siteService = (SiteService)getServer().getApplicationContext().getBean("SiteService");
this.nodeService = (NodeService)getServer().getApplicationContext().getBean("NodeService");
this.internalNodeService = (NodeService)getServer().getApplicationContext().getBean("nodeService");
this.nodeArchiveService = (NodeArchiveService)getServer().getApplicationContext().getBean("nodeArchiveService");
// Authenticate as user
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
@@ -181,22 +178,17 @@ public class DiscussionRestApiTest extends BaseWebScriptTest
this.authenticationService.deleteAuthentication(USER_TWO);
}
SiteInfo siteInfo = this.siteService.getSite(SITE_SHORT_NAME_DISCUSSION);
if (siteInfo != null)
// delete discussions test site
RetryingTransactionCallback<Void> deleteCallback = new RetryingTransactionCallback<Void>()
{
// delete discussions test site
RetryingTransactionCallback<Void> deleteCallback = new RetryingTransactionCallback<Void>()
{
@Override
public Void execute() throws Throwable
{
siteService.deleteSite(SITE_SHORT_NAME_DISCUSSION);
return null;
}
};
transactionService.getRetryingTransactionHelper().doInTransaction(deleteCallback);
nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(siteInfo.getNodeRef()));
}
@Override
public Void execute() throws Throwable
{
siteService.deleteSite(SITE_SHORT_NAME_DISCUSSION);
return null;
}
};
transactionService.getRetryingTransactionHelper().doInTransaction(deleteCallback);
}
private void createUser(String userName, String role)

View File

@@ -27,7 +27,6 @@ import org.alfresco.repo.action.executer.MailActionExecuter;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.invitation.WorkflowModelNominatedInvitation;
import org.alfresco.repo.management.subsystems.ChildApplicationContextFactory;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
@@ -82,7 +81,6 @@ public class InviteServiceTest extends BaseWebScriptTest
private MutableAuthenticationDao mutableAuthenticationDao;
private NamespaceService namespaceService;
private TransactionService transactionService;
private NodeArchiveService nodeArchiveService;
// stores invitee email addresses, one entry for each "start invite" operation
// invoked, so that resources created for each invitee for each test
@@ -136,7 +134,6 @@ public class InviteServiceTest extends BaseWebScriptTest
this.namespaceService = (NamespaceService) getServer().getApplicationContext().getBean("NamespaceService");
this.transactionService = (TransactionService) getServer().getApplicationContext()
.getBean("TransactionService");
this.nodeArchiveService = (NodeArchiveService)getServer().getApplicationContext().getBean("nodeArchiveService");
configureMailExecutorForTestMode(this.getServer());
@@ -282,19 +279,6 @@ public class InviteServiceTest extends BaseWebScriptTest
{
super.tearDown();
RunAsWork<SiteInfo[]> runAsWork = new RunAsWork<SiteInfo[]>()
{
public SiteInfo[] doWork() throws Exception
{
SiteInfo[] siteInfos = { siteService.getSite(SITE_SHORT_NAME_INVITE_1),
siteService.getSite(SITE_SHORT_NAME_INVITE_2),
siteService.getSite(SITE_SHORT_NAME_INVITE_3) };
return siteInfos;
}
};
final SiteInfo[] siteInfos = AuthenticationUtil.runAs(runAsWork, AuthenticationUtil.getSystemUserName());
//
// run various teardown operations which need to be run as 'admin'
//
@@ -349,19 +333,6 @@ public class InviteServiceTest extends BaseWebScriptTest
}
return null;
}});
AuthenticationUtil.runAs(new RunAsWork<Object>()
{
public Object doWork() throws Exception
{
for (SiteInfo siteInfo : siteInfos)
{
nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(siteInfo.getNodeRef()));
}
return null;
}
}, AuthenticationUtil.getSystemUserName());
}
public static String PERSON_FIRSTNAME = "FirstName123";

View File

@@ -25,7 +25,6 @@ import java.util.List;
import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -71,7 +70,6 @@ public class LinksRestApiTest extends BaseWebScriptTest
private NodeService nodeService;
private NodeService internalNodeService;
private SiteService siteService;
private NodeArchiveService nodeArchiveService;
private static final String USER_ONE = "UserOneSecondToo";
private static final String USER_TWO = "UserTwoSecondToo";
@@ -109,7 +107,6 @@ public class LinksRestApiTest extends BaseWebScriptTest
this.nodeService = (NodeService)getServer().getApplicationContext().getBean("NodeService");
this.siteService = (SiteService)getServer().getApplicationContext().getBean("SiteService");
this.internalNodeService = (NodeService)getServer().getApplicationContext().getBean("nodeService");
this.nodeArchiveService = (NodeArchiveService)getServer().getApplicationContext().getBean("nodeArchiveService");
// Authenticate as user
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
@@ -144,13 +141,8 @@ public class LinksRestApiTest extends BaseWebScriptTest
// admin user required to delete user
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
SiteInfo siteInfo = this.siteService.getSite(SITE_SHORT_NAME_LINKS);
if (siteInfo != null)
{
// delete the site
siteService.deleteSite(SITE_SHORT_NAME_LINKS);
nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(siteInfo.getNodeRef()));
}
// delete the site
siteService.deleteSite(SITE_SHORT_NAME_LINKS);
// delete the users
personService.deletePerson(USER_ONE);

View File

@@ -6,7 +6,6 @@ import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.site.SiteModel;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
@@ -47,7 +46,6 @@ public class NodeWebScripTest extends BaseWebScriptTest
private PersonService personService;
private SiteService siteService;
private NodeService nodeService;
private NodeArchiveService nodeArchiveService;
private static final String USER_ONE = "UserOneSecondToo";
private static final String USER_TWO = "UserTwoSecondToo";
@@ -65,7 +63,6 @@ public class NodeWebScripTest extends BaseWebScriptTest
this.personService = (PersonService)ctx.getBean("PersonService");
this.siteService = (SiteService)ctx.getBean("SiteService");
this.nodeService = (NodeService)ctx.getBean("NodeService");
this.nodeArchiveService = (NodeArchiveService)ctx.getBean("nodeArchiveService");
// Do the setup as admin
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
@@ -89,14 +86,8 @@ public class NodeWebScripTest extends BaseWebScriptTest
// Admin user required to delete users and sites
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
SiteInfo siteInfo = siteService.getSite(TEST_SITE.getShortName());
if (siteInfo != null)
{
// Zap the site, and their contents
siteService.deleteSite(TEST_SITE.getShortName());
nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(siteInfo.getNodeRef()));
}
// Zap the site, and their contents
siteService.deleteSite(TEST_SITE.getShortName());
// Delete users
for (String user : new String[] {USER_ONE, USER_TWO, USER_THREE})
@@ -121,12 +112,10 @@ public class NodeWebScripTest extends BaseWebScriptTest
@Override
public SiteInfo execute() throws Throwable
{
SiteInfo siteInfo = siteService.getSite(shortName);
if (siteInfo != null)
if (siteService.getSite(shortName) != null)
{
// Tidy up after failed earlier run
siteService.deleteSite(shortName);
nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(siteInfo.getNodeRef()));
}
// Do the create

View File

@@ -21,7 +21,6 @@ package org.alfresco.repo.web.scripts.nodelocator;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.model.Repository;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.nodelocator.AncestorNodeLocator;
import org.alfresco.repo.nodelocator.CompanyHomeNodeLocator;
import org.alfresco.repo.nodelocator.SitesHomeNodeLocator;
@@ -59,7 +58,6 @@ public class NodeLocatorWebScriptTest extends BaseWebScriptTest
private Repository repositoryHelper;
private NodeRef companyHome;
private NamespaceService namespaceService;
private NodeArchiveService nodeArchiveService;
public void testCompanyHomeNodeLocator() throws Exception
{
@@ -112,7 +110,6 @@ public class NodeLocatorWebScriptTest extends BaseWebScriptTest
if (site != null)
{
siteService.deleteSite(site.getShortName());
nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(site.getNodeRef()));
}
}
}
@@ -279,6 +276,5 @@ public class NodeLocatorWebScriptTest extends BaseWebScriptTest
this.namespaceService= (NamespaceService) appContext.getBean("NamespaceService");
this.repositoryHelper = (Repository) appContext.getBean("repositoryHelper");
this.companyHome = repositoryHelper.getCompanyHome();
this.nodeArchiveService = (NodeArchiveService) appContext.getBean("nodeArchiveService");
}
}

View File

@@ -548,13 +548,6 @@ public class SiteServiceTest extends BaseWebScriptTest
JSONObject grp = getResult.getJSONObject("authority");
assertEquals("full name not correct", testGroupName, grp.getString("fullName"));
}
// cleanup
if(authorityService.authorityExists(testGroupName))
{
this.authenticationComponent.setSystemUserAsCurrentUser();
authorityService.deleteAuthority(testGroupName);
}
}
public void testDeleteMembership() throws Exception
@@ -1164,12 +1157,5 @@ public class SiteServiceTest extends BaseWebScriptTest
}
}
}
// cleanup
if (authorityService.authorityExists(testGroupName))
{
this.authenticationComponent.setSystemUserAsCurrentUser();
this.authorityService.deleteAuthority(testGroupName);
}
}
}

View File

@@ -23,7 +23,6 @@ import java.util.Date;
import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -71,7 +70,6 @@ public class WikiRestApiTest extends BaseWebScriptTest
private NodeService internalNodeService;
private SiteService siteService;
private WikiService wikiService;
private NodeArchiveService nodeArchiveService;
private static final String USER_ONE = "UserOneSecondToo";
private static final String USER_TWO = "UserTwoSecondToo";
@@ -112,7 +110,6 @@ public class WikiRestApiTest extends BaseWebScriptTest
this.siteService = (SiteService)getServer().getApplicationContext().getBean("SiteService");
this.wikiService = (WikiService)getServer().getApplicationContext().getBean("WikiService");
this.internalNodeService = (NodeService)getServer().getApplicationContext().getBean("nodeService");
this.nodeArchiveService = (NodeArchiveService)getServer().getApplicationContext().getBean("nodeArchiveService");
// Authenticate as user
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
@@ -147,13 +144,8 @@ public class WikiRestApiTest extends BaseWebScriptTest
// admin user required to delete user
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
SiteInfo siteInfo = this.siteService.getSite(SITE_SHORT_NAME_WIKI);
if (siteInfo != null)
{
// delete the site
siteService.deleteSite(SITE_SHORT_NAME_WIKI);
nodeArchiveService.purgeArchivedNode(nodeArchiveService.getArchivedNode(siteInfo.getNodeRef()));
}
// delete the site
siteService.deleteSite(SITE_SHORT_NAME_WIKI);
// delete the users
if(personService.personExists(USER_ONE))