@Test
  public void testBulkOpInClientWithBadMetadataCausesRefresh() {
    client.invoke("testBulkOpInClientWithBadMetadataCausesRefresh", () -> {
      Region<Integer, Object> region = cache.getRegion(PartitionedRegionName);
      assertThat(region).isNotNull();
      final List<Object> testValueList = new ArrayList<>();
      final List<Integer> testKeyList = new ArrayList<>();
      for (int i = (totalNumBuckets * 3); i > 0; i--) {
        testValueList.add("execKey-" + i);
      }
      DistributedSystem.setThreadsSocketPolicy(false);
      int j = 0;
      Map<Integer, Object> origVals = new HashMap<>();
      for (Object o : testValueList) {
        testKeyList.add(j);
        Integer key = j++;
        origVals.put(key, o);
        region.put(key, o);
      }

      // check if the client meta-data is in synch
      verifyMetadata();

      long metadataRefreshes =
          ((GemFireCacheImpl) cache).getClientMetadataService()
              .getTotalRefreshTaskCount_TEST_ONLY();

      removePrimaryMetadata();

      Map<Integer, Object> resultMap = region.getAll(testKeyList);
      assertThat(resultMap).isEqualTo(origVals);

      // a new refresh should have been triggered
      assertThat(((GemFireCacheImpl) cache).getClientMetadataService()
          .getTotalRefreshTaskCount_TEST_ONLY())
              .isNotEqualTo(metadataRefreshes);
    });
  }
If a client doesn't know the primary location of a bucket it should perform a
metadata refresh. This test purposefully removes all primary location knowledge
from PR metadata in a client cache and then performs a bulk operation. This
should trigger a refresh.
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/SingleHopGetAllPutAllDUnitTest.java