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

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
36a061c
Removed parsing of annotation text (params) from ut_annotations as an…
jgebal Oct 6, 2017
a29cabe
Removed duplicate `old_tests` for ut_annotations - the functionality …
jgebal Oct 6, 2017
58c6293
Renamed `ut_annotations` to `ut_annotation_parser` and moved to annot…
jgebal Oct 7, 2017
375a7ff
Removed ``ut_annotations` from uninstall script.
jgebal Oct 7, 2017
13703fa
Fixed failing old tests after refactoring.
jgebal Oct 7, 2017
ac23f15
Refactored ut_annotation_parser API to use `ut_annotations` collectio…
jgebal Oct 7, 2017
df2c763
Added cache mechanism to `ut_annotation_parser`.
jgebal Oct 8, 2017
6088c81
Added ability to get annotations for single object.
jgebal Oct 9, 2017
4ec9eb5
Reworking annotation cache - not to use cast(Collect()) on dba_source.
jgebal Oct 13, 2017
dbf2538
Fixed failing test and test for Wrapped package.
jgebal Oct 14, 2017
ca31e98
Added missing annotation manager.
jgebal Oct 14, 2017
289f006
Removed dbms_output from code.
jgebal Oct 14, 2017
8e26ed0
Merge remote-tracking branch 'upstream/develop' into feature/annotati…
jgebal Oct 14, 2017
239abde
Add grant ut_annotation_manager to public
pesse Oct 16, 2017
6acd2ad
Add grant ut_annotation_manager to ut3_user
pesse Oct 16, 2017
e114aae
Merge branch 'develop' into feature/annotations_restructuring
jgebal Oct 17, 2017
b83e142
Fixed hardcoded schema-name
jgebal Oct 18, 2017
6dcaae9
Merge remote-tracking branch 'upstream/develop' into feature/annotati…
jgebal Oct 18, 2017
aafca84
Refactored annotation cache.
jgebal Oct 22, 2017
cd394c7
Fixed test execution on 12.1.
jgebal Oct 23, 2017
73c15a2
Merge remote-tracking branch 'upstream/develop' into feature/annotati…
jgebal Oct 23, 2017
5967a3a
Fixed test execution on 12.1.
jgebal Oct 23, 2017
1438753
Merge branch 'develop' into feature/annotations_restructuring
jgebal Oct 24, 2017
4f5d870
Merge conflicts cleanup
jgebal Oct 24, 2017
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
Prev Previous commit
Next Next commit
Fixed test execution on 12.1.
Added wrapper procedure `purge_cache` in `ut_annotation_manager`
Changed tests to use wrapper procedure.
  • Loading branch information
jgebal committed Oct 23, 2017
commit cd394c7d8cf827821ff3fc3dad5fcc4e6fd88fb7
20 changes: 10 additions & 10 deletions source/api/ut.pks
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,18 @@ create or replace package ut authid current_user as
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
);

/*
Helper procedure to set NLS session parameter for date processing in refcursor.
It needs to be called before refcursor is open in order to have DATE data type data in refcursor
properly transformed into XML format as a date-time element.
If the function is not called before opening a cursor to be compared, the DATE data is compared using default NLS setting for date.
*/
/**
* Helper procedure to set NLS session parameter for date processing in refcursor.
* It needs to be called before refcursor is open in order to have DATE data type data in refcursor
* properly transformed into XML format as a date-time element.
* If the function is not called before opening a cursor to be compared, the DATE data is compared using default NLS setting for date.
*/
procedure set_nls;

/*
Helper procedure to reset NLS session parameter to it's original state.
It needs to be called after refcursor is open in order restore the original session state and keep the NLS date setting at default.
*/
/**
* Helper procedure to reset NLS session parameter to it's original state.
* It needs to be called after refcursor is open in order restore the original session state and keep the NLS date setting at default.
*/
procedure reset_nls;

end ut;
Expand Down
4 changes: 3 additions & 1 deletion source/core/annotations/ut_annotation_cache_manager.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ create or replace package body ut_annotation_cache_manager as
in (select i.cache_id
from ut_annotation_cache_info i
join table (a_objects) o
using (object_name, object_type, object_owner)
on o.object_name = i.object_name
and o.object_type = i.object_type
and o.object_owner = i.object_owner
);

merge into ut_annotation_cache_info i
Expand Down
5 changes: 5 additions & 0 deletions source/core/annotations/ut_annotation_manager.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,10 @@ create or replace package body ut_annotation_manager as

end;

procedure purge_cache(a_object_owner varchar2, a_object_type varchar2) is
begin
ut_annotation_cache_manager.purge_cache(a_object_owner, a_object_type);
end;

end ut_annotation_manager;
/
8 changes: 8 additions & 0 deletions source/core/annotations/ut_annotation_manager.pks
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,13 @@ create or replace package ut_annotation_manager authid current_user as
*/
procedure rebuild_annotation_cache(a_object_owner varchar2, a_object_type varchar2);

/**
* Removes cached information about annotations for objects of specified type and specified owner
*
* @param a_object_owner owner of objects to purge annotations for
* @param a_object_type type of objects to purge annotations for
*/
procedure purge_cache(a_object_owner varchar2, a_object_type varchar2);

end ut_annotation_manager;
/

This file was deleted.

This file was deleted.

6 changes: 2 additions & 4 deletions test/install_tests.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ whenever oserror exit failure rollback
@@ut_reporters/test_coveralls_reporter.pks
@ut_expectations/test_expectations_cursor.pks
@@ut_runner/test_ut_runner.pks
@@annotations/ut_annotation_manager/test_annotation_manager.pks
@@annotations/ut_annotation_cache_manager/test_annotation_cache_manager.pks
@@ut_annotation_manager/test_annotation_manager.pks

@core.pkb
@ut_utils/test_ut_utils.pkb
Expand All @@ -26,8 +25,7 @@ whenever oserror exit failure rollback
@@ut_reporters/test_coveralls_reporter.pkb
@ut_expectations/test_expectations_cursor.pkb
@@ut_runner/test_ut_runner.pkb
@@annotations/ut_annotation_manager/test_annotation_manager.pkb
@@annotations/ut_annotation_cache_manager/test_annotation_cache_manager.pkb
@@ut_annotation_manager/test_annotation_manager.pkb

set linesize 200
set define on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,39 @@ create or replace package body test_annotation_manager is
commit;
end;

procedure setup_cache is
pragma autonomous_transaction;
begin
create_dummy_test_package();
execute immediate q'[create or replace procedure dummy_test_procedure as
--%some_annotation(some_text)
--%rollback(manual)
begin
null;
end;]';
execute immediate q'[create or replace procedure ut3.dummy_test_procedure as
--%some_annotation(some_text)
--%rollback(manual)
begin
null;
end;]';
ut3.ut_annotation_manager.rebuild_annotation_cache(user,'PACKAGE');
ut3.ut_annotation_manager.rebuild_annotation_cache(user,'PROCEDURE');
ut3.ut_annotation_manager.rebuild_annotation_cache('UT3','PROCEDURE');
end;

procedure cleanup_cache is
pragma autonomous_transaction;
begin
delete from ut3.ut_annotation_cache_info
where object_type = 'PROCEDURE' and object_owner in ('UT3',user)
or object_type = 'PACKAGE' and object_owner = user and object_name = 'DUMMY_TEST_PACKAGE';
drop_dummy_test_package();
execute immediate q'[drop procedure dummy_test_procedure]';
execute immediate q'[drop procedure ut3.dummy_test_procedure]';
end;



procedure add_new_package is
l_actual_cache_id integer;
Expand Down Expand Up @@ -143,7 +176,8 @@ create or replace package body test_annotation_manager is

open l_actual for
select annotation_position, annotation_name, annotation_text, subobject_name
from ut3.ut_annotation_cache where cache_id = l_actual_cache_id;
from ut3.ut_annotation_cache where cache_id = l_actual_cache_id
order by annotation_position;

open l_expected for
select 1 as annotation_position, 'suite' as annotation_name,
Expand Down Expand Up @@ -183,7 +217,8 @@ create or replace package body test_annotation_manager is

open l_actual for
select annotation_position, annotation_name, annotation_text, subobject_name
from ut3.ut_annotation_cache where cache_id = l_actual_cache_id;
from ut3.ut_annotation_cache where cache_id = l_actual_cache_id
order by annotation_position;

open l_expected for
select 1 as annotation_position, 'suite' as annotation_name,
Expand Down Expand Up @@ -219,7 +254,8 @@ create or replace package body test_annotation_manager is

open l_actual for
select annotation_position, annotation_name, annotation_text, subobject_name
from ut3.ut_annotation_cache where cache_id = l_actual_cache_id;
from ut3.ut_annotation_cache where cache_id = l_actual_cache_id
order by annotation_position;

open l_expected for
select 1 as annotation_position, 'suite' as annotation_name,
Expand Down Expand Up @@ -249,5 +285,36 @@ create or replace package body test_annotation_manager is
ut.expect(l_actual).to_be_empty();
end;

procedure test_purge_schema_type is
l_actual sys_refcursor;
begin

open l_actual for
select * from ut3.ut_annotation_cache_info
where object_owner = user and object_type = 'PROCEDURE';
ut.expect(l_actual).not_to_be_empty();

--Act
ut3.ut_annotation_cache_manager.purge_cache(user,'PROCEDURE');

--Assert
open l_actual for
select * from ut3.ut_annotation_cache_info
where object_owner = user and object_type = 'PROCEDURE';
--Cache purged for object owner/type
ut.expect(l_actual).to_be_empty();
open l_actual for
select * from ut3.ut_annotation_cache_info
where object_owner = user and object_type = 'PACKAGE';
--Cache not purged for other types
ut.expect(l_actual).not_to_be_empty();
open l_actual for
select * from ut3.ut_annotation_cache_info
where object_owner != user and object_type = 'PROCEDURE';
--Cache not purged for other owners
ut.expect(l_actual).not_to_be_empty();

end;

end test_annotation_manager;
/
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,13 @@ create or replace package test_annotation_manager is
--%beforetest(create_dummy_test_package)
procedure no_data_for_dropped_object;

procedure setup_cache;
procedure cleanup_cache;

--%test(Purges cache for a given schema and object type)
--%beforetest(setup_cache)
--%aftertest(cleanup_cache)
procedure test_purge_schema_type;

end test_annotation_manager;
/