@Test
  public void testLocalMultiKeyExecution_byInstance() throws Exception {
    PartitionedRegion pr = createPartitionedRegion(regionName, 10, 0);

    Set<String> keySet = new HashSet<>();
    for (int i = pr.getTotalNumberOfBuckets() * 2; i > 0; i--) {
      keySet.add(STRING_KEY + i);
    }

    Collection<Integer> expectedValues = new HashSet<>();
    int valueIndex = 0;
    for (String key : keySet) {
      int value = valueIndex++;
      expectedValues.add(value);
      pr.put(key, value);
    }

    Function function = new TestFunction(true, TEST_FUNCTION2);
    FunctionService.registerFunction(function);

    Execution<Boolean, Boolean, List<Boolean>> booleanExecution = FunctionService.onRegion(pr);
    ResultCollector<Boolean, List<Boolean>> booleanResultCollector =
        booleanExecution.withFilter(keySet).setArguments(true).execute(function);

    List<Boolean> booleanResults = booleanResultCollector.getResult();
    assertThat(booleanResults).hasSize(1).containsExactly(true);

    Execution<Set<String>, List<Integer>, List<List<Integer>>> valuesExecution =
        FunctionService.onRegion(pr);
    ResultCollector<List<Integer>, List<List<Integer>>> valuesResultCollector =
        valuesExecution.withFilter(keySet).setArguments(keySet).execute(function);

    List<List<Integer>> valuesResults = valuesResultCollector.getResult();
    assertThat(valuesResults).hasSize(1);

    Collection<Integer> actualValues = new HashSet<>();
    for (List<Integer> values : valuesResults) {
      assertThat(values.size()).isGreaterThan(0);
      for (int value : values) {
        assertThat(actualValues.add(value)).isTrue();
      }
    }
    assertThat(actualValues).isEqualTo(expectedValues);
  }
Test ability to execute a multi-key function by a local data store
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/execute/PRFunctionExecutionDUnitTest.java