@Test
  public void testGetPartitionsByNames() throws Exception {
    try {
      resetHMSClient();

      final String dbName = "db1";
      String tblName = "test_get_parts_by_names";
      int count = 1;
      int pCount = 10;
      int bucketCount = 100;
      Map<String, Object> tProps = new HashMap<>();

      tProps.put("DBNAME", dbName);
      tProps.put("TBLNAME", tblName);

      List<String> capabilities = new ArrayList<>();
      TableType type = TableType.MANAGED_TABLE;

      capabilities.add("HIVEFULLACIDWRITE");
      capabilities.add("HIVEFULLACIDREAD");
      capabilities.add("HIVECACHEINVALIDATE");
      capabilities.add("CONNECTORREAD");
      capabilities.add("CONNECTORWRITE");

      // tProps.put("CAPABILITIES", capabilities);
      tProps.put("TBLTYPE", type);
      tProps.put("PARTITIONS", pCount);

      setHMSClient("TestGetPartitionByNames#1", (String[])(capabilities.toArray(new String[0])));

      Table table = createTableWithCapabilities(tProps);

      List<String> partValues = new ArrayList<>();
      for (int i = 1; i <= pCount; i++) {
        partValues.add("partcol=" + i);
      }
      GetPartitionsByNamesRequest req = convertToGetPartitionsByNamesRequest(dbName, tblName, partValues);
      List<Partition> parts = client.getPartitionsByNames(req).getPartitions();
      assertEquals("Return list size does not match expected size", pCount, parts.size());

      tblName = "test_gp_ext_bucketed_wc";
      StringBuilder properties = new StringBuilder();
      properties.append("EXTERNAL").append("=").append("TRUE");
      properties.append(";");
      properties.append(CAPABILITIES_KEY).append("=").append("HIVEBUCKET2,EXTREAD,EXTWRITE");
      tProps.put("TBLNAME", tblName);
      tProps.put("TBLTYPE", TableType.EXTERNAL_TABLE);
      tProps.put("BUCKETS", bucketCount);
      tProps.put("PROPERTIES", properties.toString());
      table = createTableWithCapabilities(tProps);

      req = convertToGetPartitionsByNamesRequest(dbName, tblName, partValues);
      parts = client.getPartitionsByNames(req).getPartitions();
      LOG.debug("Return list size=" + parts.size());

      for (Partition part : parts) {
        assertEquals("Partition bucket count does not match", -1, part.getSd().getNumBuckets());
      }

      // processor has capabilities
      capabilities.clear();
      capabilities.add("HIVEBUCKET2");
      setHMSClient("TestGetPartitionByNames#2", (String[])(capabilities.toArray(new String[0])));
      req = convertToGetPartitionsByNamesRequest(dbName, tblName, partValues);
      parts = client.getPartitionsByNames(req).getPartitions();

      for (Partition part : parts) {
        assertEquals("Partition bucket count does not match", bucketCount, part.getSd().getNumBuckets());
      }

      // processor has ACCEPTS_UNMODIFIED_METADATA
      capabilities.clear();
      capabilities.add("ACCEPTS_UNMODIFIED_METADATA");
      setHMSClient("TestGetPartitionByNames#3", (String[])(capabilities.toArray(new String[0])));
      req = convertToGetPartitionsByNamesRequest(dbName, tblName, partValues);
      parts = client.getPartitionsByNames(req).getPartitions();

      for (Partition part : parts) {
        assertEquals("Partition bucket count does not match", bucketCount, part.getSd().getNumBuckets());
      }

      tblName = "test_parts_mgd_insert_wc";
      properties = new StringBuilder();
      properties.append("transactional=true");
      properties.append(";");
      properties.append(CAPABILITIES_KEY).append("=").append("HIVEMANAGEDINSERTREAD,HIVEMANAGEDINSERTWRITE,HIVECACHEINVALIDATE,")
                .append("HIVEMANAGEDSTATS,CONNECTORREAD,CONNECTORWRITE");
      properties.append(";");
      properties.append("transactional_properties=insert_only");
      tProps.put("TBLNAME", tblName);
      tProps.put("PROPERTIES", properties.toString());
      setHMSClient("createTable", new String[] {"HIVEMANAGEDINSERTWRITE,HIVEFULLACIDWRITE"});
      table = createTableWithCapabilities(tProps);
      resetHMSClient();

      capabilities.clear();
      capabilities.add("CONNECTORREAD");
      setHMSClient("TestGetPartitionByNames#3", (String[])(capabilities.toArray(new String[0])));
      req = convertToGetPartitionsByNamesRequest(dbName, tblName, partValues);
      parts = client.getPartitionsByNames(req).getPartitions();
      assertEquals("Partition count does not match", pCount, parts.size());

      LOG.info("Test execution complete:testGetPartitionsByNames");
    } catch (Exception e) {
      System.err.println(StringUtils.stringifyException(e));
      System.err.println("testGetPartitionsByNames() failed.");
      fail("testGetPartitions failed:" + e.getMessage());
    } finally {
      resetHMSClient();
    }
  }
EXTERNAL_TABLE
  1) Old table (name in upper case) with no capabilities
  2) Old table with no capabilities
  3a) New table with capabilities with no client requirements
  3b) New table with capabilities with no matching client requirements
  3c) New table with capabilities with partial match requirements
  3d) New table with capabilities with full match requirements
itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetastoreTransformer.java