Search in sources :

Example 1 with QuotaSource

use of com.github.ambry.quota.QuotaSource in project ambry by linkedin.

the class AmbryCUQuotaSourceTest method testInit.

public void testInit() throws Exception {
    QuotaSource quotaSource = new AmbryCUQuotaSourceFactory(new QuotaConfig(new VerifiableProperties(new Properties())), inMemAccountService).getQuotaSource();
    Assert.assertFalse(quotaSource.isReady());
    quotaSource.init();
    Assert.assertTrue(quotaSource.isReady());
    quotaSource.shutdown();
    Assert.assertFalse(quotaSource.isReady());
}
Also used : QuotaSource(com.github.ambry.quota.QuotaSource) VerifiableProperties(com.github.ambry.config.VerifiableProperties) QuotaConfig(com.github.ambry.config.QuotaConfig) Properties(java.util.Properties) VerifiableProperties(com.github.ambry.config.VerifiableProperties)

Example 2 with QuotaSource

use of com.github.ambry.quota.QuotaSource in project ambry by linkedin.

the class AmbryCUQuotaEnforcerFactoryTest method testGetRequestQuotaEnforcer.

@Test
public void testGetRequestQuotaEnforcer() throws IOException {
    QuotaConfig quotaConfig = new QuotaConfig(new VerifiableProperties(new Properties()));
    QuotaSource quotaSource = new AmbryCUQuotaSource(quotaConfig, Mockito.mock(AccountService.class));
    AccountStatsStore mockAccountStatsStore = Mockito.mock(AccountStatsStore.class);
    AmbryCUQuotaEnforcerFactory ambryCUQuotaEnforcerFactory = new AmbryCUQuotaEnforcerFactory(quotaConfig, quotaSource, mockAccountStatsStore);
    Assert.assertEquals(AmbryCUQuotaEnforcer.class, ambryCUQuotaEnforcerFactory.getQuotaEnforcer().getClass());
}
Also used : QuotaSource(com.github.ambry.quota.QuotaSource) VerifiableProperties(com.github.ambry.config.VerifiableProperties) QuotaConfig(com.github.ambry.config.QuotaConfig) Properties(java.util.Properties) VerifiableProperties(com.github.ambry.config.VerifiableProperties) AccountService(com.github.ambry.account.AccountService) AccountStatsStore(com.github.ambry.accountstats.AccountStatsStore) Test(org.junit.Test)

Aggregations

QuotaConfig (com.github.ambry.config.QuotaConfig)2 VerifiableProperties (com.github.ambry.config.VerifiableProperties)2 QuotaSource (com.github.ambry.quota.QuotaSource)2 Properties (java.util.Properties)2 AccountService (com.github.ambry.account.AccountService)1 AccountStatsStore (com.github.ambry.accountstats.AccountStatsStore)1 Test (org.junit.Test)1