Skip to content

Commit 68a0184

Browse files
author
Gebal, Jacek
committed
Added a fix fr compatibility with v3.0.4.
In 3.0.4 the annotation parsing was changed and there is dependency on migration utility. Added build matrix to run agains all existing versions of utPSLQL v3.
1 parent 86d3fed commit 68a0184

File tree

3 files changed

+46
-13
lines changed

3 files changed

+46
-13
lines changed

.travis.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,21 @@ env:
2929
##utPLSQL variables
3030
- UTPLSQL_DIR="utPLSQL"
3131
- UTPLSQL_V2_DIR="utPLSQL_V2"
32+
matrix:
33+
- UTPLSQL_3_VERSION='v3.0.0'
34+
- UTPLSQL_3_VERSION='v3.0.1'
35+
- UTPLSQL_3_VERSION='v3.0.2'
36+
- UTPLSQL_3_VERSION='v3.0.3'
37+
- UTPLSQL_3_VERSION='v3.0.4'
38+
- UTPLSQL_3_VERSION='latest'
39+
3240
before_install:
3341
# download travis-oracle
3442
- wget 'https://github.com/cbandy/travis-oracle/archive/v2.0.3.tar.gz'
3543
- mkdir -p .travis/oracle
3644
- tar x -C .travis/oracle --strip-components=1 -f v2.0.3.tar.gz
3745
# download latest utPLSQL release
38-
- curl -LOk $(curl --silent https://api.github.com/repos/utPLSQL/utPLSQL/releases/latest | awk '/browser_download_url/ { print $2 }' | grep ".zip" | sed 's/"//g')
46+
- curl -LOk $(curl --silent https://api.github.com/repos/utPLSQL/utPLSQL/releases/${UTPLSQL_3_VERSION} | awk '/browser_download_url/ { print $2 }' | grep ".zip" | sed 's/"//g')
3947
- unzip -q utPLSQL.zip
4048
# download utPLSQL v.2.3.1 release
4149
- curl -LOk $(curl --silent https://api.github.com/repos/utPLSQL/utPLSQL/releases/3608515 | awk '/browser_download_url/ { print $2 }' | grep ".zip" | sed 's/"//g')

source/install.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ grant execute on utassert2 to public;
100100
grant execute on ut_v2_migration to public;
101101

102102
set echo off
103+
set feedback off
104+
whenever sqlerror continue
105+
create or replace public synonym ut_annotation_parser for &&utplsql_v3_owner..ut_annotation_parser;
106+
create or replace public synonym ut_annotations for &&utplsql_v3_owner..ut_annotations;
103107
prompt &&sep
104108
PROMPT Installation completed successfully
105109
prompt &&sep

source/migration/ut3.ut_v2_migration.pkb

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ create or replace package body ut_v2_migration is
2424
l_setup_proc varchar2(128 char) := upper(a_package_prefix || 'setup');
2525
l_teardown_proc varchar2(128 char) := upper(a_package_prefix || 'teardown');
2626
l_replace_pattern varchar2(50);
27-
l_annotations ut_annotations.typ_annotated_package;
2827
l_suite_desc varchar2(4000);
2928
l_suite_package varchar2(4000);
3029
begin
@@ -36,10 +35,31 @@ create or replace package body ut_v2_migration is
3635

3736
l_source := dbms_metadata.get_ddl('PACKAGE', l_resolved_object_name, l_resolved_owner);
3837

39-
l_annotations := ut_annotations.parse_package_annotations(l_source);
40-
41-
if l_annotations.package_annotations.exists('suite') then
42-
raise_application_error(-20400, 'Package '||a_packge_name||' is already version 3 compatible');
38+
if ut.version like '%v3.0.0%' or ut.version like '%v3.0.1%' or ut.version like '%v3.0.2%' or ut.version like '%v3.0.3%' then
39+
execute immediate q'[
40+
declare
41+
l_annotations ut_annotations.typ_annotated_package := ut_annotations.parse_package_annotations(:l_source);
42+
begin
43+
if l_annotations.package_annotations.exists('suite') then
44+
raise_application_error(-20400, 'Package '||:a_packge_name||' is already version 3 compatible');
45+
end if;
46+
end;
47+
]' using l_source, a_packge_name;
48+
else
49+
execute immediate q'[
50+
declare
51+
l_exists integer;
52+
begin
53+
dbms_output.put_line('checking annotations');
54+
select 1
55+
into l_exists
56+
from table( ut_annotation_parser.parse_object_annotations( :l_source ) )
57+
where name = 'suite';
58+
raise_application_error(-20400, 'Package '||:a_packge_name||' is already version 3 compatible');
59+
exception
60+
when no_data_found then
61+
null;
62+
end;]' using l_source, a_packge_name;
4363
end if;
4464

4565
if trim(a_package_desc) is not null then
@@ -110,28 +130,29 @@ create or replace package body ut_v2_migration is
110130
dbms_metadata.set_transform_param(dbms_metadata.session_transform,'BODY',false);
111131

112132
for rec in (select p.owner
113-
,upper(case when p.samepackage='N' then p.prefix end || p.name) as name
133+
,p.name
114134
,p.description as package_desc
115135
,nvl(p.prefix, c.prefix) prefix
116136
,s.name suite_name
117137
,s.description as suite_desc
118138
,o.status
119-
from utp.ut_package p
120-
,utp.ut_suite s
121-
,utp.ut_config c
139+
from UTP.ut_package p
140+
,UTP.ut_suite s
141+
,UTP.ut_config c
122142
,all_objects o
123143
where p.id in (select max(p2.id) keep(dense_rank first order by p2.suite_id desc nulls last)
124-
from utp.ut_package p2
144+
from UTP.ut_package p2
125145
group by upper(p2.owner)
126-
,upper(case when p2.samepackage='N' then p.prefix end || p2.name))
146+
,upper(p2.name))
127147
and p.suite_id = s.id(+)
128148
and p.owner = c.username(+)
129149
and p.owner = o.owner
130-
and upper(case when p.samepackage='N' then p.prefix end || p.name) = o.object_name
150+
and p.name = o.object_name
131151
and o.object_type in ('PACKAGE')
132152
and p.owner = nvl(a_owner_name, p.owner)
133153
and p.name = nvl(a_package_name, p.name)
134154
and (s.name = a_suite_name or a_suite_name is null)
155+
and upper(p.name) like upper(nvl(p.prefix, c.prefix))||'%'
135156
) loop
136157
begin
137158
l_items_processed := l_items_processed +1;

0 commit comments

Comments
 (0)