private final void setUpDistributedCacheTestCase(boolean createLocalCache) throws Exception {
    if (createLocalCache) {
      try {
        remoteCreateCache();
        assertTrue(cache != null);

      } catch (Exception ex) {
        String s = "While creating cache in this VM";
        throw new InternalGemFireException(s, ex);
      }
    } else {
      getSystem(); // make sure we have a connected DistributedSystem
    }

    for (int h = 0; h < Host.getHostCount(); h++) {
      Host host = Host.getHost(h);

      for (int v = 0; v < host.getVMCount(); v++) {
        VM vm = host.getVM(v);
        vm.invoke(DistributedCacheTestCase::remoteCreateCache);
      }
    }
  }
Creates the {@link Cache} and root region in each remote VM and, if createLocalCache, in this
VM.
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/DistributedCacheTestCase.java