public void regionIsolationOperation(ServerName sourceServerName,
    ServerName destinationServerName, int numRegionsToIsolate, boolean isolateMetaAlso)
    throws Exception {
    final TableName tableName = TableName.valueOf(name.getMethodName());
    SingleProcessHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
    Admin admin = TEST_UTIL.getAdmin();
    HRegionServer sourceRS = cluster.getRegionServer(sourceServerName);
    List<HRegion> hRegions = sourceRS.getRegions().stream()
      .filter(hRegion -> hRegion.getRegionInfo().getTable().equals(tableName))
      .collect(Collectors.toList());
    List<String> listOfRegionIDsToIsolate = new ArrayList<>();
    for (int i = 0; i < numRegionsToIsolate; i++) {
      listOfRegionIDsToIsolate.add(hRegions.get(i).getRegionInfo().getEncodedName());
    }

    if (isolateMetaAlso) {
      listOfRegionIDsToIsolate.remove(0);
      listOfRegionIDsToIsolate.add(RegionInfoBuilder.FIRST_META_REGIONINFO.getEncodedName());
    }

    HRegionServer destinationRS = cluster.getRegionServer(destinationServerName);
    String destinationRSName = destinationRS.getServerName().getAddress().toString();
    RegionMover.RegionMoverBuilder rmBuilder =
      new RegionMover.RegionMoverBuilder(destinationRSName, TEST_UTIL.getConfiguration()).ack(true)
        .maxthreads(8).isolateRegionIdArray(listOfRegionIDsToIsolate);
    try (RegionMover rm = rmBuilder.build()) {
      LOG.debug("Unloading {} except regions: {}", destinationRS.getServerName(),
        listOfRegionIDsToIsolate);
      rm.isolateRegions();
      Assert.assertEquals(numRegionsToIsolate, destinationRS.getNumberOfOnlineRegions());
      List<HRegion> onlineRegions = destinationRS.getRegions();
      for (int i = 0; i < numRegionsToIsolate; i++) {
        Assert.assertTrue(
          listOfRegionIDsToIsolate.contains(onlineRegions.get(i).getRegionInfo().getEncodedName()));
      }
      LOG.debug("Successfully Isolated {} regions: {} on {}", listOfRegionIDsToIsolate.size(),
        listOfRegionIDsToIsolate, destinationRS.getServerName());
    } finally {
      admin.recommissionRegionServer(destinationRS.getServerName(), null);
    }
  }
Tests for Region Mover Load/Unload functionality with and without ack mode and also to test
exclude functionality useful for rack decommissioning
hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRegionMover2.java