3333 */
3434public class CloudMysql implements CdfHelper {
3535
36- private static final String TARGET_TABLE = PluginPropertyUtils .pluginProp ("targetTable" );
37- private static final String BQ_SOURCE_TABLE = PluginPropertyUtils .pluginProp ("bqSourceTable" );
36+ private String targetTable = PluginPropertyUtils .pluginProp ("targetTable" );
37+
38+ private String bqSourceTable = PluginPropertyUtils .pluginProp ("bqSourceTable" );
39+
40+ private String sourceTable = PluginPropertyUtils .pluginProp ("sourceTable" );
41+
42+ private String bqTargetTable = PluginPropertyUtils .pluginProp ("bqTargetTable" );
3843
3944 @ Then ("Validate the values of records transferred to target table is equal to the values from source table" )
4045 public void validateTheValuesOfRecordsTransferredToTargetTableIsEqualToTheValuesFromSourceTable ()
4146 throws SQLException , ClassNotFoundException {
42- int countRecords = CloudMySqlClient .countRecord (TARGET_TABLE );
47+ int countRecords = CloudMySqlClient .countRecord (targetTable );
4348 Assert .assertEquals ("Number of records transferred should be equal to records out " ,
4449 countRecords , recordOut ());
4550 BeforeActions .scenario .write (" ******** Number of records transferred ********:" + countRecords );
46- boolean recordsMatched = CloudMySqlClient .validateRecordValues (PluginPropertyUtils . pluginProp ( "sourceTable" )
47- , TARGET_TABLE );
51+ boolean recordsMatched = CloudMySqlClient .validateRecordValues (
52+ sourceTable , targetTable );
4853 Assert .assertTrue ("Value of records transferred to the target table should be equal to the value " +
4954 "of the records in the source table" , recordsMatched );
5055 }
5156
5257 @ Then ("Validate the values of records transferred to target Big Query table is equal to the values from source table" )
5358 public void validateTheValuesOfRecordsTransferredToTargetBigQueryTableIsEqualToTheValuesFromSourceTable ()
5459 throws InterruptedException , IOException , SQLException , ClassNotFoundException {
55- int targetBQRecordsCount = BigQueryClient .countBqQuery (PluginPropertyUtils . pluginProp ( " bqTargetTable" ) );
60+ int targetBQRecordsCount = BigQueryClient .countBqQuery (bqTargetTable );
5661 BeforeActions .scenario .write ("No of Records Transferred to BigQuery:" + targetBQRecordsCount );
5762 Assert .assertEquals ("Out records should match with target BigQuery table records count" ,
5863 CdfPipelineRunAction .getCountDisplayedOnSourcePluginAsRecordsOut (), targetBQRecordsCount );
5964
60- boolean recordsMatched = BQValidation .validateDBAndBQRecordValues (PluginPropertyUtils . pluginProp
61- ( " sourceTable" ), PluginPropertyUtils . pluginProp ( " bqTargetTable" ) );
65+ boolean recordsMatched = BQValidation .validateDBAndBQRecordValues (
66+ sourceTable , bqTargetTable );
6267 Assert .assertTrue ("Value of records transferred to the target table should be equal to the value " +
6368 "of the records in the source table" , recordsMatched );
6469 }
@@ -67,12 +72,13 @@ public void validateTheValuesOfRecordsTransferredToTargetBigQueryTableIsEqualToT
6772 "BigQuery table" )
6873 public void validateTheValuesOfRecordsTransferredToTargetCloudSQLMySqlTableIsEqualToTheValuesFromSourceBigQueryTable ()
6974 throws InterruptedException , IOException , SQLException , ClassNotFoundException {
70- int sourceBQRecordsCount = BigQueryClient .countBqQuery (BQ_SOURCE_TABLE );
75+ int sourceBQRecordsCount = BigQueryClient .countBqQuery (bqSourceTable );
7176 BeforeActions .scenario .write ("No of Records from source BigQuery table:" + sourceBQRecordsCount );
7277 Assert .assertEquals ("Out records should match with target PostgreSQL table records count" ,
7378 CdfPipelineRunAction .getCountDisplayedOnSourcePluginAsRecordsOut (), sourceBQRecordsCount );
7479
75- boolean recordsMatched = BQValidation .validateBQAndDBRecordValues (BQ_SOURCE_TABLE , TARGET_TABLE );
80+ boolean recordsMatched = BQValidation .validateBQAndDBRecordValues (
81+ bqSourceTable , targetTable );
7682 Assert .assertTrue ("Value of records transferred to the target table should be equal to the value " +
7783 "of the records in the source table" , recordsMatched );
7884 }
0 commit comments