@Test public void serviceCanBeDisabled() { quotaService = new HostRequestsQuotaService(requestRegistry, requestsPolicy, registryCleaner, registryLogger, false); assertFalse(quotaService.isQuotaExceeded("key")); verifyNoMoreInteractions(requestRegistry, requestsPolicy); }
@Override public boolean isQuotaExceeded(String key) { if (enabled) { long count = requestRegistry.tick(key); return !requestsPolicy.isValid(count); } return false; }
HostRequestsQuotaService implements QuotaService { @Override public boolean isQuotaExceeded(String key) { if (enabled) { long count = requestRegistry.tick(key); return !requestsPolicy.isValid(count); } return false; } }
HostRequestsQuotaService implements QuotaService { @Override public boolean isQuotaExceeded(String key) { if (enabled) { long count = requestRegistry.tick(key); return !requestsPolicy.isValid(count); } return false; } HostRequestsQuotaService(HostRequestIntervalRegistry requestRegistry, HostRequestLimitPolicy requestsPolicy,
                                    IntervalRegistryCleaner registryCleaner, IntervalRegistryLogger registryLogger,
                                    @Value("${quota.host.enabled}") boolean enabled); }
HostRequestsQuotaService implements QuotaService { @Override public boolean isQuotaExceeded(String key) { if (enabled) { long count = requestRegistry.tick(key); return !requestsPolicy.isValid(count); } return false; } HostRequestsQuotaService(HostRequestIntervalRegistry requestRegistry, HostRequestLimitPolicy requestsPolicy,
                                    IntervalRegistryCleaner registryCleaner, IntervalRegistryLogger registryLogger,
                                    @Value("${quota.host.enabled}") boolean enabled); @PostConstruct void init(); @PreDestroy void close(); @Override boolean isQuotaExceeded(String key); }
HostRequestsQuotaService implements QuotaService { @Override public boolean isQuotaExceeded(String key) { if (enabled) { long count = requestRegistry.tick(key); return !requestsPolicy.isValid(count); } return false; } HostRequestsQuotaService(HostRequestIntervalRegistry requestRegistry, HostRequestLimitPolicy requestsPolicy,
                                    IntervalRegistryCleaner registryCleaner, IntervalRegistryLogger registryLogger,
                                    @Value("${quota.host.enabled}") boolean enabled); @PostConstruct void init(); @PreDestroy void close(); @Override boolean isQuotaExceeded(String key);  }