@Test
  public void testAddPartitionSpecDBAndTableSetFromSpecProxy() throws Exception {

    createTable();
    Partition partition = buildPartition(DB_NAME, TABLE_NAME, DEFAULT_YEAR_VALUE);
    partition.setDbName(null);
    partition.setTableName(null);
    PartitionSpecProxy partitionSpecProxy =
        buildPartitionSpec(null, null, null, Lists.newArrayList(partition));
    partitionSpecProxy.setDbName(DB_NAME);
    partitionSpecProxy.setTableName(TABLE_NAME);
    client.add_partitions_pspec(partitionSpecProxy);

    Partition resultPart =
        client.getPartition(DB_NAME, TABLE_NAME, Lists.newArrayList(DEFAULT_YEAR_VALUE));
    Assert.assertNotNull(resultPart);
  }
Tests for creating partitions from partition spec.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAddPartitionsFromPartSpec.java