assertEquals(tb.getRate(), RATE);
assertEquals(tb.getSize(), SIZE);
}
public void testTokenBucket() throws Exception {
HTableTokenBucket tb = new HTableTokenBucket(conf, TABLE,
Bytes.toBytes(USER_TOKEN));
int last = 0;
for (int i = 0; i <= 5 && last < 10; i++) {
int avail = tb.available();
assertTrue("bucket did not increment", avail > last);
assertTrue("bucket updated too quickly", avail - last < 3);
last = avail;
Thread.sleep(2000);
}