@@ -294,16 +294,16 @@ public static void createTempSourceBQTable() throws IOException, InterruptedExce
294294    BeforeActions .scenario .write ("BQ source Table "  + bqSourceTable  + " created successfully" );
295295  }
296296
297-   @ After (order  = 1 , value  = "@BQ_SOURCE_TEST or @BQ_PARTITIONED_SOURCE_TEST or @BQ_SOURCE_DATATYPE_TEST or "  +
297+   @ After (order  = 2 , value  = "@BQ_SOURCE_TEST or @BQ_PARTITIONED_SOURCE_TEST or @BQ_SOURCE_DATATYPE_TEST or "  +
298298    "@BQ_INSERT_SOURCE_TEST or @BQ_UPDATE_SINK_TEST or @BQ_EXISTING_SOURCE_TEST or @BQ_EXISTING_SINK_TEST or "  +
299299    "@BQ_EXISTING_SOURCE_DATATYPE_TEST or @BQ_EXISTING_SINK_DATATYPE_TEST or @BQ_UPSERT_SOURCE_TEST or "  +
300300    "@BQ_NULL_MODE_SOURCE_TEST or @BQ_UPDATE_SOURCE_DEDUPE_TEST or @BQ_INSERT_INT_SOURCE_TEST or "  +
301-     "@BQ_TIME_SOURCE_TEST or @BQ_UPSERT_DEDUPE_SOURCE_TEST or @BQ_PRIMARY_RECORD_SOURCE_TEST" )
301+     "@BQ_TIME_SOURCE_TEST or @BQ_UPSERT_DEDUPE_SOURCE_TEST or @BQ_PRIMARY_RECORD_SOURCE_TEST or "  +
302+     "@BQ_SINGLE_SOURCE_BQMT_TEST" )
302303  public  static  void  deleteTempSourceBQTable () throws  IOException , InterruptedException  {
303304    BigQueryClient .dropBqQuery (bqSourceTable );
304305    PluginPropertyUtils .removePluginProp ("bqSourceTable" );
305306    BeforeActions .scenario .write ("BQ source Table "  + bqSourceTable  + " deleted successfully" );
306-     bqSourceTable  = StringUtils .EMPTY ;
307307  }
308308
309309  /** 
@@ -1604,35 +1604,15 @@ public static void createSourceTables() throws IOException, InterruptedException
16041604    PluginPropertyUtils .addPluginProp ("bqSourceTable2" , bqSourceTable2 );
16051605  }
16061606
1607-   @ After (order  = 1 , value  = "@BQ_DELETE_TABLES_TEST" )
1608-   public  static  void  deleteAllBqTables () throws  IOException , InterruptedException  {
1609-     BigQueryClient .dropBqQuery (bqSourceTable );
1610-     BigQueryClient .dropBqQuery (bqSourceTable2 );
1611-     bqTargetTable  = PluginPropertyUtils .pluginProp ("bqTargetTable" );
1612-     bqTargetTable2  = PluginPropertyUtils .pluginProp ("bqTargetTable2" );
1613-     BigQueryClient .dropBqQuery (bqTargetTable );
1614-     BigQueryClient .dropBqQuery (bqTargetTable2 );
1615-     PluginPropertyUtils .removePluginProp ("bqSourceTable" );
1616-     PluginPropertyUtils .removePluginProp ("bqSourceTable2" );
1617-     BeforeActions .scenario .write ("BQ source Table "  + bqSourceTable  + " deleted successfully" );
1618-     BeforeActions .scenario .write ("BQ source Table2 "  + bqSourceTable2  + " deleted successfully" );
1619-     BeforeActions .scenario .write ("BQ target Table "  + bqTargetTable  + " deleted successfully" );
1620-     BeforeActions .scenario .write ("BQ target Table2 "  + bqTargetTable2  + " deleted successfully" );
1621-   }
1622- 
1623-   @ After (order  = 1 , value  = "@BQ_SINK_BQMT_TEST" )
1607+   @ After (order  = 2 , value  = "@BQ_SINK_BQMT_TEST" )
16241608  public  static  void  deleteTargetBqmtTable () throws  IOException , InterruptedException  {
16251609    try  {
16261610      bqTargetTable  = PluginPropertyUtils .pluginProp ("bqTargetTable" );
16271611      BigQueryClient .dropBqQuery (bqTargetTable );
1628-       BigQueryClient .dropBqQuery (bqSourceTable );
16291612      BeforeActions .scenario .write ("BQ Target table - "  + bqTargetTable  + " deleted successfully" );
1630-       BeforeActions .scenario .write ("BQ Source table - "  + bqSourceTable  + " deleted successfully" );
1631-       bqTargetTable  = StringUtils .EMPTY ;
16321613    } catch  (BigQueryException  e ) {
16331614      if  (e .getMessage ().contains ("Not found: Table" )) {
16341615        BeforeActions .scenario .write ("BQ Target Table "  + bqTargetTable  + " does not exist" );
1635-         BeforeActions .scenario .write ("BQ Source Table "  + bqSourceTable  + " does not exist" );
16361616      } else  {
16371617        Assert .fail (e .getMessage ());
16381618      }
@@ -1646,4 +1626,44 @@ public static void deleteTempSource2BQTable() throws IOException, InterruptedExc
16461626    PluginPropertyUtils .removePluginProp ("bqSourceTable2" );
16471627    BeforeActions .scenario .write ("BQ source Table2 "  + bqSourceTable2  + " deleted successfully" );
16481628  }
1629+ 
1630+   @ After (order  = 2 , value  = "@BQ_TWO_SOURCE_BQMT_TEST or @BQ_SOURCE_UPDATE_TEST" )
1631+   public  static  void  deleteTwoSourceTables () throws  IOException , InterruptedException  {
1632+     try  {
1633+       BigQueryClient .dropBqQuery (bqSourceTable );
1634+       BigQueryClient .dropBqQuery (bqSourceTable2 );
1635+       BeforeActions .scenario .write ("BQ Source table - "  + bqSourceTable  + " deleted successfully" );
1636+       BeforeActions .scenario .write ("BQ Source table2 - "  + bqSourceTable2  + " deleted successfully" );
1637+       PluginPropertyUtils .removePluginProp ("bqSourceTable" );
1638+       PluginPropertyUtils .removePluginProp ("bqSourceTable2" );
1639+ 
1640+     } catch  (BigQueryException  e ) {
1641+       if  (e .getMessage ().contains ("Not found: Table" )) {
1642+         BeforeActions .scenario .write ("BQ Source Table "  + bqSourceTable  + " does not exist" );
1643+         BeforeActions .scenario .write ("BQ Source Table2 "  + bqSourceTable2  + " does not exist" );
1644+       } else  {
1645+         Assert .fail (e .getMessage ());
1646+       }
1647+     }
1648+   }
1649+ 
1650+   @ After (order  = 2 , value  = "@BQ_TWO_SINK_BQMT_TEST" )
1651+   public  static  void  deleteTwoTargetTables () throws  IOException , InterruptedException  {
1652+     try  {
1653+       bqTargetTable  =  PluginPropertyUtils .pluginProp ("bqTargetTable" );
1654+       bqTargetTable2  =  PluginPropertyUtils .pluginProp ("bqTargetTable2" );
1655+       BigQueryClient .dropBqQuery (bqTargetTable );
1656+       BigQueryClient .dropBqQuery (bqTargetTable2 );
1657+       BeforeActions .scenario .write ("BQ Target table - "  + bqTargetTable  + " deleted successfully" );
1658+       BeforeActions .scenario .write ("BQ Target table2 - "  + bqTargetTable2  + " deleted successfully" );
1659+ 
1660+     } catch  (BigQueryException  e ) {
1661+       if  (e .getMessage ().contains ("Not found: Table" )) {
1662+         BeforeActions .scenario .write ("BQ Target Table "  + bqTargetTable  + " does not exist" );
1663+         BeforeActions .scenario .write ("BQ Target Table2 "  + bqTargetTable2  + " does not exist" );
1664+       } else  {
1665+         Assert .fail (e .getMessage ());
1666+       }
1667+     }
1668+   }
16491669}
0 commit comments