Skip to content

Commit

Permalink
e2e test fix after error prop using servicenowapiexception
Browse files Browse the repository at this point in the history
  • Loading branch information
harshdeeppruthi committed Aug 6, 2024
1 parent c65c7f1 commit dcc46a5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.cdap.e2e.utils.AssertionHelper;
import io.cdap.e2e.utils.BigQueryClient;
import io.cdap.e2e.utils.PluginPropertyUtils;
import io.cdap.plugin.servicenow.apiclient.ServiceNowAPIException;
import io.cdap.plugin.servicenow.apiclient.ServiceNowTableAPIClientImpl;
import io.cdap.plugin.servicenow.locators.ServiceNowPropertiesPage;
import io.cdap.plugin.servicenow.source.ServiceNowSourceConfig;
Expand Down Expand Up @@ -50,7 +51,7 @@ public class ServiceNowSinkPropertiesPageActions {
private static Gson gson = new Gson();

public static void getRecordFromServiceNowTable(String query, String tableName)
throws OAuthProblemException, OAuthSystemException, IOException {
throws ServiceNowAPIException {
config = new ServiceNowSourceConfig(
"", "", "", "", "",
System.getenv("SERVICE_NOW_CLIENT_ID"),
Expand All @@ -65,7 +66,7 @@ public static void getRecordFromServiceNowTable(String query, String tableName)
}

public static void verifyIfRecordCreatedInServiceNowIsCorrect(String query, String tableName)
throws IOException, InterruptedException, OAuthProblemException, OAuthSystemException {
throws IOException, InterruptedException, ServiceNowAPIException {

getRecordFromServiceNowTable(query, tableName);
TableResult bigQueryTableData = getBigQueryTableData(TestSetupHooks.bqSourceDataset, TestSetupHooks.bqSourceTable);
Expand All @@ -79,7 +80,7 @@ public static void verifyIfRecordCreatedInServiceNowIsCorrect(String query, Stri
}

public static void verifyIfRecordUpdatedInServiceNowIsCorrect(String query, String tableName)
throws IOException, InterruptedException, OAuthProblemException, OAuthSystemException {
throws IOException, InterruptedException, ServiceNowAPIException {

getRecordFromServiceNowTable(query, tableName);
TableResult bigQueryTableData = getBigQueryTableData(TestSetupHooks.bqSourceDataset, TestSetupHooks.bqSourceTable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package io.cdap.plugin.servicenowsink.stepsdesign;

import io.cdap.e2e.utils.PluginPropertyUtils;
import io.cdap.plugin.servicenow.apiclient.ServiceNowAPIException;
import io.cdap.plugin.servicenow.util.ServiceNowConstants;
import io.cdap.plugin.servicenowsink.actions.ServiceNowSinkPropertiesPageActions;
import io.cdap.plugin.tests.hooks.TestSetupHooks;
Expand All @@ -36,7 +37,7 @@ public class DesignTimeSteps {

@And("Verify If new record created in ServiceNow application for table {string} is correct")
public void verifyIfNewRecordCreatedInServiceNowApplicationForTableIsCorrect(String tableName)
throws IOException, InterruptedException, OAuthProblemException, OAuthSystemException {
throws IOException, InterruptedException, ServiceNowAPIException {
String tableValueFromPluginPropertiesFile = PluginPropertyUtils.pluginProp(tableName);

switch (tableValueFromPluginPropertiesFile) {
Expand All @@ -57,7 +58,7 @@ public void verifyIfNewRecordCreatedInServiceNowApplicationForTableIsCorrect(Str

@Then("Verify If an updated record in ServiceNow application for table {string} is correct")
public void verifyIfAnUpdatedRecordInServiceNowApplicationForTableIsCorrect(String tableName)
throws OAuthProblemException, OAuthSystemException, IOException, InterruptedException {
throws IOException, InterruptedException, ServiceNowAPIException {
String tableValueFromPluginPropertiesFile = PluginPropertyUtils.pluginProp(tableName);
query = ServiceNowConstants.SYSTEM_ID + "=" + TestSetupHooks.systemId;
ServiceNowSinkPropertiesPageActions.verifyIfRecordUpdatedInServiceNowIsCorrect(query,
Expand Down
14 changes: 9 additions & 5 deletions src/e2e-test/java/io/cdap/plugin/tests/hooks/TestSetupHooks.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.cloud.bigquery.BigQueryException;
import io.cdap.e2e.utils.BigQueryClient;
import io.cdap.e2e.utils.PluginPropertyUtils;
import io.cdap.plugin.servicenow.apiclient.ServiceNowAPIException;
import io.cdap.plugin.servicenow.apiclient.ServiceNowTableAPIClientImpl;
import io.cdap.plugin.servicenow.source.ServiceNowSourceConfig;
import io.cdap.plugin.utils.enums.ApplicationInReportingMode;
Expand Down Expand Up @@ -62,7 +63,7 @@ public static void initializeServiceNowSourceConfig() {
}

@Before(order = 2, value = "@SN_PRODUCT_CATALOG_ITEM")
public static void createRecordInProductCatalogItemTable() throws IOException {
public static void createRecordInProductCatalogItemTable() throws IOException, ServiceNowAPIException {
BeforeActions.scenario.write("Create new record in Product Catalog Item table");
ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl(config.getConnection());
String uniqueId = "TestProductCatalogItem" + RandomStringUtils.randomAlphanumeric(10);
Expand All @@ -72,7 +73,8 @@ public static void createRecordInProductCatalogItemTable() throws IOException {
}

@Before(order = 2, value = "@SN_RECEIVING_SLIP_LINE")
public static void createRecordInReceivingSlipLineTable() throws IOException {
public static void createRecordInReceivingSlipLineTable()
throws IOException, ServiceNowAPIException {
BeforeActions.scenario.write("Create new record in Receiving Slip Line table");
ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl(config.getConnection());
String uniqueId = "TestReceivingSlipLine" + RandomStringUtils.randomAlphanumeric(10);
Expand All @@ -82,7 +84,8 @@ public static void createRecordInReceivingSlipLineTable() throws IOException {
}

@Before(order = 2, value = "@SN_UPDATE_AGENT_ASSIST_RECOMMENDATION")
public static void updateRecordInAgentAssistRecommendationTable() throws IOException {
public static void updateRecordInAgentAssistRecommendationTable()
throws IOException, ServiceNowAPIException {
BeforeActions.scenario.write("Create new record in Agent Assist Recommendation table");
ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl(config.getConnection());
String uniqueId = "TestAgentAssist" + RandomStringUtils.randomAlphanumeric(10);
Expand All @@ -92,7 +95,8 @@ public static void updateRecordInAgentAssistRecommendationTable() throws IOExcep
}

@Before(order = 2, value = "@SN_UPDATE_VENDOR_CATALOG_ITEM")
public static void updateRecordInAgentVendorCatalogItem() throws IOException {
public static void updateRecordInAgentVendorCatalogItem()
throws IOException, ServiceNowAPIException {
BeforeActions.scenario.write("Create new record in Vendor Catalog Item table");
ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl(config.getConnection());
String uniqueId = "TestVendorCatalog" + RandomStringUtils.randomAlphanumeric(10);
Expand All @@ -102,7 +106,7 @@ public static void updateRecordInAgentVendorCatalogItem() throws IOException {
}

@Before(order = 2, value = "@SN_UPDATE_SERVICE_OFFERING")
public static void updateRecordInServiceOffering() throws IOException {
public static void updateRecordInServiceOffering() throws IOException, ServiceNowAPIException {
BeforeActions.scenario.write("Create new record in Service Offering table");
ServiceNowTableAPIClientImpl tableAPIClient = new ServiceNowTableAPIClientImpl(config.getConnection());
String uniqueId = "TestServiceOffering" + RandomStringUtils.randomAlphanumeric(10);
Expand Down

0 comments on commit dcc46a5

Please sign in to comment.