@Test
  public void testMobCompactionWithBulkload() throws Exception {
    // The following will produce store files of 600.
    init(UTIL.getConfiguration(), 300);
    byte[] dummyData = makeDummyData(600);

    Path hbaseRootDir = CommonFSUtils.getRootDir(conf);
    Path basedir = new Path(hbaseRootDir, tableDescriptor.getTableName().getNameAsString());
    List<Pair<byte[], String>> hfiles = new ArrayList<>(1);
    for (int i = 0; i < compactionThreshold; i++) {
      Path hpath = new Path(basedir, UUID.randomUUID().toString().replace("-", ""));
      hfiles.add(Pair.newPair(COLUMN_FAMILY, hpath.toString()));
      createHFile(hpath, i, dummyData);
    }

    // The following will bulk load the above generated store files and compact, with 600(fileSize)
    // > 300(threshold)
    Map<byte[], List<Path>> map = region.bulkLoadHFiles(hfiles, true, null);
    assertTrue("Bulkload result:", !map.isEmpty());
    assertEquals("Before compaction: store files", compactionThreshold, countStoreFiles());
    assertEquals("Before compaction: mob file count", 0, countMobFiles());
    assertEquals("Before compaction: rows", compactionThreshold, UTIL.countRows(region));
    assertEquals("Before compaction: mob rows", 0, countMobRows());
    assertEquals("Before compaction: referenced mob file count", 0, countReferencedMobFiles());

    region.compactStores();

    assertEquals("After compaction: store files", 1, countStoreFiles());
    assertEquals("After compaction: mob file count:", 1, countMobFiles());
    assertEquals("After compaction: rows", compactionThreshold, UTIL.countRows(region));
    assertEquals("After compaction: mob rows", compactionThreshold, countMobRows());
    assertEquals("After compaction: referenced mob file count", 1, countReferencedMobFiles());
    assertEquals("After compaction: number of mob cells", compactionThreshold,
      countMobCellsInMetadata());
  }
This test will first generate store files, then bulk load them and trigger the compaction. When
compaction, the cell value will be larger than the threshold.
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestMobStoreCompaction.java