public void testMulti() throws Exception {
//ensure that server time increments every time we do an operation, otherwise
//previous deletes will eclipse successive puts having the same timestamp
EnvironmentEdgeManagerTestHelper.injectEdge(new IncrementingEnvironmentEdge());
Table t = new HTable(util.getConfiguration(), tableName);
List<Put> puts = new ArrayList<Put>();
Put p = new Put(row1);
p.add(dummy,dummy,dummy);
puts.add(p);
p = new Put(row2);
p.add(test,dummy,dummy);
puts.add(p);
p = new Put(row3);
p.add(test,dummy,dummy);
puts.add(p);
// before HBASE-4331, this would throw an exception
t.put(puts);
checkRowAndDelete(t,row1,1);
checkRowAndDelete(t,row2,0);
checkRowAndDelete(t,row3,0);
puts.clear();
p = new Put(row1);
p.add(test,dummy,dummy);
puts.add(p);
p = new Put(row2);
p.add(test,dummy,dummy);
puts.add(p);
p = new Put(row3);
p.add(test,dummy,dummy);
puts.add(p);
// before HBASE-4331, this would throw an exception
t.put(puts);
checkRowAndDelete(t,row1,0);
checkRowAndDelete(t,row2,0);
checkRowAndDelete(t,row3,0);
puts.clear();
p = new Put(row1);
p.add(test,dummy,dummy);
puts.add(p);
p = new Put(row2);
p.add(test,dummy,dummy);
puts.add(p);
p = new Put(row3);
p.add(dummy,dummy,dummy);
puts.add(p);
// this worked fine even before HBASE-4331
t.put(puts);
checkRowAndDelete(t,row1,0);
checkRowAndDelete(t,row2,0);
checkRowAndDelete(t,row3,1);
puts.clear();
p = new Put(row1);
p.add(dummy,dummy,dummy);
puts.add(p);
p = new Put(row2);
p.add(test,dummy,dummy);
puts.add(p);
p = new Put(row3);
p.add(dummy,dummy,dummy);
puts.add(p);
// this worked fine even before HBASE-4331
t.put(puts);
checkRowAndDelete(t,row1,1);
checkRowAndDelete(t,row2,0);
checkRowAndDelete(t,row3,1);
puts.clear();
p = new Put(row1);
p.add(test,dummy,dummy);
puts.add(p);
p = new Put(row2);
p.add(dummy,dummy,dummy);
puts.add(p);
p = new Put(row3);
p.add(test,dummy,dummy);
puts.add(p);
// before HBASE-4331, this would throw an exception
t.put(puts);
checkRowAndDelete(t,row1,0);
checkRowAndDelete(t,row2,1);
checkRowAndDelete(t,row3,0);
t.close();
EnvironmentEdgeManager.reset();
}