private void createPartitionRegions(final String regionNamePrefix, final int numberOfRegions,
      final int localMaxMemory, final int recoveryDelay, final int redundancy) {
    for (int i = 0; i < numberOfRegions; i++) {
      PartitionAttributesFactory partitionAttributesFactory = new PartitionAttributesFactory();
      partitionAttributesFactory.setLocalMaxMemory(localMaxMemory);
      partitionAttributesFactory.setRedundantCopies(redundancy);
      partitionAttributesFactory.setRecoveryDelay(recoveryDelay);

      RegionFactory regionFactory = getCache().createRegionFactory(RegionShortcut.PARTITION);
      regionFactory.setPartitionAttributes(partitionAttributesFactory.create());

      regionFactory.create(regionNamePrefix + i);
    }
  }
Test for peer recovery of buckets when a member is removed from the distributed system
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionHAFailureAndRecoveryDUnitTest.java