private void runTest(IMetaStoreClient client) throws TException {
    LOG.info("Starting smoke test");

    File dbDir = new File(System.getProperty("java.io.tmpdir"), "internal_smoke_test");
    if (!dbDir.mkdir()) {
      throw new RuntimeException("Unable to create direcotory " + dbDir.getAbsolutePath());
    }
    dbDir.deleteOnExit();

    LOG.info("Going to create database " + dbName);
    Database db = new DatabaseBuilder()
        .setName(dbName)
        .setLocation(dbDir.getAbsolutePath())
        .create(client, conf);

    LOG.info("Going to create table " + tableName);
    Table table = new TableBuilder()
        .inDb(db)
        .setTableName(tableName)
        .addCol("col1", ColumnType.INT_TYPE_NAME)
        .addCol("col2", ColumnType.TIMESTAMP_TYPE_NAME)
        .addPartCol("pcol1", ColumnType.STRING_TYPE_NAME)
        .create(client, conf);

    LOG.info("Going to create partition with value " + partValue);
    Partition part = new PartitionBuilder()
        .inTable(table)
        .addValue("val1")
        .addToTable(client, conf);

    LOG.info("Going to list the partitions");
    List<Partition> parts = client.listPartitions(dbName, tableName, (short)-1);
    LOG.info("Fetched: { " + parts.toString() + "}");

    LOG.info("Going to drop database");
    client.dropDatabase(dbName, true, false, true);


    LOG.info("Completed smoke test");
  }
This class runs a few simple operations against the server to make sure it runs reasonably.
Even though it is a test its in the main tree because it needs to be deployed with the server
to allow smoke testing once the server is installed.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/tools/SmokeTest.java