@Test
  public void testAddPartitionSpecWithSharedSDNoRelativePath() throws Exception {

    Table table = createTable();
    PartitionWithoutSD partition1 = buildPartitionWithoutSD(Lists.newArrayList("2007"), 0);
    PartitionWithoutSD partition2 = buildPartitionWithoutSD(Lists.newArrayList("2008"), 0);
    partition1.setRelativePath(null);
    partition2.setRelativePath(null);
    String location = table.getSd().getLocation() + "/noRelativePath/";
    PartitionSpecProxy partitionSpecProxy = buildPartitionSpecWithSharedSD(
        Lists.newArrayList(partition1, partition2), buildSD(location));
    client.add_partitions_pspec(partitionSpecProxy);

    Partition resultPart1 = client.getPartition(DB_NAME, TABLE_NAME, Lists.newArrayList("2007"));
    Assert.assertEquals(location + "null", resultPart1.getSd().getLocation());
    Assert.assertTrue(metaStore.isPathExists(new Path(resultPart1.getSd().getLocation())));

    Partition resultPart2 = client.getPartition(DB_NAME, TABLE_NAME, Lists.newArrayList("2008"));
    Assert.assertEquals(location + "null", resultPart2.getSd().getLocation());
    Assert.assertTrue(metaStore.isPathExists(new Path(resultPart2.getSd().getLocation())));
  }
Tests for creating partitions from partition spec.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAddPartitionsFromPartSpec.java