use of com.zimbra.soap.account.message.CreateIdentityRequest in project zm-mailbox by Zimbra.
the class TestAccess method CreateIdentity.
@Test
public void CreateIdentity() throws Exception {
String identityName = genIdentityName(seq);
Identity identity = Identity.fromName(identityName);
CreateIdentityRequest req = new CreateIdentityRequest(identity);
/*
XMLElement req = new XMLElement(AccountConstants.CREATE_IDENTITY_REQUEST);
Element identity = req.addElement(AccountConstants.E_IDENTITY);
identity.addAttribute(AccountConstants.A_NAME, identityName);
*/
accessTest(Perm.PERM_SELF_ONLY, req);
}
use of com.zimbra.soap.account.message.CreateIdentityRequest in project zm-mailbox by Zimbra.
the class SoapProvisioning method createIdentity.
@Override
public Identity createIdentity(Account account, String identityName, Map<String, Object> attrs) throws ServiceException {
com.zimbra.soap.account.type.Identity id = new com.zimbra.soap.account.type.Identity(identityName, null);
id.setAttrs(attrs);
CreateIdentityRequest request = new CreateIdentityRequest(id);
CreateIdentityResponse response = invokeJaxbOnTargetAccount(request, account.getId());
return new SoapIdentity(account, response.getIdentity(), this);
}
use of com.zimbra.soap.account.message.CreateIdentityRequest in project zm-mailbox by Zimbra.
the class JaxbToElementTest method IdentityToStringTest.
@Test
public void IdentityToStringTest() throws Exception {
com.zimbra.soap.account.type.Identity id = new com.zimbra.soap.account.type.Identity("hello", null);
Map<String, String> attrs = Maps.newHashMap();
attrs.put("key1", "value1");
attrs.put("key2", "value2 wonderful");
id.setAttrs(attrs);
CreateIdentityRequest request = new CreateIdentityRequest(id);
String toString = request.toString();
Assert.assertTrue("toString start chars", toString.startsWith("CreateIdentityRequest{identity=Identity{a="));
Assert.assertTrue("toString key1", toString.contains("Attr{name=key1, value=value1}"));
Assert.assertTrue("toString key2", toString.contains("Attr{name=key2, value=value2 wonderful}"));
Assert.assertTrue("toString name", toString.contains("name=hello"));
Assert.assertTrue("toString id", toString.contains("id=null"));
}
Aggregations