Skip to content

Commit

Permalink
Fixed Checkstyle issues and ensured all scenarios are running success…
Browse files Browse the repository at this point in the history
…fully.
  • Loading branch information
Praveena2607 committed Dec 14, 2024
1 parent 60fb70f commit 7e71bc2
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 30 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<google.cloud.storage.version>2.3.0</google.cloud.storage.version>
<google.cloud.datastore.version>1.105.1</google.cloud.datastore.version>
<google.protobuf.java.version>3.19.4</google.protobuf.java.version>
<google.tink.version>1.3.0-rc3</google.tink.version>
<google.tink.version>1.5.0</google.tink.version>
<guava.version>27.0.1-jre</guava.version>
<hadoop.version>3.3.6</hadoop.version>
<hbase-shaded-client.version>1.4.13</hbase-shaded-client.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ Feature: BigQuery source - Validate BigQuery source plugin error scenarios
Then Enter BigQuery source properties partitionFrom and partitionTo
Then Validate BigQuery source incorrect property error for Partition Start date "<property>" value "<value>"
Then Validate BigQuery source incorrect property error for Partition End date "<property>" value "<value>"
Then Enter BigQuery source properties referenceName
And Enter input plugin property: "referenceName" with value: "bqIncorrectReferenceName"
Then Validate BigQuery source incorrect property error for reference name"<property>" value "<value>"
Then Enter BigQuery source properties filter
Examples:
| property | value |
| partitionFrom | bqIncorrectFormatStartDate |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
import io.cdap.e2e.pages.actions.CdfStudioActions;
import io.cdap.e2e.pages.locators.CdfBigQueryPropertiesLocators;
import io.cdap.e2e.pages.locators.CdfStudioLocators;
import io.cdap.e2e.utils.*;
import io.cdap.e2e.utils.BigQueryClient;
import io.cdap.e2e.utils.ConstantsUtil;
import io.cdap.e2e.utils.ElementHelper;
import io.cdap.e2e.utils.PluginPropertyUtils;
import io.cdap.e2e.utils.SeleniumHelper;
import io.cdap.e2e.utils.WaitHelper;
import io.cdap.plugin.common.stepsdesign.TestSetupHooks;
import io.cdap.plugin.utils.CdfPluginPropertyLocator;
import io.cdap.plugin.utils.E2EHelper;
Expand Down Expand Up @@ -284,17 +289,19 @@ public void validateBigQuerySourceIncorrectErrorFor(String property, String valu
tableFullName = PluginPropertyUtils.pluginProp(value) + ":" + PluginPropertyUtils.pluginProp("dataset")
+ "." + TestSetupHooks.bqSourceTable;

}else if (property.equalsIgnoreCase("partitionFrom")) {
} else if (property.equalsIgnoreCase("partitionFrom")) {
tableFullName = PluginPropertyUtils.pluginProp("projectId") + ":"
+ PluginPropertyUtils.pluginProp("dataset")
+ "." + PluginPropertyUtils.pluginProp(value);}
+ "." + PluginPropertyUtils.pluginProp(value);
}

String expectedErrorMessage = PluginPropertyUtils.errorProp(E2ETestConstants.ERROR_MSG_INCORRECT_PARTITIONSTARTDATE)
.replaceAll("TABLENAME", tableFullName);
String actualErrorMessage = PluginPropertyUtils.findPropertyErrorElement("partitionFrom").getText();
System.out.println(actualErrorMessage);
Assert.assertEquals("Error message mismatch for Partition Start Date", expectedErrorMessage, actualErrorMessage);
String actualColor = PluginPropertyUtils.getErrorColor(PluginPropertyUtils.findPropertyErrorElement("partitionFrom"));
String actualColor = PluginPropertyUtils.getErrorColor(PluginPropertyUtils.findPropertyErrorElement
("partitionFrom"));
String expectedColor = ConstantsUtil.ERROR_MSG_COLOR;
Assert.assertEquals(expectedColor, actualColor);
}
Expand All @@ -314,7 +321,7 @@ public void validateBigQuerySourceIncorrectPartitionenddateErrorFor(String prope
} else if (property.equalsIgnoreCase("datasetProjectId")) {
tableFullName = PluginPropertyUtils.pluginProp(value) + ":" + PluginPropertyUtils.pluginProp("dataset")
+ "." + TestSetupHooks.bqSourceTable;
}else if (property.equalsIgnoreCase("partitionEndDate")) {
} else if (property.equalsIgnoreCase("partitionEndDate")) {
tableFullName = PluginPropertyUtils.pluginProp(value) + ":"
+ PluginPropertyUtils.pluginProp("partitionTo")
+ "." + TestSetupHooks.bqSourceTable;
Expand All @@ -330,12 +337,6 @@ public void validateBigQuerySourceIncorrectPartitionenddateErrorFor(String prope
Assert.assertEquals(expectedColor, actualColor);
}

@Then("Enter BigQuery source properties referenceName")
public void EnterBigQuerysourcepropertiesreferenceName() throws IOException {
CdfBigQueryPropertiesActions.enterBigQueryReferenceName("invalidRef&^*&&*");

}

@Then("Validate BigQuery source incorrect property error for reference name{string} value {string}")
public void validateBigQuerySourceIncorrectPropertyErrorForreferncename(String property, String value) {
CdfBigQueryPropertiesActions.getSchema();
Expand All @@ -351,8 +352,7 @@ public void validateBigQuerySourceIncorrectPropertyErrorForreferncename(String p
} else if (property.equalsIgnoreCase("datasetProject")) {
tableFullName = PluginPropertyUtils.pluginProp(value) + ":" + PluginPropertyUtils.pluginProp("dataset")
+ "." + TestSetupHooks.bqSourceTable;
}
else if (property.equalsIgnoreCase("referenceName")) {
} else if (property.equalsIgnoreCase("referenceName")) {
tableFullName = PluginPropertyUtils.pluginProp(value) + ":" + PluginPropertyUtils.pluginProp("reference")
+ "." + TestSetupHooks.bqSourceTable;
}
Expand All @@ -361,16 +361,16 @@ else if (property.equalsIgnoreCase("referenceName")) {
String actualErrorMessage = PluginPropertyUtils.findPropertyErrorElement("referenceName").getText();

Assert.assertEquals(expectedErrorMessage, actualErrorMessage);
String actualColor = PluginPropertyUtils.getErrorColor(PluginPropertyUtils.findPropertyErrorElement("referenceName"));
String actualColor = PluginPropertyUtils.getErrorColor(PluginPropertyUtils.findPropertyErrorElement
("referenceName"));
String expectedColor = ConstantsUtil.ERROR_MSG_COLOR;
Assert.assertEquals(expectedColor, actualColor);

}

@Then("Enter BigQuery source properties filter")
public void EnterBigQuerysourcepropertiesfilter() throws IOException {
public void enterBigQuerysourcePropertiesfilter() throws IOException {
CdfBigQueryPropertiesActions.enterFilter("%%%%");

}

@Then("Enter BigQuery source property output schema {string} as macro argument {string}")
Expand Down
9 changes: 4 additions & 5 deletions src/e2e-test/java/io/cdap/plugin/utils/E2ETestConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ public class E2ETestConstants {
public static final String ERROR_MSG_BQ_INCORRECT_CHUNKSIZE = "errorMessageIncorrectBQChunkSize";
public static final String ERROR_MSG_BQ_INCORRECT_TEMPORARY_BUCKET = "errorMessageIncorrectBQBucketName";
public static final String ERROR_MSG_BQ_INCORRECT_PROPERTY = "errorMessageIncorrectBQProperty";
public static final String ERROR_MSG_INCORRECT_PARTITIONSTARTDATE= "errorMessageIncorrectPartitionStartDate";
public static final String ERROR_MSG_INCORRECT_PARTITIONENDDATE= "errorMessageIncorrectPartitionEndDate";
public static final String ERROR_MSG_INCORRECT_REFERENCENAME= "errorMessageIncorrectReferenceName";
public static final String ERROR_MSG_INCORRECT_FILTER= "errorMessageIncorrectRegexPathFilter";

public static final String ERROR_MSG_INCORRECT_PARTITIONSTARTDATE = "errorMessageIncorrectPartitionStartDate";
public static final String ERROR_MSG_INCORRECT_PARTITIONENDDATE = "errorMessageIncorrectPartitionEndDate";
public static final String ERROR_MSG_INCORRECT_REFERENCENAME = "errorMessageIncorrectReferenceName";
public static final String ERROR_MSG_INCORRECT_FILTER = "errorMessageIncorrectRegexPathFilter";
}
4 changes: 2 additions & 2 deletions src/e2e-test/resources/errorMessage.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ errorMessageMultipleFileWithoutClearDefaultSchema=Found a row with 4 fields when
errorMessageInvalidSourcePath=Invalid bucket name in path 'abc@'. Bucket name should
errorMessageInvalidDestPath=Invalid bucket name in path 'abc@'. Bucket name should
errorMessageInvalidEncryptionKey=CryptoKeyName.parse: formattedString not in valid format: Parameter "abc@" must be
errorMessageIncorrectPartitionStartDate=12-12-2024 is not in a valid format. Enter valid date in format: yyyy-MM-dd
errorMessageIncorrectPartitionEndDate=13-12-2024 is not in a valid format. Enter valid date in format: yyyy-MM-dd
errorMessageIncorrectPartitionStartDate=16-12-2024 is not in a valid format. Enter valid date in format: yyyy-MM-dd
errorMessageIncorrectPartitionEndDate=17-12-2024 is not in a valid format. Enter valid date in format: yyyy-MM-dd
errorMessageIncorrectReferenceName=Invalid reference name 'invalidRef&^*&&*'. Supported characters are: letters, numbers, and '_', '-', '.', or '$'.
errorLogsMessageInvalidFilter=Spark Program 'phase-1' failed.
8 changes: 4 additions & 4 deletions src/e2e-test/resources/pluginParameters.properties
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,10 @@ bqTargetTable=dummy
bqTargetTable2=dummy
bqmtTargetTable=tabA
bqmtTargetTable2=tabB
bqStartDate=2024-12-12
bqEndDate=2024-12-13
partitionFrom=2024-12-12
partitionTo=2024-12-13
bqStartDate=2024-12-16
bqEndDate=2024-12-17
partitionFrom=2024-12-16
partitionTo=2024-12-17
filter=Id=20
bqIncorrectReferenceName=invalidRef&^*&&*
OutputSchema={ "type": "record", "name": "text", "fields": [{ "name": "Id", "type": "long" }, { "name": "Value", "type": "long" }, \
Expand Down

0 comments on commit 7e71bc2

Please sign in to comment.