Search in sources :

Example 1 with GetDistributionListResponse

use of com.zimbra.soap.admin.message.GetDistributionListResponse in project zm-mailbox by Zimbra.

the class TestDomainAdmin method testGetDistributionListInDomAdminDomain.

@Test
public void testGetDistributionListInDomAdminDomain() throws Exception {
    String domAdminId = createAdminConsoleStyleDomainAdmin(DOMADMIN);
    SoapProvisioning domAdminSoapProv = getSoapProvisioning(DOMADMIN, TestUtil.DEFAULT_PASSWORD);
    CreateDistributionListResponse caResp;
    caResp = domAdminSoapProv.invokeJaxb(new CreateDistributionListRequest(TARGET_DL));
    assertNotNull("CreateDistributionListResponse for " + TARGET_DL + " simple as domAdmin", caResp);
    String dlId = caResp.getDl().getId();
    GetDistributionListRequest getDlReq = new GetDistributionListRequest(DistributionListSelector.fromName(TARGET_DL));
    GetDistributionListResponse getDlResp = domAdminSoapProv.invokeJaxb(getDlReq);
    assertNotNull("GetDistributionListResponse for " + TARGET_DL + " simple as domAdmin", getDlResp);
    AddDistributionListAliasResponse aaaResp;
    aaaResp = domAdminSoapProv.invokeJaxb(new AddDistributionListAliasRequest(dlId, ALIAS_FOR_TARGET_DL));
    assertNotNull("AddDistributionListAliasResponse for " + TARGET_DL + " simple as domAdmin", aaaResp);
    RemoveDistributionListAliasResponse daaResp;
    daaResp = domAdminSoapProv.invokeJaxb(new RemoveDistributionListAliasRequest(dlId, ALIAS_FOR_TARGET_DL));
    assertNotNull("RemoveDistributionListAliasResponse for " + TARGET_DL + " simple as domAdmin", daaResp);
    RenameDistributionListResponse renAResp;
    renAResp = domAdminSoapProv.invokeJaxb(new RenameDistributionListRequest(dlId, TARGET_DL_RENAMED));
    assertNotNull("RenameDistributionListResponse for " + TARGET_DL + " simple as domAdmin", renAResp);
    DeleteDistributionListRequest delDLReq;
    DeleteDistributionListResponse delDlResp;
    delDLReq = new DeleteDistributionListRequest(null);
    try {
        delDlResp = domAdminSoapProv.invokeJaxb(delDLReq);
        fail("DeleteDistributionListRequest succeeded in spite of having no 'id' specified!!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "invalid request: missing required attribute: id");
    }
    delDLReq = new DeleteDistributionListRequest(dlId);
    delDlResp = domAdminSoapProv.invokeJaxb(delDLReq);
    assertNotNull("DeleteDistributionListResponse for " + TARGET_DL + " as domAdmin", delDlResp);
    try {
        getDlResp = domAdminSoapProv.invokeJaxb(getDlReq);
        fail("GetDistributionListRequest succeeded after delete!");
    } catch (SoapFaultException sfe) {
        checkSoapReason(sfe, "no such distribution list:");
    }
    try {
        getDlResp = domAdminSoapProv.invokeJaxb(new GetDistributionListRequest(DistributionListSelector.fromId(dlId)));
        fail("GetDistributionListRequest succeeded after delete!");
    } catch (SoapFaultException sfe) {
        // because by id not name
        checkSoapReason(sfe, "permission denied: can not access distribution list");
    }
}
Also used : GetDistributionListResponse(com.zimbra.soap.admin.message.GetDistributionListResponse) RemoveDistributionListAliasRequest(com.zimbra.soap.admin.message.RemoveDistributionListAliasRequest) AddDistributionListAliasRequest(com.zimbra.soap.admin.message.AddDistributionListAliasRequest) CreateDistributionListResponse(com.zimbra.soap.admin.message.CreateDistributionListResponse) GetDistributionListRequest(com.zimbra.soap.admin.message.GetDistributionListRequest) SoapFaultException(com.zimbra.common.soap.SoapFaultException) RemoveDistributionListAliasResponse(com.zimbra.soap.admin.message.RemoveDistributionListAliasResponse) RenameDistributionListResponse(com.zimbra.soap.admin.message.RenameDistributionListResponse) RenameDistributionListRequest(com.zimbra.soap.admin.message.RenameDistributionListRequest) CreateDistributionListRequest(com.zimbra.soap.admin.message.CreateDistributionListRequest) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) DeleteDistributionListRequest(com.zimbra.soap.admin.message.DeleteDistributionListRequest) DeleteDistributionListResponse(com.zimbra.soap.admin.message.DeleteDistributionListResponse) AddDistributionListAliasResponse(com.zimbra.soap.admin.message.AddDistributionListAliasResponse) Test(org.junit.Test)

Aggregations

SoapFaultException (com.zimbra.common.soap.SoapFaultException)1 SoapProvisioning (com.zimbra.cs.account.soap.SoapProvisioning)1 AddDistributionListAliasRequest (com.zimbra.soap.admin.message.AddDistributionListAliasRequest)1 AddDistributionListAliasResponse (com.zimbra.soap.admin.message.AddDistributionListAliasResponse)1 CreateDistributionListRequest (com.zimbra.soap.admin.message.CreateDistributionListRequest)1 CreateDistributionListResponse (com.zimbra.soap.admin.message.CreateDistributionListResponse)1 DeleteDistributionListRequest (com.zimbra.soap.admin.message.DeleteDistributionListRequest)1 DeleteDistributionListResponse (com.zimbra.soap.admin.message.DeleteDistributionListResponse)1 GetDistributionListRequest (com.zimbra.soap.admin.message.GetDistributionListRequest)1 GetDistributionListResponse (com.zimbra.soap.admin.message.GetDistributionListResponse)1 RemoveDistributionListAliasRequest (com.zimbra.soap.admin.message.RemoveDistributionListAliasRequest)1 RemoveDistributionListAliasResponse (com.zimbra.soap.admin.message.RemoveDistributionListAliasResponse)1 RenameDistributionListRequest (com.zimbra.soap.admin.message.RenameDistributionListRequest)1 RenameDistributionListResponse (com.zimbra.soap.admin.message.RenameDistributionListResponse)1 Test (org.junit.Test)1