@Test
  public void testSplitStoreFileWithFavoriteNodes() throws IOException {

    Path dir = new Path(util.getDefaultRootDirPath(), "testhfile");
    FileSystem fs = util.getDFSCluster().getFileSystem();

    Path testIn = new Path(dir, "testSplitStoreFileWithFavoriteNodes");
    ColumnFamilyDescriptor familyDesc = ColumnFamilyDescriptorBuilder.of(FAMILY);
    String tableName = tn.getMethodName();
    Table table = util.createTable(TableName.valueOf(tableName), familyDesc.getNameAsString());
    HFileTestUtil.createHFile(util.getConfiguration(), fs, testIn, FAMILY, QUALIFIER,
      Bytes.toBytes("aaa"), Bytes.toBytes("zzz"), 1000);

    Path bottomOut = new Path(dir, "bottom.out");
    Path topOut = new Path(dir, "top.out");

    final AsyncTableRegionLocator regionLocator =
      util.getAsyncConnection().getRegionLocator(TableName.valueOf(tableName));
    BulkLoadHFilesTool.splitStoreFile(regionLocator, util.getConfiguration(), testIn, familyDesc,
      Bytes.toBytes("ggg"), bottomOut, topOut);
    verifyHFileFavoriteNode(topOut, regionLocator, fs);
    verifyHFileFavoriteNode(bottomOut, regionLocator, fs);
    int rowCount = verifyHFile(bottomOut);
    rowCount += verifyHFile(topOut);
    assertEquals(1000, rowCount);
  }
Test hfile splits with the favored nodes
hbase-server/src/test/java/org/apache/hadoop/hbase/tool/TestBulkLoadHFiles.java