Map<String, List<Mutation>> mutationMap = new HashMap<String, List<Mutation>>();
ArrayList<Mutation> mutations = new ArrayList<Mutation>(10);
for (int j = 0; j < 10; j++) {
Column col = new Column(StringSerializer.get().toByteBuffer("testBatchMutateColumn_" + j),
StringSerializer.get().toByteBuffer("testBatchMutateColumn_value_" + j), connectionManager.createClock());
//list.add(col);
ColumnOrSuperColumn cosc = new ColumnOrSuperColumn();
cosc.setColumn(col);
Mutation mutation = new Mutation();
mutation.setColumn_or_supercolumn(cosc);
mutations.add(mutation);
}
mutationMap.put("Standard1", mutations);
outerMutationMap.put("testBatchMutateColumn_" + i, mutationMap);
}
keyspace.batchMutate(se.toBytesMap(outerMutationMap));
// re-use later
outerMutationMap.clear();
// get value
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
ColumnPath cp = new ColumnPath("Standard1");
cp.setColumn(bytes("testBatchMutateColumn_" + j));
Column col = keyspace.getColumn("testBatchMutateColumn_" + i, cp);
assertNotNull(col);
String value = string(col.getValue());
assertEquals("testBatchMutateColumn_value_" + j, value);
}
}