From 31461aec338813ebfba0a9c494cf5f934464076b Mon Sep 17 00:00:00 2001 From: Jacek Date: Fri, 23 Jun 2017 01:37:44 +0100 Subject: [PATCH 1/3] Install and Uninstall scripts are now much more readable Resolves #321 --- source/install.sql | 395 ++++++++++++++++++----------------- source/install_component.sql | 7 + source/uninstall.sql | 167 ++++++++------- 3 files changed, 295 insertions(+), 274 deletions(-) create mode 100644 source/install_component.sql diff --git a/source/install.sql b/source/install.sql index 9bc514d08..037dec7b2 100644 --- a/source/install.sql +++ b/source/install.sql @@ -27,242 +27,244 @@ spool install.log define ut3_owner = &1 whenever sqlerror exit failure rollback whenever oserror exit failure rollback +set serveroutput on size unlimited format truncated +set feedback off +prompt Switching current schema to &&ut3_owner alter session set current_schema = &&ut3_owner; -alter session set plsql_warnings = 'ENABLE:ALL', 'DISABLE:(6000,6001,6003,6010, 7206)'; -set define off - +alter session set plsql_warnings = 'ENABLE:ALL', 'DISABLE:(5004,5018,6000,6001,6003,6009,6010,7206)'; +--set define off --common utilities -@@core/types/ut_varchar2_list.tps -@@core/types/ut_varchar2_rows.tps -@@core/types/ut_object_name.tps -@@core/types/ut_object_name.tpb -@@core/types/ut_object_names.tps -@@core/types/ut_key_value_pair.tps -@@core/types/ut_key_value_pairs.tps -@@core/ut_utils.pks -@@core/ut_metadata.pks -@@core/ut_utils.pkb -@@core/ut_metadata.pkb -@@reporters/ut_ansiconsole_helper.pks -@@reporters/ut_ansiconsole_helper.pkb +@@install_component.sql 'core/types/ut_varchar2_list.tps' +@@install_component.sql 'core/types/ut_varchar2_rows.tps' +@@install_component.sql 'core/types/ut_object_name.tps' +@@install_component.sql 'core/types/ut_object_name.tpb' +@@install_component.sql 'core/types/ut_object_names.tps' +@@install_component.sql 'core/types/ut_key_value_pair.tps' +@@install_component.sql 'core/types/ut_key_value_pairs.tps' +@@install_component.sql 'core/ut_utils.pks' +@@install_component.sql 'core/ut_metadata.pks' +@@install_component.sql 'core/ut_utils.pkb' +@@install_component.sql 'core/ut_metadata.pkb' +@@install_component.sql 'reporters/ut_ansiconsole_helper.pks' +@@install_component.sql 'reporters/ut_ansiconsole_helper.pkb' --core types -@@core/types/ut_expectation_result.tps -@@core/types/ut_expectation_results.tps -@@core/types/ut_results_counter.tps -@@core/types/ut_suite_item_base.tps -@@core/types/ut_event_listener_base.tps -@@core/types/ut_suite_item.tps -@@core/types/ut_suite_items.tps -@@core/types/ut_executable.tps -@@core/types/ut_test.tps -@@core/types/ut_logical_suite.tps -@@core/types/ut_suite.tps -@@core/types/ut_file_mapping.tps -@@core/types/ut_file_mappings.tps -@@core/types/ut_coverage_options.tps -@@core/types/ut_run.tps -@@core/types/ut_reporter_base.tps -@@core/types/ut_reporters.tps -@@core/types/ut_event_listener.tps +@@install_component.sql 'core/types/ut_expectation_result.tps' +@@install_component.sql 'core/types/ut_expectation_results.tps' +@@install_component.sql 'core/types/ut_results_counter.tps' +@@install_component.sql 'core/types/ut_suite_item_base.tps' +@@install_component.sql 'core/types/ut_event_listener_base.tps' +@@install_component.sql 'core/types/ut_suite_item.tps' +@@install_component.sql 'core/types/ut_suite_items.tps' +@@install_component.sql 'core/types/ut_executable.tps' +@@install_component.sql 'core/types/ut_test.tps' +@@install_component.sql 'core/types/ut_logical_suite.tps' +@@install_component.sql 'core/types/ut_suite.tps' +@@install_component.sql 'core/types/ut_file_mapping.tps' +@@install_component.sql 'core/types/ut_file_mappings.tps' +@@install_component.sql 'core/types/ut_coverage_options.tps' +@@install_component.sql 'core/types/ut_run.tps' +@@install_component.sql 'core/types/ut_reporter_base.tps' +@@install_component.sql 'core/types/ut_reporters.tps' +@@install_component.sql 'core/types/ut_event_listener.tps' --output buffer table -@@core/ut_output_buffer_tmp.sql -@@core/ut_message_id_seq.sql +@@install_component.sql 'core/ut_output_buffer_tmp.sql' +@@install_component.sql 'core/ut_message_id_seq.sql' --output buffer api -@@core/ut_output_buffer.pks -@@core/ut_output_buffer.pkb +@@install_component.sql 'core/ut_output_buffer.pks' +@@install_component.sql 'core/ut_output_buffer.pkb' --annoations -@@core/ut_annotations.pks -@@core/ut_annotations.pkb +@@install_component.sql 'core/ut_annotations.pks' +@@install_component.sql 'core/ut_annotations.pkb' --suite manager -@@core/ut_suite_manager.pks -@@core/ut_suite_manager.pkb +@@install_component.sql 'core/ut_suite_manager.pks' +@@install_component.sql 'core/ut_suite_manager.pkb' ---expectationios execution state interface -@@core/ut_expectation_processor.pks -@@core/ut_expectation_processor.pkb +--expectations execution state interface +@@install_component.sql 'core/ut_expectation_processor.pks' +@@install_component.sql 'core/ut_expectation_processor.pkb' --installing profiler tabs if they dont exist whenever sqlerror continue @@core/coverage/proftab.sql whenever sqlerror exit failure rollback -@@core/ut_file_mapper.pks -@@core/ut_file_mapper.pkb +@@install_component.sql 'core/ut_file_mapper.pks' +@@install_component.sql 'core/ut_file_mapper.pkb' --gathering coverage -@@core/coverage/ut_coverage_sources_tmp.sql -@@core/coverage/ut_coverage_helper.pks -@@core/coverage/ut_coverage_helper.pkb -@@core/coverage/ut_coverage.pks -@@core/coverage/ut_coverage.pkb -@@core/coverage/ut_coverage_reporter_base.tps -@@core/coverage/ut_coverage_reporter_base.tpb +@@install_component.sql 'core/coverage/ut_coverage_sources_tmp.sql' +@@install_component.sql 'core/coverage/ut_coverage_helper.pks' +@@install_component.sql 'core/coverage/ut_coverage_helper.pkb' +@@install_component.sql 'core/coverage/ut_coverage.pks' +@@install_component.sql 'core/coverage/ut_coverage.pkb' +@@install_component.sql 'core/coverage/ut_coverage_reporter_base.tps' +@@install_component.sql 'core/coverage/ut_coverage_reporter_base.tpb' --core type bodies -@@core/types/ut_results_counter.tpb -@@core/types/ut_suite_item.tpb -@@core/types/ut_test.tpb -@@core/types/ut_logical_suite.tpb -@@core/types/ut_suite.tpb -@@core/types/ut_run.tpb -@@core/types/ut_event_listener.tpb -@@core/types/ut_expectation_result.tpb -@@core/types/ut_reporter_base.tpb -@@core/types/ut_file_mapping.tpb -@@core/types/ut_executable.tpb -@@core/types/ut_console_reporter_base.tps -@@core/types/ut_console_reporter_base.tpb +@@install_component.sql 'core/types/ut_results_counter.tpb' +@@install_component.sql 'core/types/ut_suite_item.tpb' +@@install_component.sql 'core/types/ut_test.tpb' +@@install_component.sql 'core/types/ut_logical_suite.tpb' +@@install_component.sql 'core/types/ut_suite.tpb' +@@install_component.sql 'core/types/ut_run.tpb' +@@install_component.sql 'core/types/ut_event_listener.tpb' +@@install_component.sql 'core/types/ut_expectation_result.tpb' +@@install_component.sql 'core/types/ut_reporter_base.tpb' +@@install_component.sql 'core/types/ut_file_mapping.tpb' +@@install_component.sql 'core/types/ut_executable.tpb' +@@install_component.sql 'core/types/ut_console_reporter_base.tps' +@@install_component.sql 'core/types/ut_console_reporter_base.tpb' --expectations and matchers -@@expectations/data_values/ut_cursor_data.sql -@@expectations/data_values/ut_data_value.tps -@@expectations/data_values/ut_data_value_anydata.tps -@@expectations/data_values/ut_data_value_collection.tps -@@expectations/data_values/ut_data_value_object.tps -@@expectations/data_values/ut_data_value_blob.tps -@@expectations/data_values/ut_data_value_boolean.tps -@@expectations/data_values/ut_data_value_clob.tps -@@expectations/data_values/ut_data_value_date.tps -@@expectations/data_values/ut_data_value_dsinterval.tps -@@expectations/data_values/ut_data_value_number.tps -@@expectations/data_values/ut_data_value_refcursor.tps -@@expectations/data_values/ut_data_value_timestamp.tps -@@expectations/data_values/ut_data_value_timestamp_tz.tps -@@expectations/data_values/ut_data_value_timestamp_ltz.tps -@@expectations/data_values/ut_data_value_varchar2.tps -@@expectations/data_values/ut_data_value_yminterval.tps -@@expectations/matchers/ut_matcher.tps -@@expectations/matchers/ut_comparison_matcher.tps -@@expectations/matchers/ut_be_false.tps -@@expectations/matchers/ut_be_greater_or_equal.tps -@@expectations/matchers/ut_be_greater_than.tps -@@expectations/matchers/ut_be_less_or_equal.tps -@@expectations/matchers/ut_be_less_than.tps -@@expectations/matchers/ut_be_like.tps -@@expectations/matchers/ut_be_not_null.tps -@@expectations/matchers/ut_be_null.tps -@@expectations/matchers/ut_be_true.tps -@@expectations/matchers/ut_equal.tps -@@expectations/matchers/ut_be_between.tps -@@expectations/matchers/ut_be_empty.tps -@@expectations/matchers/ut_match.tps -@@expectations/ut_expectation.tps -@@expectations/ut_expectation_anydata.tps -@@expectations/ut_expectation_blob.tps -@@expectations/ut_expectation_boolean.tps -@@expectations/ut_expectation_clob.tps -@@expectations/ut_expectation_date.tps -@@expectations/ut_expectation_dsinterval.tps -@@expectations/ut_expectation_number.tps -@@expectations/ut_expectation_refcursor.tps -@@expectations/ut_expectation_timestamp.tps -@@expectations/ut_expectation_timestamp_ltz.tps -@@expectations/ut_expectation_timestamp_tz.tps -@@expectations/ut_expectation_varchar2.tps -@@expectations/ut_expectation_yminterval.tps -@@expectations/data_values/ut_data_value.tpb -@@expectations/data_values/ut_data_value_anydata.tpb -@@expectations/data_values/ut_data_value_object.tpb -@@expectations/data_values/ut_data_value_collection.tpb -@@expectations/data_values/ut_data_value_blob.tpb -@@expectations/data_values/ut_data_value_boolean.tpb -@@expectations/data_values/ut_data_value_clob.tpb -@@expectations/data_values/ut_data_value_date.tpb -@@expectations/data_values/ut_data_value_dsinterval.tpb -@@expectations/data_values/ut_data_value_number.tpb -@@expectations/data_values/ut_data_value_refcursor.tpb -@@expectations/data_values/ut_data_value_timestamp.tpb -@@expectations/data_values/ut_data_value_timestamp_tz.tpb -@@expectations/data_values/ut_data_value_timestamp_ltz.tpb -@@expectations/data_values/ut_data_value_varchar2.tpb -@@expectations/data_values/ut_data_value_yminterval.tpb -@@expectations/matchers/ut_matcher.tpb -@@expectations/matchers/ut_comparison_matcher.tpb -@@expectations/matchers/ut_be_false.tpb -@@expectations/matchers/ut_be_greater_or_equal.tpb -@@expectations/matchers/ut_be_greater_than.tpb -@@expectations/matchers/ut_be_less_or_equal.tpb -@@expectations/matchers/ut_be_less_than.tpb -@@expectations/matchers/ut_be_like.tpb -@@expectations/matchers/ut_be_not_null.tpb -@@expectations/matchers/ut_be_null.tpb -@@expectations/matchers/ut_be_true.tpb -@@expectations/matchers/ut_equal.tpb -@@expectations/matchers/ut_be_between.tpb -@@expectations/matchers/ut_be_empty.tpb -@@expectations/matchers/ut_match.tpb -@@expectations/ut_expectation.tpb -@@expectations/ut_expectation_anydata.tpb -@@expectations/ut_expectation_blob.tpb -@@expectations/ut_expectation_boolean.tpb -@@expectations/ut_expectation_clob.tpb -@@expectations/ut_expectation_date.tpb -@@expectations/ut_expectation_dsinterval.tpb -@@expectations/ut_expectation_number.tpb -@@expectations/ut_expectation_refcursor.tpb -@@expectations/ut_expectation_timestamp.tpb -@@expectations/ut_expectation_timestamp_ltz.tpb -@@expectations/ut_expectation_timestamp_tz.tpb -@@expectations/ut_expectation_varchar2.tpb -@@expectations/ut_expectation_yminterval.tpb +@@install_component.sql 'expectations/data_values/ut_cursor_data.sql' +@@install_component.sql 'expectations/data_values/ut_data_value.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_anydata.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_collection.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_object.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_blob.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_boolean.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_clob.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_date.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_dsinterval.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_number.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_refcursor.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_timestamp.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_timestamp_tz.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_timestamp_ltz.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_varchar2.tps' +@@install_component.sql 'expectations/data_values/ut_data_value_yminterval.tps' +@@install_component.sql 'expectations/matchers/ut_matcher.tps' +@@install_component.sql 'expectations/matchers/ut_comparison_matcher.tps' +@@install_component.sql 'expectations/matchers/ut_be_false.tps' +@@install_component.sql 'expectations/matchers/ut_be_greater_or_equal.tps' +@@install_component.sql 'expectations/matchers/ut_be_greater_than.tps' +@@install_component.sql 'expectations/matchers/ut_be_less_or_equal.tps' +@@install_component.sql 'expectations/matchers/ut_be_less_than.tps' +@@install_component.sql 'expectations/matchers/ut_be_like.tps' +@@install_component.sql 'expectations/matchers/ut_be_not_null.tps' +@@install_component.sql 'expectations/matchers/ut_be_null.tps' +@@install_component.sql 'expectations/matchers/ut_be_true.tps' +@@install_component.sql 'expectations/matchers/ut_equal.tps' +@@install_component.sql 'expectations/matchers/ut_be_between.tps' +@@install_component.sql 'expectations/matchers/ut_be_empty.tps' +@@install_component.sql 'expectations/matchers/ut_match.tps' +@@install_component.sql 'expectations/ut_expectation.tps' +@@install_component.sql 'expectations/ut_expectation_anydata.tps' +@@install_component.sql 'expectations/ut_expectation_blob.tps' +@@install_component.sql 'expectations/ut_expectation_boolean.tps' +@@install_component.sql 'expectations/ut_expectation_clob.tps' +@@install_component.sql 'expectations/ut_expectation_date.tps' +@@install_component.sql 'expectations/ut_expectation_dsinterval.tps' +@@install_component.sql 'expectations/ut_expectation_number.tps' +@@install_component.sql 'expectations/ut_expectation_refcursor.tps' +@@install_component.sql 'expectations/ut_expectation_timestamp.tps' +@@install_component.sql 'expectations/ut_expectation_timestamp_ltz.tps' +@@install_component.sql 'expectations/ut_expectation_timestamp_tz.tps' +@@install_component.sql 'expectations/ut_expectation_varchar2.tps' +@@install_component.sql 'expectations/ut_expectation_yminterval.tps' +@@install_component.sql 'expectations/data_values/ut_data_value.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_anydata.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_object.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_collection.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_blob.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_boolean.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_clob.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_date.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_dsinterval.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_number.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_refcursor.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_timestamp.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_timestamp_tz.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_timestamp_ltz.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_varchar2.tpb' +@@install_component.sql 'expectations/data_values/ut_data_value_yminterval.tpb' +@@install_component.sql 'expectations/matchers/ut_matcher.tpb' +@@install_component.sql 'expectations/matchers/ut_comparison_matcher.tpb' +@@install_component.sql 'expectations/matchers/ut_be_false.tpb' +@@install_component.sql 'expectations/matchers/ut_be_greater_or_equal.tpb' +@@install_component.sql 'expectations/matchers/ut_be_greater_than.tpb' +@@install_component.sql 'expectations/matchers/ut_be_less_or_equal.tpb' +@@install_component.sql 'expectations/matchers/ut_be_less_than.tpb' +@@install_component.sql 'expectations/matchers/ut_be_like.tpb' +@@install_component.sql 'expectations/matchers/ut_be_not_null.tpb' +@@install_component.sql 'expectations/matchers/ut_be_null.tpb' +@@install_component.sql 'expectations/matchers/ut_be_true.tpb' +@@install_component.sql 'expectations/matchers/ut_equal.tpb' +@@install_component.sql 'expectations/matchers/ut_be_between.tpb' +@@install_component.sql 'expectations/matchers/ut_be_empty.tpb' +@@install_component.sql 'expectations/matchers/ut_match.tpb' +@@install_component.sql 'expectations/ut_expectation.tpb' +@@install_component.sql 'expectations/ut_expectation_anydata.tpb' +@@install_component.sql 'expectations/ut_expectation_blob.tpb' +@@install_component.sql 'expectations/ut_expectation_boolean.tpb' +@@install_component.sql 'expectations/ut_expectation_clob.tpb' +@@install_component.sql 'expectations/ut_expectation_date.tpb' +@@install_component.sql 'expectations/ut_expectation_dsinterval.tpb' +@@install_component.sql 'expectations/ut_expectation_number.tpb' +@@install_component.sql 'expectations/ut_expectation_refcursor.tpb' +@@install_component.sql 'expectations/ut_expectation_timestamp.tpb' +@@install_component.sql 'expectations/ut_expectation_timestamp_ltz.tpb' +@@install_component.sql 'expectations/ut_expectation_timestamp_tz.tpb' +@@install_component.sql 'expectations/ut_expectation_varchar2.tpb' +@@install_component.sql 'expectations/ut_expectation_yminterval.tpb' --core reporter -@@reporters/ut_documentation_reporter.tps -@@reporters/ut_documentation_reporter.tpb +@@install_component.sql 'reporters/ut_documentation_reporter.tps' +@@install_component.sql 'reporters/ut_documentation_reporter.tpb' --plugin interface API for running utPLSQL -@@api/ut_runner.pks -@@api/ut_runner.pkb +@@install_component.sql 'api/ut_runner.pks' +@@install_component.sql 'api/ut_runner.pkb' --developer interface for expectations and running utPLSQL -@@api/ut.pks -@@api/ut.pkb +@@install_component.sql 'api/ut.pks' +@@install_component.sql 'api/ut.pkb' --additional reporters -@@reporters/ut_teamcity_reporter.tps -@@reporters/ut_teamcity_reporter_helper.pks -@@reporters/ut_teamcity_reporter_helper.pkb -@@reporters/ut_teamcity_reporter.tpb -@@reporters/ut_xunit_reporter.tps -@@reporters/ut_xunit_reporter.tpb -@@reporters/ut_sonar_test_reporter.tps -@@reporters/ut_sonar_test_reporter.tpb - -@@reporters/ut_coverage_html_reporter.tps -@@reporters/ut_coverage_report_html_helper.pks -@@reporters/ut_coverage_report_html_helper.pkb -@@reporters/ut_coverage_html_reporter.tpb -@@reporters/ut_coverage_sonar_reporter.tps -@@reporters/ut_coverage_sonar_reporter.tpb -@@reporters/ut_coveralls_reporter.tps -@@reporters/ut_coveralls_reporter.tpb +@@install_component.sql 'reporters/ut_teamcity_reporter.tps' +@@install_component.sql 'reporters/ut_teamcity_reporter_helper.pks' +@@install_component.sql 'reporters/ut_teamcity_reporter_helper.pkb' +@@install_component.sql 'reporters/ut_teamcity_reporter.tpb' +@@install_component.sql 'reporters/ut_xunit_reporter.tps' +@@install_component.sql 'reporters/ut_xunit_reporter.tpb' +@@install_component.sql 'reporters/ut_sonar_test_reporter.tps' +@@install_component.sql 'reporters/ut_sonar_test_reporter.tpb' -@@api/be_between.syn -@@api/be_empty.syn -@@api/be_false.syn -@@api/be_greater_or_equal.syn -@@api/be_greater_than.syn -@@api/be_less_or_equal.syn -@@api/be_less_than.syn -@@api/be_like.syn -@@api/be_not_null.syn -@@api/be_null.syn -@@api/be_true.syn -@@api/equal.syn -@@api/match.syn +@@install_component.sql 'reporters/ut_coverage_html_reporter.tps' +@@install_component.sql 'reporters/ut_coverage_report_html_helper.pks' +@@install_component.sql 'reporters/ut_coverage_report_html_helper.pkb' +@@install_component.sql 'reporters/ut_coverage_html_reporter.tpb' +@@install_component.sql 'reporters/ut_coverage_sonar_reporter.tps' +@@install_component.sql 'reporters/ut_coverage_sonar_reporter.tpb' +@@install_component.sql 'reporters/ut_coveralls_reporter.tps' +@@install_component.sql 'reporters/ut_coveralls_reporter.tpb' +@@install_component.sql 'api/be_between.syn' +@@install_component.sql 'api/be_empty.syn' +@@install_component.sql 'api/be_false.syn' +@@install_component.sql 'api/be_greater_or_equal.syn' +@@install_component.sql 'api/be_greater_than.syn' +@@install_component.sql 'api/be_less_or_equal.syn' +@@install_component.sql 'api/be_less_than.syn' +@@install_component.sql 'api/be_like.syn' +@@install_component.sql 'api/be_not_null.syn' +@@install_component.sql 'api/be_null.syn' +@@install_component.sql 'api/be_true.syn' +@@install_component.sql 'api/equal.syn' +@@install_component.sql 'api/match.syn' set linesize 200 -set define & +set define on column text format a100 column error_count noprint new_value error_count + prompt Validating installation select name, type, sequence, line, position, text, count(1) over() error_count from all_errors @@ -276,6 +278,9 @@ select name, type, sequence, line, position, text, count(1) over() error_count begin if to_number('&&error_count') > 0 then raise_application_error(-20000, 'Not all sources were successfully installed.'); + else + dbms_output.put_line('Installation completed successfully'); + dbms_output.put_line('--------------------------------------------------------------'); end if; end; / diff --git a/source/install_component.sql b/source/install_component.sql new file mode 100644 index 000000000..0f4d9054b --- /dev/null +++ b/source/install_component.sql @@ -0,0 +1,7 @@ +set heading off +set feedback off +exec dbms_output.put_line('Installing component '||upper(regexp_substr('&&1','\/(\w*)\.',1,1,'i',1))); +@@&&1 +show errors +exec dbms_output.put_line('--------------------------------------------------------------'); + diff --git a/source/uninstall.sql b/source/uninstall.sql index e8203d9bb..1a62f54a2 100644 --- a/source/uninstall.sql +++ b/source/uninstall.sql @@ -17,14 +17,15 @@ prompt Uninstalling UTPLSQL v3 framework set serveroutput on size unlimited format truncated set verify off -set define & +set feedback on +set define on spool uninstall.log define ut3_owner = &1 alter session set current_schema = &&ut3_owner; - +set echo on drop synonym be_between; drop synonym match; @@ -51,15 +52,15 @@ drop synonym be_true; drop synonym equal; -drop type ut_coveralls_reporter; +drop type ut_coveralls_reporter force; -drop type ut_coverage_sonar_reporter; +drop type ut_coverage_sonar_reporter force; drop package ut_coverage_report_html_helper; -drop type ut_coverage_html_reporter; +drop type ut_coverage_html_reporter force; -drop type ut_sonar_test_reporter; +drop type ut_sonar_test_reporter force; drop package ut_coverage; @@ -77,97 +78,97 @@ drop package ut_suite_manager; drop package ut; -drop type ut_expectation_yminterval; +drop type ut_expectation_yminterval force; -drop type ut_expectation_varchar2; +drop type ut_expectation_varchar2 force; -drop type ut_expectation_timestamp_tz; +drop type ut_expectation_timestamp_tz force; -drop type ut_expectation_timestamp_ltz; +drop type ut_expectation_timestamp_ltz force; -drop type ut_expectation_timestamp; +drop type ut_expectation_timestamp force; -drop type ut_expectation_refcursor; +drop type ut_expectation_refcursor force; -drop type ut_expectation_number; +drop type ut_expectation_number force; -drop type ut_expectation_dsinterval; +drop type ut_expectation_dsinterval force; -drop type ut_expectation_date; +drop type ut_expectation_date force; -drop type ut_expectation_clob; +drop type ut_expectation_clob force; -drop type ut_expectation_boolean; +drop type ut_expectation_boolean force; -drop type ut_expectation_blob; +drop type ut_expectation_blob force; -drop type ut_expectation_anydata; +drop type ut_expectation_anydata force; -drop type ut_expectation; +drop type ut_expectation force; drop package ut_expectation_processor; -drop type ut_match; +drop type ut_match force; -drop type ut_be_between; +drop type ut_be_between force; -drop type ut_equal; +drop type ut_equal force; -drop type ut_be_true; +drop type ut_be_true force; -drop type ut_be_null; +drop type ut_be_null force; -drop type ut_be_not_null; +drop type ut_be_not_null force; -drop type ut_be_like; +drop type ut_be_like force; -drop type ut_be_greater_or_equal; +drop type ut_be_greater_or_equal force; -drop type ut_be_empty; +drop type ut_be_empty force; -drop type ut_be_greater_than; +drop type ut_be_greater_than force; -drop type ut_be_less_or_equal; +drop type ut_be_less_or_equal force; -drop type ut_be_less_than; +drop type ut_be_less_than force; -drop type ut_be_false; +drop type ut_be_false force; -drop type ut_comparison_matcher; +drop type ut_comparison_matcher force; -drop type ut_matcher; +drop type ut_matcher force; -drop type ut_data_value_yminterval; +drop type ut_data_value_yminterval force; -drop type ut_data_value_varchar2; +drop type ut_data_value_varchar2 force; -drop type ut_data_value_timestamp_tz; +drop type ut_data_value_timestamp_tz force; -drop type ut_data_value_timestamp_ltz; +drop type ut_data_value_timestamp_ltz force; -drop type ut_data_value_timestamp; +drop type ut_data_value_timestamp force; -drop type ut_data_value_number; +drop type ut_data_value_number force; -drop type ut_data_value_refcursor; +drop type ut_data_value_refcursor force; -drop type ut_data_value_dsinterval; +drop type ut_data_value_dsinterval force; -drop type ut_data_value_date; +drop type ut_data_value_date force; -drop type ut_data_value_clob; +drop type ut_data_value_clob force; -drop type ut_data_value_boolean; +drop type ut_data_value_boolean force; -drop type ut_data_value_blob; +drop type ut_data_value_blob force; -drop type ut_data_value_object; +drop type ut_data_value_object force; -drop type ut_data_value_collection; +drop type ut_data_value_collection force; -drop type ut_data_value_anydata; +drop type ut_data_value_anydata force; -drop type ut_data_value; +drop type ut_data_value force; drop table ut_cursor_data; @@ -181,45 +182,45 @@ drop package ut_ansiconsole_helper; drop package ut_utils; -drop type ut_documentation_reporter; +drop type ut_documentation_reporter force; -drop type ut_teamcity_reporter; +drop type ut_teamcity_reporter force; -drop type ut_xunit_reporter; +drop type ut_xunit_reporter force; -drop type ut_event_listener; +drop type ut_event_listener force; -drop type ut_coverage_reporter_base; +drop type ut_coverage_reporter_base force; -drop type ut_reporters; +drop type ut_reporters force; drop type ut_reporter_base force; -drop type ut_run; +drop type ut_run force; -drop type ut_coverage_options; +drop type ut_coverage_options force; -drop type ut_file_mappings; +drop type ut_file_mappings force; -drop type ut_file_mapping; +drop type ut_file_mapping force; -drop type ut_suite; +drop type ut_suite force; -drop type ut_logical_suite; +drop type ut_logical_suite force; -drop type ut_test; +drop type ut_test force; -drop type ut_console_reporter_base; +drop type ut_console_reporter_base force; -drop type ut_executable; +drop type ut_executable force; -drop type ut_suite_items; +drop type ut_suite_items force; -drop type ut_suite_item; +drop type ut_suite_item force; -drop type ut_event_listener_base; +drop type ut_event_listener_base force; -drop type ut_suite_item_base; +drop type ut_suite_item_base force; drop package ut_output_buffer; @@ -229,24 +230,26 @@ drop table ut_output_buffer_tmp$; drop sequence ut_message_id_seq; -drop type ut_results_counter; +drop type ut_results_counter force; -drop type ut_expectation_results; +drop type ut_expectation_results force; -drop type ut_expectation_result; +drop type ut_expectation_result force; -drop type ut_key_value_pairs; +drop type ut_key_value_pairs force; -drop type ut_key_value_pair; +drop type ut_key_value_pair force; -drop type ut_object_names; +drop type ut_object_names force; -drop type ut_object_name; +drop type ut_object_name force; -drop type ut_varchar2_list; +drop type ut_varchar2_list force; -drop type ut_varchar2_rows; +drop type ut_varchar2_rows force; +set echo off +set feedback off begin for syn in ( select @@ -268,5 +271,11 @@ begin end loop; end; / +begin + dbms_output.put_line('--------------------------------------------------------------'); + dbms_output.put_line('Uninstall complete'); + dbms_output.put_line('--------------------------------------------------------------'); +end; +/ spool off From e1a3fa785ae22633c9f43362ab549eaa34a88827 Mon Sep 17 00:00:00 2001 From: Jacek Date: Tue, 27 Jun 2017 00:51:01 +0100 Subject: [PATCH 2/3] Updated install/uninstall scripts to improve readability. --- .../create_synonyms_and_grants_for_public.sql | 4 +-- .../create_synonyms_and_grants_for_user.sql | 25 +++++++++++-- source/define_ut3_owner_param.sql | 36 +++++++++++++++++++ source/install.sql | 27 +++++++------- source/install_component.sql | 5 +-- source/install_headless.sql | 6 ++-- source/uninstall.sql | 25 ++++++++----- 7 files changed, 97 insertions(+), 31 deletions(-) create mode 100644 source/define_ut3_owner_param.sql diff --git a/source/create_synonyms_and_grants_for_public.sql b/source/create_synonyms_and_grants_for_public.sql index aaa28574b..f44c45742 100644 --- a/source/create_synonyms_and_grants_for_public.sql +++ b/source/create_synonyms_and_grants_for_public.sql @@ -17,13 +17,13 @@ Create all necessary grant for the user who owns test packages and want to execute utPLSQL framework */ +@@define_ut3_owner_param.sql + set echo off set feedback on set heading off set verify off -define ut3_owner = &1 - prompt Granting privileges on UTPLSQL objects in &&ut3_owner schema to PUBLIC whenever sqlerror exit failure rollback diff --git a/source/create_synonyms_and_grants_for_user.sql b/source/create_synonyms_and_grants_for_user.sql index 8204dcb06..5116710c8 100644 --- a/source/create_synonyms_and_grants_for_user.sql +++ b/source/create_synonyms_and_grants_for_user.sql @@ -17,14 +17,33 @@ Create all necessary grant for the user who owns test packages and want to execute utPLSQL framework */ +@@define_ut3_owner_param.sql + +column 2 new_value 2 noprint +select null as "2" from dual where 1=0; +spool params.sql.tmp +select + case + when '&&2' is null then q'[ACCEPT ut3_user CHAR PROMPT 'Provide schema name where synonyms for the utPLSQL v3 should be created ']' + else 'define ut3_user=&&2' + end +from dual; +spool off +set termout on +@params.sql.tmp +set termout off +/* cleanup temporary sql files */ +--try running on windows +$ del params.sql.tmp +--try running on linux/unix +! rm params.sql.tmp +set termout on + set echo off set feedback on set heading off set verify off -define ut3_owner = &1 -define ut3_user = &2 - prompt Granting privileges on UTPLSQL objects in &&ut3_owner schema to user &&ut3_user whenever sqlerror exit failure rollback diff --git a/source/define_ut3_owner_param.sql b/source/define_ut3_owner_param.sql new file mode 100644 index 000000000..b37fe813e --- /dev/null +++ b/source/define_ut3_owner_param.sql @@ -0,0 +1,36 @@ +set serveroutput on size unlimited format truncated +whenever oserror continue + +set heading off +set linesize 1000 +set pagesize 0 + +set verify off +set define on + +set termout off +set timing off +set feedback off + +column line_separator new_value line_separator noprint +select '--------------------------------------------------------------' as line_separator from dual; + +column 1 new_value 1 noprint +select null as "1" from dual where 1=0; +spool params.sql.tmp +select + case + when '&&1' is null then q'[ACCEPT ut3_owner CHAR DEFAULT 'UT3' PROMPT 'Provide schema for the utPLSQL v3 (UT3)']' + else 'define ut3_owner=&&1' + end +from dual; +spool off +set termout on +@params.sql.tmp +set termout off +/* cleanup temporary sql files */ +--try running on windows +$ del params.sql.tmp +--try running on linux/unix +! rm params.sql.tmp +set termout on diff --git a/source/install.sql b/source/install.sql index 037dec7b2..0ccf2a078 100644 --- a/source/install.sql +++ b/source/install.sql @@ -14,23 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. */ -prompt Installing utplsql framework -set serveroutput on size unlimited -set feedback on -set timing off -set verify off -set define & +@@define_ut3_owner_param.sql spool install.log -define ut3_owner = &1 +prompt &&line_separator +prompt Installing utPLSQL v3 framework +prompt &&line_separator + whenever sqlerror exit failure rollback whenever oserror exit failure rollback -set serveroutput on size unlimited format truncated -set feedback off prompt Switching current schema to &&ut3_owner +prompt &&line_separator alter session set current_schema = &&ut3_owner; alter session set plsql_warnings = 'ENABLE:ALL', 'DISABLE:(5004,5018,6000,6001,6003,6009,6010,7206)'; --set define off @@ -89,8 +86,11 @@ alter session set plsql_warnings = 'ENABLE:ALL', 'DISABLE:(5004,5018,6000,6001,6 @@install_component.sql 'core/ut_expectation_processor.pks' @@install_component.sql 'core/ut_expectation_processor.pkb' ---installing profiler tabs if they dont exist +prompt Installing PLSQL profiler objects into &&ut3_owner schema +prompt You will see "ORA-00955" errors if they already exist +prompt &&line_separator whenever sqlerror continue +set feedback on @@core/coverage/proftab.sql whenever sqlerror exit failure rollback @@ -266,13 +266,16 @@ column text format a100 column error_count noprint new_value error_count prompt Validating installation -select name, type, sequence, line, position, text, count(1) over() error_count +prompt &&line_separator +set heading on +select type, name, sequence, line, position, text, count(1) over() error_count from all_errors where owner = upper('&&ut3_owner') and name not like 'BIN$%' --not recycled and (name = 'UT' or name like 'UT\_%' escape '\') -- errors only. ignore warnings and attribute = 'ERROR' + order by name, type, sequence / begin @@ -280,7 +283,7 @@ begin raise_application_error(-20000, 'Not all sources were successfully installed.'); else dbms_output.put_line('Installation completed successfully'); - dbms_output.put_line('--------------------------------------------------------------'); + dbms_output.put_line('&&line_separator'); end if; end; / diff --git a/source/install_component.sql b/source/install_component.sql index 0f4d9054b..2b02c58b4 100644 --- a/source/install_component.sql +++ b/source/install_component.sql @@ -1,7 +1,8 @@ set heading off set feedback off exec dbms_output.put_line('Installing component '||upper(regexp_substr('&&1','\/(\w*)\.',1,1,'i',1))); +set feedback on @@&&1 -show errors -exec dbms_output.put_line('--------------------------------------------------------------'); +set feedback off +exec dbms_output.put_line('&&line_separator'); diff --git a/source/install_headless.sql b/source/install_headless.sql index 084ca2cb6..9af2527db 100644 --- a/source/install_headless.sql +++ b/source/install_headless.sql @@ -18,8 +18,8 @@ define ut3_user = ut3 define ut3_password = XNtxj8eEgA6X6b6f define ut3_tablespace = users -@@create_utplsql_owner.sql &&ut3_user &&ut3_password &&ut3_tablespace -@@install.sql &&ut3_user -@@create_synonyms_and_grants_for_public.sql &&ut3_user +@@create_utplsql_owner.sql &&ut3_owner &&ut3_password &&ut3_tablespace +@@install.sql &&ut3_owner +@@create_synonyms_and_grants_for_public.sql &&ut3_owner exit diff --git a/source/uninstall.sql b/source/uninstall.sql index 1a62f54a2..48aba7d04 100644 --- a/source/uninstall.sql +++ b/source/uninstall.sql @@ -14,15 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -prompt Uninstalling UTPLSQL v3 framework -set serveroutput on size unlimited format truncated -set verify off +@@define_ut3_owner_param.sql + set feedback on -set define on spool uninstall.log -define ut3_owner = &1 +prompt &&line_separator +prompt Uninstalling UTPLSQL v3 framework +prompt &&line_separator alter session set current_schema = &&ut3_owner; set echo on @@ -250,17 +250,22 @@ drop type ut_varchar2_rows force; set echo off set feedback off +declare + i integer := 0; begin + dbms_output.put_line('Dropping synonyms pointing to non-existing objects in schema '||upper('&&ut3_owner')); for syn in ( select case when owner = 'PUBLIC' then 'public synonym ' else 'synonym ' || owner || '.' end || synonym_name as syn_name, table_owner||'.'||table_name as for_object - from all_synonyms + from all_synonyms s where table_owner = upper('&&ut3_owner') and table_owner != owner + and not exists (select 1 from all_objects o where o.owner = s.table_owner and o.object_name = s.table_name) ) loop + i := i + 1; begin execute immediate 'drop '||syn.syn_name; dbms_output.put_line('Dropped '||syn.syn_name||' for object '||syn.for_object); @@ -269,12 +274,14 @@ begin dbms_output.put_line('FAILED to drop '||syn.syn_name||' for object '||syn.for_object); end; end loop; + dbms_output.put_line('&&line_separator'); + dbms_output.put_line(i||' synonyms dropped'); end; / begin - dbms_output.put_line('--------------------------------------------------------------'); - dbms_output.put_line('Uninstall complete'); - dbms_output.put_line('--------------------------------------------------------------'); + dbms_output.put_line('&&line_separator'); + dbms_output.put_line('Uninstall complete'); + dbms_output.put_line('&&line_separator'); end; / From fba1291c2d00f8737623673afa5a79b24681b9c3 Mon Sep 17 00:00:00 2001 From: Jacek Date: Tue, 27 Jun 2017 21:32:13 +0100 Subject: [PATCH 3/3] Updated install/uninstall scripts to improve readability. --- source/install_component.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/install_component.sql b/source/install_component.sql index 2b02c58b4..54a04483b 100644 --- a/source/install_component.sql +++ b/source/install_component.sql @@ -1,8 +1,6 @@ set heading off set feedback off exec dbms_output.put_line('Installing component '||upper(regexp_substr('&&1','\/(\w*)\.',1,1,'i',1))); -set feedback on @@&&1 -set feedback off exec dbms_output.put_line('&&line_separator');