public void testSimpleSerialziationDeserialization() throws Exception {
byte[] indexed_qualifer = Bytes.toBytes("indexed_qual");
//setup the index
CoveredColumnIndexSpecifierBuilder builder = new CoveredColumnIndexSpecifierBuilder();
ColumnGroup fam1 = new ColumnGroup(INDEX_TABLE);
// match a single family:qualifier pair
CoveredColumn col1 = new CoveredColumn(FAMILY, indexed_qualifer);
fam1.add(col1);
// matches the family2:* columns
CoveredColumn col2 = new CoveredColumn(FAMILY2, null);
fam1.add(col2);
builder.addIndexGroup(fam1);
ColumnGroup fam2 = new ColumnGroup(INDEX_TABLE2);
// match a single family2:qualifier pair
CoveredColumn col3 = new CoveredColumn(FAMILY2, indexed_qualifer);
fam2.add(col3);
builder.addIndexGroup(fam2);
Configuration conf = new Configuration(false);
//convert the map that HTableDescriptor gets into the conf the coprocessor receives
Map<String, String> map = builder.convertToMap();
for(Entry<String, String> entry: map.entrySet()){
conf.set(entry.getKey(), entry.getValue());
}
List<ColumnGroup> columns = CoveredColumnIndexSpecifierBuilder.getColumns(conf);
assertEquals("Didn't deserialize the expected number of column groups", 2, columns.size());
ColumnGroup group = columns.get(0);
assertEquals("Didn't deserialize expected column in first group", col1, group.getColumnForTesting(0));
assertEquals("Didn't deserialize expected column in first group", col2, group.getColumnForTesting(1));
group = columns.get(1);
assertEquals("Didn't deserialize expected column in second group", col3, group.getColumnForTesting(0));
}