use of org.hbase.async.HBaseException in project opentsdb by OpenTSDB.
the class TestUniqueId method getOrCreateIdUnableToIncrementMaxId.
// Test the creation of an ID when unable to increment MAXID
@Test
public void getOrCreateIdUnableToIncrementMaxId() throws Exception {
PowerMockito.mockStatic(Thread.class);
uid = new UniqueId(client, table, METRIC, 3);
// null => ID doesn't exist.
when(client.get(anyGet())).thenReturn(Deferred.<ArrayList<KeyValue>>fromResult(null));
// Watch this! ______,^ I'm writing C++ in Java!
HBaseException hbe = fakeHBaseException();
when(client.atomicIncrement(incrementForRow(MAXID))).thenThrow(hbe);
PowerMockito.doNothing().when(Thread.class);
Thread.sleep(anyInt());
try {
uid.getOrCreateId("foo");
fail("HBaseException should have been thrown!");
} catch (HBaseException e) {
assertSame(hbe, e);
}
}
Aggregations