use of com.zimbra.cs.account.Identity in project zm-mailbox by Zimbra.
the class TestLdapProvIdentity method createIdentity.
private Identity createIdentity(Account acct, String identityName) throws Exception {
Identity identity = prov.get(acct, Key.IdentityBy.name, identityName);
assertNull(identity);
createIdentityRaw(acct, identityName);
identity = prov.get(acct, Key.IdentityBy.name, identityName);
assertNotNull(identity);
assertEquals(identityName, identity.getName());
return identity;
}
use of com.zimbra.cs.account.Identity in project zm-mailbox by Zimbra.
the class TestLdapProvIdentity method createIdentity.
@Test
public void createIdentity() throws Exception {
String ACCT_NAME_LOCALPART = Names.makeAccountNameLocalPart(genAcctNameLocalPart());
String IDENTITY_NAME = Names.makeIdentityName(genIdentityName());
Account acct = createAccount(ACCT_NAME_LOCALPART);
Identity identity = createIdentity(acct, IDENTITY_NAME);
assertEquals(acct.getId(), identity.getAccount().getId());
deleteIdentity(acct, identity);
deleteAccount(acct);
}
use of com.zimbra.cs.account.Identity in project zm-mailbox by Zimbra.
the class TestLdapProvIdentity method getAllIdentitys.
@Test
public void getAllIdentitys() throws Exception {
String ACCT_NAME_LOCALPART = Names.makeAccountNameLocalPart(genAcctNameLocalPart());
String IDENTITYE_NAME_1 = Names.makeIdentityName(genIdentityName("1"));
String IDENTITYE_NAME_2 = Names.makeIdentityName(genIdentityName("2"));
String IDENTITYE_NAME_3 = Names.makeIdentityName(genIdentityName("3"));
Account acct = createAccount(ACCT_NAME_LOCALPART);
Identity identity1 = createIdentity(acct, IDENTITYE_NAME_1);
Identity identity2 = createIdentity(acct, IDENTITYE_NAME_2);
Identity identity3 = createIdentity(acct, IDENTITYE_NAME_3);
acct = getFresh(acct);
List<Identity> allIdentitys = prov.getAllIdentities(acct);
// 3 + the account identity
assertEquals(4, allIdentitys.size());
Set<String> allIdentityIds = new HashSet<String>();
for (Identity identity : allIdentitys) {
allIdentityIds.add(identity.getId());
}
assertTrue(allIdentityIds.contains(identity1.getId()));
assertTrue(allIdentityIds.contains(identity2.getId()));
assertTrue(allIdentityIds.contains(identity3.getId()));
deleteIdentity(acct, identity1);
deleteIdentity(acct, identity2);
deleteIdentity(acct, identity3);
deleteAccount(acct);
}
use of com.zimbra.cs.account.Identity in project zm-mailbox by Zimbra.
the class TestLdapProvRenameDomain method createIdentities.
private void createIdentities(Account acct, String[] sigIds) throws Exception {
for (int i = 0; i < NUM_IDENTITIES; i++) {
Map<String, Object> attrs = new HashMap<String, Object>();
// just some random id, not used anywhere
attrs.put(Provisioning.A_zimbraPrefDefaultSignatureId, LdapUtil.generateUUID());
attrs.put(Provisioning.A_zimbraPrefFromAddress, "micky.mouse@zimbra,com");
attrs.put(Provisioning.A_zimbraPrefFromDisplay, "Micky Mouse");
attrs.put(Provisioning.A_zimbraPrefReplyToEnabled, "TRUE");
attrs.put(Provisioning.A_zimbraPrefReplyToAddress, "goofy@yahoo.com");
attrs.put(Provisioning.A_zimbraPrefReplyToDisplay, "Micky");
if (i < NUM_SIGNATURES)
attrs.put(Provisioning.A_zimbraPrefDefaultSignatureId, sigIds[i]);
Identity entry = prov.createIdentity(acct, IDENTITY_NAME(acct, i), attrs);
}
}
Aggregations