@@ -260,4 +260,163 @@ public void validateRecordsTransferredToTargetTableIsEqualToNumberOfRecordsFromS
260260 BeforeActions .scenario .write ("Number of records transferred from source table to target table:" + count );
261261 Assert .assertEquals (count , countRecordsTarget );
262262 }
263+
264+ @ Then ("Enter BigQuery source properties partitionFrom and partitionTo" )
265+ public void enterBigQuerySourcePropertiespartitionFromandpartitionTo () throws IOException {
266+ CdfBigQueryPropertiesActions .enterPartitionStartDate (new SimpleDateFormat ("dd-MM-yyyy" ).format (new Date ()));
267+ CdfBigQueryPropertiesActions .enterPartitionEndDate (new SimpleDateFormat ("dd-MM-yyyy" )
268+ .format (DateUtils .addDays (new Date (), 1 )));
269+ }
270+ @ Then ("Validate BigQuery source incorrect property error for Partition Start date {string} value {string}" )
271+ public void validateBigQuerySourceIncorrectErrorFor (String property , String value ) {
272+ CdfBigQueryPropertiesActions .getSchema ();
273+
274+
275+ SeleniumHelper .waitElementIsVisible (CdfBigQueryPropertiesLocators .getSchemaButton , 5L );
276+ String tableFullName = StringUtils .EMPTY ;
277+ if (property .equalsIgnoreCase ("dataset" )) {
278+ tableFullName = PluginPropertyUtils .pluginProp ("projectId" ) + ":" + PluginPropertyUtils .pluginProp (value )
279+ + "." + TestSetupHooks .bqSourceTable ;
280+ } else if (property .equalsIgnoreCase ("table" )) {
281+ tableFullName = PluginPropertyUtils .pluginProp ("projectId" ) + ":"
282+ + PluginPropertyUtils .pluginProp ("dataset" )
283+ + "." + PluginPropertyUtils .pluginProp (value );
284+ } else if (property .equalsIgnoreCase ("datasetProject" )) {
285+ tableFullName = PluginPropertyUtils .pluginProp (value ) + ":" + PluginPropertyUtils .pluginProp ("dataset" )
286+ + "." + TestSetupHooks .bqSourceTable ;
287+
288+ }else if (property .equalsIgnoreCase ("partitionFrom" )) {
289+ tableFullName = PluginPropertyUtils .pluginProp ("projectId" ) + ":"
290+ + PluginPropertyUtils .pluginProp ("dataset" )
291+ + "." + PluginPropertyUtils .pluginProp (value );}
292+
293+ String expectedErrorMessage = PluginPropertyUtils .errorProp (E2ETestConstants .ERROR_MSG_INCORRECT_PARTITIONSTARTDATE )
294+ .replaceAll ("TABLENAME" , tableFullName );
295+ String actualErrorMessage = PluginPropertyUtils .findPropertyErrorElement ("partitionFrom" ).getText ();
296+ System .out .println (actualErrorMessage );
297+ Assert .assertEquals ("Error message mismatch for Partition Start Date" , expectedErrorMessage , actualErrorMessage );
298+ String actualColor = PluginPropertyUtils .getErrorColor (PluginPropertyUtils .findPropertyErrorElement ("partitionFrom" ));
299+ String expectedColor = ConstantsUtil .ERROR_MSG_COLOR ;
300+ Assert .assertEquals (expectedColor , actualColor );
301+ }
302+
303+ @ Then ("Validate BigQuery source incorrect property error for Partition End date {string} value {string}" )
304+ public void validateBigQuerySourceIncorrectPartitionenddateErrorFor (String property , String value ) {
305+ CdfBigQueryPropertiesActions .getSchema ();
306+ SeleniumHelper .waitElementIsVisible (CdfBigQueryPropertiesLocators .getSchemaButton , 5L );
307+ String tableFullName = StringUtils .EMPTY ;
308+ if (property .equalsIgnoreCase ("dataset" )) {
309+ tableFullName = PluginPropertyUtils .pluginProp ("projectId" ) + ":" + PluginPropertyUtils .pluginProp (value )
310+ + "." + TestSetupHooks .bqSourceTable ;
311+ } else if (property .equalsIgnoreCase ("table" )) {
312+ tableFullName = PluginPropertyUtils .pluginProp ("projectId" ) + ":"
313+ + PluginPropertyUtils .pluginProp ("dataset" )
314+ + "." + PluginPropertyUtils .pluginProp (value );
315+ } else if (property .equalsIgnoreCase ("datasetProjectId" )) {
316+ tableFullName = PluginPropertyUtils .pluginProp (value ) + ":" + PluginPropertyUtils .pluginProp ("dataset" )
317+ + "." + TestSetupHooks .bqSourceTable ;
318+ }else if (property .equalsIgnoreCase ("partitionEndDate" )) {
319+ tableFullName = PluginPropertyUtils .pluginProp (value ) + ":"
320+ + PluginPropertyUtils .pluginProp ("partitionTo" )
321+ + "." + TestSetupHooks .bqSourceTable ;
322+ }
323+
324+ String expectedErrorMessage = PluginPropertyUtils .errorProp (E2ETestConstants .ERROR_MSG_INCORRECT_PARTITIONENDDATE )
325+ .replaceAll ("TABLENAME" , tableFullName );
326+ String actualErrorMessage = PluginPropertyUtils .findPropertyErrorElement ("partitionTo" ).getText ();
327+ System .out .println (actualErrorMessage );
328+ Assert .assertEquals ("Error message mismatch for Partition End Date" , expectedErrorMessage , actualErrorMessage );
329+ String actualColor = PluginPropertyUtils .getErrorColor (PluginPropertyUtils .findPropertyErrorElement ("partitionTo" ));
330+ String expectedColor = ConstantsUtil .ERROR_MSG_COLOR ;
331+ Assert .assertEquals (expectedColor , actualColor );
332+ }
333+
334+ @ Then ("Enter BigQuery source properties referenceName" )
335+ public void EnterBigQuerysourcepropertiesreferenceName () throws IOException {
336+ CdfBigQueryPropertiesActions .enterBigQueryReferenceName ("#$%^" );
337+
338+ }
339+
340+ @ Then ("Validate BigQuery source incorrect property error for reference name{string} value {string}" )
341+ public void validateBigQuerySourceIncorrectPropertyErrorForreferncename (String property , String value ) {
342+ CdfBigQueryPropertiesActions .getSchema ();
343+ SeleniumHelper .waitElementIsVisible (CdfBigQueryPropertiesLocators .getSchemaButton , 5L );
344+ String tableFullName = StringUtils .EMPTY ;
345+ if (property .equalsIgnoreCase ("dataset" )) {
346+ tableFullName = PluginPropertyUtils .pluginProp ("projectId" ) + ":" + PluginPropertyUtils .pluginProp (value )
347+ + "." + TestSetupHooks .bqSourceTable ;
348+ } else if (property .equalsIgnoreCase ("table" )) {
349+ tableFullName = PluginPropertyUtils .pluginProp ("projectId" ) + ":"
350+ + PluginPropertyUtils .pluginProp ("dataset" )
351+ + "." + PluginPropertyUtils .pluginProp (value );
352+ } else if (property .equalsIgnoreCase ("datasetProject" )) {
353+ tableFullName = PluginPropertyUtils .pluginProp (value ) + ":" + PluginPropertyUtils .pluginProp ("dataset" )
354+ + "." + TestSetupHooks .bqSourceTable ;
355+ }
356+ else if (property .equalsIgnoreCase ("referenceName" )) {
357+ tableFullName = PluginPropertyUtils .pluginProp (value ) + ":" + PluginPropertyUtils .pluginProp ("reference" )
358+ + "." + TestSetupHooks .bqSourceTable ;
359+ }
360+ String expectedErrorMessage = PluginPropertyUtils .errorProp (E2ETestConstants .ERROR_MSG_INCORRECT_REFERENCENAME )
361+ .replaceAll ("TABLENAME" , tableFullName );
362+ String actualErrorMessage = PluginPropertyUtils .findPropertyErrorElement ("referenceName" ).getText ();
363+
364+ Assert .assertEquals (expectedErrorMessage , actualErrorMessage );
365+ String actualColor = PluginPropertyUtils .getErrorColor (PluginPropertyUtils .findPropertyErrorElement ("referenceName" ));
366+ String expectedColor = ConstantsUtil .ERROR_MSG_COLOR ;
367+ Assert .assertEquals (expectedColor , actualColor );
368+
369+ }
370+
371+ @ Then ("Enter BigQuery source properties filter" )
372+ public void EnterBigQuerysourcepropertiesfilter () throws IOException {
373+ CdfBigQueryPropertiesActions .enterFilter ("%%%%" );
374+
375+ }
376+
377+ @ Then ("Enter BigQuery source property output schema {string} as macro argument {string}" )
378+ public void enterBigQueryPropertyAsMacroArgumentoutputschema (String pluginProperty , String macroArgument ) {
379+ SCHEMA_LOCATORS .schemaActions .click ();
380+ SCHEMA_LOCATORS .schemaActionType ("macro" ).click ();
381+ WaitHelper .waitForElementToBeHidden (SCHEMA_LOCATORS .schemaActionType ("macro" ), 5 );
382+ try {
383+ enterMacro (CdfPluginPropertyLocator .fromPropertyString (pluginProperty ).pluginProperty , macroArgument );
384+ } catch (NullPointerException e ) {
385+ Assert .fail ("CDF_PLUGIN_PROPERTY_MAPPING for '" + pluginProperty + "' not present in CdfPluginPropertyLocator." );
386+ }
387+ }
388+
389+ @ Then ("Enter BigQuery property reference name {string}" )
390+ public void EnterBigQuerypropertyreferencename (String referenceName ) throws IOException {
391+ CdfBigQueryPropertiesActions .enterBigQueryReferenceName (PluginPropertyUtils .pluginProp (referenceName ));
392+ }
393+
394+ @ Then ("Verify the BigQuery validation error message for reference name {string}" )
395+ public void VerifytheBigQueryvalidationerrormessageforreferencename (String property ) {
396+ CdfStudioActions .clickValidateButton ();
397+ String expectedErrorMessage ;
398+ if (property .equalsIgnoreCase ("gcsChunkSize" )) {
399+ expectedErrorMessage = PluginPropertyUtils
400+ .errorProp (E2ETestConstants .ERROR_MSG_BQ_INCORRECT_CHUNKSIZE );
401+ } else if (property .equalsIgnoreCase ("bucket" )) {
402+ expectedErrorMessage = PluginPropertyUtils
403+ .errorProp (E2ETestConstants .ERROR_MSG_BQ_INCORRECT_TEMPORARY_BUCKET );
404+ } else if (property .equalsIgnoreCase ("table" )) {
405+ expectedErrorMessage = PluginPropertyUtils
406+ .errorProp (E2ETestConstants .ERROR_MSG_INCORRECT_TABLE_NAME );
407+ } else if (property .equalsIgnoreCase ("referenceName" )) {
408+ expectedErrorMessage = PluginPropertyUtils
409+ .errorProp (E2ETestConstants .ERROR_MSG_INCORRECT_REFERENCENAME );
410+ } else {
411+ expectedErrorMessage = PluginPropertyUtils .errorProp (E2ETestConstants .ERROR_MSG_INCORRECT_REFERENCENAME ).
412+ replaceAll ("referenceName" , property .substring (0 , 1 ).toUpperCase () + property .substring (1 ));
413+ }
414+ String actualErrorMessage = PluginPropertyUtils .findPropertyErrorElement ("referenceName" ).getText ();
415+ System .out .println (actualErrorMessage );
416+ Assert .assertEquals (expectedErrorMessage , actualErrorMessage );
417+ String actualColor = PluginPropertyUtils .getErrorColor (PluginPropertyUtils .findPropertyErrorElement ("referenceName" ));
418+ String expectedColor = ConstantsUtil .ERROR_MSG_COLOR ;
419+ Assert .assertEquals (expectedColor , actualColor );
420+ }
421+
263422}
0 commit comments