@Override public SerializableQuota<QuotaSize> getStorageQuota(String quotaRoot) throws MailboxException { return SerializableQuota.newInstance(quotaManager.getStorageQuota(quotaRootResolver.fromString(quotaRoot))); }
public static <U extends QuotaValue<U>> SerializableQuota<U> newInstance(U used, U max) { return new SerializableQuota<>( new SerializableQuotaValue<>(used), new SerializableQuotaValue<>(max) ); }
@Override public SerializableQuota<QuotaCount> getMessageCountQuota(String quotaRoot) throws MailboxException { return SerializableQuota.newInstance(quotaManager.getMessageQuota(quotaRootResolver.fromString(quotaRoot))); }
public static <U extends QuotaValue<U>> SerializableQuota<U> newInstance(Quota<U> quota) { return newInstance(quota.getUsed(), quota.getLimit()); }
@Test public void getMessageCountQuotaCommandShouldWork() throws Exception { String quotaroot = "#private&user@domain"; String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.GETMESSAGECOUNTQUOTA.getCommand(), quotaroot}; CommandLine commandLine = ServerCmd.parseCommandLine(arguments); when(quotaProbe.getMessageCountQuota(quotaroot)).thenReturn(SerializableQuota.newInstance(QuotaCount.unlimited(), QuotaCount.count(12))); testee.executeCommandLine(commandLine); }
@Test public void getStorageQuotaCommandShouldWork() throws Exception { String quotaroot = "#private&user@domain"; String[] arguments = { "-h", "127.0.0.1", "-p", "9999", CmdType.GETSTORAGEQUOTA.getCommand(), quotaroot}; CommandLine commandLine = ServerCmd.parseCommandLine(arguments); when(quotaProbe.getStorageQuota(quotaroot)).thenReturn(SerializableQuota.newInstance(QuotaSize.unlimited(), QuotaSize.size(12))); testee.executeCommandLine(commandLine); }