Search in sources :

Example 1 with CreateIdentityRequest

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);
}
Also used : CreateIdentityRequest(com.zimbra.soap.account.message.CreateIdentityRequest) Identity(com.zimbra.soap.account.type.Identity) Test(org.junit.Test)

Example 2 with CreateIdentityRequest

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);
}
Also used : CreateIdentityRequest(com.zimbra.soap.account.message.CreateIdentityRequest) CreateIdentityResponse(com.zimbra.soap.account.message.CreateIdentityResponse) Identity(com.zimbra.cs.account.Identity)

Example 3 with CreateIdentityRequest

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"));
}
Also used : CreateIdentityRequest(com.zimbra.soap.account.message.CreateIdentityRequest) Test(org.junit.Test)

Aggregations

CreateIdentityRequest (com.zimbra.soap.account.message.CreateIdentityRequest)3 Test (org.junit.Test)2 Identity (com.zimbra.cs.account.Identity)1 CreateIdentityResponse (com.zimbra.soap.account.message.CreateIdentityResponse)1 Identity (com.zimbra.soap.account.type.Identity)1