@Test public void dataGeneration() throws Exception { setUp(RecipeExecLocation.SourceCluster); runSql(connection, "use hdr_sdb1"); createVanillaTable(connection, "store_sales"); createSerDeTable(connection); createPartitionedTable(connection); createExternalTable(connection, clusterFS, baseTestHDFSDir + "click_data/", "click_data"); createExternalPartitionedTable( connection, clusterFS, baseTestHDFSDir + "click_data2/", "click_data2"); runSql(connection2, "use hdr_sdb1"); createVanillaTable(connection2, "store_sales"); createSerDeTable(connection2); createPartitionedTable(connection2); createExternalTable(connection2, clusterFS2, baseTestHDFSDir + "click_data/", "click_data"); createExternalPartitionedTable( connection2, clusterFS2, baseTestHDFSDir + "click_data2/", "click_data2"); final NotifyingAssert anAssert = new NotifyingAssert(true); HiveAssert.assertDbEqual( cluster, clusterHC.getDatabase("hdr_sdb1"), cluster2, clusterHC2.getDatabase("hdr_sdb1"), anAssert); HiveAssert.assertTableEqual( cluster, clusterHC.getTable("hdr_sdb1", "click_data"), cluster2, clusterHC2.getTable("hdr_sdb1", "click_data"), anAssert); anAssert.assertAll(); }
@Test(enabled = false) public void assertionTest() throws Exception { setUp(RecipeExecLocation.SourceCluster); final SoftAssert anAssert = new SoftAssert(); HiveAssert.assertTableEqual( cluster, clusterHC.getTable("default", "hcatsmoke10546"), cluster2, clusterHC2.getTable("default", "hcatsmoke10548"), anAssert); HiveAssert.assertDbEqual( cluster, clusterHC.getDatabase("default"), cluster2, clusterHC2.getDatabase("default"), anAssert); anAssert.assertAll(); }
private static boolean dbExists(HCatClient client, final String database) throws Exception { try { HCatDatabase db = client.getDatabase(database); return db != null; } catch (ObjectNotFoundException e) { System.out.println(e.getMessage()); return false; } catch (HCatException e) { throw new Exception("Exception checking if the db exists:" + e.getMessage(), e); } }