Search in sources :

Example 1 with SubscribeDistributionListRequest

use of com.zimbra.soap.account.message.SubscribeDistributionListRequest 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)

Example 2 with SubscribeDistributionListRequest

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

the class TestDelegatedDL method noHomeServerZimbraAccount.

/*
     * Verify groups without a home server will get PROXY_ERROR for zimbraAccount
     * SOAP calls.
     */
@Test
@Bug(bug = 66412)
public void noHomeServerZimbraAccount() throws Exception {
    String groupName = TestUtil.getAddress(genGroupNameLocalPart(), DOMAIN_NAME);
    Group group = provUtil.createGroup(groupName, DYNAMIC);
    // remove zimbraMailHost
    Map<String, Object> attrs = Maps.newHashMap();
    attrs.put(Provisioning.A_zimbraMailHost, null);
    prov.modifyAttrs(group, attrs);
    SoapTransport transport = authUser(USER_OWNER);
    /*
         * GetDistributionList
         */
    GetDistributionListRequest getDLreq = new GetDistributionListRequest(DistributionListSelector.fromName(groupName), Boolean.TRUE);
    verifyCaughtProxyError(transport, getDLreq);
    /*
         * DistributionListAction
         */
    DistributionListActionRequest DLActionReq = new DistributionListActionRequest(DistributionListSelector.fromName(groupName), new DistributionListAction(Operation.addMembers));
    verifyCaughtProxyError(transport, DLActionReq);
    /*
         * SubscribeDistributionList
         */
    SubscribeDistributionListRequest subsDLReq = new SubscribeDistributionListRequest(DistributionListSelector.fromName(groupName), DistributionListSubscribeOp.subscribe);
    verifyCaughtProxyError(transport, subsDLReq);
    provUtil.deleteGroup(group);
}
Also used : Group(com.zimbra.cs.account.Group) SubscribeDistributionListRequest(com.zimbra.soap.account.message.SubscribeDistributionListRequest) DistributionListAction(com.zimbra.soap.account.type.DistributionListAction) GetDistributionListRequest(com.zimbra.soap.account.message.GetDistributionListRequest) SoapTransport(com.zimbra.common.soap.SoapTransport) DistributionListActionRequest(com.zimbra.soap.account.message.DistributionListActionRequest) Test(org.junit.Test) Bug(com.zimbra.qa.QA.Bug)

Aggregations

SoapTransport (com.zimbra.common.soap.SoapTransport)2 SubscribeDistributionListRequest (com.zimbra.soap.account.message.SubscribeDistributionListRequest)2 Test (org.junit.Test)2 ServiceException (com.zimbra.common.service.ServiceException)1 AccountServiceException (com.zimbra.cs.account.AccountServiceException)1 Group (com.zimbra.cs.account.Group)1 Bug (com.zimbra.qa.QA.Bug)1 DistributionListActionRequest (com.zimbra.soap.account.message.DistributionListActionRequest)1 GetDistributionListRequest (com.zimbra.soap.account.message.GetDistributionListRequest)1 SubscribeDistributionListResponse (com.zimbra.soap.account.message.SubscribeDistributionListResponse)1 DistributionListAction (com.zimbra.soap.account.type.DistributionListAction)1