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

Skip to content

Commit 133ecae

Browse files
committed
Adding new API user.
1 parent 844f0bf commit 133ecae

10 files changed

Lines changed: 446 additions & 15 deletions

File tree

.travis/install.sh

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,33 @@ grant select any dictionary to $UT3_OWNER;
6060
grant create any procedure, drop any procedure, execute any procedure to $UT3_OWNER;
6161
SQL
6262

63-
#Create user that will own the tests
63+
#Create user that will own the tests that are relevant to internal framework
6464
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
6565
set feedback off
6666
@create_utplsql_owner.sql $UT3_TESTER $UT3_TESTER_PASSWORD $UT3_TABLESPACE
67-
68-
--needed for testing distributed transactions
69-
grant create public database link to $UT3_TESTER;
70-
grant drop public database link to $UT3_TESTER;
71-
set feedback on
72-
--Needed for testing coverage outside of main UT3 schema.
73-
grant create any procedure, drop any procedure, execute any procedure, create any type, drop any type, execute any type, under any type, select any table, update any table, insert any table, delete any table, create any table, drop any table, alter any table, select any dictionary to $UT3_TESTER;
74-
revoke execute on dbms_crypto from $UT3_TESTER;
75-
grant create job to $UT3_TESTER;
7667
exit
7768
SQL
7869

79-
#Create additional UT3$USER# to test for special characters
70+
#Create additional UT3$USER# to test for special characters and front end API testing
8071
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
8172
set feedback off
8273
@create_utplsql_owner.sql $UT3_USER $UT3_USER_PASSWORD $UT3_TABLESPACE
83-
--Grant UT3 framework to UT3$USER#
74+
--Grant UT3 framework to min user
8475
@create_user_grants.sql $UT3_OWNER $UT3_USER
8576
exit
8677
SQL
78+
79+
#Create additional UT3_TESTER_HELPER that will provide a functions to allow min grant test user setup test
80+
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
81+
set feedback off
82+
@create_utplsql_owner.sql $UT3_TESTER_HELPER $UT3_TESTER_HELPER_PASSWORD $UT3_TABLESPACE
83+
--needed for testing distributed transactions
84+
grant create public database link to $UT3_TESTER_HELPER;
85+
grant drop public database link to $UT3_TESTER_HELPER;
86+
set feedback on
87+
--Needed for testing coverage outside of main UT3 schema.
88+
grant create any procedure, drop any procedure, execute any procedure, create any type, drop any type, execute any type, under any type, select any table, update any table, insert any table, delete any table, create any table, drop any table, alter any table, select any dictionary to $UT3_TESTER_HELPER;
89+
revoke execute on dbms_crypto from $UT3_TESTER_HELPER;
90+
grant create job to $UT3_TESTER_HELPER;
91+
exit
92+
SQL

development/cleanup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#goto git root directory
44
git rev-parse && cd "$(git rev-parse --show-cdup)"
55

6-
. development/env.sh
6+
#. development/env.sh
77

88
"${SQLCLI}" sys/${ORACLE_PWD}@//${CONNECTION_STR} AS SYSDBA <<-SQL
99
set echo on
@@ -21,6 +21,7 @@ end;
2121
drop user ${UT3_OWNER} cascade;
2222
drop user ${UT3_RELEASE_VERSION_SCHEMA} cascade;
2323
drop user ${UT3_TESTER} cascade;
24+
drop user ${UT3_TESTER_HELPER} cascade;
2425
drop user ${UT3_USER} cascade;
2526
2627
begin

development/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#goto git root directory
44
git rev-parse && cd "$(git rev-parse --show-cdup)"
55

6-
. development/env.sh
6+
#. development/env.sh
77

88
header="******************************************************************************************"
99
if ! development/cleanup.sh; then

development/template.env.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ export UT3_TESTER_PASSWORD=ut3
1616
export UT3_TABLESPACE=users
1717
export UT3_USER="UT3\$USER#"
1818
export UT3_USER_PASSWORD=ut3
19-
19+
export UT3_TESTER_HELPER=ut3_tester_helper
20+
export UT3_TESTER_HELPER_PASSWORD=ut3

test/install_ut3_tester_helper.sql

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
set define off
2+
whenever sqlerror exit failure rollback
3+
whenever oserror exit failure rollback
4+
5+
alter session set plsql_optimize_level=0;
6+
--Install ut3_tester_helper
7+
@@ut3_tester_helper/core.pks
8+
9+
@@ut3_tester_helper/core.pkb
10+
11+
12+
grant execute on ut3_tester_helper.core to UT3$USER#;
13+
14+
set linesize 200
15+
set define on
16+
set verify off
17+
column text format a100
18+
column error_count noprint new_value error_count
19+
20+
prompt Validating installation
21+
22+
set heading on
23+
select type, name, sequence, line, position, text, count(1) over() error_count
24+
from all_errors
25+
where owner = USER
26+
and name not like 'BIN$%' --not recycled
27+
and name != 'UT_WITH_INVALID_BODY'
28+
-- errors only. ignore warnings
29+
and attribute = 'ERROR'
30+
order by name, type, sequence
31+
/
32+
33+
begin
34+
if to_number('&&error_count') > 0 then
35+
raise_application_error(-20000, 'Not all sources were successfully installed.');
36+
else
37+
dbms_output.put_line('Installation completed successfully');
38+
end if;
39+
end;
40+
/
41+
42+
exit;

test/install_ut3_user_tests.sql

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
set define off
2+
whenever sqlerror exit failure rollback
3+
whenever oserror exit failure rollback
4+
5+
alter session set plsql_optimize_level=0;
6+
7+
prompt Install user tests
8+
@@ut3_user/expectations/test_matchers.pks
9+
@@ut3_user/expectations/test_matchers.pkb
10+
11+
set linesize 200
12+
set define on
13+
set verify off
14+
column text format a100
15+
column error_count noprint new_value error_count
16+
17+
prompt Validating installation
18+
19+
set heading on
20+
select type, name, sequence, line, position, text, count(1) over() error_count
21+
from all_errors
22+
where owner = USER
23+
and name not like 'BIN$%' --not recycled
24+
and name != 'UT_WITH_INVALID_BODY'
25+
-- errors only. ignore warnings
26+
and attribute = 'ERROR'
27+
order by name, type, sequence
28+
/
29+
30+
begin
31+
if to_number('&&error_count') > 0 then
32+
raise_application_error(-20000, 'Not all sources were successfully installed.');
33+
else
34+
dbms_output.put_line('Installation completed successfully');
35+
end if;
36+
end;
37+
/
38+
39+
exit;

test/core.pkb renamed to test/ut3_tester_helper/core.pkb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,38 @@ create or replace package body core is
8888
return l_glob_val;
8989
end;
9090

91+
function get_failed_expectations return ut3.ut_varchar2_list is
92+
l_expectations_result ut3.ut_expectation_results := ut3.ut_expectation_processor.get_failed_expectations();
93+
l_result ut3.ut_varchar2_list;
94+
begin
95+
for i in 1..l_expectations_result.count loop
96+
l_result := l_result multiset union l_expectations_result(i).get_result_lines();
97+
end loop;
98+
return l_result;
99+
end;
100+
101+
function failed_expectations_data return anydata is
102+
begin
103+
return anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations());
104+
end;
105+
106+
function get_failed_expectations_n return number is
107+
l_num_failed number;
108+
l_results ut3.ut_expectation_results := ut3.ut_expectation_processor.get_failed_expectations();
109+
begin
110+
l_num_failed := l_results.count;
111+
return l_num_failed;
112+
end;
113+
114+
procedure clear_expectations is
115+
begin
116+
ut3.ut_expectation_processor.clear_expectations();
117+
end;
118+
119+
function table_to_clob(a_results in ut3.ut_varchar2_list) return clob is
120+
begin
121+
return ut3.ut_utils.table_to_clob(a_results);
122+
end;
123+
91124
end;
92125
/

test/core.pks renamed to test/ut3_tester_helper/core.pks

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
create or replace package core is
22

3+
gc_success number := ut3.ut_utils.gc_success;
4+
gc_failure number := ut3.ut_utils.gc_failure;
5+
36
--%suite
47
--%suitepath(utplsql)
58

@@ -16,6 +19,14 @@ create or replace package core is
1619
function get_value(a_variable varchar2) return integer;
1720

1821
function get_dbms_output_as_clob return clob;
22+
23+
function get_failed_expectations return ut3.ut_varchar2_list;
24+
25+
function get_failed_expectations_n return number;
26+
27+
procedure clear_expectations;
28+
29+
function table_to_clob(a_results in ut3.ut_varchar2_list) return clob;
1930

2031
end;
2132
/

0 commit comments

Comments
 (0)