Search in sources :

Example 1 with GranteeInfo

use of com.zimbra.soap.admin.type.GranteeInfo in project zm-mailbox by Zimbra.

the class TestDelegatedDL method getDistributionListAdmin.

/*
     * Test the owners element in zimbraAdmin:GetDistributionList
     */
@Test
public void getDistributionListAdmin() throws Exception {
    SoapTransport transport = authAdmin(ADMIN);
    com.zimbra.soap.admin.message.GetDistributionListRequest req = new com.zimbra.soap.admin.message.GetDistributionListRequest(com.zimbra.soap.admin.type.DistributionListSelector.fromName(DL_NAME));
    com.zimbra.soap.admin.message.GetDistributionListResponse resp = invokeJaxb(transport, req);
    com.zimbra.soap.admin.type.DistributionListInfo dlInfo = resp.getDl();
    String dlId = dlInfo.getId();
    Group group = prov.getGroup(Key.DistributionListBy.name, DL_NAME);
    assertNotNull(group);
    assertEquals(group.getId(), dlId);
    /*
        System.out.println("\nAttrs:");
        List<com.zimbra.soap.admin.type.Attr> attrs = dlInfo.getAttrList();
        for (com.zimbra.soap.admin.type.Attr attr : attrs) {
            System.out.println(attr.getN() + ", " + attr.getValue());
        }
        */
    List<GranteeInfo> dlOwners = dlInfo.getOwners();
    assertEquals(1, dlOwners.size());
    for (GranteeInfo owner : dlOwners) {
        com.zimbra.soap.type.GranteeType type = owner.getType();
        String id = owner.getId();
        String name = owner.getName();
        assertEquals(com.zimbra.soap.type.GranteeType.usr, type);
        assertEquals(USER_OWNER, name);
    }
}
Also used : Group(com.zimbra.cs.account.Group) GranteeInfo(com.zimbra.soap.admin.type.GranteeInfo) DistributionListGranteeInfo(com.zimbra.soap.account.type.DistributionListGranteeInfo) GetDistributionListRequest(com.zimbra.soap.account.message.GetDistributionListRequest) SoapTransport(com.zimbra.common.soap.SoapTransport) Test(org.junit.Test)

Aggregations

SoapTransport (com.zimbra.common.soap.SoapTransport)1 Group (com.zimbra.cs.account.Group)1 GetDistributionListRequest (com.zimbra.soap.account.message.GetDistributionListRequest)1 DistributionListGranteeInfo (com.zimbra.soap.account.type.DistributionListGranteeInfo)1 GranteeInfo (com.zimbra.soap.admin.type.GranteeInfo)1 Test (org.junit.Test)1