private void verifyResourceInFullAuto(HardwareLayout hardwareLayout,
      Map<String, Map<String, Set<String>>> instancesUnderResourcesInDc,
      Map<String, Map<String, Set<Integer>>> partitionsUnderResourcesInDc) {
    String clusterName = CLUSTER_NAME_PREFIX + CLUSTER_NAME_IN_STATIC_CLUSTER_MAP;
    for (Datacenter dc : hardwareLayout.getDatacenters()) {
      ZkInfo zkInfo = dcsToZkInfo.get(dc.getName());
      ZKHelixAdmin admin = new ZKHelixAdmin("localhost:" + zkInfo.getPort());
      if (activeDcSet.contains(dc.getName())) {
        Map<String, Set<String>> instancesUnderResources = instancesUnderResourcesInDc.get(dc.getName());
        Map<String, Set<Integer>> partitionsUnderResources = partitionsUnderResourcesInDc.get(dc.getName());
        assertEquals("Instances and partitions map must have the same size", instancesUnderResources.size(),
            partitionsUnderResources.size());
        List<String> resources = admin.getResourcesInCluster(clusterName);
        assertEquals("Resource count mismatch", resources.size(), instancesUnderResources.size());
        for (String resource : resources) {
          IdealState idealState = admin.getResourceIdealState(clusterName, resource);
          assertNotNull("Expect resource " + resource + " exist", idealState);
          Set<Integer> partitions =
              idealState.getPartitionSet().stream().map(Integer::valueOf).collect(Collectors.toSet());
          Set<Integer> expectedPartitions = partitionsUnderResources.get(resource);
          assertEquals("Partition mismatch for resource " + resource, expectedPartitions, partitions);

          Set<String> instances = idealState.getPartitionSet()
              .stream()
              .flatMap(pn -> idealState.getInstanceSet(pn).stream())
              .collect(Collectors.toSet());
          Set<String> expectedInstances = instancesUnderResources.get(resource);
          assertEquals("Instances mismatch for resource " + resource, expectedInstances, instances);
        }
      }
      admin.close();
    }
  }
Verify that the number of resources in Helix is as expected.
@param hardwareLayout the {@link HardwareLayout} of the static clustermap.
@param expectedResourceCount the expected number of resources in Helix.
ambry-tools/src/integration-test/java/com/github/ambry/clustermap/HelixBootstrapUpgradeToolTest.java