REPO-4132: User 'System' cleanup follow-up (Revert changes in REPO-3743) (#330)

* Reverted changes for REPO-3743 #276
* Changes in PersonService to ensure a consistent behaviour for the System case:
- PersonService.createPerson() throws now an AlfrescoRuntimeException when trying to create a person for the username 'System'
- PersonService.getPerson("System") throws NoSuchPersonException
- PersonService.personExists("System") returns false
* Remove StandardRenditionLocationResolverTest tests from the suite - the RenditionService deprecated, so related tests won't be maintained
* Fixes for the System user case in ImapService
* Update alfresco-data-model 8.27
This commit is contained in:
Ancuta Morarasu
2019-01-23 20:45:01 +02:00
committed by GitHub
parent e93effbf13
commit 9f739a53d5
36 changed files with 206 additions and 170 deletions

View File

@@ -136,7 +136,8 @@ public class ImapServiceImplTest extends TestCase
private ContentService contentService;
private NodeRef testImapFolderNodeRef;
private Flags flags;
private Flags flags;
private ImapServiceImpl imapServiceImpl;
String anotherUserName;
@@ -170,29 +171,29 @@ public class ImapServiceImplTest extends TestCase
authenticationService.authenticate(USER_NAME, USER_PASSWORD.toCharArray());
// downgrade integrity
IntegrityChecker.setWarnInTransaction();
anotherUserName = "user" + System.currentTimeMillis();
PropertyMap testUser = new PropertyMap();
testUser.put(ContentModel.PROP_USERNAME, anotherUserName);
testUser.put(ContentModel.PROP_FIRSTNAME, anotherUserName);
testUser.put(ContentModel.PROP_LASTNAME, anotherUserName);
testUser.put(ContentModel.PROP_EMAIL, anotherUserName + "@alfresco.com");
testUser.put(ContentModel.PROP_JOBTITLE, "jobTitle");
personService.createPerson(testUser);
// create the ACEGI Authentication instance for the new user
authenticationService.createAuthentication(anotherUserName, anotherUserName.toCharArray());
IntegrityChecker.setWarnInTransaction();
anotherUserName = "user" + System.currentTimeMillis();
PropertyMap testUser = new PropertyMap();
testUser.put(ContentModel.PROP_USERNAME, anotherUserName);
testUser.put(ContentModel.PROP_FIRSTNAME, anotherUserName);
testUser.put(ContentModel.PROP_LASTNAME, anotherUserName);
testUser.put(ContentModel.PROP_EMAIL, anotherUserName + "@alfresco.com");
testUser.put(ContentModel.PROP_JOBTITLE, "jobTitle");
personService.createPerson(testUser);
// create the ACEGI Authentication instance for the new user
authenticationService.createAuthentication(anotherUserName, anotherUserName.toCharArray());
user = new AlfrescoImapUser(anotherUserName + "@alfresco.com", anotherUserName, anotherUserName);
NodeRef companyHomeNodeRef = findCompanyHomeNodeRef();
ChildApplicationContextFactory imap = (ChildApplicationContextFactory) ctx.getBean("imap");
ApplicationContext imapCtx = imap.getApplicationContext();
ImapServiceImpl imapServiceImpl = (ImapServiceImpl)imapCtx.getBean("imapService");
imapServiceImpl = (ImapServiceImpl)imapCtx.getBean("imapService");
// Creating IMAP test folder for IMAP root
LinkedList<String> folders = new LinkedList<String>();
@@ -307,7 +308,7 @@ public class ImapServiceImplTest extends TestCase
}
public void testListMailbox() throws Exception
{
{
imapService.getOrCreateMailbox(user, MAILBOX_NAME_A, false, true);
imapService.getOrCreateMailbox(user, MAILBOX_NAME_B, false, true);
List<AlfrescoImapFolder> mf = imapService.listMailboxes(user, MAILBOX_PATTERN, false);
@@ -1004,8 +1005,14 @@ public class ImapServiceImplTest extends TestCase
assertEquals("The parent should change to destination.", destinationNode.getNodeRef(), copiedParentNodeRef);
assertEquals("There should be only one node in the destination folder", 1, nodeService.getChildAssocs(destinationNode.getNodeRef()).size());
assertTrue("New node should have original node aspects", nodeService.hasAspect(copiedNode.getNodeRef(), ContentModel.ASPECT_TAGGABLE));
}
}
public void testListMailboxOnStartup()
{
authenticationService.clearCurrentSecurityContext();
// Starting IMAP
imapServiceImpl.startupInTxn(true);
}
/**
* @param mailbox - {@link AlfrescoImapFolder} instance which should be checked