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

Skip to content

Commit 1f31a8b

Browse files
committed
Merge branch 'develop' into feature/filtering_obj_coll_by_attribute_xpath
# Conflicts: # source/core/ut_utils.pkb # source/core/ut_utils.pks
2 parents d12bec1 + 55fe15f commit 1f31a8b

31 files changed

Lines changed: 274 additions & 167 deletions

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ addons:
88
# Java8 Required for Sonar and SQLCL
99
- oracle-java8-installer
1010
- oracle-java8-set-default
11-
sonarqube:
11+
sonarcloud:
12+
organization: utplsql
1213
token:
1314
secure: ${SONAR_TOKEN}
1415
branches:
@@ -40,7 +41,7 @@ env:
4041
- ORACLE_PWD="oracle"
4142
matrix:
4243
- ORACLE_VERSION="11g-xe-r2" CONNECTION_STR='127.0.0.1:1521/XE' DOCKER_OPTIONS='--shm-size=1g'
43-
- ORACLE_VERSION="12c-se2-r1-v2" CONNECTION_STR='127.0.0.1:1521/ORCLPDB1' DOCKER_OPTIONS="-v /dev/pdbs:/opt/oracle/oradata/pdbs"
44+
- ORACLE_VERSION="12c-se2-r1-v2" CONNECTION_STR='127.0.0.1:1521/ORCLPDB1' DOCKER_OPTIONS="-v /dev/pdbs:/opt/oracle/oradata/pdbs"
4445
- ORACLE_VERSION="12c-se-r2-v4" CONNECTION_STR='127.0.0.1:1521/ORCLPDB1' DOCKER_OPTIONS="-v /dev/pdbs:/opt/oracle/oradata/pdbs"
4546

4647
cache:

.travis/install.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ pwd
88
set feedback off
99
set verify off
1010
11-
--@../source/create_utplsql_owner.sql $UT3_OWNER $UT3_OWNER_PASSWORD $UT3_TABLESPACE
12-
@../source/install_headless.sql
11+
@../source/install_headless.sql $UT3_OWNER $UT3_OWNER_PASSWORD
12+
SQL
1313

14+
"$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
1415
set feedback on
15-
--change the deafult password
16-
alter user $UT3_OWNER identified by $UT3_OWNER_PASSWORD;
1716
--needed for Mystats script to work
1817
grant select any dictionary to $UT3_OWNER;
1918
--Needed for testing a coverage outside ut3_owner.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v3.0.0
1+
v3.0.2

sonar-project.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# must be unique in a given SonarQube instance
2-
sonar.projectKey=utPLSQL:utPLSQL
2+
sonar.projectKey=utPLSQL
33
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
44
sonar.projectName=utPLSQL
5-
sonar.projectVersion=v3.0.0
5+
sonar.projectVersion=v3.0.2
66

77
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
88
# Since SonarQube 4.2, this property is optional if sonar.modules is set.

source/api/ut_runner.pkb

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -53,130 +53,136 @@ create or replace package body ut_runner is
5353
procedure run(
5454
a_paths ut_varchar2_list, a_reporters ut_reporters, a_color_console boolean := false,
5555
a_coverage_schemes ut_varchar2_list := null, a_source_file_mappings ut_file_mappings := null, a_test_file_mappings ut_file_mappings := null,
56-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
56+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
5757
) is
5858
l_items_to_run ut_run;
5959
l_listener ut_event_listener;
60-
l_coverage_options ut_coverage_options;
6160
begin
62-
ut_output_buffer.cleanup_buffer();
61+
begin
62+
ut_output_buffer.cleanup_buffer();
63+
64+
ut_console_reporter_base.set_color_enabled(a_color_console);
65+
if a_reporters is null or a_reporters.count = 0 then
66+
l_listener := ut_event_listener(ut_reporters(ut_documentation_reporter()));
67+
else
68+
l_listener := ut_event_listener(a_reporters);
69+
end if;
70+
l_items_to_run := ut_run(
71+
ut_suite_manager.configure_execution_by_path(a_paths),
72+
a_paths,
73+
ut_utils.convert_collection(a_coverage_schemes),
74+
to_ut_object_list(a_exclude_objects),
75+
to_ut_object_list(a_include_objects),
76+
set(a_source_file_mappings),
77+
set(a_test_file_mappings)
78+
);
79+
l_items_to_run.do_execute(l_listener);
6380

64-
ut_console_reporter_base.set_color_enabled(a_color_console);
65-
if a_reporters is null or a_reporters.count = 0 then
66-
l_listener := ut_event_listener(ut_reporters(ut_documentation_reporter()));
67-
else
68-
l_listener := ut_event_listener(a_reporters);
69-
end if;
70-
l_coverage_options := ut_coverage_options(
71-
schema_names => a_coverage_schemes,
72-
exclude_objects => to_ut_object_list(a_exclude_objects),
73-
include_objects => to_ut_object_list(a_include_objects),
74-
file_mappings => set(a_source_file_mappings)
75-
);
76-
l_items_to_run := ut_run( ut_suite_manager.configure_execution_by_path(a_paths), a_paths, l_coverage_options, set(a_test_file_mappings) );
77-
l_items_to_run.do_execute(l_listener);
78-
79-
cleanup_temp_tables;
80-
ut_output_buffer.close(l_listener.reporters);
81-
exception
82-
when others then
8381
cleanup_temp_tables;
8482
ut_output_buffer.close(l_listener.reporters);
85-
dbms_output.put_line(dbms_utility.format_error_backtrace);
86-
dbms_output.put_line(dbms_utility.format_error_stack);
87-
raise;
83+
exception
84+
when others then
85+
cleanup_temp_tables;
86+
ut_output_buffer.close(l_listener.reporters);
87+
dbms_output.put_line(dbms_utility.format_error_backtrace);
88+
dbms_output.put_line(dbms_utility.format_error_stack);
89+
raise;
90+
end;
91+
if a_fail_on_errors and l_items_to_run.result in (ut_utils.tr_failure, ut_utils.tr_error) then
92+
raise_application_error(ut_utils.gc_some_tests_failed, 'Some tests failed');
93+
end if;
8894
end;
8995

9096
procedure run(
9197
a_paths ut_varchar2_list, a_reporters ut_reporters, a_color_console boolean := false,
9298
a_coverage_schemes ut_varchar2_list := null, a_source_files ut_varchar2_list, a_test_files ut_varchar2_list,
93-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
99+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
94100
) is
95101
begin
96102
run(
97103
a_paths, a_reporters, a_color_console, a_coverage_schemes,
98104
ut_file_mapper.build_file_mappings(a_source_files),
99105
ut_file_mapper.build_file_mappings(a_test_files),
100-
a_include_objects, a_exclude_objects
106+
a_include_objects, a_exclude_objects, a_fail_on_errors
101107
);
102108
end;
103109

104110
procedure run(
105111
a_paths ut_varchar2_list, a_reporter ut_reporter_base := null, a_color_console boolean := false,
106112
a_coverage_schemes ut_varchar2_list := null, a_source_file_mappings ut_file_mappings := null, a_test_file_mappings ut_file_mappings := null,
107-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
113+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
108114
) is
109115
begin
110116
run(
111117
a_paths, ut_reporters(coalesce(a_reporter,ut_documentation_reporter())),
112118
a_color_console, a_coverage_schemes, a_source_file_mappings, a_test_file_mappings,
113-
a_include_objects, a_exclude_objects
119+
a_include_objects, a_exclude_objects, a_fail_on_errors
114120
);
115121
end;
116122

117123
procedure run(
118124
a_paths ut_varchar2_list, a_reporter ut_reporter_base := null, a_color_console boolean := false,
119125
a_coverage_schemes ut_varchar2_list := null, a_source_files ut_varchar2_list, a_test_files ut_varchar2_list,
120-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
126+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
121127
) is
122128
begin
123129
run(
124130
a_paths, ut_reporters(coalesce(a_reporter,ut_documentation_reporter())),
125131
a_color_console, a_coverage_schemes, a_source_files, a_test_files,
126-
a_include_objects, a_exclude_objects
132+
a_include_objects, a_exclude_objects, a_fail_on_errors
127133
);
128134
end;
129135

130136

131137
procedure run(
132138
a_path in varchar2, a_reporter ut_reporter_base := null, a_color_console boolean := false,
133139
a_coverage_schemes ut_varchar2_list := null, a_source_file_mappings ut_file_mappings := null, a_test_file_mappings ut_file_mappings := null,
134-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
140+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
135141
) is
136142
begin
137143
run(
138144
ut_varchar2_list(coalesce(a_path, sys_context('userenv', 'current_schema'))),
139145
a_reporter, a_color_console, a_coverage_schemes, a_source_file_mappings, a_test_file_mappings,
140-
a_include_objects, a_exclude_objects
146+
a_include_objects, a_exclude_objects, a_fail_on_errors
141147
);
142148
end run;
143149

144150
procedure run(
145151
a_path in varchar2, a_reporter ut_reporter_base := null, a_color_console boolean := false,
146152
a_coverage_schemes ut_varchar2_list := null, a_source_files ut_varchar2_list, a_test_files ut_varchar2_list,
147-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
153+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
148154
) is
149155
begin
150156
run(
151157
ut_varchar2_list(coalesce(a_path, sys_context('userenv', 'current_schema'))),
152158
a_reporter, a_color_console, a_coverage_schemes, a_source_files, a_test_files,
153-
a_include_objects, a_exclude_objects
159+
a_include_objects, a_exclude_objects, a_fail_on_errors
154160
);
155161
end run;
156162

157163
procedure run(
158164
a_path in varchar2, a_reporters in ut_reporters, a_color_console boolean := false,
159165
a_coverage_schemes ut_varchar2_list := null, a_source_file_mappings ut_file_mappings := null, a_test_file_mappings ut_file_mappings := null,
160-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
166+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
161167
) is
162168
begin
163169
run(
164170
ut_varchar2_list(coalesce(a_path, sys_context('userenv', 'current_schema'))),
165171
a_reporters, a_color_console, a_coverage_schemes, a_source_file_mappings, a_test_file_mappings,
166-
a_include_objects, a_exclude_objects
172+
a_include_objects, a_exclude_objects, a_fail_on_errors
167173
);
168174
end run;
169175

170176
procedure run(
171177
a_path in varchar2, a_reporters in ut_reporters, a_color_console boolean := false,
172178
a_coverage_schemes ut_varchar2_list := null, a_source_files ut_varchar2_list, a_test_files ut_varchar2_list,
173-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
179+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
174180
) is
175181
begin
176182
run(
177183
ut_varchar2_list(coalesce(a_path, sys_context('userenv', 'current_schema'))),
178184
a_reporters, a_color_console, a_coverage_schemes, a_source_files, a_test_files,
179-
a_include_objects, a_exclude_objects
185+
a_include_objects, a_exclude_objects, a_fail_on_errors
180186
);
181187
end run;
182188

source/api/ut_runner.pks

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,51 +36,51 @@ create or replace package ut_runner authid current_user is
3636
procedure run(
3737
a_path varchar2 := null, a_reporter ut_reporter_base := null, a_color_console boolean := false,
3838
a_coverage_schemes ut_varchar2_list := null, a_source_file_mappings ut_file_mappings := null, a_test_file_mappings ut_file_mappings := null,
39-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
39+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
4040
);
4141

4242
procedure run(
4343
a_path varchar2 := null, a_reporter ut_reporter_base := null, a_color_console boolean := false,
4444
a_coverage_schemes ut_varchar2_list := null, a_source_files ut_varchar2_list, a_test_files ut_varchar2_list,
45-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
45+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
4646
);
4747

4848
procedure run(
4949
a_path varchar2, a_reporters ut_reporters, a_color_console boolean := false,
5050
a_coverage_schemes ut_varchar2_list := null, a_source_file_mappings ut_file_mappings := null, a_test_file_mappings ut_file_mappings := null,
51-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
51+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
5252
);
5353

5454
procedure run(
5555
a_path varchar2, a_reporters ut_reporters, a_color_console boolean := false,
5656
a_coverage_schemes ut_varchar2_list := null, a_source_files ut_varchar2_list, a_test_files ut_varchar2_list,
57-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
57+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
5858
);
5959

6060
-- TODO - implementation to be changed
6161
procedure run(
6262
a_paths ut_varchar2_list, a_reporter ut_reporter_base := null, a_color_console boolean := false,
6363
a_coverage_schemes ut_varchar2_list := null, a_source_file_mappings ut_file_mappings := null, a_test_file_mappings ut_file_mappings := null,
64-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
64+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
6565
);
6666

6767
procedure run(
6868
a_paths ut_varchar2_list, a_reporter ut_reporter_base := null, a_color_console boolean := false,
6969
a_coverage_schemes ut_varchar2_list := null, a_source_files ut_varchar2_list, a_test_files ut_varchar2_list,
70-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
70+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
7171
);
7272

7373
-- TODO - implementation to be changed
7474
procedure run(
7575
a_paths ut_varchar2_list, a_reporters ut_reporters, a_color_console boolean := false,
7676
a_coverage_schemes ut_varchar2_list := null, a_source_file_mappings ut_file_mappings := null, a_test_file_mappings ut_file_mappings := null,
77-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
77+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
7878
);
7979

8080
procedure run(
8181
a_paths ut_varchar2_list, a_reporters ut_reporters, a_color_console boolean := false,
8282
a_coverage_schemes ut_varchar2_list := null, a_source_files ut_varchar2_list, a_test_files ut_varchar2_list,
83-
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null
83+
a_include_objects ut_varchar2_list := null, a_exclude_objects ut_varchar2_list := null, a_fail_on_errors boolean default false
8484
);
8585

8686
end ut_runner;

source/core/coverage/ut_coverage.pkb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ create or replace package body ut_coverage is
149149
type t_source_lines is table of binary_integer;
150150
l_source_lines t_source_lines;
151151
line_no binary_integer;
152-
l_schema_names ut_varchar2_list;
152+
l_schema_names ut_varchar2_rows;
153153
l_query varchar2(32767);
154154
begin
155-
l_schema_names := coalesce(a_coverage_options.schema_names, ut_varchar2_list(sys_context('USERENV','CURRENT_SCHEMA')));
155+
l_schema_names := coalesce(a_coverage_options.schema_names, ut_varchar2_rows(sys_context('USERENV','CURRENT_SCHEMA')));
156156

157157
if not ut_coverage_helper.is_develop_mode() then
158158
--skip all the utplsql framework objects and all the unit test packages that could potentially be reported by coverage.

source/core/coverage/ut_coverage_reporter_base.tpb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ create or replace type body ut_coverage_reporter_base is
1717
*/
1818

1919
overriding final member procedure before_calling_run(self in out nocopy ut_coverage_reporter_base, a_run ut_run) as
20-
l_schema_names ut_varchar2_list := a_run.get_run_schemes();
2120
begin
2221
(self as ut_reporter_base).before_calling_run(a_run);
2322
ut_coverage.coverage_start();

source/core/types/ut_coverage_options.tps

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ create or replace type ut_coverage_options as object (
1616
limitations under the License.
1717
*/
1818

19-
schema_names ut_varchar2_list,
19+
schema_names ut_varchar2_rows,
2020
exclude_objects ut_object_names,
2121
include_objects ut_object_names,
2222
file_mappings ut_file_mappings

source/core/types/ut_executable.tpb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,16 @@ create or replace type body ut_executable is
6666
end do_execute;
6767

6868
member function do_execute(self in out nocopy ut_executable, a_item in out nocopy ut_suite_item, a_listener in out nocopy ut_event_listener_base) return boolean is
69-
l_statement varchar2(4000);
70-
l_status number;
71-
l_cursor_number number;
72-
l_owner varchar2(200) := self.owner_name;
73-
l_object_name varchar2(200) := self.object_name;
74-
l_procedure_name varchar2(200) := self.procedure_name;
69+
l_statement varchar2(4000);
70+
l_status number;
71+
l_cursor_number number;
72+
l_owner varchar2(200) := self.owner_name;
73+
l_object_name varchar2(200) := self.object_name;
74+
l_procedure_name varchar2(200) := self.procedure_name;
7575

7676
l_completed_without_errors boolean := true;
77-
77+
l_start_transaction_id varchar2(250);
78+
l_end_transaction_id varchar2(250);
7879
procedure save_dbms_output is
7980
l_status number;
8081
l_line varchar2(32767);
@@ -94,6 +95,7 @@ create or replace type body ut_executable is
9495
end save_dbms_output;
9596
begin
9697
if self.is_defined() then
98+
l_start_transaction_id := dbms_transaction.local_transaction_id(true);
9799
--listener - before call to executable
98100
a_listener.fire_before_event(self.associated_event_name, a_item);
99101

@@ -135,9 +137,15 @@ create or replace type body ut_executable is
135137

136138
l_completed_without_errors := (self.error_stack||self.error_backtrace) is null;
137139

138-
a_listener.fire_after_event(self.associated_event_name, a_item);
139140
--listener - after call to executable
141+
a_listener.fire_after_event(self.associated_event_name, a_item);
142+
143+
l_end_transaction_id := dbms_transaction.local_transaction_id();
144+
if l_start_transaction_id != l_end_transaction_id or l_end_transaction_id is null then
145+
a_item.add_transaction_invalidator(self.form_name());
146+
end if;
140147
end if;
148+
141149
return l_completed_without_errors;
142150
end do_execute;
143151

0 commit comments

Comments
 (0)