private void writeBootstrapOrUpgrade(long expectedResourceCount, boolean forceRemove, int maxInstancesInOneResource)
      throws Exception {
    Utils.writeJsonObjectToFile(zkJson, zkLayoutPath);
    Utils.writeJsonObjectToFile(testHardwareLayout.getHardwareLayout().toJSONObject(), hardwareLayoutPath);
    Utils.writeJsonObjectToFile(testPartitionLayout.getPartitionLayout().toJSONObject(), partitionLayoutPath);
    // This updates and verifies that the information in Helix is consistent with the one in the static cluster map.
    HelixBootstrapUpgradeUtil.bootstrapOrUpgrade(hardwareLayoutPath, partitionLayoutPath, zkLayoutPath,
        CLUSTER_NAME_PREFIX, dcStr, DEFAULT_MAX_PARTITIONS_PER_RESOURCE, false, forceRemove, new HelixAdminFactory(),
        false, ClusterMapConfig.DEFAULT_STATE_MODEL_DEF, BootstrapCluster, dataNodeConfigSourceType, false,
        maxInstancesInOneResource);
    verifyResourceCount(testHardwareLayout.getHardwareLayout(), expectedResourceCount);
  }
Write the layout files out from the constructed in-memory hardware and partition layouts; use the bootstrap tool
to update the contents in Helix; verify that the information is consistent between the two.
@param expectedResourceCount number of resources expected in Helix for this cluster in each datacenter.
@param forceRemove whether the forceRemove option should be passed when doing the bootstrap/upgrade.
@param maxInstancesInOneResource the maximum number of data nodes to place under a resource, this is only meaningful
                                 when the resources are constructed to be full auto compatible.
@throws IOException if a file read error is encountered.
@throws JSONException if a JSON parse error is encountered.
ambry-tools/src/integration-test/java/com/github/ambry/clustermap/HelixBootstrapUpgradeToolTest.java