Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 815deac

Browse files
committed
Updates to documentation
Cleanup of te code
1 parent e082b75 commit 815deac

7 files changed

Lines changed: 22 additions & 63 deletions

File tree

docs/about/authors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
| ---------------- | --------------
88
| David Pyke | [Shoelace](https://github.com/Shoelace)
99
| Jacek Gebal | [jgebal](https://github.com/jgebal)
10+
| Lukasz Wasylow | [lwasylow](https://github.com/lwasylow/)
1011
| Pavel Kaplya | [Pazus](https://github.com/Pazus)
1112
| Robert Love | [rlove](https://github.com/rlove)
12-
| Vinicius Avellar | [viniciusam](https://github.com/viniciusam/)
1313
| Samuel Nitsche | [pesse](https://github.com/pesse/)
14-
| Lukasz Wasylow | [lwasylow](https://github.com/lwasylow/)
14+
| Vinicius Avellar | [viniciusam](https://github.com/viniciusam/)
1515

1616

1717

docs/userguide/advanced_data_comparison.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,12 @@ Each item in the comma separated list can be:
3535
- a column name of cursor to be compared
3636
- an attribute name of object type to be compared
3737
- an attribute name of object type within a table of objects to be compared
38-
- an [XPath](http://zvon.org/xxl/XPathTutorial/Output/example1.html) expression representing column/attribute
3938
- Include and exclude option will not support implicit colum names that starts with single quota, or in fact any other special characters e.g. <, >, &
4039

4140
Each element in `ut_varchar2_list` nested table can be an item or a comma separated list of items.
4241

4342
When specifying column/attribute names, keep in mind that the names are **case sensitive**.
4443

45-
**XPath expressions with comma are not supported.**
46-
4744
## Excluding elements from data comparison
4845

4946
Consider the following examples
@@ -286,30 +283,31 @@ Diff:
286283

287284
***Please note that .join_by option will take longer to process due to need of parsing via primary keys.***
288285

289-
## Defining item as XPath
290-
When using XPath expression, keep in mind the following:
286+
## Defining item lists in option
287+
XPath expressions are deprecated. They are currently still supported but in future versions they can be removed completely. Please use a current standard of defining items filter.
288+
289+
When using item list expression, keep in mind the following:
291290

292-
- cursor columns are nested under `<ROW>` element
293291
- object type attributes are nested under `<OBJECTY_TYPE>` element
294292
- nested table and varray items type attributes are nested under `<ARRAY><OBJECTY_TYPE>` elements
295293

296-
Example of a valid XPath parameter to include columns: `RN`, `A_Column`, `SOME_COL` in data comparison.
294+
Example of a valid parameter to include columns: `RN`, `A_Column`, `SOME_COL` in data comparison.
297295
```sql
298-
procedure include_col_as_xpath_eq is
296+
procedure include_col_list_eq is
299297
l_actual sys_refcursor;
300298
l_expected sys_refcursor;
301299
begin
302300
open l_expected for select rownum as rn, 'a' as "A_Column", 'x' SOME_COL from dual a connect by level < 4;
303301
open l_actual for select rownum as rn, 'a' as "A_Column", 'x' SOME_COL, a.* from all_objects a where rownum < 4;
304-
ut.expect( l_actual ).to_equal( l_expected ).include( '/ROW/RN|/ROW/A_Column|/ROW/SOME_COL' );
302+
ut.expect( l_actual ).to_equal( l_expected ).include( 'RN,A_Column,SOME_COL' );
305303
end;
306304

307-
procedure include_col_as_xpath_cn is
305+
procedure include_col_list_eq is
308306
l_actual sys_refcursor;
309307
l_expected sys_refcursor;
310308
begin
311309
open l_expected for select rownum as rn, 'a' as "A_Column", 'x' SOME_COL from dual a connect by level < 4;
312310
open l_actual for select rownum as rn, 'a' as "A_Column", 'x' SOME_COL, a.* from all_objects a where rownum < 6;
313-
ut.expect( l_actual ).to_include( l_expected ).include( '/ROW/RN|/ROW/A_Column|/ROW/SOME_COL' );
311+
ut.expect( l_actual ).to_include( l_expected ).include( 'RN,A_Column,SOME_COL' );
314312
end;
315313
```

source/expectations/data_values/ut_compound_data_helper.pkb

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -640,18 +640,6 @@ create or replace package body ut_compound_data_helper is
640640
order by type desc,name;
641641
return l_missing_pk;
642642
end;
643-
644-
function validate_attributes(a_cursor_info ut_cursor_column_tab,a_filter_list ut_varchar2_list)
645-
return ut_varchar2_list is
646-
l_result ut_varchar2_list := ut_varchar2_list();
647-
begin
648-
select col_name bulk collect into l_result
649-
from (select regexp_replace(column_value,'^((/ROW/)|^(//)|^(/\*/))?(.*)','\5') col_name
650-
from table(a_filter_list)) flr left outer join table(a_cursor_info) cur
651-
on (flr.col_name = cur.access_path) where cur.access_path is null;
652-
653-
return l_result;
654-
end;
655643

656644
function inc_exc_columns_from_cursor (a_cursor_info ut_cursor_column_tab, a_exclude_xpath ut_varchar2_list, a_include_xpath ut_varchar2_list)
657645
return ut_cursor_column_tab is
@@ -716,15 +704,6 @@ create or replace package body ut_compound_data_helper is
716704

717705
return l_result;
718706
end;
719-
720-
function generate_missing_cols_warn_msg(a_missing_columns ut_varchar2_list,a_attribute in varchar2) return varchar2 is
721-
l_warn_msg varchar2(32767) := 'For specified option :'||a_attribute||' following columns not exists in cursor:'||chr(10);
722-
begin
723-
for i in 1..a_missing_columns.count loop
724-
l_warn_msg := l_warn_msg||a_missing_columns(i)||chr(10);
725-
end loop;
726-
return l_warn_msg;
727-
end;
728707

729708
function getxmlchildren(a_parent_name varchar2,a_cursor_table ut_cursor_column_tab)
730709
return xmltype is

source/expectations/data_values/ut_compound_data_helper.pks

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,13 @@ create or replace package ut_compound_data_helper authid definer is
102102
function get_missing_pk(a_expected ut_cursor_column_tab, a_actual ut_cursor_column_tab, a_current_list ut_varchar2_list)
103103
return tt_missing_pk;
104104

105-
function validate_attributes(a_cursor_info ut_cursor_column_tab, a_filter_list ut_varchar2_list) return ut_varchar2_list;
106-
107105
function inc_exc_columns_from_cursor (a_cursor_info ut_cursor_column_tab, a_exclude_xpath ut_varchar2_list, a_include_xpath ut_varchar2_list)
108106
return ut_cursor_column_tab;
109107

110108
function contains_collection (a_cursor_info ut_cursor_column_tab) return number;
111109

112110
function remove_incomparable_cols( a_cursor_details ut_cursor_column_tab,a_incomparable_cols ut_varchar2_list) return ut_cursor_column_tab;
113111

114-
function generate_missing_cols_warn_msg(a_missing_columns ut_varchar2_list,a_attribute in varchar2) return varchar2;
115-
116112
function getxmlchildren(a_parent_name varchar2,a_cursor_table ut_cursor_column_tab) return xmltype;
117113

118114
function is_sql_compare_allowed(a_type_name varchar2) return boolean;

source/expectations/data_values/ut_compound_data_value.tpb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,7 @@ create or replace type body ut_compound_data_value as
9696

9797
function get_diff_message (a_row_diff ut_compound_data_helper.t_row_diffs,a_is_unordered boolean) return varchar2 is
9898
begin
99-
100-
if a_is_unordered then
101-
if a_row_diff.pk_value is not null then
102-
return ' PK '||a_row_diff.pk_value||' - '||rpad(a_row_diff.diff_type,10)||a_row_diff.diffed_row;
103-
else
104-
return rpad(a_row_diff.diff_type,10)||a_row_diff.diffed_row;
105-
end if;
106-
else
107-
return ' Row No. '||a_row_diff.rn||' - '||rpad(a_row_diff.diff_type,10)||a_row_diff.diffed_row;
108-
end if;
99+
return ' Row No. '||a_row_diff.rn||' - '||rpad(a_row_diff.diff_type,10)||a_row_diff.diffed_row;
109100
end;
110101

111102
begin

source/expectations/matchers/ut_include.tpb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,10 @@ create or replace type body ut_include as
7474
l_actual ut_data_value;
7575
begin
7676
if self.expected.data_type = a_actual.data_type and self.expected.is_diffable then
77-
if self.expected is of (ut_data_value_refcursor) then
78-
l_actual := treat(a_actual as ut_data_value_refcursor).filter_cursor(exclude_list, include_list);
79-
l_result :=
80-
'Actual: '||a_actual.get_object_info()||' '||self.description()||': '||self.expected.get_object_info()
81-
|| chr(10) || 'Diff:' || treat(expected as ut_data_value_refcursor).filter_cursor(self.exclude_list, self.include_list).diff(l_actual, true, self.get_join_by_list());
82-
else
83-
l_result :=
84-
'Actual: '||a_actual.get_object_info()||' '||self.description()||': '||self.expected.get_object_info()
85-
|| chr(10) || 'Diff:' || expected.diff(a_actual, self.get_exclude_xpath(), self.get_include_xpath(), self.get_join_by_xpath(), true);
86-
end if;
77+
l_actual := treat(a_actual as ut_data_value_refcursor).filter_cursor(exclude_list, include_list);
78+
l_result :=
79+
'Actual: '||a_actual.get_object_info()||' '||self.description()||': '||self.expected.get_object_info()
80+
|| chr(10) || 'Diff:' || treat(expected as ut_data_value_refcursor).filter_cursor(self.exclude_list, self.include_list).diff(l_actual, true, self.get_join_by_list());
8781
else
8882
l_result := (self as ut_matcher).failure_message(a_actual) || ': '|| self.expected.to_string_report();
8983
end if;

test/core/expectations/test_expectations_cursor.pkb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,15 +1755,16 @@ Diff:%
17551755
from dual connect by level <=2;
17561756

17571757
--Act
1758-
ut3.ut.expect(l_actual).to_equal(l_expected).join_by('NESTED_TABLE/UT_KEY_VALUE_PAIR');
1758+
ut3.ut.expect(l_actual).to_equal(l_expected).join_by('NESTED_TABLE/UT_KEY_VALUE_PAIRS');
17591759

17601760
--Assert
17611761
l_expected_message := q'[%Actual: refcursor [ count = 2 ] was expected to equal: refcursor [ count = 2 ]
17621762
%Diff:
1763-
%Unable to join sets:
1764-
%Join key NESTED_TABLE/UT_KEY_VALUE_PAIR does not exists in expected%
1765-
%Join key NESTED_TABLE/UT_KEY_VALUE_PAIR does not exists in actual%
1766-
%Please make sure that your join clause is not refferring to collection element%]';
1763+
%Rows: [ 4 differences ]
1764+
%Extra: <RN>2</RN><NESTED_TABLE><UT_KEY_VALUE_PAIR><KEY>1</KEY><VALUE>Something 1</VALUE></UT_KEY_VALUE_PAIR><UT_KEY_VALUE_PAIR><KEY>2</KEY><VALUE>Something 2</VALUE></UT_KEY_VALUE_PAIR></NESTED_TABLE>
1765+
%Extra: <RN>1</RN><NESTED_TABLE><UT_KEY_VALUE_PAIR><KEY>1</KEY><VALUE>Something 1</VALUE></UT_KEY_VALUE_PAIR><UT_KEY_VALUE_PAIR><KEY>2</KEY><VALUE>Something 2</VALUE></UT_KEY_VALUE_PAIR></NESTED_TABLE>
1766+
%Missing: <RN>1</RN><NESTED_TABLE><UT_KEY_VALUE_PAIR><KEY>1</KEY><VALUE>Somethings 1</VALUE></UT_KEY_VALUE_PAIR><UT_KEY_VALUE_PAIR><KEY>2</KEY><VALUE>Somethings 2</VALUE></UT_KEY_VALUE_PAIR></NESTED_TABLE>
1767+
%Missing: <RN>2</RN><NESTED_TABLE><UT_KEY_VALUE_PAIR><KEY>1</KEY><VALUE>Somethings 1</VALUE></UT_KEY_VALUE_PAIR><UT_KEY_VALUE_PAIR><KEY>2</KEY><VALUE>Somethings 2</VALUE></UT_KEY_VALUE_PAIR></NESTED_TABLE>%]';
17671768
l_actual_message := ut3.ut_expectation_processor.get_failed_expectations()(1).message;
17681769
--Assert
17691770
ut.expect(l_actual_message).to_be_like(l_expected_message);

0 commit comments

Comments
 (0)