Skip to content

Commit 8905a21

Browse files
e2e BQ test scenarios Validation step for Existing Table
1 parent 0105c20 commit 8905a21

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/e2e-test/features/bigquery/source/BigQueryToBigQuery.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ Feature: BigQuery source - Verification of BigQuery to BigQuery successful data
301301
Then Wait till pipeline is in running state
302302
Then Open and capture logs
303303
Then Verify the pipeline status is "Succeeded"
304-
Then Validate The Data From BQ To BQ With Actual And Expected File for: "bqexpectedfile"
304+
Then Validate the data transferred from BQ to BQ with actual And expected file for: "bqexpectedfile"
305305

306306
@BQ_EXISTING_SOURCE_TEST @BQ_SINK_TEST
307307
Scenario: Validate successful record transfer from BigQuery source(existing table) without clicking on the validate button of BigQuery source to BigQuery sink(new table)

src/e2e-test/java/io/cdap/plugin/bigquery/stepsdesign/BQValidationExistingTables.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
import java.util.HashMap;
2121
import java.util.Map;
2222

23+
/**
24+
* BigQuery Plugin Existing Table validation.
25+
*/
2326
public class BQValidationExistingTables {
2427

2528
private static final Logger LOG = LoggerFactory.getLogger(BQValidationExistingTables.class);
@@ -28,10 +31,10 @@ public static boolean validateActualDataToExpectedData(String table, String file
2831
InterruptedException, URISyntaxException {
2932
Map<String, JsonObject> bigQueryMap = new HashMap<>();
3033
Map<String, JsonObject> fileMap = new HashMap<>();
31-
Path importexpectedfile = Paths.get(BQValidationExistingTables.class.getResource("/" + fileName).toURI());
34+
Path importbqexpectedfile = Paths.get(BQValidationExistingTables.class.getResource("/" + fileName).toURI());
3235

3336
getBigQueryTableData(table, bigQueryMap);
34-
getFileData(importexpectedfile.toString(), fileMap);
37+
getFileData(importbqexpectedfile.toString(), fileMap);
3538

3639
boolean isMatched = matchJsonMaps(bigQueryMap, fileMap);
3740

@@ -58,6 +61,7 @@ public static void getFileData(String fileName, Map<String, JsonObject> fileMap)
5861
System.err.println("Error reading the file: " + e.getMessage());
5962
}
6063
}
64+
6165
private static void getBigQueryTableData(String targetTable, Map<String, JsonObject> bigQueryMap)
6266
throws IOException, InterruptedException {
6367
String dataset = PluginPropertyUtils.pluginProp("dataset");
@@ -89,11 +93,11 @@ private static String getIdKey(JsonObject json) {
8993
if (json.has("ID")) {
9094
return "ID";
9195
} else if (json.has("Name")) {
92-
return "ID";
96+
return "Name";
9397
} else if (json.has("Price")) {
94-
return "Age";
98+
return "Price";
9599
} else if (json.has("Customer_Exists")) {
96-
return "Customer_id";
100+
return "Customer_Exists";
97101
} else {
98102
return null;
99103
}

src/e2e-test/java/io/cdap/plugin/bigquery/stepsdesign/BigQuerySource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void enterBigQuerySourcePropertyTableNameAsView() {
162162
CdfBigQueryPropertiesActions.enterBigQueryTable(TestSetupHooks.bqSourceView);
163163
}
164164

165-
@Then("Validate The Data From BQ To BQ With Actual And Expected File for: {string}")
165+
@Then("Validate the data transferred from BQ to BQ with actual And expected file for: {string}")
166166
public void validateTheDataFromBQToBQWithActualAndExpectedFileFor(String expectedFile) throws IOException,
167167
InterruptedException, URISyntaxException {
168168
boolean recordsMatched = BQValidationExistingTables.validateActualDataToExpectedData(

0 commit comments

Comments
 (0)