From 6d56d7cd688d19c5c8788fd18637a4e39cd45c8c Mon Sep 17 00:00:00 2001 From: Aryan-Verma Date: Mon, 28 Aug 2023 10:08:31 +0530 Subject: [PATCH] fixing unit tests fixing error message fixed DataplexBatchSourceConfigTest fixed error message --- .../java/io/cdap/plugin/bigquery/stepsdesign/BigQueryBase.java | 3 +++ src/e2e-test/java/io/cdap/plugin/utils/E2ETestConstants.java | 1 + src/e2e-test/resources/errorMessage.properties | 1 + .../dataplex/source/config/DataplexBatchSourceConfigTest.java | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/e2e-test/java/io/cdap/plugin/bigquery/stepsdesign/BigQueryBase.java b/src/e2e-test/java/io/cdap/plugin/bigquery/stepsdesign/BigQueryBase.java index a9b645d943..d4ae865c8a 100644 --- a/src/e2e-test/java/io/cdap/plugin/bigquery/stepsdesign/BigQueryBase.java +++ b/src/e2e-test/java/io/cdap/plugin/bigquery/stepsdesign/BigQueryBase.java @@ -234,6 +234,9 @@ public void verifyTheBigQueryValidationErrorMessageForInvalidProperty(String pro } else if (property.equalsIgnoreCase("bucket")) { expectedErrorMessage = PluginPropertyUtils .errorProp(E2ETestConstants.ERROR_MSG_BQ_INCORRECT_TEMPORARY_BUCKET); + } else if (property.equalsIgnoreCase("table")) { + expectedErrorMessage = PluginPropertyUtils + .errorProp(E2ETestConstants.ERROR_MSG_INCORRECT_TABLE_NAME); } else { expectedErrorMessage = PluginPropertyUtils.errorProp(E2ETestConstants.ERROR_MSG_BQ_INCORRECT_PROPERTY). replaceAll("PROPERTY", property.substring(0, 1).toUpperCase() + property.substring(1)); diff --git a/src/e2e-test/java/io/cdap/plugin/utils/E2ETestConstants.java b/src/e2e-test/java/io/cdap/plugin/utils/E2ETestConstants.java index c608e3af9d..4fb86da3b4 100644 --- a/src/e2e-test/java/io/cdap/plugin/utils/E2ETestConstants.java +++ b/src/e2e-test/java/io/cdap/plugin/utils/E2ETestConstants.java @@ -7,6 +7,7 @@ public class E2ETestConstants { public static final String ERROR_MSG_GCS_INVALID_PATH = "errorMessageGCSInvalidPath"; public static final String ERROR_MSG_GCS_INVALID_BUCKET_NAME = "errorMessageGCSInvalidBucketName"; public static final String ERROR_MSG_INCORRECT_TABLE = "errorMessageIncorrectBQTable"; + public static final String ERROR_MSG_INCORRECT_TABLE_NAME = "errorMessageIncorrectBQTableName"; public static final String ERROR_MSG_PUBSUB_INVALID_ADVANCED_FIELDS = "errorMessagePubSubInvalidAdvancedField"; public static final String ERROR_MSG_PUBSUB_MAX_BATCH_COUNT = "errorMessagePubSubMaxBatchCountField"; public static final String ERROR_MSG_PUBSUB_MAX_BATCH_SIZE = "errorMessagePubSubMaxBatchSizeField"; diff --git a/src/e2e-test/resources/errorMessage.properties b/src/e2e-test/resources/errorMessage.properties index 9a45c144fe..deadc4b7dc 100644 --- a/src/e2e-test/resources/errorMessage.properties +++ b/src/e2e-test/resources/errorMessage.properties @@ -15,6 +15,7 @@ errorMessagePubSubRetryTimeout=Invalid max retry timeout for retrying failed pub errorMessagePubSubErrorThreshold=Invalid error threshold for publishing. Ensure the value is a positive number. errorMessageIncorrectBQChunkSize=Value must be a multiple of 262144. errorMessageIncorrectBQBucketName=Bucket name can only contain lowercase letters, numbers, '.', '_', and '-'. +errorMessageIncorrectBQTableName=Table name can only contain letters (lower or uppercase), numbers, '_' and '-'. errorMessageIncorrectBQProperty=PROPERTY name can only contain letters (lower or uppercase), numbers and '_'. errorMessageInvalidPath=Error when trying to detect schema: Input path not found errorMessageBQExecuteTableDataset=Dataset and table must be specified together. diff --git a/src/test/java/io/cdap/plugin/gcp/dataplex/source/config/DataplexBatchSourceConfigTest.java b/src/test/java/io/cdap/plugin/gcp/dataplex/source/config/DataplexBatchSourceConfigTest.java index 0ff8a1f042..0d96a0701d 100644 --- a/src/test/java/io/cdap/plugin/gcp/dataplex/source/config/DataplexBatchSourceConfigTest.java +++ b/src/test/java/io/cdap/plugin/gcp/dataplex/source/config/DataplexBatchSourceConfigTest.java @@ -129,7 +129,7 @@ public void testValidateTable() { .setReferenceName("test").build(); try { dataplexBatchSourceConfig.validateBigQueryDataset(mockFailureCollector, - "project", "dataset", "table-wrong"); + "project", "dataset", "table.wrong"); } catch (Exception e) { }