Skip to content

Added test cases for Connection manager and hide sink plugin. #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@
<Embed-Directory>lib</Embed-Directory>
<!--Only @Plugin classes in the export packages will be included as plugin-->
<_exportcontents>
io.cdap.plugin.*;
io.cdap.plugin.servicenow.source.*,io.cdap.plugin.servicenow.connector.*;
</_exportcontents>
</instructions>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ Feature: ServiceNow Multi Source - Design time validation scenarios
And Click on the Validate button
Then Verify mandatory property error for below listed properties:
| referenceName |
| clientId |
| clientSecret |
| restApiEndpoint |
| user |
| password |

@TS-SN-MULTI-DSGN-ERROR-02
Scenario: Verify validation message for invalid table name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,15 @@ Feature: ServiceNow Multi Source - Design time scenarios (macro)
And Click on the Macro button of Property: "restApiEndpoint" and set the value to: "restApiEndpoint"
And Click on the Macro button of Property: "user" and set the value to: "username"
And Click on the Macro button of Property: "password" and set the value to: "password"
Then Validate "ServiceNow Multi Source" plugin properties

@TS-SN-MULTI-DSGN-MACRO-02
Scenario: Verify user should be able to validate the plugin using connection manager with macros
When Open Datafusion Project to configure pipeline
And Select plugin: "ServiceNow Multi Source" from the plugins list as: "Source"
And Navigate to the properties page of plugin: "ServiceNow Multi Source"
And Fill Reference Name
And Click plugin property: "switch-useConnection"
And Click on the Macro button of Property: "connection" and set the value to: "Connection"
And Click on the Macro button of Property: "tableNames" and set the value to: "tableNames"
Then Validate "ServiceNow Multi Source" plugin properties
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,46 @@ Feature: ServiceNow Multi Source - Run time scenarios (macro)
And Verify the pipeline status is "Failed"
Then Open Pipeline logs and verify Log entries having below listed Level and Message:
| Level | Message |
| ERROR | invalid.filters.logsmessage |
| ERROR | invalid.filters.logsmessage |

@TS-SN-MULTI-RNTM-MACRO-05 @BQ_SINK @CONNECTION
Scenario: Verify user should be able to preview the pipeline when the source plugin is configured for connection manager with macros
When Open Datafusion Project to configure pipeline
And Select plugin: "ServiceNow Multi Source" from the plugins list as: "Source"
And Navigate to the properties page of plugin: "ServiceNow Multi Source"
And Fill Reference Name
And Click on the Macro button of Property: "tableNames" and set the value to: "tableNames"
And Click plugin property: "switch-useConnection"
And Click on the Browse Connections button
And Click on the Add Connection button
And Click plugin property: "connector-ServiceNow"
And Enter input plugin property: "name" with value: "connection.name"
And fill Credentials section for pipeline user
Then Click on the Test Connection button
And Verify the test connection is successful
Then Click on the Create button
And Use new connection
And Click on the Macro button of Property: "connection" and set the value to: "Connection"
Then Validate "ServiceNow Multi Source" plugin properties
And Close the Plugin Properties page
And Select Sink plugin: "BigQueryMultiTable" from the plugins list
And Connect source as "ServiceNow" and sink as "BigQueryMultiTable" to establish connection
And Navigate to the properties page of plugin: "BigQuery Multi Table"
And Configure BigQuery Multi Table sink plugin for Dataset
Then Validate "BigQuery Multi Table" plugin properties
And Close the Plugin Properties page
And Preview and run the pipeline
And Enter runtime argument value "receiving_slip_line" for key "tableNames"
And Enter runtime argument value "connectionMacros" for key "Connection"
Then Run the preview of pipeline with runtime arguments
Then Verify the preview of pipeline is "success"
And Close the pipeline logs
And Close the preview
And Save and Deploy Pipeline
And Run the Pipeline in Runtime
And Enter runtime argument value "receiving_slip_line" for key "tableName"
And Enter runtime argument value "connectionMacros" for key "Connection"
And Run the Pipeline in Runtime with runtime arguments
And Wait till pipeline is in running state
And Open and capture logs
Then Verify the pipeline status is "Succeeded"
1 change: 0 additions & 1 deletion src/e2e-test/features/servicenowsink/DesignTime.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@ServiceNow
@SNSink
@Smoke
@Regression
Feature: ServiceNow Sink - Design time scenarios

@TS-SN-DSGN-SINK-01 @BQ_SOURCE_TEST_RECEIVING_SLIP_LINE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@ServiceNow
@SNSink
@Smoke
@Regression
Feature: ServiceNow Sink - Design time validation scenarios

@TS-SN-DSGN-SINK-ERROR-01
Expand All @@ -26,11 +25,6 @@ Feature: ServiceNow Sink - Design time validation scenarios
And Click on the Validate button
Then Verify mandatory property error for below listed properties:
| referenceName |
| clientId |
| clientSecret |
| restApiEndpoint |
| user |
| password |

@TS-SN-DSGN-SINK-ERROR-02
Scenario: Verify invalid credentials validation messages
Expand Down
23 changes: 21 additions & 2 deletions src/e2e-test/features/servicenowsink/DesignTimeWithMacro.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@ServiceNow
@SNSink
@Smoke
@@Regression
Feature: ServiceNow Sink - Design time validation scenarios (macro)

@TS-SN-DSGN-SINK-MACRO-01 @BQ_SOURCE_TEST_RECEIVING_SLIP_LINE
Expand Down Expand Up @@ -69,4 +68,24 @@ Feature: ServiceNow Sink - Design time validation scenarios (macro)
And fill Credentials section for pipeline user
And Enter input plugin property: "tableName" with value: "receiving_slip_line"
And Click on the Macro button of Property: "operation" and set the value to: "operation"
Then Validate "ServiceNow" plugin properties
Then Validate "ServiceNow" plugin properties

@TS-SN-DSGN-SINK-MACRO-04 @BQ_SOURCE_TEST_RECEIVING_SLIP_LINE
Scenario: Verify user should be able to validate plugin with macros for Connection Manager
When Open Datafusion Project to configure pipeline
And Select plugin: "BigQuery" from the plugins list as: "Source"
And Navigate to the properties page of plugin: "BigQuery"
And Configure BigQuery source plugin for Dataset and Table
And Validate "BigQuery" plugin properties
And Close the Plugin Properties page
And Select Sink plugin: "ServiceNow" from the plugins list
And Connect plugins: "BigQuery" and "ServiceNow" to establish connection
And Navigate to the properties page of plugin: "ServiceNow"
And Fill Reference Name
And Click plugin property: "switch-useConnection"
And Click on the Macro button of Property: "connection" and set the value to: "Connection"
And Enter input plugin property: "tableName" with value: "receiving_slip_line"
Then Validate "ServiceNow" plugin properties



1 change: 0 additions & 1 deletion src/e2e-test/features/servicenowsink/RunTime.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@ServiceNow
@SNSink
@Smoke
@Regression
Feature: ServiceNow Sink - Run time scenarios

@TS-SN-RNTM-SINK-01 @BQ_SOURCE_TEST_RECEIVING_SLIP_LINE
Expand Down
38 changes: 37 additions & 1 deletion src/e2e-test/features/servicenowsink/RunTimeWithMacros.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@ServiceNow
@SNSink
@Smoke
@Regression
Feature: ServiceNow Sink - Run time scenarios (macro)

@TS-SN-RNTM-SINK-MACRO-01 @BQ_SOURCE_TEST_RECEIVING_SLIP_LINE @BQ_SINK_CLEANUP
Expand Down Expand Up @@ -198,3 +197,40 @@ Feature: ServiceNow Sink - Run time scenarios (macro)
| Level | Message |
| ERROR | invalid.credentials.logsmessage |

@TS-SN-RNTM-SINK-MACRO-01 @BQ_SOURCE_TEST_RECEIVING_SLIP_LINE @BQ_SINK_CLEANUP @CONNECTION
Scenario: Verify user should be able to preview a pipeline when plugin is configured for Insert operation with macros for connection manager
When Open Datafusion Project to configure pipeline
And Select plugin: "BigQuery" from the plugins list as: "Source"
And Navigate to the properties page of plugin: "BigQuery"
And Fill Reference Name
And Configure BigQuery source plugin for Dataset and Table
And Validate "BigQuery" plugin properties
And Capture the generated Output Schema
And Close the Plugin Properties page
And Select Sink plugin: "ServiceNow" from the plugins list
And Connect plugins: "BigQuery" and "ServiceNow" to establish connection
And Navigate to the properties page of plugin: "ServiceNow"
And Fill Reference Name
And Select radio button plugin property: "operation" with value: "INSERT"
And Click on the Macro button of Property: "tableName" and set the value to: "tableName"
And Click on the Macro button of Property: "connection" and set the value to: "Connection"
And Validate "ServiceNow" plugin properties
And Close the Plugin Properties page
And Preview and run the pipeline
And Enter runtime argument value "receiving_slip_line" for key "tableName"
And Enter runtime argument value "connectionMacros" for key "Connection"
And Run the preview of pipeline with runtime arguments
Then Verify the preview of pipeline is "success"
And Open and capture pipeline preview logs
And Close the pipeline logs
And Close the preview
And Save and Deploy Pipeline
And Run the Pipeline in Runtime
And Enter runtime argument value "receiving_slip_line" for key "tableName"
And Enter runtime argument value "connectionMacros" for key "Connection"
And Run the Pipeline in Runtime with runtime arguments
And Wait till pipeline is in running state
And Open and capture logs
And Verify the pipeline status is "Succeeded"
And Close the pipeline logs

Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ Feature: ServiceNow Source - Design time validation scenarios
And Click on the Validate button
Then Verify mandatory property error for below listed properties:
| referenceName |
| clientId |
| clientSecret |
| restApiEndpoint |
| user |
| password |

@TS-SN-DSGN-ERROR-02
Scenario: Verify invalid credentials validation messages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,16 @@ Feature: ServiceNow Source - Design time scenarios (macro)
And Click on the Macro button of Property: "restApiEndpoint" and set the value to: "restApiEndpoint"
And Click on the Macro button of Property: "user" and set the value to: "username"
And Click on the Macro button of Property: "password" and set the value to: "password"
Then Validate "ServiceNow" plugin properties

@TS-SN-DSGN-MACRO-03
Scenario: Verify user should be able to validate plugin with macros for connection manager
When Open Datafusion Project to configure pipeline
And Select plugin: "ServiceNow" from the plugins list as: "Source"
And Navigate to the properties page of plugin: "ServiceNow"
And Fill Reference Name
And Select mode as: "TABLE"
And Click on the Macro button of Property: "tableName" and set the value to: "tableName"
And Click plugin property: "switch-useConnection"
And Click on the Macro button of Property: "connection" and set the value to: "Connection"
Then Validate "ServiceNow" plugin properties
50 changes: 49 additions & 1 deletion src/e2e-test/features/servicenowsource/RunTimeWithMacros.feature
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,52 @@ Feature: ServiceNow Source - Run time scenarios (macro)
And Verify the pipeline status is "Failed"
Then Open Pipeline logs and verify Log entries having below listed Level and Message:
| Level | Message |
| ERROR | invalid.filters.logsmessage |
| ERROR | invalid.filters.logsmessage |

@TS-SN-RNTM-MACRO-06 @SN_SOURCE_CONFIG @SN_RECEIVING_SLIP_LINE @BQ_SINK @CONNECTION
Scenario: Verify user should be able to run a pipeline when ServiceNow plugin is configured with macros for connection manager
When Open Datafusion Project to configure pipeline
And Select plugin: "ServiceNow" from the plugins list as: "Source"
And Navigate to the properties page of plugin: "ServiceNow"
And Fill Reference Name
And Select mode as: "TABLE"
And Click on the Macro button of Property: "tableName" and set the value to: "tableName"
And Click plugin property: "switch-useConnection"
And Click on the Browse Connections button
And Click on the Add Connection button
And Click plugin property: "connector-ServiceNow"
And Enter input plugin property: "name" with value: "connection.name"
And fill Credentials section for pipeline user
Then Click on the Test Connection button
And Verify the test connection is successful
Then Click on the Create button
And Use new connection
And Click on the Macro button of Property: "connection" and set the value to: "Connection"
Then Validate "ServiceNow" plugin properties
And Close the Plugin Properties page
And Select Sink plugin: "BigQueryTable" from the plugins list
And Connect source as "ServiceNow" and sink as "BigQuery" to establish connection
And Navigate to the properties page of plugin: "BigQuery"
And Replace input plugin property: "project" with value: "projectId"
And Enter input plugin property: "datasetProject" with value: "datasetprojectId"
And Configure BigQuery sink plugin for Dataset and Table
Then Validate "BigQuery" plugin properties
And Close the Plugin Properties page
And Save and Deploy Pipeline
And Run the Pipeline in Runtime
And Enter runtime argument value "receiving_slip_line" for key "tableName"
And Enter runtime argument value "connectionMacros" for key "Connection"
And Run the Pipeline in Runtime with runtime arguments
And Wait till pipeline is in running state
And Open and capture logs
Then Verify the pipeline status is "Succeeded"
And Close the pipeline logs
And Close the preview
And Save and Deploy Pipeline
And Run the Pipeline in Runtime
And Enter runtime argument value "receiving_slip_line" for key "tableName"
And Enter runtime argument value "connectionMacros" for key "Connection"
And Run the Pipeline in Runtime with runtime arguments
And Wait till pipeline is in running state
And Open and capture logs
Then Verify the pipeline status is "Succeeded"
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ public static void setNewConnectionName() {
String connectionName = "ServiceNowConnection" + RandomStringUtils.randomAlphanumeric(10);
PluginPropertyUtils.addPluginProp("connection.name", connectionName);
BeforeActions.scenario.write("New Connection name: " + connectionName);
String connectionMacros = "${conn(" + connectionName + ")}";
PluginPropertyUtils.addPluginProp("connectionMacros", connectionMacros);
}

@After(order = 1, value = "@BQ_SINK_CLEANUP")
Expand Down
1 change: 1 addition & 0 deletions src/e2e-test/resources/pluginParameters.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ invalid.tablename=proc

#Connection Manager
connection.name = dummy
connectionMacros=dummy

##BigQuery
projectId=cdf-athena
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,40 @@

import java.util.Map;

import javax.annotation.Nullable;


/**
* PluginConfig for ServiceNow Connector
*/
public class ServiceNowConnectorConfig extends PluginConfig {
@Name(ServiceNowConstants.PROPERTY_CLIENT_ID)
@Macro
@Nullable
@Description(" The Client ID for ServiceNow Instance.")
private final String clientId;

@Name(ServiceNowConstants.PROPERTY_CLIENT_SECRET)
@Macro
@Nullable
@Description("The Client Secret for ServiceNow Instance.")
private final String clientSecret;

@Name(ServiceNowConstants.PROPERTY_API_ENDPOINT)
@Macro
@Nullable
@Description("The REST API Endpoint for ServiceNow Instance. For example, https://instance.service-now.com")
private final String restApiEndpoint;

@Name(ServiceNowConstants.PROPERTY_USER)
@Macro
@Nullable
@Description("The user name for ServiceNow Instance.")
private final String user;

@Name(ServiceNowConstants.PROPERTY_PASSWORD)
@Macro
@Nullable
@Description("The password for ServiceNow Instance.")
private final String password;

Expand Down
Loading