Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Refactored tests to comply with new schema layout
  • Loading branch information
jgebal committed Mar 15, 2020
commit 2c0b2d029dbf9cd17cec0cdb37d82c4e2046b9b3
2 changes: 1 addition & 1 deletion test/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -ev
git rev-parse && cd "$(git rev-parse --show-cdup)"

time utPLSQL-cli/bin/utplsql run ${UT3_TESTER_HELPER}/${UT3_TESTER_HELPER_PASSWORD}@${CONNECTION_STR} \
-source_path=source -owner=ut3 \
-source_path=source -owner=ut3_develop \
-p='ut3_tester,ut3$user#' \
-test_path=test -c \
-f=ut_coverage_sonar_reporter -o=coverage.xml \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ is
l_package_spec varchar2(32737);
l_package_body varchar2(32737);
l_exception_spec varchar2(32737);
l_test_results ut3.ut_varchar2_list;
l_test_results ut3_develop.ut_varchar2_list;
begin
l_exception_spec := q'[
create or replace package exc_pkg is
Expand Down Expand Up @@ -251,9 +251,9 @@ is
execute immediate l_package_body;


select * bulk collect into l_test_results from table(ut3.ut.run(('annotated_package_with_throws')));
select * bulk collect into l_test_results from table(ut3_develop.ut.run(('annotated_package_with_throws')));

g_tests_results := ut3.ut_utils.table_to_clob(l_test_results);
g_tests_results := ut3_develop.ut_utils.table_to_clob(l_test_results);
end;

procedure throws_same_annotated_except is
Expand Down
4 changes: 2 additions & 2 deletions test/ut3_tester/core/annotations/test_annotation_cache.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ create or replace package body test_annotation_cache is
begin
open l_actual_cache_info for
select *
from ut3.ut_annotation_cache_info
from ut3_develop.ut_annotation_cache_info
where object_owner = 'UT3_CACHE_TEST_OWNER';
open l_expected_cache_info for
select 'UT3_CACHE_TEST_OWNER' as object_owner, upper( column_value ) as object_name
Expand Down Expand Up @@ -395,7 +395,7 @@ create or replace package body test_annotation_cache is

procedure t_ut_owner_cannot_run_tests is
begin
cant_run_any_packages( 'ut3' );
cant_run_any_packages( 'ut3_develop' );
cache_populated_for_packages( ut_varchar2_rows( 'GRANTED_TEST_SUITE', 'NOT_GRANTED_TEST_SUITE' ) );
end;

Expand Down
66 changes: 33 additions & 33 deletions test/ut3_tester/core/annotations/test_annotation_manager.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -101,41 +101,41 @@ create or replace package body test_annotation_manager is
begin
select max(cache_id)
into l_actual_cache_id
from ut3.ut_annotation_cache_info
from ut3_develop.ut_annotation_cache_info
where object_owner = sys_context('USERENV', 'CURRENT_USER') and object_type = 'PACKAGE' and object_name = 'DUMMY_PACKAGE'
and parse_time >= a_start_date;
ut.expect(l_actual_cache_id).to_be_not_null;

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_develop.ut_annotation_cache where cache_id = l_actual_cache_id
order by annotation_position;

ut.expect(l_actual).to_be_empty();
end;

procedure assert_dummy_test_package(a_start_time timestamp) is
l_actual_cache_id integer;
l_data ut3.ut_annotated_objects;
l_data ut3_develop.ut_annotated_objects;
l_result sys_refcursor;
l_actual sys_refcursor;
l_expected sys_refcursor;
begin
open l_expected for
select
ut3.ut_annotated_object(
ut3_develop.ut_annotated_object(
sys_context('USERENV', 'CURRENT_USER'),
'DUMMY_TEST_PACKAGE', 'PACKAGE', a_start_time,
ut3.ut_annotations(
ut3.ut_annotation( 2, 'suite', 'dummy_test_suite', null ),
ut3.ut_annotation( 3, 'rollback', 'manual', null ),
ut3.ut_annotation( 7, 'test', 'dummy_test', 'some_dummy_test_procedure' ),
ut3.ut_annotation( 8, 'beforetest', 'some_procedure', 'some_dummy_test_procedure' )
ut3_develop.ut_annotations(
ut3_develop.ut_annotation( 2, 'suite', 'dummy_test_suite', null ),
ut3_develop.ut_annotation( 3, 'rollback', 'manual', null ),
ut3_develop.ut_annotation( 7, 'test', 'dummy_test', 'some_dummy_test_procedure' ),
ut3_develop.ut_annotation( 8, 'beforetest', 'some_procedure', 'some_dummy_test_procedure' )
)
) annotated_object
from dual;

l_result := ut3.ut_annotation_manager.get_annotated_objects(sys_context('USERENV', 'CURRENT_USER'), 'PACKAGE', a_start_time);
l_result := ut3_develop.ut_annotation_manager.get_annotated_objects(sys_context('USERENV', 'CURRENT_USER'), 'PACKAGE', a_start_time);
fetch l_result bulk collect into l_data;
open l_actual for select value(x) as annotated_object from table(l_data) x where object_name = 'DUMMY_TEST_PACKAGE';
ut.expect(l_actual).to_equal(l_expected).exclude('ANNOTATED_OBJECT/PARSE_TIME').join_by('ANNOTATED_OBJECT/OBJECT_NAME');
Expand All @@ -153,7 +153,7 @@ create or replace package body test_annotation_manager is
--Assert
select max(cache_id)
into l_actual_cache_id
from ut3.ut_annotation_cache_info
from ut3_develop.ut_annotation_cache_info
where object_owner = sys_context('USERENV', 'CURRENT_USER') and object_type = 'PACKAGE' and object_name = 'DUMMY_TEST_PACKAGE';

ut.expect(l_actual_cache_id).to_be_null;
Expand Down Expand Up @@ -185,7 +185,7 @@ create or replace package body test_annotation_manager is
--Act
annotation_cache_helper.enable_ddl_trigger();
l_start_date := sysdate;
ut3.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
ut3_develop.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
--Assert
assert_dummy_test_package(l_start_date);
assert_dummy_package(l_start_date);
Expand All @@ -197,7 +197,7 @@ create or replace package body test_annotation_manager is
--Arrange
open l_actual for
select *
from ut3.ut_annotation_cache_info
from ut3_develop.ut_annotation_cache_info
where object_owner = sys_context('USERENV', 'CURRENT_USER') and object_type = 'PACKAGE' and object_name = 'DUMMY_PACKAGE';

ut.expect(l_actual).to_be_empty();
Expand All @@ -207,7 +207,7 @@ create or replace package body test_annotation_manager is
--Assert
open l_actual for
select *
from ut3.ut_annotation_cache_info
from ut3_develop.ut_annotation_cache_info
where object_owner = sys_context('USERENV', 'CURRENT_USER') and object_type = 'PACKAGE' and object_name = 'DUMMY_PACKAGE';

ut.expect(l_actual).to_be_empty();
Expand All @@ -233,7 +233,7 @@ create or replace package body test_annotation_manager is
--Assert
open l_actual for
select *
from ut3.ut_annotation_cache_info
from ut3_develop.ut_annotation_cache_info
where object_owner = sys_context('USERENV', 'CURRENT_USER')
and object_type = 'PACKAGE' and object_name = 'DUMMY_TEST_PACKAGE';

Expand All @@ -247,7 +247,7 @@ create or replace package body test_annotation_manager is
--Arrange
create_dummy_test_package();
l_start_date := sysdate;
ut3.ut_annotation_manager.purge_cache(sys_context('USERENV', 'CURRENT_USER'), 'PACKAGE');
ut3_develop.ut_annotation_manager.purge_cache(sys_context('USERENV', 'CURRENT_USER'), 'PACKAGE');
--Act & Assert
assert_dummy_test_package(l_start_date);
end;
Expand All @@ -273,7 +273,7 @@ create or replace package body test_annotation_manager is

--Assert
ut.expect(
ut3.ut_annotation_manager.get_annotated_objects(
ut3_develop.ut_annotation_manager.get_annotated_objects(
sys_context( 'USERENV', 'CURRENT_USER' ), 'PACKAGE', l_start_time
),
'Annotations are empty after package was dropped'
Expand All @@ -287,7 +287,7 @@ create or replace package body test_annotation_manager is
create_dummy_package();
--Act & Assert
ut.expect(
ut3.ut_annotation_manager.get_annotated_objects(
ut3_develop.ut_annotation_manager.get_annotated_objects(
sys_context( 'USERENV', 'CURRENT_USER' ), 'PACKAGE', l_start_time
),
'Annotations are empty for not annotated package'
Expand All @@ -300,7 +300,7 @@ create or replace package body test_annotation_manager is
--Arrange
create_dummy_package();
ut.expect(
ut3.ut_annotation_manager.get_annotated_objects(
ut3_develop.ut_annotation_manager.get_annotated_objects(
sys_context( 'USERENV', 'CURRENT_USER' ), 'PACKAGE', l_start_time
),
'Annotations are empty for non annotated package'
Expand All @@ -311,7 +311,7 @@ create or replace package body test_annotation_manager is

--Assert
ut.expect(
ut3.ut_annotation_manager.get_annotated_objects(
ut3_develop.ut_annotation_manager.get_annotated_objects(
sys_context( 'USERENV', 'CURRENT_USER' ), 'PACKAGE', l_start_time
),
'Annotations are empty after non annoteted package was dropped'
Expand All @@ -332,7 +332,7 @@ create or replace package body test_annotation_manager is

--Assert
ut.expect(
ut3.ut_annotation_manager.get_annotated_objects(
ut3_develop.ut_annotation_manager.get_annotated_objects(
sys_context( 'USERENV', 'CURRENT_USER' ), 'PACKAGE', l_start_time
)
).to_be_empty();
Expand All @@ -346,7 +346,7 @@ create or replace package body test_annotation_manager is
procedure some_dummy_test_procedure;
end;]');
ut.expect(
ut3.ut_annotation_manager.get_annotated_objects(
ut3_develop.ut_annotation_manager.get_annotated_objects(
sys_context( 'USERENV', 'CURRENT_USER' ), 'PACKAGE', l_start_time
)
).to_be_empty();
Expand All @@ -365,23 +365,23 @@ create or replace package body test_annotation_manager is
l_start_date date;
begin
--Arrange
ut3.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
ut3_develop.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
l_start_date := sysdate;
modify_dummy_test_package();
--Act
ut3.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
ut3_develop.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
--Assert
select max(cache_id)
into l_actual_cache_id
from ut3.ut_annotation_cache_info
from ut3_develop.ut_annotation_cache_info
where object_owner = sys_context('USERENV', 'CURRENT_USER') and object_type = 'PACKAGE' and object_name = 'DUMMY_TEST_PACKAGE'
and parse_time >= l_start_date;

ut.expect(l_actual_cache_id).to_be_not_null;

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_develop.ut_annotation_cache where cache_id = l_actual_cache_id
order by annotation_position;

open l_expected for
Expand All @@ -407,7 +407,7 @@ create or replace package body test_annotation_manager is
--Assert
select count(1)
into l_cache_count
from ut3.ut_annotation_cache_info
from ut3_develop.ut_annotation_cache_info
where object_owner = sys_context('USERENV', 'CURRENT_USER')
and object_type = 'PACKAGE'
and object_name = 'DUMMY_TEST_PACKAGE'
Expand All @@ -417,14 +417,14 @@ create or replace package body test_annotation_manager is

procedure no_data_for_dropped_object is
l_result sys_refcursor;
l_data ut3.ut_annotated_objects;
l_data ut3_develop.ut_annotated_objects;
l_actual sys_refcursor;
l_start_time timestamp := systimestamp;
begin
--Arrange
drop_dummy_test_package();
--Act
l_result := ut3.ut_annotation_manager.get_annotated_objects( sys_context('USERENV', 'CURRENT_USER'),'PACKAGE', l_start_time );
l_result := ut3_develop.ut_annotation_manager.get_annotated_objects( sys_context('USERENV', 'CURRENT_USER'),'PACKAGE', l_start_time );
fetch l_result bulk collect into l_data;
open l_actual for select object_name from table(l_data) where object_name = 'DUMMY_TEST_PACKAGE';
--Assert
Expand All @@ -435,14 +435,14 @@ create or replace package body test_annotation_manager is
l_cache_count integer;
begin
--Arrange
ut3.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
ut3_develop.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
drop_dummy_test_package();
--Act
ut3.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
ut3_develop.ut_annotation_manager.rebuild_annotation_cache(sys_context('USERENV', 'CURRENT_USER'),'PACKAGE');
--Assert
select count(1)
into l_cache_count
from ut3.ut_annotation_cache_info
from ut3_develop.ut_annotation_cache_info
where object_owner = sys_context('USERENV', 'CURRENT_USER')
and object_type = 'PACKAGE'
and object_name = 'DUMMY_TEST_PACKAGE';
Expand All @@ -457,7 +457,7 @@ create or replace package body test_annotation_manager is
--Arrange
create_dummy_test_package();
l_start_date := sysdate;
ut3.ut_annotation_manager.purge_cache(sys_context('USERENV', 'CURRENT_USER'), 'PACKAGE');
ut3_develop.ut_annotation_manager.purge_cache(sys_context('USERENV', 'CURRENT_USER'), 'PACKAGE');
--Act & Assert
assert_dummy_test_package(l_start_date);
end;
Expand Down
Loading