@Test
  public void testAddPartitionSpecUpperCaseDBAndTableName() throws Exception {

    // Create table 'test_partition_db.test_add_part_table'
    String tableName = "test_add_part_table";
    String tableLocation = metaStore.getWarehouseRoot() + "/" + tableName.toUpperCase();
    createTable(DB_NAME, tableName, getYearPartCol(), tableLocation);

    // Create partitions with table name 'TEST_ADD_PART_TABLE' and db name 'TEST_PARTITION_DB'
    Partition partition1 = buildPartition(DB_NAME.toUpperCase(), tableName.toUpperCase(), "2013",
        tableLocation + "/year=2013");
    Partition partition2 = buildPartition(DB_NAME.toUpperCase(), tableName.toUpperCase(), "2014",
        tableLocation + "/year=2014");
    List<Partition> partitions = Lists.newArrayList(partition1, partition2);

    String rootPath = tableLocation + "/addpartspectest/";
    PartitionSpecProxy partitionSpec =
        buildPartitionSpec(DB_NAME.toUpperCase(), tableName.toUpperCase(), rootPath, partitions);
    client.add_partitions_pspec(partitionSpec);

    // Validate the partition attributes
    // The db and table name should be all lower case: 'test_partition_db' and
    // 'test_add_part_table'
    // The location should be saved case-sensitive, it should be
    // warehouse dir + "TEST_ADD_PART_TABLE/year=2017"
    Partition part = client.getPartition(DB_NAME, tableName, "year=2013");
    Assert.assertNotNull(part);
    Assert.assertEquals(tableName, part.getTableName());
    Assert.assertEquals(DB_NAME, part.getDbName());
    Assert.assertEquals(tableLocation + "/year=2013", part.getSd().getLocation());
    Partition part1 = client.getPartition(DB_NAME.toUpperCase(), tableName.toUpperCase(), "year=2013");
    Assert.assertEquals(part, part1);
    part = client.getPartition(DB_NAME, tableName, "year=2014");
    Assert.assertNotNull(part);
    Assert.assertEquals(tableName, part.getTableName());
    Assert.assertEquals(DB_NAME, part.getDbName());
    Assert.assertEquals(tableLocation + "/year=2014", part.getSd().getLocation());
    part1 = client.getPartition(DB_NAME.toUpperCase(), tableName.toUpperCase(), "year=2014");
    Assert.assertEquals(part, part1);
  }
Tests for creating partitions from partition spec.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAddPartitionsFromPartSpec.java