Skip to content

Commit

Permalink
Merge 81a9caf into abd2f37
Browse files Browse the repository at this point in the history
  • Loading branch information
jgebal committed Mar 20, 2019
2 parents abd2f37 + 81a9caf commit 1ac5005
Show file tree
Hide file tree
Showing 13 changed files with 223 additions and 62 deletions.
1 change: 1 addition & 0 deletions .travis/push_release_version.sh
Expand Up @@ -9,6 +9,7 @@ if [ "${TRAVIS_REPO_SLUG}" = "${UTPLSQL_REPO}" ] && [ "$TRAVIS_PULL_REQUEST" ==
git add sonar-project.properties
git add VERSION
git add source/*
git add docs/*
git commit -m 'Updated project version after build [skip ci]'
echo "Pushing to origin"
git push --quiet origin HEAD:${CURRENT_BRANCH}
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
v3.1.4
v3.1.5
3 changes: 2 additions & 1 deletion sonar-project.properties
Expand Up @@ -2,7 +2,7 @@
sonar.projectKey=utPLSQL
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=utPLSQL
sonar.projectVersion=v3.1.4
sonar.projectVersion=v3.1.5

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.
Expand All @@ -19,6 +19,7 @@ sonar.projectDescription=PL/SQL Unit Testing Framework
sonar.plsql.file.suffixes=sql,tab,pkb,tpb
sonar.language=plsql


sonar.exclusions=create_synonyms_and_grants_for_public.sql, create_user_grants.sql, create_user_synonyms.sql, create_utplsql_owner.sql, define_ut3_owner_param.sql, install.sql, install_above_12_1.sql, install_component.sql, install_headless.sql, uninstall.sql, uninstall_all.sql, uninstall_coverage_tables.sql

sonar.pullrequest.provider=github
Expand Down
2 changes: 1 addition & 1 deletion source/core/ut_utils.pks
Expand Up @@ -21,7 +21,7 @@ create or replace package ut_utils authid definer is
*
*/

gc_version constant varchar2(50) := 'v3.1.4.2692';
gc_version constant varchar2(50) := 'v3.1.5.2706';

subtype t_executable_type is varchar2(30);
gc_before_all constant t_executable_type := 'beforeall';
Expand Down
4 changes: 4 additions & 0 deletions source/create_synonyms_and_grants_for_public.sql
Expand Up @@ -107,6 +107,8 @@ 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

Expand Down Expand Up @@ -167,3 +169,5 @@ 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;
3 changes: 2 additions & 1 deletion source/create_user_grants.sql
Expand Up @@ -126,4 +126,5 @@ 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;
2 changes: 2 additions & 0 deletions source/create_user_synonyms.sql
Expand Up @@ -109,3 +109,5 @@ 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;
75 changes: 60 additions & 15 deletions test/core/min_grant_user/test_min_grant_user.pkb
@@ -1,15 +1,60 @@
create or replace package body test_min_grant_user is

procedure test_join_by_cursor is
l_results clob;
begin
execute immediate 'begin ut3$user#.test_cursor_grants.run(); end;';
l_results := core.get_dbms_output_as_clob();
--Assert
ut.expect( l_results ).to_be_like( '%execute join by test [% sec]' ||
'%1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%' );

end;

end;
/
create or replace package body test_min_grant_user is

procedure test_join_by_cursor is
l_results clob;
begin
execute immediate 'begin ut3$user#.test_cursor_grants.run_test_join_by_cursor(); end;';
l_results := core.get_dbms_output_as_clob();
--Assert
ut.expect( l_results ).to_be_like( '%execute join by test [% sec]' ||
'%1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%' );

end;

procedure test_equal_cursor is
l_results clob;
begin
execute immediate 'begin ut3$user#.test_cursor_grants.run_test_equal_cursor(); end;';
l_results := core.get_dbms_output_as_clob();
--Assert
ut.expect( l_results ).to_be_like( '%execute equal test [% sec]' ||
'%1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%' );

end;

procedure test_not_empty_cursor is
l_results clob;
begin
execute immediate 'begin ut3$user#.test_cursor_grants.run_test_not_empty_cursor(); end;';
l_results := core.get_dbms_output_as_clob();
--Assert
ut.expect( l_results ).to_be_like( '%execute not_empty test [% sec]' ||
'%1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%' );

end;


procedure test_have_count_cursor is
l_results clob;
begin
execute immediate 'begin ut3$user#.test_cursor_grants.run_test_have_count_cursor(); end;';
l_results := core.get_dbms_output_as_clob();
--Assert
ut.expect( l_results ).to_be_like( '%execute have_count test [% sec]' ||
'%1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%' );

end;

procedure test_empty_cursor is
l_results clob;
begin
execute immediate 'begin ut3$user#.test_cursor_grants.run_test_empty_cursor(); end;';
l_results := core.get_dbms_output_as_clob();
--Assert
ut.expect( l_results ).to_be_like( '%execute empty test [% sec]' ||
'%1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)%' );

end;

end;
/
32 changes: 22 additions & 10 deletions test/core/min_grant_user/test_min_grant_user.pks
@@ -1,10 +1,22 @@
create or replace package test_min_grant_user is

--%suite(minimum grant user tests)
--%suitepath(utplsql.core)

--%test(execute join by test)
procedure test_join_by_cursor;

end;
/
create or replace package test_min_grant_user is

--%suite(minimum grant user tests)
--%suitepath(utplsql.core)

--%test(execute join by test)
procedure test_join_by_cursor;

--%test(execute equal test)
procedure test_equal_cursor;

--%test(execute not_empty test)
procedure test_not_empty_cursor;

--%test(execute have_count test)
procedure test_have_count_cursor;

--%test(execute empty test)
procedure test_empty_cursor;

end;
/
5 changes: 4 additions & 1 deletion test/helpers/test_dummy_object.tps
Expand Up @@ -13,4 +13,7 @@ create or replace type test_dummy_object as object (
"name" varchar2(30),
"Value" varchar2(30)
)
/
/


grant execute on test_dummy_object to ut3$user#;
2 changes: 2 additions & 0 deletions test/helpers/test_dummy_object_list.tps
@@ -1,2 +1,4 @@
create or replace type test_dummy_object_list as table of test_dummy_object
/

grant execute on test_dummy_object_list to ut3$user#;
119 changes: 96 additions & 23 deletions test/helpers/ut3user#.test_cursor_grants.pkb
@@ -1,23 +1,96 @@
create or replace package body ut3$user#.test_cursor_grants is

procedure run is
begin
ut3.ut.run('test_cursor_grants');
end;

procedure test_join_by_cursor is
l_actual SYS_REFCURSOR;
l_expected SYS_REFCURSOR;
begin
--Arrange
open l_actual for select owner, object_name,object_type from all_objects where owner = user
order by 1,2,3 asc;
open l_expected for select owner, object_name,object_type from all_objects where owner = user
order by 1,2,3 desc;

--Act
ut3.ut.expect(l_actual).to_equal(l_expected).join_by('OWNER');

end;
end;
/
create or replace package body ut3$user#.test_cursor_grants is

procedure run_test_join_by_cursor is
begin
ut3.ut.run('test_cursor_grants.test_join_by_cursor');
end;

procedure run_test_equal_cursor is
begin
ut3.ut.run('test_cursor_grants.test_equal_cursor');
end;

procedure run_test_not_empty_cursor is
begin
ut3.ut.run('test_cursor_grants.test_not_empty_cursor');
end;

procedure run_test_have_count_cursor is
begin
ut3.ut.run('test_cursor_grants.test_have_count_cursor');
end;

procedure run_test_empty_cursor is
begin
ut3.ut.run('test_cursor_grants.test_empty_cursor');
end;

procedure test_join_by_cursor is
l_actual SYS_REFCURSOR;
l_expected SYS_REFCURSOR;
begin
--Arrange
open l_actual for select owner, object_name,object_type from all_objects where owner = user
order by 1,2,3 asc;
open l_expected for select owner, object_name,object_type from all_objects where owner = user
order by 1,2,3 desc;

--Act
ut3.ut.expect(l_actual).to_equal(l_expected).join_by('OBJECT_NAME,OBJECT_TYPE');

end;

procedure test_equal_cursor is
l_actual SYS_REFCURSOR;
l_expected SYS_REFCURSOR;
l_list ut3_tester.test_dummy_object_list;
begin
--Arrange
open l_actual for select value(x) as item from table(l_list) x;
open l_expected for select value(x) as item from table(l_list) x;

--Act
ut3.ut.expect(l_actual).to_equal(l_expected);

end;

procedure test_not_empty_cursor is
l_details_cur SYS_REFCURSOR;
l_expected ut3_tester.test_dummy_object_list;
begin
select ut3_tester.test_dummy_object( rn, 'Something '||rn, rn1)
bulk collect into l_expected
from (select rownum * case when mod(rownum,2) = 0 then -1 else 1 end rn,
rownum * case when mod(rownum,4) = 0 then -1 else 1 end rn1
from dual connect by level <=10);

--Arrange
open l_details_cur for
select value(x) as item from table(l_expected) x;

--Act
ut3.ut.expect(l_details_cur).not_to_be_empty();
end;

procedure test_have_count_cursor is
l_expected SYS_REFCURSOR;
begin
--Arrange
open l_expected for
select value(x) as item from table(ut3_tester.test_dummy_object_list()) x;

--Act
ut3.ut.expect(l_expected).to_have_count(0);
end;

procedure test_empty_cursor is
l_expected SYS_REFCURSOR;
begin
open l_expected for
select value(x) as item from table(ut3_tester.test_dummy_object_list()) x;
--Act
ut3.ut.expect(l_expected).to_be_empty();
end;

end;
/
35 changes: 26 additions & 9 deletions test/helpers/ut3user#.test_cursor_grants.pks
@@ -1,9 +1,26 @@
create or replace package ut3$user#.test_cursor_grants is
--%suite()

procedure run;

--%test(execute join by test)
procedure test_join_by_cursor;
end;
/
create or replace package ut3$user#.test_cursor_grants is
--%suite()

procedure run_test_join_by_cursor;
procedure run_test_equal_cursor;
procedure run_test_not_empty_cursor;
procedure run_test_have_count_cursor;
procedure run_test_empty_cursor;

--%test(execute join by test)
procedure test_join_by_cursor;

--%test(execute equal test)
procedure test_equal_cursor;

--%test(execute not empty test)
procedure test_not_empty_cursor;

--%test(execute have_count test)
procedure test_have_count_cursor;

--%test(execute empty test)
procedure test_empty_cursor;

end;
/

0 comments on commit 1ac5005

Please sign in to comment.