Put put = new Put(row1);
put.add(fam1, qf1, emptyVal);
//checkAndPut with empty value
boolean res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL,
new BinaryComparator(emptyVal), put, lockId, true);
assertTrue(res);
//Putting data in key
put = new Put(row1);
put.add(fam1, qf1, val1);
//checkAndPut with correct value
res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL,
new BinaryComparator(emptyVal), put, lockId, true);
assertTrue(res);
// not empty anymore
res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL,
new BinaryComparator(emptyVal), put, lockId, true);
assertFalse(res);
Delete delete = new Delete(row1);
delete.deleteColumn(fam1, qf1);
res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL,
new BinaryComparator(emptyVal), delete, lockId, true);
assertFalse(res);
put = new Put(row1);
put.add(fam1, qf1, val2);
//checkAndPut with correct value
res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL,
new BinaryComparator(val1), put, lockId, true);
assertTrue(res);
//checkAndDelete with correct value
delete = new Delete(row1);
delete.deleteColumn(fam1, qf1);
delete.deleteColumn(fam1, qf1);
res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL,
new BinaryComparator(val2), delete, lockId, true);
assertTrue(res);
delete = new Delete(row1);
res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL,
new BinaryComparator(emptyVal), delete, lockId, true);
assertTrue(res);
//checkAndPut looking for a null value
put = new Put(row1);
put.add(fam1, qf1, val1);