use of com.zimbra.soap.mail.message.DataSourceUsage in project zm-mailbox by Zimbra.
the class GetDataSourceUsage method handle.
@Override
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
ZimbraSoapContext zsc = getZimbraSoapContext(context);
Account account = getRequestedAccount(zsc);
GetDataSourceUsageResponse resp = new GetDataSourceUsageResponse();
resp.setDataSourceQuota(account.getDataSourceQuota());
resp.setDataSourceTotalQuota(account.getDataSourceTotalQuota());
for (DataSource ds : account.getAllDataSources()) {
DataSourceUsage dsu = new DataSourceUsage();
dsu.setId(ds.getId());
dsu.setUsage(ds.getUsage());
resp.addDataSourceUsage(dsu);
}
return zsc.jaxbToElement(resp);
}
use of com.zimbra.soap.mail.message.DataSourceUsage in project zm-mailbox by Zimbra.
the class TestPurgeDataSource method checkDataSourceUsage.
private void checkDataSourceUsage() throws ServiceException {
GetDataSourceUsageResponse usage = mbox.invokeJaxb(new GetDataSourceUsageRequest());
long quota = usage.getDataSourceQuota();
for (DataSourceUsage usg : usage.getUsages()) {
assertTrue(usg.getId() + " is over quota", usg.getUsage() <= quota);
}
}
Aggregations