Skip to content

Commit 6148f76

Browse files
committed
Fixing CloudSQL MySQL Build Failures
1 parent cb5e3ee commit 6148f76

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

cloudsql-mysql-plugin/src/e2e-test/java/io/cdap/plugin/CloudMySqlClient.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
public class CloudMySqlClient {
3838

39-
private static final String DATATYPES_COLUMNS = PluginPropertyUtils.pluginProp("datatypesColumns");
39+
private static String dataTypesColumns = PluginPropertyUtils.pluginProp("datatypesColumns");
4040

4141
public static Connection getCloudSqlConnection() throws ClassNotFoundException, SQLException {
4242
Class.forName("com.google.cloud.sql.mysql.SocketFactory");
@@ -158,8 +158,7 @@ public static void createSourceDatatypesTable(String sourceTable) throws SQLExce
158158

159159
public static void createTargetDatatypesTable(String targetTable) throws SQLException, ClassNotFoundException {
160160
try (Connection connect = getCloudSqlConnection(); Statement statement = connect.createStatement()) {
161-
String datatypesColumns = DATATYPES_COLUMNS;
162-
String createTargetTableQuery = "CREATE TABLE " + targetTable + " " + datatypesColumns;
161+
String createTargetTableQuery = "CREATE TABLE " + targetTable + " " + dataTypesColumns;
163162
statement.executeUpdate(createTargetTableQuery);
164163
}
165164
}

cloudsql-mysql-plugin/src/e2e-test/java/io/cdap/plugin/cloudmysql/stepsdesign/CloudMysql.java

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,37 @@
3333
*/
3434
public 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

Comments
 (0)