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");
}
}
Aggregations