@Override public synchronized String toString() { StringBuilder builder = new StringBuilder(); builder.append("QuotaState(ts=" + getLastUpdate()); if (isBypass()) { builder.append(" bypass"); } else { if (globalLimiter != NoopQuotaLimiter.get()) { //builder.append(" global-limiter"); builder.append(" " + globalLimiter); } } builder.append(')'); return builder.toString(); }
assertTrue(quotaInfo.isBypass()); otherQuotaState.setQuotas(buildReqNumThrottle(NUM_GLOBAL_THROTTLE_1)); assertEquals(LAST_UPDATE_1, otherQuotaState.getLastUpdate()); assertFalse(otherQuotaState.isBypass()); assertFalse(quotaInfo.isBypass()); assertThrottleException(quotaInfo.getGlobalLimiter(), NUM_GLOBAL_THROTTLE_1); otherQuotaState.setQuotas(buildReqNumThrottle(NUM_GLOBAL_THROTTLE_2)); assertEquals(LAST_UPDATE_2, otherQuotaState.getLastUpdate()); assertFalse(otherQuotaState.isBypass()); assertFalse(quotaInfo.isBypass()); assertThrottleException(quotaInfo.getGlobalLimiter(), NUM_GLOBAL_THROTTLE_2 - NUM_GLOBAL_THROTTLE_1); assertTrue(otherQuotaState.isBypass()); assertTrue(quotaInfo.isBypass()); assertNoopLimiter(quotaInfo.getGlobalLimiter());
@Test public void testQuotaStateBypass() { QuotaState quotaInfo = new QuotaState(); assertTrue(quotaInfo.isBypass()); assertNoopLimiter(quotaInfo.getGlobalLimiter()); UserQuotaState userQuotaState = new UserQuotaState(); assertTrue(userQuotaState.isBypass()); assertNoopLimiter(userQuotaState.getTableLimiter(UNKNOWN_TABLE_NAME)); }
@Override public synchronized String toString() { StringBuilder builder = new StringBuilder(); builder.append("QuotaState(ts=" + getLastUpdate()); if (isBypass()) { builder.append(" bypass"); } else { if (globalLimiter != NoopQuotaLimiter.get()) { // builder.append(" global-limiter"); builder.append(" " + globalLimiter); } } builder.append(')'); return builder.toString(); }
assertTrue(quotaInfo.isBypass()); otherQuotaState.setQuotas(buildReqNumThrottle(NUM_GLOBAL_THROTTLE_1)); assertEquals(LAST_UPDATE_1, otherQuotaState.getLastUpdate()); assertFalse(otherQuotaState.isBypass()); assertFalse(quotaInfo.isBypass()); assertThrottleException(quotaInfo.getGlobalLimiter(), NUM_GLOBAL_THROTTLE_1); otherQuotaState.setQuotas(buildReqNumThrottle(NUM_GLOBAL_THROTTLE_2)); assertEquals(LAST_UPDATE_2, otherQuotaState.getLastUpdate()); assertFalse(otherQuotaState.isBypass()); assertFalse(quotaInfo.isBypass()); assertThrottleException(quotaInfo.getGlobalLimiter(), NUM_GLOBAL_THROTTLE_2 - NUM_GLOBAL_THROTTLE_1); assertTrue(otherQuotaState.isBypass()); assertTrue(quotaInfo.isBypass()); assertNoopLimiter(quotaInfo.getGlobalLimiter());
@Test public void testQuotaStateBypass() { QuotaState quotaInfo = new QuotaState(); assertTrue(quotaInfo.isBypass()); assertNoopLimiter(quotaInfo.getGlobalLimiter()); UserQuotaState userQuotaState = new UserQuotaState(); assertTrue(userQuotaState.isBypass()); assertNoopLimiter(userQuotaState.getTableLimiter(UNKNOWN_TABLE_NAME)); }