use of com.zimbra.common.soap.SoapFaultException in project zm-mailbox by Zimbra.
the class TestDataSource method testPop3.
@Test
public void testPop3() throws Exception {
Account pop3acct = TestUtil.getAccount(TEST_USER_NAME);
ZMailbox pop3mbox = TestUtil.getZMailbox(TEST_USER_NAME);
ZMailbox mbox = TestUtil.getZMailbox(USER_NAME);
String pop3DSFolder = NAME_PREFIX + " testPop3 source";
String pop3DSFolderId = createFolderForDataSource(mbox, pop3DSFolder);
String dsId = createPop3DataSource(mbox, pop3acct.getName(), pop3DSFolderId);
String subj = NAME_PREFIX + " testtrashpop3";
addMessage(pop3mbox, subj, "test");
refreshPop3DatasourceData(mbox, dsId);
ZSearchParams params = new ZSearchParams(String.format("subject:\"%s\"", subj));
params.setTypes("MESSAGE");
ZSearchResult result = mbox.search(params);
ZSearchHit hit = result.getHits().get(0);
String id = hit.getId();
try {
mbox.trashMessage(id);
} catch (SoapFaultException sfe) {
fail("SoapFaultException caught when deleting item from Pop3 datasource folder - " + sfe.getMessage());
}
params = new ZSearchParams("in:Trash");
params.setTypes("MESSAGE");
result = mbox.search(params);
List<ZSearchHit> hits = result.getHits();
assertEquals(1, hits.size());
assertEquals(id, hits.get(0).getId());
}
use of com.zimbra.common.soap.SoapFaultException in project zm-mailbox by Zimbra.
the class TestDomainAdmin method testAccountPassword.
@Test
public void testAccountPassword() throws Exception {
Account acct = adminSoapProv.createAccount(TARGET_ACCT, TestUtil.DEFAULT_PASSWORD, null);
String domAdminId = createAdminConsoleStyleDomainAdmin(DOMADMIN);
adminSoapProv.authAccount(acct, TestUtil.DEFAULT_PASSWORD, AuthContext.Protocol.test);
assertNotNull("Account for " + TARGET_ACCT, acct);
// first as admin
adminSoapProv.changePassword(acct, TestUtil.DEFAULT_PASSWORD, "DelTA4Pa555");
adminSoapProv.checkPasswordStrength(acct, "2ndDelTA4Pa555");
adminSoapProv.setPassword(acct, "2ndDelTA4Pa555");
SoapProvisioning domAdminSoapProv = getSoapProvisioning(DOMADMIN, TestUtil.DEFAULT_PASSWORD);
try {
domAdminSoapProv.changePassword(acct, "DelTA4Pa555", TestUtil.DEFAULT_PASSWORD);
fail("changePassword succeeded when shouldn't");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "authentication failed for");
}
try {
domAdminSoapProv.checkPasswordStrength(acct, "2ndDelTA4Pa555");
fail("checkPasswordStrength succeeded in spite of not having checkPasswordStrength right!!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: need right: checkPasswordStrength for account");
}
domAdminSoapProv.setPassword(acct, TestUtil.DEFAULT_PASSWORD);
}
use of com.zimbra.common.soap.SoapFaultException in project zm-mailbox by Zimbra.
the class TestDomainAdmin method testGetDistributionListInDiffDomain.
@Test
public void testGetDistributionListInDiffDomain() throws Exception {
String domAdminId = createAdminConsoleStyleDomainAdmin(DOMADMIN);
CreateDistributionListResponse caResp;
caResp = adminSoapProv.invokeJaxb(new CreateDistributionListRequest(DIFF_DL));
assertNotNull("CreateDistributionListResponse for " + DIFF_DL + " as FULL ADMIN", caResp);
String dlId = caResp.getDl().getId();
SoapProvisioning domAdminSoapProv = getSoapProvisioning(DOMADMIN, TestUtil.DEFAULT_PASSWORD);
GetDistributionListRequest getAcctReq = new GetDistributionListRequest(DistributionListSelector.fromName(DIFF_DL));
try {
domAdminSoapProv.invokeJaxb(getAcctReq);
fail("GetDistributionListRequest succeeded for DistributionList in other domain!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access distribution list");
}
// try non-existent acct
getAcctReq = new GetDistributionListRequest(DistributionListSelector.fromName(DIFF_DL2));
try {
domAdminSoapProv.invokeJaxb(getAcctReq);
fail("GetDistributionListRequest succeeded for non-existent DistributionList in other domain!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access distribution list");
}
AddDistributionListAliasResponse aaaResp;
try {
aaaResp = domAdminSoapProv.invokeJaxb(new AddDistributionListAliasRequest(dlId, ALIAS_FOR_TARGET_DL));
fail("AddDistributionListAliasRequest succeeded for DistributionList in other domain!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access distribution list");
}
aaaResp = adminSoapProv.invokeJaxb(new AddDistributionListAliasRequest(dlId, ALIAS_FOR_TARGET_DL));
assertNotNull("AddDistributionListAliasResponse for " + TARGET_DL + " as FULL ADMIN", aaaResp);
try {
domAdminSoapProv.invokeJaxb(new RemoveDistributionListAliasRequest(dlId, ALIAS_FOR_TARGET_DL));
fail("RemoveDistributionListAliasRequest succeeded for DistributionList in other domain!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access distribution list");
}
try {
domAdminSoapProv.invokeJaxb(new RenameDistributionListRequest(dlId, TARGET_DL_RENAMED));
fail("RenameDistributionListRequest succeeded for DistributionList in other domain!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access distribution list");
}
try {
domAdminSoapProv.invokeJaxb(new DeleteDistributionListRequest(dlId));
fail("DeleteDistributionListRequest succeeded for DistributionList in other domain!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access distribution list");
}
}
use of com.zimbra.common.soap.SoapFaultException 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");
}
}
use of com.zimbra.common.soap.SoapFaultException in project zm-mailbox by Zimbra.
the class TestDomainAdmin method testModifyCalendarResourceInDiffDomain.
@Test
public void testModifyCalendarResourceInDiffDomain() throws Exception {
String domAdminId = createAdminConsoleStyleDomainAdmin(DOMADMIN);
SoapProvisioning domAdminSoapProv = getSoapProvisioning(DOMADMIN, TestUtil.DEFAULT_PASSWORD);
List<Attr> attrs = Lists.newArrayList();
attrs.add(new Attr(Provisioning.A_displayName, "testModifyCalendarResourceInDiffDomain Room 101"));
attrs.add(new Attr(Provisioning.A_description, "Room 101 for 50 seats"));
attrs.add(new Attr(Provisioning.A_zimbraCalResType, "Location"));
attrs.add(new Attr(Provisioning.A_zimbraCalResAutoAcceptDecline, "TRUE"));
attrs.add(new Attr(Provisioning.A_zimbraCalResAutoDeclineIfBusy, "TRUE"));
CreateCalendarResourceResponse caResp;
caResp = adminSoapProv.invokeJaxb(new CreateCalendarResourceRequest(DIFF_CALRES, TestUtil.DEFAULT_PASSWORD, attrs));
assertNotNull("CreateCalendarResourceResponse for " + DIFF_CALRES + " as FULL ADMIN", caResp);
String acctId = caResp.getCalResource().getId();
ModifyCalendarResourceRequest modAcctReq = new ModifyCalendarResourceRequest(acctId);
modAcctReq.addAttr(new Attr(Provisioning.A_description, "dummy description"));
try {
domAdminSoapProv.invokeJaxb(modAcctReq);
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access calendar resource ");
}
try {
domAdminSoapProv.invokeJaxbOnTargetAccount(modAcctReq, acctId);
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access calendar resource ");
}
DeleteCalendarResourceRequest delAcctReq = new DeleteCalendarResourceRequest(acctId);
DeleteCalendarResourceResponse delAcctResp = adminSoapProv.invokeJaxbOnTargetAccount(delAcctReq, acctId);
assertNotNull("DeleteCalendarResourceResponse for " + DIFF_CALRES + " as ADMIN specifying target acct", delAcctResp);
try {
domAdminSoapProv.invokeJaxb(modAcctReq);
fail("ModifyCalendarResourceRequest succeeded after delete!");
} catch (SoapFaultException sfe) {
// Get this instead of "no such account: " because modify by ID (not name) and for domain admin
// cannot know whether that ID was for a domain we administered or not.
checkSoapReason(sfe, "permission denied: can not access calendar resource ");
}
try {
domAdminSoapProv.invokeJaxbOnTargetAccount(modAcctReq, acctId);
fail("ModifyCalendarResourceRequest succeeded after delete!");
} catch (SoapFaultException sfe) {
checkSoapReason(sfe, "permission denied: can not access account ");
}
}
Aggregations