public void testBatchWriterTimeout(Connector conn, String tableName) throws Exception {
conn.tableOperations().create(tableName);
conn.tableOperations().addConstraint(tableName, SlowConstraint.class.getName());
sleepUninterruptibly(1, TimeUnit.SECONDS);
BatchWriter bw = conn.createBatchWriter(tableName,
new BatchWriterConfig().setTimeout(3, TimeUnit.SECONDS));
Mutation mut = new Mutation("r1");
mut.put("cf1", "cq1", "v1");
bw.addMutation(mut);
try {
bw.close();
fail("batch writer did not timeout");
} catch (MutationsRejectedException mre) {
if (mre.getCause() instanceof TimedOutException)
return;
throw mre;
}
}