rdblue commented on a change in pull request #187: Catalog Implementation for 
hive and hadoop.
URL: https://github.com/apache/incubator-iceberg/pull/187#discussion_r284918225
 
 

 ##########
 File path: hive/src/test/java/org/apache/iceberg/hive/HiveCatalogTest.java
 ##########
 @@ -39,11 +27,47 @@
 import static 
org.apache.iceberg.BaseMetastoreTableOperations.METADATA_LOCATION_PROP;
 import static org.apache.iceberg.BaseMetastoreTableOperations.TABLE_TYPE_PROP;
 
-public class HiveTablesTest extends HiveTableBaseTest {
+public class HiveCatalogTest extends HiveCatalogBaseTest {
+  private HiveCatalog hiveCatalog = new HiveCatalog(hiveConf);
+
   @Test
   public void testCreate() throws TException {
     // Table should be created in hive metastore
-    final org.apache.hadoop.hive.metastore.api.Table table = 
metastoreClient.getTable(DB_NAME, TABLE_NAME);
+    varifyTable(TABLE_IDENTIFIER);
+  }
+
+  @Test
+  public void testRename() throws TException {
+    varifyTable(TABLE_IDENTIFIER);
+
+    String renamedTableName = "rename_table_name";
+    TableIdentifier renameTableIdentifier = new 
TableIdentifier(TABLE_IDENTIFIER.namespace(), renamedTableName);
+    hiveCatalog.renameTable(this.TABLE_IDENTIFIER, renameTableIdentifier);
+
+    try {
+      hiveCatalog.getTable(TABLE_IDENTIFIER);
+      Assert.fail("Should have thrown NoSuchTableException");
+    } catch (NoSuchTableException expected) {
+
+    }
+    varifyTable(renameTableIdentifier);
+    hiveCatalog.dropTable(renameTableIdentifier);
+  }
+
+  @Test(expected = NoSuchObjectException.class)
+  public void testDrop() throws TException {
+    // verify the table actually exists
+    metastoreClient.getTable(DB_NAME, TABLE_NAME);
+
+    hiveCatalog.dropTable(TABLE_IDENTIFIER);
+
+    metastoreClient.getTable(DB_NAME, TABLE_NAME);
 
 Review comment:
   It is usually better to use `assertThrows` because you can check the error 
message. Then you wouldn't need to load the table first.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to