@Test
  public void testSimpleQueryOnLocator() {
    server1.invoke(() -> setUpDataForRegion(PARTITIONED_REGION_NAME_PATH));

    locator.invoke(() -> {
      String query = "query --query=\"" +
          "select ID , status , createTime , pk, floatMinValue " +
          "from " + PARTITIONED_REGION_NAME_PATH + " " +
          "where ID <= 4" + "\" --interactive=false";

      String result = getMemberMXBean().processCommand(query);

      assertThat(result).contains("ID");
      assertThat(result).contains("status");
      assertThat(result).contains("createTime");
      assertThat(result).contains("pk");
      assertThat(result).contains("floatMinValue");
      assertThat(result).contains("\"Rows\":\"5\"");
    });
  }
Override to specify the mechanism used to connect to the Locator.
geode-dunit/src/main/java/org/apache/geode/management/internal/cli/commands/QueryCommandDistributedTestBase.java