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

Skip to content

Commit 4dc48e6

Browse files
committed
Interim commit - performance check on Travis.
1 parent f475b7c commit 4dc48e6

11 files changed

Lines changed: 244 additions & 169 deletions

source/core/annotations/ut_annotation_cache_manager.pkb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ create or replace package body ut_annotation_cache_manager as
9292
join ut_annotation_cache_info i
9393
on o.object_owner = i.object_owner and o.object_name = i.object_name and o.object_type = i.object_type
9494
join ut_annotation_cache c on i.cache_id = c.cache_id
95-
where ]'|| case when a_parse_time is null then ':a_parse_date is null' else 'i.parse_time > :a_parse_time' end ||q'[
95+
where ]'|| case when a_parse_time is null then ':a_parse_date is null' else 'i.parse_time >= :a_parse_time' end ||q'[
9696
group by i.object_owner, i.object_name, i.object_type, i.parse_time]'
9797
using a_cached_objects, a_parse_time;
9898
return l_results;

source/core/annotations/ut_annotation_manager.pkb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ create or replace package body ut_annotation_manager as
4444
|| case
4545
when a_parse_date is null
4646
then ':a_parse_date is null'
47-
else 'o.last_ddl_time > cast(:a_parse_date as date)'
47+
else 'o.last_ddl_time >= cast(:a_parse_date as date)'
4848
end;
4949
open l_rows for l_cursor_text using a_object_owner, a_object_type, a_parse_date;
5050
fetch l_rows bulk collect into l_result limit 1000000;

source/core/ut_suite_builder.pkb

Lines changed: 192 additions & 52 deletions
Large diffs are not rendered by default.

source/core/ut_suite_builder.pks

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@ create or replace package ut_suite_builder authid current_user is
3737
a_procedure_name varchar2 := null
3838
) return ut_suite_items;
3939

40+
function get_schema_ut_packages(a_schema_names ut_varchar2_rows) return ut_object_names;
41+
4042
function build_suites_from_annotations(
4143
a_owner_name varchar2,
4244
a_annotated_objects sys_refcursor,
4345
a_path varchar2 := null,
4446
a_object_name varchar2 := null,
45-
a_procedure_name varchar2 := null
47+
a_procedure_name varchar2 := null,
48+
a_skip_all_objects boolean := false
4649
) return ut_suite_items;
4750

4851
end ut_suite_builder;

source/core/ut_suite_cache_manager.pkb

Lines changed: 10 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -16,71 +16,6 @@ create or replace package body ut_suite_cache_manager is
1616
limitations under the License.
1717
*/
1818

19-
function get_cached_suite_data(
20-
a_schema_name varchar2,
21-
a_path varchar2 := null,
22-
a_object_name varchar2 := null,
23-
a_procedure_name varchar2 := null
24-
) return t_cached_suites_cursor is
25-
l_path varchar2( 4000 );
26-
l_result sys_refcursor;
27-
begin
28-
if a_path is null and a_object_name is not null then
29-
select min(path) into l_path
30-
from ut_suite_cache
31-
where object_owner = upper(a_schema_name) and object_name = lower(a_object_name) and
32-
name = nvl(lower(a_procedure_name), name);
33-
else
34-
l_path := lower( a_path );
35-
end if;
36-
37-
38-
open l_result for
39-
select c.*
40-
from ut_suite_cache c
41-
-- join all_objects a
42-
-- on a.owner = x.object_owner
43-
-- and a.object_name = x.object_name
44-
-- and a.object_type = 'PACKAGE'
45-
where ( l_path like c.path || '.' || '%'
46-
or ( c.path like l_path || '%'
47-
and c.object_name = nvl(lower(a_object_name), c.object_name)
48-
and c.name = nvl(lower(a_procedure_name), c.name)
49-
)
50-
) and c.object_owner = upper(a_schema_name)
51-
order by c.object_owner,
52-
replace(case
53-
when c.self_type in ( 'UT_TEST' )
54-
then substr(c.path, 1, instr(c.path, '.', -1) - 1)
55-
else c.path
56-
end, '.', chr(0)) desc nulls last,
57-
c.object_name desc,
58-
c.line_no desc;
59-
60-
return l_result;
61-
end;
62-
63-
64-
function get_schema_ut_packages( a_schema_names ut_varchar2_rows ) return ut_object_names is
65-
l_results ut_object_names := ut_object_names( );
66-
l_schema_names ut_varchar2_rows;
67-
l_object_names ut_varchar2_rows;
68-
begin
69-
select distinct c.object_owner, c.object_name
70-
bulk collect into l_schema_names, l_object_names
71-
from ut_suite_cache c
72-
-- join all_objects a
73-
-- on a.owner = c.object_owner
74-
-- and a.object_name = c.object_name
75-
-- and a.object_type = 'PACKAGE'
76-
join table ( a_schema_names ) s on c.object_owner = upper(s.column_value);
77-
l_results.extend( l_schema_names.count );
78-
for i in 1 .. l_schema_names.count loop
79-
l_results( i ) := ut_object_name( l_schema_names( i ), l_object_names( i ) );
80-
end loop;
81-
return l_results;
82-
end;
83-
8419
function get_schema_parse_time(a_schema_name varchar2) return timestamp result_cache is
8520
l_cache_parse_time timestamp;
8621
begin
@@ -95,6 +30,7 @@ create or replace package body ut_suite_cache_manager is
9530
pragma autonomous_transaction;
9631
l_parse_time timestamp;
9732
l_cached_parse_time timestamp;
33+
l_object_owner varchar2(250) := upper(a_object_owner);
9834
begin
9935
if a_suite_items.count = 0 then
10036
return;
@@ -115,17 +51,20 @@ create or replace package body ut_suite_cache_manager is
11551

11652
update ut_suite_cache_schema t
11753
set t.parse_time = l_parse_time
118-
where object_owner = a_object_owner;
54+
where object_owner = l_object_owner;
11955

12056
if sql%rowcount = 0 then
12157
insert into ut_suite_cache_schema
12258
(object_owner, parse_time)
123-
values (a_object_owner, l_parse_time);
59+
values (l_object_owner, l_parse_time);
12460
end if;
12561

12662
delete from ut_suite_cache t
12763
where (t.object_name, t.object_owner)
128-
in (select s.object_name, s.object_owner from table(a_suite_items) s where s.self_type != 'UT_LOGICAL_SUITE');
64+
in (
65+
select upper(s.object_name), upper(s.object_owner)
66+
from table(a_suite_items) s where s.self_type != 'UT_LOGICAL_SUITE'
67+
);
12968

13069

13170
insert into ut_suite_cache t
@@ -134,7 +73,7 @@ create or replace package body ut_suite_cache_manager is
13473
line_no, parse_time, description,
13574
rollback_type, disabled_flag, warnings
13675
)
137-
select self_type, path, object_owner, object_name, name,
76+
select self_type, path, upper(object_owner), upper(object_name), upper(name),
13877
line_no, parse_time, description,
13978
rollback_type, disabled_flag, warnings
14079
from table(a_suite_items) s
@@ -155,7 +94,7 @@ create or replace package body ut_suite_cache_manager is
15594
from table(a_suite_items) x
15695
where x.self_type in( 'UT_SUITE', 'UT_SUITE_CONTEXT' ) )
15796
select s.i.self_type as self_type, s.i.path as path,
158-
s.i.object_owner as object_owner, s.i.object_name as object_name, s.i.name as name,
97+
upper(s.i.object_owner) as object_owner, upper(s.i.object_name) as object_name, upper(s.i.name) as name,
15998
s.i.line_no as line_no, s.i.parse_time as parse_time, s.i.description as description,
16099
s.i.rollback_type as rollback_type, s.i.disabled_flag as disabled_flag, s.i.warnings as warnings,
161100
s.i.before_all_list as before_all_list, s.i.after_all_list as after_all_list,
@@ -178,7 +117,7 @@ create or replace package body ut_suite_cache_manager is
178117
from table ( a_suite_items ) x
179118
where x.self_type in ( 'UT_TEST' ) )
180119
select s.t.self_type as self_type, s.t.path as path,
181-
s.t.object_owner as object_owner, s.t.object_name as object_name, s.t.name as name,
120+
upper(s.t.object_owner) as object_owner, upper(s.t.object_name) as object_name, upper(s.t.name) as name,
182121
s.t.line_no as line_no, s.t.parse_time as parse_time, s.t.description as description,
183122
s.t.rollback_type as rollback_type, s.t.disabled_flag as disabled_flag, s.t.warnings as warnings,
184123
null before_all_list, null after_all_list,

source/core/ut_suite_cache_manager.pks

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,9 @@ create or replace package ut_suite_cache_manager authid definer is
1919
/**
2020
* Responsible for storing and retrieving suite data from cache
2121
*/
22-
subtype t_cached_suite is ut_suite_cache%rowtype;
23-
type tt_cached_suites is table of t_cached_suite;
24-
type t_cached_suites_cursor is ref cursor return t_cached_suite;
2522

2623
procedure save_cache(a_object_owner varchar2, a_suite_items ut_suite_items);
2724

28-
function get_cached_suite_data(
29-
a_schema_name varchar2,
30-
a_path varchar2 := null,
31-
a_object_name varchar2 := null,
32-
a_procedure_name varchar2 := null
33-
) return t_cached_suites_cursor;
34-
35-
function get_schema_ut_packages(a_schema_names ut_varchar2_rows) return ut_object_names;
36-
3725
function get_schema_parse_time(a_schema_name varchar2) return timestamp result_cache;
3826

3927
end ut_suite_cache_manager;

source/core/ut_suite_manager.pkb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ create or replace package body ut_suite_manager is
2929

3030
function get_schema_ut_packages(a_schema_names ut_varchar2_rows) return ut_object_names is
3131
begin
32-
return ut_suite_cache_manager.get_schema_ut_packages(a_schema_names);
32+
return ut_suite_builder.get_schema_ut_packages(a_schema_names);
3333
end;
3434

3535
procedure validate_paths(a_paths in ut_varchar2_list) is
@@ -170,6 +170,15 @@ create or replace package body ut_suite_manager is
170170
l_path_item.object_name,
171171
l_path_item.procedure_name
172172
);
173+
if l_suites.count = 0 then
174+
if l_path_item.suite_path is not null then
175+
raise_application_error(ut_utils.gc_suite_package_not_found,'No suite packages found for path '||l_schema||':'||l_path_item.suite_path|| '.');
176+
elsif l_path_item.procedure_name is not null then
177+
raise_application_error(ut_utils.gc_suite_package_not_found,'Suite test '||l_schema||'.'||l_path_item.object_name|| '.'||l_path_item.procedure_name||' does not exist');
178+
else
179+
raise_application_error(ut_utils.gc_suite_package_not_found,'Suite package '||l_schema||'.'||l_path_item.object_name|| ' does not exist');
180+
end if;
181+
end if;
173182
l_index := l_suites.first;
174183
while l_index is not null loop
175184
l_objects_to_run.extend;

source/create_synonyms_and_grants_for_public.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ grant execute on &&ut3_owner..ut_annotated_object to public;
8686
grant execute on &&ut3_owner..ut_annotated_objects to public;
8787
grant select on &&ut3_owner..ut_annotation_cache_info to public;
8888
grant select on &&ut3_owner..ut_annotation_cache to public;
89+
grant execute on &&ut3_owner..ut_executables to public;
90+
grant execute on &&ut3_owner..ut_executable_test to public;
91+
grant select on &&ut3_owner..ut_suite_cache to public;
92+
grant select on &&ut3_owner..ut_suite_cache_schema to public;
8993
grant execute on &&ut3_owner..ut_annotation_cache_manager to public;
9094
grant execute on &&ut3_owner..ut_annotation_parser to public;
9195
grant execute on &&ut3_owner..ut_annotation_objs_cache_info to public;

source/create_user_grants.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ grant execute on &&ut3_owner..ut_annotated_object to &ut3_user;
106106
grant execute on &&ut3_owner..ut_annotated_objects to &ut3_user;
107107
grant select on &&ut3_owner..ut_annotation_cache_info to &ut3_user;
108108
grant select on &&ut3_owner..ut_annotation_cache to &ut3_user;
109+
grant execute on &&ut3_owner..ut_executables to &ut3_user;
110+
grant execute on &&ut3_owner..ut_executable_test to &ut3_user;
111+
grant select on &&ut3_owner..ut_suite_cache to &ut3_user;
112+
grant select on &&ut3_owner..ut_suite_cache_schema to &ut3_user;
109113
grant execute on &&ut3_owner..ut_annotation_cache_manager to &ut3_user;
110114
grant execute on &&ut3_owner..ut_annotation_parser to &ut3_user;
111115
grant execute on &&ut3_owner..ut_annotation_objs_cache_info to &ut3_user;

test/core/test_suite_builder.pkb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ create or replace package body test_suite_builder is
1818
a_owner_name => 'UT3_TESTER',
1919
a_annotated_objects => l_cursor,
2020
a_path => null,
21-
a_object_name => a_package_name
21+
a_object_name => a_package_name,
22+
a_skip_all_objects => true
2223
);
2324
l_suite := treat( l_suites(l_suites.first) as ut3.ut_logical_suite);
2425

@@ -395,7 +396,7 @@ create or replace package body test_suite_builder is
395396
ut3.ut_annotation(1, 'suite','Cool', null),
396397
ut3.ut_annotation(2, 'beforeall',null, 'first_before_all'),
397398
ut3.ut_annotation(3, 'beforeall',null, 'another_before_all'),
398-
ut3.ut_annotation(4, 'beforeeach',null, 'first_bfore_each'),
399+
ut3.ut_annotation(4, 'beforeeach',null, 'first_before_each'),
399400
ut3.ut_annotation(5, 'beforeeach',null, 'another_before_each'),
400401
ut3.ut_annotation(6, 'aftereach',null, 'first_after_each'),
401402
ut3.ut_annotation(7, 'aftereach',null, 'another_after_each'),
@@ -640,9 +641,6 @@ create or replace package body test_suite_builder is
640641
'%<UT_LOGICAL_SUITE>' ||
641642
'%<WARNINGS/>' ||
642643
'%<ITEMS>' ||
643-
'<UT_SUITE_ITEM>' ||
644-
'%<NAME>suite_level_test</NAME><DESCRIPTION>In suite</DESCRIPTION><PATH>some_package.suite_level_test</PATH>' ||
645-
'%</UT_SUITE_ITEM>' ||
646644
'<UT_SUITE_ITEM>' ||
647645
'%<NAME>a_context</NAME><DESCRIPTION>A context</DESCRIPTION><PATH>some_package.a_context</PATH>' ||
648646
'%<ITEMS>' ||
@@ -655,6 +653,9 @@ create or replace package body test_suite_builder is
655653
'%</BEFORE_ALL_LIST>' ||
656654
'<AFTER_ALL_LIST/>' ||
657655
'</UT_SUITE_ITEM>' ||
656+
'<UT_SUITE_ITEM>' ||
657+
'%<NAME>suite_level_test</NAME><DESCRIPTION>In suite</DESCRIPTION><PATH>some_package.suite_level_test</PATH>' ||
658+
'%</UT_SUITE_ITEM>' ||
658659
'</ITEMS>' ||
659660
'<BEFORE_ALL_LIST>' ||
660661
'%<OBJECT_NAME>some_package</OBJECT_NAME><PROCEDURE_NAME>suite_level_beforeall</PROCEDURE_NAME>' ||

0 commit comments

Comments
 (0)