private void validatePutAndCreateAndKeySetIteratorInDatastore(final VM vm0) {
    vm0.invoke(() -> {
      Cache cache = getCache();
      Region<String, String> region = cache.getRegion(regionName);

      // size and isEmpty and keySet
      assertThat(region.size()).isEqualTo(0);
      assertThat(region.isEmpty()).isTrue();
      assertThat(region.keySet().size()).isEqualTo(0);

      // put
      for (int i = putRange_1Start; i <= putRange_1End; i++) {
        region.put(Integer.toString(i), Integer.toString(i));
      }

      // size and isEmpty
      assertThat(region.size()).isEqualTo(putRange_1End);
      assertThat(region.isEmpty()).isFalse();

      // Positive assertion of functionality in a distributed env.
      // For basic functional support (or lack of), please see
      // PartitionedRegionSingleNodeOperationsJUnitTest

      // keys
      Set<String> keySet = region.keySet();
      assertThat(keySet.size()).isEqualTo(putRange_1End);

      // keySet iterator
      Iterator<String> iterator = keySet.iterator();
      while (iterator.hasNext()) {
        assertThatThrownBy(iterator::remove).isInstanceOf(Exception.class);
        String key = iterator.next();
        assertThat(key.getClass()).isEqualTo(String.class);
      }

      assertThatThrownBy(iterator::remove).isInstanceOf(Exception.class);
      assertThat(iterator.hasNext()).isFalse();

      assertThatThrownBy(iterator::next).isInstanceOf(NoSuchElementException.class);
      assertThat(iterator.hasNext()).isFalse();

      // destroy
      try (IgnoredException ignored1 = addIgnoredException(EntryNotFoundException.class.getName());
          IgnoredException ignored2 = addIgnoredException(ReplyException.class.getName())) {
        for (int i = putRange_1Start; i <= putRange_1End; i++) {
          region.destroy(Integer.toString(i));
        }
      }

      // size and isEmpty
      assertThat(region.size()).isEqualTo(0);
      assertThat(region.isEmpty()).isTrue();

      // put
      for (int i = putRange_1Start; i <= putRange_1End; i++) {
        String key = Integer.toString(i);
        String value = Integer.toString(i);

        region.put(key, value);
      }

      // create
      for (int i = createRange_1Start; i <= createRange_1End; i++) {
        String key = Integer.toString(i);
        String value = i % 2 == 0 ? Integer.toString(i) : null;

        region.create(key, value);
      }

      // create throws EntryExistsException
      try (IgnoredException ignored1 = addIgnoredException(EntryExistsException.class.getName());
          IgnoredException ignored2 = addIgnoredException(ReplyException.class.getName())) {
        for (int i = createRange_1Start; i <= createRange_1End; i++) {
          String key = Integer.toString(i);
          String value = i % 2 == 0 ? Integer.toString(i) : null;

          assertThatThrownBy(() -> region.create(key, value))
              .isInstanceOf(EntryExistsException.class);
        }
      }
    });
  }
This is a PartitionedRegion test for scope = D_ACK. 4 VMs are used to create the PR with and
without(Only Accessor) the DataStore.
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionAPIDUnitTest.java