org.apache.james.mailbox.model.Quota.isOverQuota()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(228)

本文整理了Java中org.apache.james.mailbox.model.Quota.isOverQuota方法的一些代码示例,展示了Quota.isOverQuota的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quota.isOverQuota方法的具体详情如下:
包路径:org.apache.james.mailbox.model.Quota
类名称:Quota
方法名:isOverQuota

Quota.isOverQuota介绍

[英]Tells us if the quota is reached
[中]告诉我们是否达到了配额

代码示例

代码示例来源:origin: org.apache.james/apache-james-mailbox-store

private void trySizeAddition(long size) throws OverQuotaException {
  Quota<QuotaSize> afterAdditionQuotaSize = sizeQuota.addValueToQuota(QuotaSize.size(size));
  if (afterAdditionQuotaSize.isOverQuota()) {
    throw new OverQuotaException(
      "You use too much space in " + quotaRoot.getValue(),
      afterAdditionQuotaSize.getLimit(),
      afterAdditionQuotaSize.getUsed());
  }
}

代码示例来源:origin: org.apache.james/apache-james-mailbox-store

private void tryCountAddition(long count) throws OverQuotaException {
  Quota<QuotaCount> afterAdditionQuotaCount = messageQuota.addValueToQuota(QuotaCount.count(count));
  if (afterAdditionQuotaCount.isOverQuota()) {
    throw new OverQuotaException(
      "You have too many messages in " + quotaRoot.getValue(),
      messageQuota.getLimit(),
      messageQuota.getUsed());
  }
}

代码示例来源:origin: apache/james-project

@Test
public void isOverQuotaShouldReturnFalseWhenQuotaIsNotExceeded() {
  Quota<QuotaCount> quota = Quota.<QuotaCount>builder().used(QuotaCount.count(36)).computedLimit(QuotaCount.count(360)).build();
  assertThat(quota.isOverQuota()).isFalse();
}

代码示例来源:origin: apache/james-project

@Test
public void isOverQuotaShouldReturnFalseWhenMaxValueIsUnlimited() {
  Quota<QuotaCount> quota = Quota.<QuotaCount>builder().used(QuotaCount.count(36)).computedLimit(QuotaCount.unlimited()).build();
  assertThat(quota.isOverQuota()).isFalse();
}

代码示例来源:origin: apache/james-project

@Test
public void isOverQuotaShouldReturnTrueWhenQuotaIsExceeded() {
  Quota<QuotaCount> quota = Quota.<QuotaCount>builder().used(QuotaCount.count(360)).computedLimit(QuotaCount.count(36)).build();
  assertThat(quota.isOverQuota()).isTrue();
}

相关文章