diff --git a/source/create_synonyms_and_grants_for_public.sql b/source/create_synonyms_and_grants_for_public.sql index 2535c25fc..dcc940737 100644 --- a/source/create_synonyms_and_grants_for_public.sql +++ b/source/create_synonyms_and_grants_for_public.sql @@ -107,8 +107,6 @@ grant select, insert, delete, update on &&ut3_owner..dbmspcc_units to public; grant execute on &&ut3_owner..ut_matcher_options to public; grant execute on &&ut3_owner..ut_matcher_options_items to public; grant execute on &&ut3_owner..ut_run_info to public; -grant execute on &&ut3_owner..ut_cursor_column_tab to public; -grant execute on &&ut3_owner..ut_cursor_details to public; prompt Creating synonyms for UTPLSQL objects in &&ut3_owner schema to PUBLIC @@ -169,5 +167,3 @@ create public synonym dbmspcc_blocks for &&ut3_owner..dbmspcc_blocks; create public synonym dbmspcc_runs for &&ut3_owner..dbmspcc_runs; create public synonym dbmspcc_units for &&ut3_owner..dbmspcc_units; create public synonym ut_run_info for &&ut3_owner..ut_run_info; -create public synonym ut_cursor_column_tab for &&ut3_owner..ut_cursor_column_tab; -create public synonym ut_cursor_details for &&ut3_owner..ut_cursor_details; diff --git a/source/create_user_grants.sql b/source/create_user_grants.sql index c0dbebcaf..feab90933 100644 --- a/source/create_user_grants.sql +++ b/source/create_user_grants.sql @@ -126,5 +126,3 @@ grant select, insert, delete, update on &&ut3_owner..dbmspcc_units to &ut3_user; grant execute on &&ut3_owner..ut_matcher_options to &ut3_user; grant execute on &&ut3_owner..ut_matcher_options_items to &ut3_user; grant execute on &&ut3_owner..ut_run_info to &ut3_user; -grant execute on &&ut3_owner..ut_cursor_column_tab to &ut3_user; -grant execute on &&ut3_owner..ut_cursor_details to &ut3_user; diff --git a/source/create_user_synonyms.sql b/source/create_user_synonyms.sql index 89d1736f8..b08cb7b0e 100644 --- a/source/create_user_synonyms.sql +++ b/source/create_user_synonyms.sql @@ -109,5 +109,3 @@ create or replace synonym &ut3_user..dbmspcc_blocks for &&ut3_owner..dbmspcc_blo create or replace synonym &ut3_user..dbmspcc_runs for &&ut3_owner..dbmspcc_runs; create or replace synonym &ut3_user..dbmspcc_units for &&ut3_owner..dbmspcc_units; create or replace synonym &ut3_user..ut_run_info for &&ut3_owner..ut_run_info; -create or replace synonym &ut3_user..ut_cursor_column_tab for &&ut3_owner..ut_cursor_column_tab; -create or replace synonym &ut3_user..ut_cursor_details for &&ut3_owner..ut_cursor_details; \ No newline at end of file diff --git a/source/expectations/data_values/ut_compound_data_helper.pkb b/source/expectations/data_values/ut_compound_data_helper.pkb index dab3d4af1..5175699cd 100644 --- a/source/expectations/data_values/ut_compound_data_helper.pkb +++ b/source/expectations/data_values/ut_compound_data_helper.pkb @@ -79,13 +79,16 @@ create or replace package body ut_compound_data_helper is execute immediate q'[with expected_cols as ( select access_path exp_column_name,column_position exp_col_pos, - replace(column_type,'VARCHAR2','CHAR') exp_col_type_compare, column_type exp_col_type + replace(column_type_name,'VARCHAR2','CHAR') exp_col_type_compare, column_type_name exp_col_type from table(:a_expected) + where parent_name is null and hierarchy_level = 1 and column_name is not null ), actual_cols as ( select access_path act_column_name,column_position act_col_pos, - replace(column_type,'VARCHAR2','CHAR') act_col_type_compare, column_type act_col_type - from table(:a_actual)), + replace(column_type_name,'VARCHAR2','CHAR') act_col_type_compare, column_type_name act_col_type + from table(:a_actual) + where parent_name is null and hierarchy_level = 1 and column_name is not null + ), joined_cols as ( select e.*,a.*]' || case when a_order_enforced then ', diff --git a/source/expectations/data_values/ut_cursor_column.tpb b/source/expectations/data_values/ut_cursor_column.tpb index ab83ff339..5f6f18c56 100644 --- a/source/expectations/data_values/ut_cursor_column.tpb +++ b/source/expectations/data_values/ut_cursor_column.tpb @@ -12,7 +12,7 @@ create or replace type body ut_cursor_column as self.column_position := a_col_position; --Position of the column in cursor/ type self.column_len := a_col_max_len; --length of column self.column_name := TRIM( BOTH '''' FROM a_col_name); --name of the column - self.column_type_name := a_col_type_name; --type name e.g. test_dummy_object or varchar2 + self.column_type_name := coalesce(a_col_type_name,a_col_type); --type name e.g. test_dummy_object or varchar2 self.access_path := case when a_access_path is null then self.column_name else diff --git a/source/expectations/data_values/ut_cursor_details.tpb b/source/expectations/data_values/ut_cursor_details.tpb index f6162aac2..c1d229e6a 100644 --- a/source/expectations/data_values/ut_cursor_details.tpb +++ b/source/expectations/data_values/ut_cursor_details.tpb @@ -195,12 +195,10 @@ create or replace type body ut_cursor_details as member function get_xml_children(a_parent_name varchar2 := null) return xmltype is l_result xmltype; begin - select xmlagg(xmlelement(evalname t.column_name,t.column_type, - self.get_xml_children(t.column_name))) + select xmlagg(xmlelement(evalname t.column_name,t.column_type_name)) into l_result from table(self.cursor_columns_info) t - where (a_parent_name is not null and parent_name = a_parent_name and hierarchy_level > 1 and column_name is not null) - or (a_parent_name is null and parent_name is null and hierarchy_level = 1 and column_name is not null) + where (a_parent_name is null and parent_name is null and hierarchy_level = 1 and column_name is not null) having count(*) > 0; return l_result; diff --git a/test/core/expectations/test_expectations_cursor.pkb b/test/core/expectations/test_expectations_cursor.pkb index f0d9ae36e..1b155353d 100644 --- a/test/core/expectations/test_expectations_cursor.pkb +++ b/test/core/expectations/test_expectations_cursor.pkb @@ -2465,5 +2465,65 @@ Diff:% ut.expect(l_actual_message).to_be_like(l_expected_message); end; + procedure udt_messg_format_eq is + l_actual sys_refcursor; + l_expected sys_refcursor; + l_expected_tab ut3.ut_key_value_pairs := ut3.ut_key_value_pairs(); + l_expected_message varchar2(32767); + l_actual_message varchar2(32767); + begin + select ut3.ut_key_value_pair(rownum,'Something '||rownum) + bulk collect into l_expected_tab + from dual connect by level <=2; + + --Arrange + open l_actual for select object_name, owner from all_objects where rownum < 3; + open l_expected for select value(x) as udt from table(l_expected_tab) x; + + --Act + ut3.ut.expect(l_actual).to_contain(l_expected); + --Assert + l_expected_message := q'[%Actual: refcursor [ count = 2 ] was expected to contain: refcursor [ count = 2 ] +%Diff: +%Columns: +%Column [data-type: UT_KEY_VALUE_PAIR] is missing. Expected column position: 1. +%Column [position: 1, data-type: VARCHAR2] is not expected in results. +%Column [position: 2, data-type: VARCHAR2] is not expected in results. +%Rows: [ 2 differences ] +%Missing: 1Something 1 +%Missing: 2Something 2%]'; + l_actual_message := ut3.ut_expectation_processor.get_failed_expectations()(1).message; + --Assert + ut.expect(l_actual_message).to_be_like(l_expected_message); + end; + + procedure udt_messg_format_empt is + l_actual sys_refcursor; + l_actual_tab ut3.ut_key_value_pairs := ut3.ut_key_value_pairs(); + l_actual_message varchar2(32767); + l_expected_message varchar2(32767); + begin + select ut3.ut_key_value_pair(rownum,'Something '||rownum) + bulk collect into l_actual_tab + from dual connect by level <=2; + + --Arrange + open l_actual for select value(x) as udt from table(l_actual_tab) x; + + --Act + ut3.ut.expect(l_actual).to_be_empty(); + --Assert + l_expected_message := q'[%Actual: (refcursor [ count = 2 ]) +%Data-types: +%UT_KEY_VALUE_PAIR +%Data: +%1Something 12Something 2 +%was expected to be empty%]'; + + l_actual_message := ut3.ut_expectation_processor.get_failed_expectations()(1).message; + --Assert + ut.expect(l_actual_message).to_be_like(l_expected_message); + end; + end; / diff --git a/test/core/expectations/test_expectations_cursor.pks b/test/core/expectations/test_expectations_cursor.pks index c0195393e..e8f492674 100644 --- a/test/core/expectations/test_expectations_cursor.pks +++ b/test/core/expectations/test_expectations_cursor.pks @@ -390,6 +390,11 @@ create or replace package test_expectations_cursor is --%test(Cursor to contain duplicates fail) procedure to_contain_duplicates_fail; - + + --%test(Display a message with a uer defined type with only type name not structure on equal) + procedure udt_messg_format_eq; + + --%test(Display a message with a uer defined type with only type name not structure on empty) + procedure udt_messg_format_empt; end; /