Search in sources :

Example 1 with SubscribeDistributionListResponse

use of com.zimbra.soap.account.message.SubscribeDistributionListResponse in project zm-mailbox by Zimbra.

the class TestDelegatedDL method subscribeDistributionList.

@Test
public void subscribeDistributionList() throws Exception {
    SoapTransport transport = authUser(USER_NOT_OWNER);
    // subscribe
    SubscribeDistributionListRequest req = new SubscribeDistributionListRequest(DistributionListSelector.fromName(DL_NAME), DistributionListSubscribeOp.subscribe);
    SubscribeDistributionListResponse resp = invokeJaxb(transport, req);
    assertEquals(DistributionListSubscribeStatus.subscribed, resp.getStatus());
    // unsubscribe
    req = new SubscribeDistributionListRequest(DistributionListSelector.fromName(DL_NAME), DistributionListSubscribeOp.unsubscribe);
    boolean caughtPermDenied = false;
    try {
        resp = invokeJaxb(transport, req);
    } catch (ServiceException e) {
        String code = e.getCode();
        if (ServiceException.PERM_DENIED.equals(code)) {
            caughtPermDenied = true;
        }
    }
    assertTrue(caughtPermDenied);
}
Also used : AccountServiceException(com.zimbra.cs.account.AccountServiceException) ServiceException(com.zimbra.common.service.ServiceException) SubscribeDistributionListRequest(com.zimbra.soap.account.message.SubscribeDistributionListRequest) SubscribeDistributionListResponse(com.zimbra.soap.account.message.SubscribeDistributionListResponse) SoapTransport(com.zimbra.common.soap.SoapTransport) Test(org.junit.Test)

Aggregations

ServiceException (com.zimbra.common.service.ServiceException)1 SoapTransport (com.zimbra.common.soap.SoapTransport)1 AccountServiceException (com.zimbra.cs.account.AccountServiceException)1 SubscribeDistributionListRequest (com.zimbra.soap.account.message.SubscribeDistributionListRequest)1 SubscribeDistributionListResponse (com.zimbra.soap.account.message.SubscribeDistributionListResponse)1 Test (org.junit.Test)1