@Before
public void beforeTest() throws Exception {
HBaseTestUtils.util.truncateTable(Bytes.toBytes(tableName));
tablePool = new HTablePool(HBaseTestUtils.getConf(), 10);
Dao<GenericRecord> dao = new GenericAvroDao(tablePool, tableName,
recordString);
for (int i = 0; i < 100; ++i) {
@SuppressWarnings("deprecation")
GenericRecord entity = new GenericData.Record(Schema.parse(recordString));
entity.put("keyPart1", "part1_" + i);
entity.put("keyPart2", "part2_" + i);
entity.put("field1", "field1_" + Integer.toString(i));
entity.put("field2", "field2_" + Integer.toString(i));
dao.put(entity);
}
// Add a few NULL values
@SuppressWarnings("deprecation")
GenericRecord entity = new GenericData.Record(Schema.parse(recordString));
entity.put("keyPart1", "part1_NULL");
entity.put("keyPart2", "part2_NULL");
entity.put("field1", "");
entity.put("field2", "");
dao.put(entity);
@SuppressWarnings("deprecation")
GenericRecord entityMissing = new GenericData.Record(
Schema.parse(recordString));
entityMissing.put("keyPart1", "part1_MISSING");
entityMissing.put("keyPart2", "part2_MISSING");
entityMissing.put("field1", "field1_MISSING_FIELD2");
dao.put(entityMissing);
}