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

Skip to content

Commit 3d2b483

Browse files
authored
Merge branch 'develop' into feature/test_performance
2 parents c15f4c2 + 88a3559 commit 3d2b483

11 files changed

Lines changed: 50 additions & 105 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ env:
5252
- ORACLE_VERSION="${DOCKER_TAG_11G:-11g-r2-xe}" CONNECTION_STR='127.0.0.1:1521/XE' DOCKER_OPTIONS='--shm-size=1g'
5353
- ORACLE_VERSION="${DOCKER_TAG_12C:-12c-r1-se2}" CONNECTION_STR='127.0.0.1:1521/ORCLPDB1' DOCKER_OPTIONS="-v /dev/pdbs:/opt/oracle/oradata/pdbs"
5454
- ORACLE_VERSION="${DOCKER_TAG_12C2:-12c-r2-se2}" CONNECTION_STR='127.0.0.1:1521/ORCLPDB1' DOCKER_OPTIONS="-v /dev/pdbs:/opt/oracle/oradata/pdbs"
55+
- ORACLE_VERSION="${DOCKER_TAG_18:-18c-se2}" CONNECTION_STR='127.0.0.1:1521/ORCLPDB1' DOCKER_OPTIONS="-v /dev/pdbs:/opt/oracle/oradata/pdbs"
5556

5657
cache:
5758
pip: true

.travis/download.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ fi
6060

6161
if [ "$PRODUCT" == "sqlcl" ]; then
6262
agreementUrl="http://www.oracle.com/technetwork/developer-tools/sqlcl/downloads/index.html"
63-
downloadUrl="http://download.oracle.com/otn/java/sqldeveloper/sqlcl-4.2.0.17.073.1038-no-jre.zip"
64-
outputFile=sqlcl-4.2.0.17.073.1038-no-jre.zip
63+
downloadUrl="http://download.oracle.com/otn/java/sqldeveloper/sqlcl-18.2.0.zip"
64+
outputFile=sqlcl-18.2.0.zip
6565
downloadFile $agreementUrl $downloadUrl $outputFile
6666
exit 0
6767
fi

.travis/install_sqlcl.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -e
33

4-
SQLCL_FILE=sqlcl-4.2.0.17.073.1038-no-jre.zip
4+
SQLCL_FILE=sqlcl-18.2.0.zip
55
cd .travis
66

77
# Download if not present on cache dir.

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ We are using private docker images to test utPLSQL for our Travis CI builds. The
175175
* 11g XE R2
176176
* 12c SE R1
177177
* 12c SE R2
178+
* 18c SE
178179

179180
These images are based on the slimmed versions [official dockerfiles released by Oracle](https://github.com/utPLSQL/docker-scripts), but due to licensing restrictions, we can't make the images public.
180181
You can build your own and use it locally, or push to a private docker repository.

docs/userguide/install.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ foreach ($i in $urlList) {
4949
}
5050
```
5151

52+
# Supported database versions
53+
54+
The utPLSQL may be installed on any supported version of Oracle Database [see](http://www.oracle.com/us/support/library/lifetime-support-technology-069183.pdf#page=6)
55+
* 11g R2
56+
* 12c
57+
* 12c R2
58+
* 18c
59+
5260
# Headless installation
5361

5462
To install the utPLSQL into a new database schema and grant it to public, execute the script `install_headless.sql` as SYSDBA.

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ If you have a great feature in mind, that you would like to see in utPLSQL v3 pl
192192
| Auto Compilation of Tests | Yes | No (Let us know if you use this) |
193193
| Assertion Library | 30 assertions<sup>2</sup> | 26 matchers (13 + 13 negated) |
194194
| Extendable assertions | No | Yes - custom matchers |
195-
| PLSQL Record Assertions | generated code through **utRecEq** Package | [possible on Oracle 12c](https://oracle-base.com/articles/12c/using-the-table-operator-with-locally-defined-types-in-plsql-12cr1) using [cursor matchers](docs/userguide/expectations.md#comparing-cursors)|
195+
| PLSQL Record Assertions | generated code through **utRecEq** Package | [possible on Oracle 12c+](https://oracle-base.com/articles/12c/using-the-table-operator-with-locally-defined-types-in-plsql-12cr1) using [cursor matchers](docs/userguide/expectations.md#comparing-cursors)|
196196
| Test Skeleton Generation | Yes | No (Let us know if you use this) |
197197
| **Test Execution<sup>3</sup>** | | |
198198
| Single Test Package Execution | Yes | Yes |

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.3.2140-develop';
24+
gc_version constant varchar2(50) := 'v3.1.3.2156-develop';
2525

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

test/api/test_ut_run.pkb

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -514,11 +514,27 @@ create or replace package body test_ut_run is
514514
end;
515515

516516
procedure create_test_suite is
517+
l_service_name varchar2(100);
517518
pragma autonomous_transaction;
518519
begin
520+
select global_name into l_service_name from global_name;
521+
execute immediate
522+
'create public database link db_loopback connect to ut3_tester identified by ut3
523+
using ''(DESCRIPTION=
524+
(ADDRESS=(PROTOCOL=TCP)
525+
(HOST='||sys_context('userenv','SERVER_HOST')||')
526+
(PORT=1521)
527+
)
528+
(CONNECT_DATA=(SERVICE_NAME='||l_service_name||')))''';
519529
execute immediate q'[
520530
create or replace package stateful_package as
531+
function get_state return varchar2;
532+
end;
533+
]';
534+
execute immediate q'[
535+
create or replace package body stateful_package as
521536
g_state varchar2(1) := 'A';
537+
function get_state return varchar2 is begin return g_state; end;
522538
end;
523539
]';
524540
execute immediate q'[
@@ -527,11 +543,11 @@ create or replace package body test_ut_run is
527543
--%suitepath(test_state)
528544

529545
--%test
530-
--%beforetest(acquire_state,recompile_in_background)
546+
--%beforetest(acquire_state_via_db_link,rebuild_stateful_package)
531547
procedure failing_stateful_test;
532548

533-
procedure recompile_in_background;
534-
procedure acquire_state;
549+
procedure rebuild_stateful_package;
550+
procedure acquire_state_via_db_link;
535551

536552
end;
537553
]';
@@ -540,39 +556,23 @@ create or replace package body test_ut_run is
540556

541557
procedure failing_stateful_test is
542558
begin
543-
ut3.ut.expect(stateful_package.g_state).to_equal('abc');
559+
ut3.ut.expect(stateful_package.get_state@db_loopback).to_equal('abc');
544560
end;
545561

546-
procedure recompile_in_background is
547-
l_job_name varchar2(30) := 'recreate_stateful_package';
548-
l_cnt integer := 1;
562+
procedure rebuild_stateful_package is
549563
pragma autonomous_transaction;
550564
begin
551-
dbms_scheduler.create_job(
552-
job_name => l_job_name,
553-
job_type => 'PLSQL_BLOCK',
554-
job_action => q'/
555-
begin
556-
execute immediate q'[
557-
create or replace package stateful_package as
558-
g_state varchar2(3) := 'abc';
559-
end;]';
560-
end;/',
561-
start_date => localtimestamp,
562-
enabled => TRUE,
563-
auto_drop => TRUE,
564-
comments => 'one-time job'
565-
);
566-
dbms_lock.sleep(1);
567-
while l_cnt > 0 loop
568-
select count(1) into l_cnt
569-
from dba_scheduler_running_jobs srj
570-
where srj.job_name = l_job_name;
571-
end loop;
565+
execute immediate q'[
566+
create or replace package body stateful_package as
567+
g_state varchar2(3) := 'abc';
568+
function get_state return varchar2 is begin return g_state; end;
569+
end;
570+
]';
572571
end;
573-
procedure acquire_state is
572+
573+
procedure acquire_state_via_db_link is
574574
begin
575-
dbms_output.put_line('stateful_package.g_state='||stateful_package.g_state);
575+
dbms_output.put_line('stateful_package.get_state@db_loopback='||stateful_package.get_state@db_loopback);
576576
end;
577577
end;
578578
}';
@@ -589,10 +589,9 @@ create or replace package body test_ut_run is
589589
failing_stateful_test [% sec] (FAILED - 1)%
590590
Failures:%
591591
1) failing_stateful_test
592-
ORA-04061: existing state of package "UT3_TESTER.STATEFUL_PACKAGE" has been invalidated
593-
ORA-04065: not executed, altered or dropped package "UT3_TESTER.STATEFUL_PACKAGE"
594-
ORA-06508: PL/SQL: could not find program unit being called: "UT3_TESTER.STATEFUL_PACKAGE"
595-
ORA-06512: at "UT3_TESTER.TEST_STATEFUL", line 5%
592+
ORA-04068: existing state of packages (DB_LOOPBACK) has been discarded
593+
ORA-04061: existing state of package body "UT3_TESTER.STATEFUL_PACKAGE" has been invalidated
594+
ORA-04065: not executed, altered or dropped package body "UT3_TESTER.STATEFUL_PACKAGE"%
596595
ORA-06512: at line 6%
597596
1 tests, 0 failed, 1 errored, 0 disabled, 0 warning(s)%';
598597

@@ -613,6 +612,7 @@ Failures:%
613612
begin
614613
execute immediate 'drop package stateful_package';
615614
execute immediate 'drop package test_stateful';
615+
begin execute immediate 'drop public database link db_loopback'; exception when others then null; end;
616616
end;
617617

618618
procedure run_in_invalid_state is

test/api/test_ut_run.pks

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ create or replace package test_ut_run is
7979
--%test(Executes successfully an empty suite)
8080
procedure run_func_empty_suite;
8181

82+
--disabled(Makes session wait for lock on 18.1 due to library cache pin wait)
8283
--%test(ut.run - raises after completing all tests if a test fails with ORA-04068 or ORA-04061)
8384
--%beforetest(create_test_suite)
8485
--%aftertest(drop_test_suite)

test/core/test_ut_executable.pkb

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -50,32 +50,6 @@ create or replace package body test_ut_executable is
5050
ut.expect(l_executable.get_error_stack_trace()).to_be_like('ORA-06501: PL/SQL: program error%');
5151
end;
5252

53-
procedure create_state_dependant_pkg is
54-
pragma autonomous_transaction;
55-
begin
56-
execute immediate q'[
57-
create or replace package stateful_package as
58-
g_state varchar2(1) := 'A';
59-
end;
60-
]';
61-
execute immediate q'[
62-
create or replace package state_dependant_pkg as
63-
procedure run;
64-
end;
65-
]';
66-
execute immediate q'[
67-
create or replace package body state_dependant_pkg as
68-
procedure run is
69-
x varchar2(30);
70-
begin
71-
if stateful_package.g_state = 'A' then
72-
dbms_output.put_line('stateful_package.g_state = "A"');
73-
end if;
74-
end;
75-
end;
76-
]';
77-
end;
78-
7953
procedure modify_stateful_package is
8054
l_job_name varchar2(30) := 'recreate_stateful_package';
8155
l_cnt integer := 1;
@@ -104,38 +78,6 @@ create or replace package body test_ut_executable is
10478
end loop;
10579
end;
10680

107-
procedure drop_state_dependant_pkg is
108-
pragma autonomous_transaction;
109-
begin
110-
execute immediate 'drop package state_dependant_pkg';
111-
execute immediate 'drop package stateful_package';
112-
end;
113-
114-
115-
procedure exec_invalid_state_proc is
116-
l_executable ut3.ut_executable;
117-
l_test ut3.ut_test;
118-
l_result boolean;
119-
begin
120-
--Arrange
121-
l_test := ut3.ut_test(a_object_name => 'state_dependant_pkg',a_name => 'state_dependant_pkg');
122-
l_executable := ut3.ut_executable_test( user, 'state_dependant_pkg', 'run', ut3.ut_utils.gc_test_execute );
123-
l_result := l_executable.do_execute(l_test);
124-
ut.expect(l_result).to_be_true;
125-
126-
modify_stateful_package;
127-
128-
l_test := ut3.ut_test(a_object_name => 'state_dependant_pkg',a_name => 'state_dependant_pkg');
129-
l_executable := ut3.ut_executable_test( user, 'state_dependant_pkg', 'run', ut3.ut_utils.gc_test_execute );
130-
--Act
131-
l_result := l_executable.do_execute(l_test);
132-
--Assert
133-
ut.expect(l_result).to_be_false;
134-
ut.expect(l_executable.serveroutput).to_be_null;
135-
ut.expect(l_executable.get_error_stack_trace()).to_be_like('ORA-04061: existing state of package "UT3_TESTER.STATEFUL_PACKAGE" has been invalidated%');
136-
ut.expect(ut3.ut_expectation_processor.invalidation_exception_found()).to_be_true;
137-
end;
138-
13981
procedure form_name is
14082
begin
14183
ut.expect(ut3.ut_executable_test( user, 'package', 'proc', null ).form_name()).to_equal(user||'.package.proc');

0 commit comments

Comments
 (0)