Skip to content

Commit ec258dc

Browse files
committed
Merge branch 'develop' of github.com:lwasylow/utPLSQL into feature/cursor_pk_join
2 parents 278dc68 + 5244887 commit ec258dc

14 files changed

Lines changed: 357 additions & 114 deletions

docs/userguide/install.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,13 @@ Example invocation:
135135
cd source
136136
sqlplus admin/admins_password@database @create_synonyms_and_grants_for_public.sql ut3
137137
```
138-
To grant utPLSQL to an individual user, execute script `source/create_synonyms_and_grants_for_user.sql`, provide `schema_name` where utPLSQL is installed and `user_name` to grant access for.
138+
To grant utPLSQL to an individual user, execute scripts `source/create_user_grants.sql` and `source/create_user_synonyms.sql`, provide `schema_name` where utPLSQL is installed and `user_name` to grant access for.
139139

140140
Example invocation:
141141
```bash
142142
cd source
143-
sqlplus admin/admins_password@database @create_synonyms_and_grants_for_user.sql ut3 hr
143+
sqlplus ut3_user/ut3_password@database @create_user_grants.sql ut3 hr
144+
sqlplus user/user_password@database @create_user_synonyms.sql ut3 hr
144145
```
145146

146147
The following tools that support the SQL*Plus commands can be used to run the installation script:
Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
1-
create global temporary table ut_dbms_output_cache(
2-
/*
3-
utPLSQL - Version 3
4-
Copyright 2016 - 2017 utPLSQL Project
5-
Licensed under the Apache License, Version 2.0 (the "License"):
6-
you may not use this file except in compliance with the License.
7-
You may obtain a copy of the License at
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
Unless required by applicable law or agreed to in writing, software
10-
distributed under the License is distributed on an "AS IS" BASIS,
11-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
See the License for the specific language governing permissions and
13-
limitations under the License.
14-
*/
15-
/*
16-
* This table is not a global temporary table as it needs to allow cross-session data exchange
17-
* It is used however as a temporary table with multiple writers.
18-
* This is why it has very high initrans and has nologging
19-
*/
20-
seq_no number(20,0) not null,
21-
text varchar2(4000),
22-
constraint ut_dbms_output_cache_pk primary key(seq_no)
23-
) on commit preserve rows;
1+
/*
2+
utPLSQL - Version 3
3+
Copyright 2016 - 2017 utPLSQL Project
4+
Licensed under the Apache License, Version 2.0 (the "License"):
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS,
10+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
See the License for the specific language governing permissions and
12+
limitations under the License.
13+
*/
14+
/*
15+
* This table is not a global temporary table as it needs to allow cross-session data exchange
16+
* It is used however as a temporary table with multiple writers.
17+
* This is why it has very high initrans and has nologging
18+
*/
19+
declare
20+
l_tab_exist number;
21+
begin
22+
select count(*) into l_tab_exist from
23+
(select table_name from all_tables where table_name = 'UT_DBMS_OUTPUT_CACHE' and owner = sys_context('USERENV','CURRENT_SCHEMA')
24+
union all
25+
select synonym_name from all_synonyms where synonym_name = 'UT_DBMS_OUTPUT_CACHE' and owner = sys_context('USERENV','CURRENT_SCHEMA'));
26+
if l_tab_exist = 0 then
27+
28+
execute immediate q'[create global temporary table ut_dbms_output_cache
29+
(
30+
seq_no number(20,0) not null,
31+
text varchar2(4000),
32+
constraint ut_dbms_output_cache_pk primary key(seq_no)
33+
) on commit preserve rows
34+
]';
35+
36+
end if;
37+
end;
38+
/

source/core/ut_suite_builder.pkb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ create or replace package body ut_suite_builder is
105105
l_annotation_pos binary_integer;
106106
begin
107107
l_result.owner := a_object.object_owner;
108-
l_result.name := a_object.object_name;
108+
l_result.name := lower(trim(a_object.object_name));
109109
l_annotation_no := a_object.annotations.first;
110110
while l_annotation_no is not null loop
111111
l_annotation_pos := a_object.annotations(l_annotation_no).position;
112112
if a_object.annotations(l_annotation_no).subobject_name is null then
113113
l_result.annotations(l_annotation_pos).name := a_object.annotations(l_annotation_no).name;
114114
l_result.annotations(l_annotation_pos).text := a_object.annotations(l_annotation_no).text;
115115
else
116-
l_result.annotations(l_annotation_pos).procedure_name := a_object.annotations(l_annotation_no).subobject_name;
116+
l_result.annotations(l_annotation_pos).procedure_name := lower(trim(a_object.annotations(l_annotation_no).subobject_name));
117117
l_result.annotations(l_annotation_pos).procedure_annotations := get_procedure_annotations(a_object.annotations, l_annotation_no);
118118
end if;
119119
l_annotation_no := a_object.annotations.next(l_annotation_no);

source/core/ut_utils.pks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ create or replace package ut_utils authid definer is
2121
*
2222
*/
2323

24-
gc_version constant varchar2(50) := 'v3.1.2.1883-develop';
24+
gc_version constant varchar2(50) := 'v3.1.2.1899-develop';
2525

2626
/* Constants: Event names */
2727
subtype t_event_name is varchar2(30);

source/create_user_grants.sql

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/*
2+
utPLSQL - Version 3
3+
Copyright 2016 - 2017 utPLSQL Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License"):
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
17+
Create all necessary grant for the user who owns test packages and want to execute utPLSQL framework
18+
*/
19+
20+
@@define_ut3_owner_param.sql
21+
22+
column 2 new_value 2 noprint
23+
select null as "2" from dual where 1=0;
24+
spool params.sql.tmp
25+
select
26+
case
27+
when '&&2' is null then q'[ACCEPT ut3_user CHAR PROMPT 'Provide schema to which should be granted the utPLSQL v3 ']'
28+
else 'define ut3_user=&&2'
29+
end
30+
from dual;
31+
spool off
32+
set termout on
33+
@params.sql.tmp
34+
set termout off
35+
/* cleanup temporary sql files */
36+
--try running on windows
37+
$ del params.sql.tmp
38+
--try running on linux/unix
39+
! rm params.sql.tmp
40+
set termout on
41+
42+
set echo off
43+
set feedback on
44+
set heading off
45+
set verify off
46+
47+
prompt Granting privileges on UTPLSQL objects in &&ut3_owner schema to user &&ut3_user
48+
49+
whenever sqlerror exit failure rollback
50+
whenever oserror exit failure rollback
51+
52+
alter session set current_schema = &&ut3_owner;
53+
54+
grant execute on &&ut3_owner..ut_be_between to &ut3_user;
55+
grant execute on &&ut3_owner..ut_be_empty to &ut3_user;
56+
grant execute on &&ut3_owner..ut_be_false to &ut3_user;
57+
grant execute on &&ut3_owner..ut_be_greater_or_equal to &ut3_user;
58+
grant execute on &&ut3_owner..ut_be_greater_than to &ut3_user;
59+
grant execute on &&ut3_owner..ut_be_less_or_equal to &ut3_user;
60+
grant execute on &&ut3_owner..ut_be_less_than to &ut3_user;
61+
grant execute on &&ut3_owner..ut_be_like to &ut3_user;
62+
grant execute on &&ut3_owner..ut_be_not_null to &ut3_user;
63+
grant execute on &&ut3_owner..ut_be_null to &ut3_user;
64+
grant execute on &&ut3_owner..ut_be_true to &ut3_user;
65+
grant execute on &&ut3_owner..ut_equal to &ut3_user;
66+
grant execute on &&ut3_owner..ut_have_count to &ut3_user;
67+
grant execute on &&ut3_owner..ut_match to &ut3_user;
68+
grant execute on &&ut3_owner..ut to &ut3_user;
69+
grant execute on &&ut3_owner..ut_runner to &ut3_user;
70+
grant execute on &&ut3_owner..ut_teamcity_reporter to &ut3_user;
71+
grant execute on &&ut3_owner..ut_xunit_reporter to &ut3_user;
72+
grant execute on &&ut3_owner..ut_junit_reporter to &ut3_user;
73+
grant execute on &&ut3_owner..ut_tfs_junit_reporter to &ut3_user;
74+
grant execute on &&ut3_owner..ut_documentation_reporter to &ut3_user;
75+
grant execute on &&ut3_owner..ut_coverage_html_reporter to &ut3_user;
76+
grant execute on &&ut3_owner..ut_coverage_sonar_reporter to &ut3_user;
77+
grant execute on &&ut3_owner..ut_coveralls_reporter to &ut3_user;
78+
grant execute on &&ut3_owner..ut_coverage_cobertura_reporter to &ut3_user;
79+
grant execute on &&ut3_owner..ut_reporters to &ut3_user;
80+
grant execute on &&ut3_owner..ut_varchar2_list to &ut3_user;
81+
grant execute on &&ut3_owner..ut_varchar2_rows to &ut3_user;
82+
grant execute on &&ut3_owner..ut_integer_list to &ut3_user;
83+
grant execute on &&ut3_owner..ut_reporter_base to &ut3_user;
84+
grant execute on &&ut3_owner..ut_output_reporter_base to &ut3_user;
85+
grant execute on &&ut3_owner..ut_coverage_reporter_base to &ut3_user;
86+
grant execute on &&ut3_owner..ut_console_reporter_base to &ut3_user;
87+
grant execute on &&ut3_owner..ut_coverage to &ut3_user;
88+
grant execute on &&ut3_owner..ut_coverage_options to &ut3_user;
89+
grant execute on &&ut3_owner..ut_coverage_helper to &ut3_user;
90+
grant execute on &&ut3_owner..ut_output_buffer_base to &ut3_user;
91+
grant execute on &&ut3_owner..ut_output_table_buffer to &ut3_user;
92+
grant execute on &&ut3_owner..ut_file_mappings to &ut3_user;
93+
grant execute on &&ut3_owner..ut_file_mapping to &ut3_user;
94+
grant execute on &&ut3_owner..ut_file_mapper to &ut3_user;
95+
grant execute on &&ut3_owner..ut_key_value_pairs to &ut3_user;
96+
grant execute on &&ut3_owner..ut_key_value_pair to &ut3_user;
97+
grant select, insert, delete on &&ut3_owner..ut_compound_data_tmp to &ut3_user;
98+
grant select, insert, delete on &&ut3_owner..ut_compound_data_diff_tmp to &ut3_user;
99+
grant execute on &&ut3_owner..ut_sonar_test_reporter to &ut3_user;
100+
grant execute on &&ut3_owner..ut_annotations to &ut3_user;
101+
grant execute on &&ut3_owner..ut_annotation to &ut3_user;
102+
grant execute on &&ut3_owner..ut_annotation_manager to &ut3_user;
103+
grant execute on &&ut3_owner..ut_annotated_object to &ut3_user;
104+
grant execute on &&ut3_owner..ut_annotated_objects to &ut3_user;
105+
grant select on &&ut3_owner..ut_annotation_cache_info to &ut3_user;
106+
grant select on &&ut3_owner..ut_annotation_cache to &ut3_user;
107+
grant execute on &&ut3_owner..ut_annotation_cache_manager to &ut3_user;
108+
grant execute on &&ut3_owner..ut_annotation_parser to &ut3_user;
109+
grant execute on &&ut3_owner..ut_annotation_objs_cache_info to &ut3_user;
110+
grant execute on &&ut3_owner..ut_annotation_obj_cache_info to &ut3_user;
111+
begin
112+
$if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
113+
execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_blocks to &ut3_user';
114+
execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_runs to &ut3_user';
115+
execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_units to &ut3_user';
116+
$else
117+
null;
118+
$end
119+
end;
120+
/

source/create_synonyms_and_grants_for_user.sql renamed to source/create_user_synonyms.sql

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -51,75 +51,6 @@ whenever oserror exit failure rollback
5151

5252
alter session set current_schema = &&ut3_owner;
5353

54-
grant execute on &&ut3_owner..ut_be_between to &ut3_user;
55-
grant execute on &&ut3_owner..ut_be_empty to &ut3_user;
56-
grant execute on &&ut3_owner..ut_be_false to &ut3_user;
57-
grant execute on &&ut3_owner..ut_be_greater_or_equal to &ut3_user;
58-
grant execute on &&ut3_owner..ut_be_greater_than to &ut3_user;
59-
grant execute on &&ut3_owner..ut_be_less_or_equal to &ut3_user;
60-
grant execute on &&ut3_owner..ut_be_less_than to &ut3_user;
61-
grant execute on &&ut3_owner..ut_be_like to &ut3_user;
62-
grant execute on &&ut3_owner..ut_be_not_null to &ut3_user;
63-
grant execute on &&ut3_owner..ut_be_null to &ut3_user;
64-
grant execute on &&ut3_owner..ut_be_true to &ut3_user;
65-
grant execute on &&ut3_owner..ut_equal to &ut3_user;
66-
grant execute on &&ut3_owner..ut_have_count to &ut3_user;
67-
grant execute on &&ut3_owner..ut_match to &ut3_user;
68-
grant execute on &&ut3_owner..ut to &ut3_user;
69-
grant execute on &&ut3_owner..ut_runner to &ut3_user;
70-
grant execute on &&ut3_owner..ut_teamcity_reporter to &ut3_user;
71-
grant execute on &&ut3_owner..ut_xunit_reporter to &ut3_user;
72-
grant execute on &&ut3_owner..ut_junit_reporter to &ut3_user;
73-
grant execute on &&ut3_owner..ut_tfs_junit_reporter to &ut3_user;
74-
grant execute on &&ut3_owner..ut_documentation_reporter to &ut3_user;
75-
grant execute on &&ut3_owner..ut_coverage_html_reporter to &ut3_user;
76-
grant execute on &&ut3_owner..ut_coverage_sonar_reporter to &ut3_user;
77-
grant execute on &&ut3_owner..ut_coveralls_reporter to &ut3_user;
78-
grant execute on &&ut3_owner..ut_coverage_cobertura_reporter to &ut3_user;
79-
grant execute on &&ut3_owner..ut_reporters to &ut3_user;
80-
grant execute on &&ut3_owner..ut_varchar2_list to &ut3_user;
81-
grant execute on &&ut3_owner..ut_varchar2_rows to &ut3_user;
82-
grant execute on &&ut3_owner..ut_integer_list to &ut3_user;
83-
grant execute on &&ut3_owner..ut_reporter_base to &ut3_user;
84-
grant execute on &&ut3_owner..ut_output_reporter_base to &ut3_user;
85-
grant execute on &&ut3_owner..ut_coverage_reporter_base to &ut3_user;
86-
grant execute on &&ut3_owner..ut_console_reporter_base to &ut3_user;
87-
grant execute on &&ut3_owner..ut_coverage to &ut3_user;
88-
grant execute on &&ut3_owner..ut_coverage_options to &ut3_user;
89-
grant execute on &&ut3_owner..ut_coverage_helper to &ut3_user;
90-
grant execute on &&ut3_owner..ut_output_buffer_base to &ut3_user;
91-
grant execute on &&ut3_owner..ut_output_table_buffer to &ut3_user;
92-
grant execute on &&ut3_owner..ut_file_mappings to &ut3_user;
93-
grant execute on &&ut3_owner..ut_file_mapping to &ut3_user;
94-
grant execute on &&ut3_owner..ut_file_mapper to &ut3_user;
95-
grant execute on &&ut3_owner..ut_key_value_pairs to &ut3_user;
96-
grant execute on &&ut3_owner..ut_key_value_pair to &ut3_user;
97-
grant select, insert, delete on &&ut3_owner..ut_compound_data_tmp to &ut3_user;
98-
grant select, insert, delete on &&ut3_owner..ut_compound_data_diff_tmp to &ut3_user;
99-
grant execute on &&ut3_owner..ut_sonar_test_reporter to &ut3_user;
100-
grant execute on &&ut3_owner..ut_annotations to &ut3_user;
101-
grant execute on &&ut3_owner..ut_annotation to &ut3_user;
102-
grant execute on &&ut3_owner..ut_annotation_manager to &ut3_user;
103-
grant execute on &&ut3_owner..ut_annotated_object to &ut3_user;
104-
grant execute on &&ut3_owner..ut_annotated_objects to &ut3_user;
105-
grant select on &&ut3_owner..ut_annotation_cache_info to &ut3_user;
106-
grant select on &&ut3_owner..ut_annotation_cache to &ut3_user;
107-
grant execute on &&ut3_owner..ut_annotation_cache_manager to &ut3_user;
108-
grant execute on &&ut3_owner..ut_annotation_parser to &ut3_user;
109-
grant execute on &&ut3_owner..ut_annotation_objs_cache_info to &ut3_user;
110-
grant execute on &&ut3_owner..ut_annotation_obj_cache_info to &ut3_user;
111-
begin
112-
$if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
113-
execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_blocks to &ut3_user';
114-
execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_runs to &ut3_user';
115-
execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_units to &ut3_user';
116-
$else
117-
null;
118-
$end
119-
end;
120-
/
121-
122-
12354
prompt Creating synonyms for UTPLSQL objects in &&ut3_owner schema to user &&ut3_user
12455

12556
create or replace synonym &ut3_user..be_between for &&ut3_owner..be_between;

source/reporters/ut_junit_reporter.tpb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,15 @@ create or replace type body ut_junit_reporter is
5353
self.print_text('</error>');
5454
elsif a_test.result > ut_utils.gc_success then
5555
self.print_text('<failure>');
56-
self.print_text(c_cddata_tag_start);
5756
for i in 1 .. a_test.failed_expectations.count loop
5857

5958
l_lines := a_test.failed_expectations(i).get_result_lines();
6059

6160
for j in 1 .. l_lines.count loop
62-
self.print_text(l_lines(j));
61+
self.print_text(dbms_xmlgen.convert(l_lines(j)));
6362
end loop;
64-
self.print_text(a_test.failed_expectations(i).caller_info);
63+
self.print_text(dbms_xmlgen.convert(a_test.failed_expectations(i).caller_info));
6564
end loop;
66-
self.print_text(c_cddata_tag_end);
6765
self.print_text('</failure>');
6866
end if;
6967
-- TODO - decide if we need/want to use the <system-err/> tag too

source/reporters/ut_sonar_test_reporter.tpb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,12 @@ create or replace type body ut_sonar_test_reporter is
5656
self.print_text('</error>');
5757
elsif a_test.result > ut_utils.gc_success then
5858
self.print_text('<failure message="some expectations have failed">');
59-
self.print_text('<![CDATA[');
6059
for i in 1 .. a_test.failed_expectations.count loop
6160
l_lines := a_test.failed_expectations(i).get_result_lines();
6261
for i in 1 .. l_lines.count loop
63-
self.print_text(l_lines(i));
62+
self.print_text(dbms_xmlgen.convert(l_lines(i)));
6463
end loop;
6564
end loop;
66-
self.print_text(']]>');
6765
self.print_text('</failure>');
6866
end if;
6967
self.print_text('</testCase>');

source/reporters/ut_tfs_junit_reporter.tpb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,13 @@ create or replace type body ut_tfs_junit_reporter is
7676
-- Do not count error as failure
7777
elsif a_test.result = ut_utils.gc_failure then
7878
self.print_text('<failure type="failure" message="Test '||a_test.name||' failed">');
79-
self.print_text('<![CDATA[');
8079
for i in 1 .. a_test.failed_expectations.count loop
8180
l_lines := a_test.failed_expectations(i).get_result_lines();
8281
for j in 1 .. l_lines.count loop
83-
self.print_text(l_lines(j));
82+
self.print_text(dbms_xmlgen.convert(l_lines(j)));
8483
end loop;
85-
self.print_text(a_test.failed_expectations(i).caller_info);
84+
self.print_text(dbms_xmlgen.convert(a_test.failed_expectations(i).caller_info));
8685
end loop;
87-
self.print_text(']]>');
8886
self.print_text('</failure>');
8987
end if;
9088

0 commit comments

Comments
 (0)