@Test
  public void testGetPartitionsRequest() throws Exception {
    ReturnTable returnTable = createTable4PartColsParts(getClient());
    Table t = returnTable.table;
    GetPartitionsRequest request = new GetPartitionsRequest(t.getDbName(), t.getTableName(),
        new GetProjectionsSpec(), new GetPartitionsFilterSpec());
    request.setCatName(t.getCatName());

    List<Partition> partitions = MetaStoreServerUtils.getPartitionsByProjectSpec(getClient(), request);
    assertPartitionsHaveCorrectParams(partitions);
    List<List<String>> values = partitions.stream().map(partition -> partition.getValues()).collect(Collectors.toList());
    assertEquals(returnTable.testValues, values);

    request.getProjectionSpec()
        .setFieldList(Arrays.asList("dbName", "tableName", "catName", "parameters", "values"));
    partitions = MetaStoreServerUtils.getPartitionsByProjectSpec(getClient(), request);
    assertPartitionsHaveCorrectParams(partitions);
    values = partitions.stream().map(partition -> partition.getValues()).collect(Collectors.toList());
    assertEquals(returnTable.testValues, values);

    request.getFilterSpec().setFilterMode(PartitionFilterMode.BY_VALUES);
    request.getFilterSpec().setFilters(Arrays.asList("2017"));
    partitions = MetaStoreServerUtils.getPartitionsByProjectSpec(getClient(), request);
    assertPartitionsHaveCorrectParams(partitions);
    values = partitions.stream().map(partition -> partition.getValues()).collect(Collectors.toList());
    assertEquals("Two partitions expected", 2, values.size());
    assertEquals(Arrays.asList(Arrays.asList("2017", "10", "26"),
        Arrays.asList("2017", "11", "27")), returnTable.testValues.subList(2, 4));
  }
Test class for list partitions with configurable include/exclude pattern on parameters.
Embedded Metastore uses JDO, Remote Metastore uses direct SQL to query the partitions:
MetaStoreFactoryForTests.getMetaStores()
ql/src/test/org/apache/hadoop/hive/metastore/TestListPartitionsWithXIncludeParams.java