@@ -65,7 +65,7 @@ public static void initializeServiceNowSourceConfig() {
6565 @ Before (order = 2 , value = "@SN_PRODUCT_CATALOG_ITEM" )
6666 public static void createRecordInProductCatalogItemTable () throws IOException , ServiceNowAPIException {
6767 BeforeActions .scenario .write ("Create new record in Product Catalog Item table" );
68- ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl (config .getConnection ());
68+ ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl (config .getConnection (), true );
6969 String uniqueId = "TestProductCatalogItem" + RandomStringUtils .randomAlphanumeric (10 );
7070 String recordDetails = "{'name':'" + uniqueId + "','price':'2500'}" ;
7171 StringEntity entity = new StringEntity (recordDetails );
@@ -76,18 +76,50 @@ public static void createRecordInProductCatalogItemTable() throws IOException, S
7676 public static void createRecordInReceivingSlipLineTable ()
7777 throws IOException , ServiceNowAPIException {
7878 BeforeActions .scenario .write ("Create new record in Receiving Slip Line table" );
79- ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl (config .getConnection ());
79+ ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl (config .getConnection (), true );
8080 String uniqueId = "TestReceivingSlipLine" + RandomStringUtils .randomAlphanumeric (10 );
8181 String recordDetails = "{'number':'" + uniqueId + "'}" ;
8282 StringEntity entity = new StringEntity (recordDetails );
8383 systemId = tableAPIClient .createRecord (TablesInTableMode .RECEIVING_SLIP_LINE .value , entity );
84+ BeforeActions .scenario .write ("New Record in Receiving Slip Line table: " + systemId + " created successfully" );
85+ }
86+
87+ @ Before (order = 2 , value = "@SN_DATE_TIME_TABLE" )
88+ public static void createRecordInDateTimeTable ()
89+ throws IOException , ServiceNowAPIException {
90+ BeforeActions .scenario .write ("Create new record in Date time table" );
91+ ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl (config .getConnection (), false );
92+ String recordDetails = "{'u_date': '2025-05-28 15:07'," +
93+ " 'u_datetime1': '28.05.2025 03:07:56 PM'," +
94+ " 'u_datetime2': '28.05.2025 03.07.56 PM'," +
95+ " 'u_datetime3': '2025-05-28 15:07:56'," +
96+ " 'u_datetime4': '28.05.2025 15:07:56'," +
97+ " 'u_datetime5': '28.05.2025 15.07.56'," +
98+ " 'u_datetime6': '28-05-2025 15:07:56'," +
99+ " 'u_datetime7': '28-05-2025 15.07.56'," +
100+ " 'u_datetime8': '05/28/2025 15:07:56'," +
101+ " 'u_datetime9': '28/05/2025 15:07:56'," +
102+ " 'u_datetime10': '05-28-2025 15:07:56'," +
103+ " 'u_datetime11': '28-05-25 15.07.56'," +
104+ " 'u_datetime13': '05-28-2025 15:07'," +
105+ " 'u_datetime': '28-05-2025 15.07'}" ;
106+ StringEntity entity = new StringEntity (recordDetails );
107+ systemId = tableAPIClient .createRecordInDisplayMode (TablesInTableMode .DATE_TIME_TABLE .value , entity );
108+ BeforeActions .scenario .write ("New Record in Date time table: " + systemId + " created successfully" );
109+ }
110+
111+ @ After (order = 2 , value = "@SN_DATE_TIME_TABLE" )
112+ public static void deleteRecord () throws ServiceNowAPIException , IOException {
113+ ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl (config .getConnection (), false );
114+ tableAPIClient .deleteRecordFromServiceNowTable (TablesInTableMode .DATE_TIME_TABLE .value , TestSetupHooks .systemId );
115+ BeforeActions .scenario .write ("Record in Date time table: " + systemId + " deleted successfully" );
84116 }
85117
86118 @ Before (order = 2 , value = "@SN_UPDATE_AGENT_ASSIST_RECOMMENDATION" )
87119 public static void updateRecordInAgentAssistRecommendationTable ()
88120 throws IOException , ServiceNowAPIException {
89121 BeforeActions .scenario .write ("Create new record in Agent Assist Recommendation table" );
90- ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl (config .getConnection ());
122+ ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl (config .getConnection (), true );
91123 String uniqueId = "TestAgentAssist" + RandomStringUtils .randomAlphanumeric (10 );
92124 String recordDetails = "{'active':'false','name':'" + uniqueId + "'}" ;
93125 StringEntity entity = new StringEntity (recordDetails );
@@ -98,7 +130,7 @@ public static void updateRecordInAgentAssistRecommendationTable()
98130 public static void updateRecordInAgentVendorCatalogItem ()
99131 throws IOException , ServiceNowAPIException {
100132 BeforeActions .scenario .write ("Create new record in Vendor Catalog Item table" );
101- ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl (config .getConnection ());
133+ ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl (config .getConnection (), true );
102134 String uniqueId = "TestVendorCatalog" + RandomStringUtils .randomAlphanumeric (10 );
103135 String recordDetails = "{'out_of_stock':'false','product_id':'" + uniqueId + "'}" ;
104136 StringEntity entity = new StringEntity (recordDetails );
@@ -108,7 +140,7 @@ public static void updateRecordInAgentVendorCatalogItem()
108140 @ Before (order = 2 , value = "@SN_UPDATE_SERVICE_OFFERING" )
109141 public static void updateRecordInServiceOffering () throws IOException , ServiceNowAPIException {
110142 BeforeActions .scenario .write ("Create new record in Service Offering table" );
111- ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl (config .getConnection ());
143+ ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl (config .getConnection (), true );
112144 String uniqueId = "TestServiceOffering" + RandomStringUtils .randomAlphanumeric (10 );
113145 String recordDetails = "{'purchase_date':'2022-05-28','end_date':'2022-06-05 15:00:00'," +
114146 " 'start_date':'2022-05-25 15:00:00','number':'" + uniqueId + "'}" ;
@@ -234,6 +266,7 @@ public static void updateTempSourceBQTableForServiceOffering() throws IOExceptio
234266 public static void setTempTargetBQTable () {
235267 bqTargetTable = "TestSN_table" + RandomStringUtils .randomAlphanumeric (10 );
236268 BeforeActions .scenario .write ("BigQuery Target table name: " + bqTargetTable );
269+ PluginPropertyUtils .addPluginProp ("bqTargetTable" , bqTargetTable );
237270 }
238271
239272 @ Before (order = 1 , value = "@CONNECTION" )
@@ -243,7 +276,7 @@ public static void setNewConnectionName() {
243276 BeforeActions .scenario .write ("New Connection name: " + connectionName );
244277 }
245278
246- @ After (order = 1 , value = "@BQ_SINK_CLEANUP" )
279+ @ After (order = 1 , value = "@BQ_SINK_CLEANUP or @BQ_SINK " )
247280 public static void deleteTempTargetBQTable () throws IOException , InterruptedException {
248281 try {
249282 BigQueryClient .dropBqQuery (bqTargetTable );
@@ -257,4 +290,14 @@ public static void deleteTempTargetBQTable() throws IOException, InterruptedExce
257290 }
258291 }
259292 }
293+
294+ @ After (order = 1 , value = "@BQ_SOURCE_TEST_RECEIVING_SLIP_LINE or @BQ_SOURCE_UPDATE_SERVICE_OFFERING or " +
295+ "@BQ_SOURCE_UPDATE_VENDOR_CATALOG_ITEM or @BQ_SOURCE_UPDATE_AGENT_ASSIST_RECOMMENDATION or " +
296+ "@BQ_SOURCE_UPDATE_RECEIVING_SLIP_LINE or @BQ_SOURCE_SERVICE_OFFERING or @BQ_SOURCE_VENDOR_CATALOG_ITEM or " +
297+ "@BQ_SOURCE_AGENT_ASSIST_RECOMMENDATION" )
298+ public static void deleteTempSourceBQTable () throws IOException , InterruptedException {
299+ BigQueryClient .dropBqQuery (bqSourceTable );
300+ PluginPropertyUtils .removePluginProp ("bqSourceTable" );
301+ BeforeActions .scenario .write ("BQ source Table " + bqSourceTable + " deleted successfully" );
302+ }
260303}
0 commit comments