Path rootDir = TEST_UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir();
Path archiveDir = new Path(rootDir, HConstants.HFILE_ARCHIVE_DIRECTORY);
// First region, simple with one plain hfile.
HRegionInfo hri = new HRegionInfo(tableWithRefsName);
HRegionFileSystem r0fs = HRegionFileSystem.createRegionOnFileSystem(conf,
fs, FSUtils.getTableDir(archiveDir, hri.getTable()), hri);
Path storeFile = new Path(rootDir, TEST_HFILE);
FSDataOutputStream out = fs.create(storeFile);
out.write(Bytes.toBytes("Test Data"));
out.close();
r0fs.commitStoreFile(TEST_FAMILY, storeFile);
// Second region, used to test the split case.
// This region contains a reference to the hfile in the first region.
hri = new HRegionInfo(tableWithRefsName);
HRegionFileSystem r1fs = HRegionFileSystem.createRegionOnFileSystem(conf,
fs, new Path(archiveDir, hri.getTable().getNameAsString()), hri);
storeFile = new Path(rootDir, TEST_HFILE + '.' + r0fs.getRegionInfo().getEncodedName());
out = fs.create(storeFile);
out.write(Bytes.toBytes("Test Data"));
out.close();
r1fs.commitStoreFile(TEST_FAMILY, storeFile);
Path tableDir = FSUtils.getTableDir(archiveDir, tableWithRefsName);
HTableDescriptor htd = new HTableDescriptor(tableWithRefsName);
htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
new FSTableDescriptors(fs, rootDir)