Skip to content
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

Extent base database content with Vertica coverage #1060

Open
wants to merge 8 commits into
base: master
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
9 changes: 5 additions & 4 deletions content/io/cloudslang/base/database/sql_command.sl
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
#!
#! @input db_server_name: The hostname or ip address of the database server.
#! @input db_type: The type of database to connect to.
#! Valid: 'Oracle', 'MSSQL', 'Sybase', 'Netcool', 'DB2', 'PostgreSQL' and 'Custom'.
#! Valid: 'Oracle', 'MSSQL', 'Sybase', 'Netcool', 'DB2', 'PostgreSQL', 'Vertica' and 'Custom'.
#! @input username: The username to use when connecting to the database.
#! @input password: The password to use when connecting to the database.
#! @input instance: The name instance (for MSSQL Server). Leave it blank for default instance.
#! @input db_port: The port to connect to.
#! Default: Oracle: '1521', MSSQL: '1433', Sybase: '5000', Netcool: '4100', DB2: '50000', PostgreSQL: '5432'.
#! Default: Oracle: '1521', MSSQL: '1433', Sybase: '5000', Netcool: '4100', DB2: '50000', PostgreSQL: '5432',
#! Vertica: '5433'.
#! @input database_name: The name of the database.
#! @input authentication_type: The type of authentication used to access the database (applicable only to MSSQL type).
#! Valid: 'sql', 'windows'
Expand Down Expand Up @@ -55,7 +56,7 @@
#! Example: 'db.pooling.enable=true'
#! @input result_set_type: The result set type. See JDBC folder description for more details.
#! Valid values: 'TYPE_FORWARD_ONLY', 'TYPE_SCROLL_INSENSITIVE', 'TYPE_SCROLL_SENSITIVE'.
#! Default value: 'TYPE_SCROLL_INSENSITIVE' except DB2 which is overridden to 'TYPE_FORWARD_ONLY'
#! Default value: 'TYPE_SCROLL_INSENSITIVE' except or DB2 and Vertica which is overridden to 'TYPE_FORWARD_ONLY'
#! @input result_set_concurrency: The result set concurrency. See JDBC folder description for more details.
#! Valid values: 'CONCUR_READ_ONLY', 'CONCUR_UPDATABLE'
#! Default value: 'CONCUR_READ_ONLY'
Expand Down Expand Up @@ -174,7 +175,7 @@ operation:
private: true

java_action:
gav: 'io.cloudslang.content:cs-database:0.0.4'
gav: 'io.cloudslang.content:cs-database:0.0.5-SNAPSHOT'
class_name: io.cloudslang.content.database.actions.SQLCommand
method_name: execute

Expand Down
9 changes: 5 additions & 4 deletions content/io/cloudslang/base/database/sql_query.sl
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
#!
#! @input db_server_name: The hostname or ip address of the database server.
#! @input db_type: The type of database to connect to.
#! Valid: 'Oracle', 'MSSQL', 'Sybase', 'Netcool', 'DB2', 'PostgreSQL' and 'Custom'.
#! Valid: 'Oracle', 'MSSQL', 'Sybase', 'Netcool', 'DB2', 'PostgreSQL', Vertica and 'Custom'.
#! @input username: The username to use when connecting to the database.
#! @input password: The password to use when connecting to the database.
#! @input instance: The name instance (for MSSQL Server). Leave it blank for default instance.
#! @input db_port: The port to connect to.
#! Default: Oracle: '1521', MSSQL: '1433', Sybase: '5000', Netcool: '4100', DB2: '50000', PostgreSQL: '5432'.
#! Default: Oracle: '1521', MSSQL: '1433', Sybase: '5000', Netcool: '4100', DB2: '50000', PostgreSQL: '5432',
#! Vertica: '5433'.
#! @input database_name: The name of the database.
#! @input authentication_type: The type of authentication used to access the database (applicable only to MSSQL type).
#! Default: 'sql'
Expand Down Expand Up @@ -61,7 +62,7 @@
#! Example: 'db.pooling.enable=true'
#! @input result_set_type: The result set type. See JDBC folder description for more details.
#! Valid values: 'TYPE_FORWARD_ONLY', 'TYPE_SCROLL_INSENSITIVE', 'TYPE_SCROLL_SENSITIVE'.
#! Default value: 'TYPE_SCROLL_INSENSITIVE' except DB2 which is overridden to 'TYPE_FORWARD_ONLY'
#! Default value: 'TYPE_SCROLL_INSENSITIVE' except for DB2 and Vertica which is overridden to 'TYPE_FORWARD_ONLY'
#! @input result_set_concurrency: The result set concurrency. See JDBC folder description for more details.
#! Valid values: 'CONCUR_READ_ONLY', 'CONCUR_UPDATABLE'
#! Default value: 'CONCUR_READ_ONLY'
Expand Down Expand Up @@ -202,7 +203,7 @@ operation:
private: true

java_action:
gav: 'io.cloudslang.content:cs-database:0.0.4'
gav: 'io.cloudslang.content:cs-database:0.0.5-SNAPSHOT'
class_name: io.cloudslang.content.database.actions.SQLQuery
method_name: execute

Expand Down
9 changes: 5 additions & 4 deletions content/io/cloudslang/base/database/sql_query_all_rows.sl
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
#!
#! @input db_server_name: The hostname or ip address of the database server.
#! @input db_type: The type of database to connect to.
#! Valid: 'Oracle', 'MSSQL', 'Sybase', 'Netcool', 'DB2', 'PostgreSQL' and 'Custom'.
#! Valid: 'Oracle', 'MSSQL', 'Sybase', 'Netcool', 'DB2', 'PostgreSQL', 'Vertica' and 'Custom'.
#! @input username: The username to use when connecting to the database.
#! @input password: The password to use when connecting to the database.
#! @input instance: The name instance (for MSSQL Server). Leave it blank for default instance.
#! @input db_port: The port to connect to.
#! Default: Oracle: '1521', MSSQL: '1433', Sybase: '5000', Netcool: '4100', DB2: '50000', PostgreSQL: '5432'.
#! Default: Oracle: '1521', MSSQL: '1433', Sybase: '5000', Netcool: '4100', DB2: '50000', PostgreSQL: '5432',
#! Vertica: '5433'.
#! @input database_name: The name of the database.
#! @input authentication_type: The type of authentication used to access the database (applicable only to MSSQL type).
#! Default: 'sql'
Expand Down Expand Up @@ -62,7 +63,7 @@
#! Example: 'db.pooling.enable=true'
#! @input result_set_type: The result set type. See JDBC folder description for more details.
#! Valid values: 'TYPE_FORWARD_ONLY', 'TYPE_SCROLL_INSENSITIVE', 'TYPE_SCROLL_SENSITIVE'.
#! Default value: 'TYPE_SCROLL_INSENSITIVE' except DB2 which is overridden to 'TYPE_FORWARD_ONLY'
#! Default value: 'TYPE_SCROLL_INSENSITIVE' except or DB2 and Vertica which is overridden to 'TYPE_FORWARD_ONLY'
#! @input result_set_concurrency: The result set concurrency. See JDBC folder description for more details.
#! Valid values: 'CONCUR_READ_ONLY', 'CONCUR_UPDATABLE'
#! Default value: 'CONCUR_READ_ONLY'
Expand Down Expand Up @@ -196,7 +197,7 @@ operation:
private: true

java_action:
gav: 'io.cloudslang.content:cs-database:0.0.4'
gav: 'io.cloudslang.content:cs-database:0.0.5-SNAPSHOT'
class_name: io.cloudslang.content.database.actions.SQLQueryAllRows
method_name: execute

Expand Down
9 changes: 5 additions & 4 deletions content/io/cloudslang/base/database/sql_query_tabular.sl
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
#!
#! @input db_server_name: The hostname or ip address of the database server.
#! @input db_type: The type of database to connect to.
#! Valid: 'Oracle', 'MSSQL', 'Sybase', 'Netcool', 'DB2', 'PostgreSQL' and 'Custom'.
#! Valid: 'Oracle', 'MSSQL', 'Sybase', 'Netcool', 'DB2', 'PostgreSQL', Vertica and 'Custom'.
#! @input username: The username to use when connecting to the database.
#! @input password: The password to use when connecting to the database.
#! @input instance: The name instance (for MSSQL Server). Leave it blank for default instance.
#! @input db_port: The port to connect to.
#! Default: Oracle: '1521', MSSQL: '1433', Sybase: '5000', Netcool: '4100', DB2: '50000', PostgreSQL: '5432'.
#! Default: Oracle: '1521', MSSQL: '1433', Sybase: '5000', Netcool: '4100', DB2: '50000', PostgreSQL: '5432',
#! Vertica: '5433'.
#! @input database_name: The name of the database.
#! @input authentication_type: The type of authentication used to access the database (applicable only to MSSQL type).
#! Default: 'sql'
Expand Down Expand Up @@ -58,7 +59,7 @@
#! Example: 'db.pooling.enable=true'
#! @input result_set_type: The result set type. See JDBC folder description for more details.
#! Valid values: 'TYPE_FORWARD_ONLY', 'TYPE_SCROLL_INSENSITIVE', 'TYPE_SCROLL_SENSITIVE'.
#! Default value: 'TYPE_SCROLL_INSENSITIVE' except DB2 which is overridden to 'TYPE_FORWARD_ONLY'
#! Default value: 'TYPE_SCROLL_INSENSITIVE' except or DB2 and Vertica which is overridden to 'TYPE_FORWARD_ONLY'
#! @input result_set_concurrency: The result set concurrency. See JDBC folder description for more details.
#! Valid values: 'CONCUR_READ_ONLY', 'CONCUR_UPDATABLE'
#! Default value: 'CONCUR_READ_ONLY'
Expand Down Expand Up @@ -178,7 +179,7 @@ operation:
private: true

java_action:
gav: 'io.cloudslang.content:cs-database:0.0.4'
gav: 'io.cloudslang.content:cs-database:0.0.5-SNAPSHOT'
class_name: io.cloudslang.content.database.actions.SQLQueryTabular
method_name: execute

Expand Down
27 changes: 27 additions & 0 deletions test/io/cloudslang/base/database/test_vertica.inputs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

# (c) Copyright 2014-2017 EntIT Software LLC, a Micro Focus company, L.P.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License v2.0 which accompany this distribution.
#
# The Apache License is available at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
########################################################################################################################

testVertica:
testSuites: [vertica]
testFlowPath: io.cloudslang.base.database.test_vertica
inputs:
- db_server_name: <db_server_name>
- username: <username>
- password: <password>
- database_name: <database_name>
outputs:
- return_result: "Command completed successfully"
result: SUCCESS
180 changes: 180 additions & 0 deletions test/io/cloudslang/base/database/test_vertica.sl
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
namespace: io.cloudslang.base.database

imports:
db: io.cloudslang.base.database
strings: io.cloudslang.base.strings

flow:
name: test_vertica

inputs:
- db_server_name
- db_port:
required: false
default: "5433"
- username
- password:
sensitive: true
- database_name

outputs:
- return_result
- output_text

workflow:

- clean_up_old_table_ignore_errors:
do:
io.cloudslang.base.database.sql_command:
- db_server_name: ${db_server_name}
- db_port: ${db_port}
- db_type: Vertica
- username: ${username}
- password: ${password}
- database_name: ${database_name}
- command: 'DROP TABLE TestCsTickStore;'
- trust_all_roots: 'true'
publish:
- output_text: ${output_text}
- return_result: ${return_result}
navigate:
- SUCCESS: sql_create_table
- FAILURE: sql_create_table

- sql_create_table:
do:
io.cloudslang.base.database.sql_command:
- db_server_name: ${db_server_name}
- db_port: ${db_port}
- db_type: Vertica
- username: ${username}
- password: ${password}
- database_name: ${database_name}
- command: 'CREATE TABLE TestCsTickStore (ts TIMESTAMP, symbol VARCHAR(8), bid FLOAT);'
- trust_all_roots: 'true'
publish:
- output_text: ${output_text}
- return_result: ${return_result}
navigate:
- SUCCESS: sql_insert_row
- FAILURE: CREATE_STACK_FAILURE

- sql_insert_row:
do:
io.cloudslang.base.database.sql_command:
- db_server_name: ${db_server_name}
- db_port: ${db_port}
- db_type: Vertica
- username: ${username}
- password: ${password}
- database_name: ${database_name}
- command: "INSERT INTO TestCsTickStore VALUES ('2018-01-01 03:00:00', 'XYZ', 10.0);"
- trust_all_roots: 'true'
publish:
- output_text: ${output_text}
- return_result: ${return_result}
navigate:
- SUCCESS: sql_select_count
- FAILURE: CREATE_STACK_FAILURE

- sql_select_count:
do:
io.cloudslang.base.database.sql_command:
- db_server_name: ${db_server_name}
- db_port: ${db_port}
- db_type: Vertica
- username: ${username}
- password: ${password}
- database_name: ${database_name}
- command: 'SELECT COUNT(*) FROM TestCsTickStore;'
- trust_all_roots: 'true'
publish:
- output_text: ${output_text}
- return_result: ${return_result}
navigate:
- SUCCESS: sql_query_all
- FAILURE: CREATE_STACK_FAILURE

- sql_query_all:
do:
io.cloudslang.base.database.sql_query_all_rows:
- db_server_name: ${db_server_name}
- db_port: ${db_port}
- db_type: Vertica
- username: ${username}
- password: ${password}
- database_name: ${database_name}
- command: 'SELECT * FROM TestCsTickStore;'
- trust_all_roots: 'true'
publish:
- output_text: ${output_text}
- return_result: ${return_result}
navigate:
- SUCCESS: sql_query_tabular
- FAILURE: CREATE_STACK_FAILURE


- sql_query_tabular:
do:
io.cloudslang.base.database.sql_query_tabular:
- db_server_name: ${db_server_name}
- db_port: ${db_port}
- db_type: Vertica
- username: ${username}
- password: ${password}
- database_name: ${database_name}
- command: 'SELECT * FROM TestCsTickStore;'
- trust_all_roots: 'true'
publish:
- output_text: ${output_text}
- return_result: ${return_result}
navigate:
- SUCCESS: sql_query
- FAILURE: CREATE_STACK_FAILURE


- sql_query:
do:
io.cloudslang.base.database.sql_query:
- db_server_name: ${db_server_name}
- db_port: ${db_port}
- db_type: Vertica
- username: ${username}
- password: ${password}
- database_name: ${database_name}
- key: key
- command: 'SELECT * FROM TestCsTickStore;'
- trust_all_roots: 'true'
publish:
- output_text: ${output_text}
- return_result: ${return_result}
- rows_left: ${rows_left}
- column_names: ${column_names}

navigate:
- HAS_MORE: sql_drop_table
- NO_MORE: sql_drop_table
- FAILURE: CREATE_STACK_FAILURE


- sql_drop_table:
do:
io.cloudslang.base.database.sql_command:
- db_server_name: ${db_server_name}
- db_port: ${db_port}
- db_type: Vertica
- username: ${username}
- password: ${password}
- database_name: ${database_name}
- command: 'DROP TABLE TestCsTickStore;'
- trust_all_roots: 'true'
publish:
- output_text: ${output_text}
- return_result: ${return_result}
navigate:
- SUCCESS: SUCCESS
- FAILURE: CREATE_STACK_FAILURE

results:
- SUCCESS
- CREATE_STACK_FAILURE