Merged AMUKHA/PLAT-HEAD-2016-01-11 (5.1) to HEAD (5.1)

120772 amukha: ACE-4909: [Win 10, Chrome] - Site Members: Searching users with two chars results in wrapped exception
      - Added a check if the tenant is disabled;
      - Added JUnit test for disabled tenant and for deleted tenant.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@120786 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alex Mukha
2016-01-12 15:52:52 +00:00
parent f102a7dfe4
commit e33ac7c249
2 changed files with 52 additions and 2 deletions

View File

@@ -272,7 +272,7 @@ public class AuthenticationTest extends TestCase
private Map<QName, Serializable> createPersonProperties(String userName)
{
HashMap<QName, Serializable> properties = new HashMap<QName, Serializable>();
properties.put(ContentModel.PROP_USERNAME, "Andy");
properties.put(ContentModel.PROP_USERNAME, userName);
return properties;
}
@@ -497,6 +497,40 @@ public class AuthenticationTest extends TestCase
assertEquals(compositePasswordEncoder.encode("md4",password, null), hashedPassword);
}
/**
* Test for ACE-4909
*/
public void testCheckUserDisabledTenant()
{
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
String domainName = "ace4909.domain";
String userName = "ace4909" + TenantService.SEPARATOR + domainName;
Map<QName, Serializable> props = createPersonProperties(userName);
NodeRef userNodeRef = personService.createPerson(props);
assertNotNull(userNodeRef);
authenticationService.createAuthentication(userName, "passwd".toCharArray());
tenantAdminService.createTenant(domainName, TENANT_ADMIN_PW.toCharArray(), null);
tenantAdminService.disableTenant(domainName);
assertTrue("The user should exist", dao.userExists(userName));
}
/**
* Test for ACE-4909
*/
public void testCheckUserDeletedTenant()
{
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
String domainName = "ace4909.domain";
String userName = "ace4909" + TenantService.SEPARATOR + domainName;
Map<QName, Serializable> props = createPersonProperties(userName);
NodeRef userNodeRef = personService.createPerson(props);
assertNotNull(userNodeRef);
authenticationService.createAuthentication(userName, "passwd".toCharArray());
tenantAdminService.createTenant(domainName, TENANT_ADMIN_PW.toCharArray(), null);
tenantAdminService.deleteTenant(domainName);
assertTrue("The user should exist", dao.userExists(userName));
}
public void testCreateAndyUserAndOtherCRUD() throws NoSuchAlgorithmException, UnsupportedEncodingException
{
RepositoryAuthenticationDao dao = createRepositoryAuthenticationDao();