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

Skip to content

Commit ace7812

Browse files
committed
Improvements to developer scripts. Changed the self-testing version to develop (for now).
Changed test_ut_utils to compile properly in Windows7 (UTF-8 using multi-byte emoji)
1 parent 9c6abb8 commit ace7812

6 files changed

Lines changed: 37 additions & 32 deletions

File tree

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ env:
4646
- DOCKHER_HUB_REPO="${DOCKER_BASE_TAG:-$UT3_DOCKER_REPO}"
4747
#utPLSQL released version directory
4848
- UTPLSQL_DIR="utPLSQL_latest_release"
49+
- UTPLSQL_CLI_FILE="utPLSQL-cli-develop-test3.zip"
4950
matrix:
5051
- ORACLE_VERSION="${DOCKER_TAG_11G:-11g-r2-xe}" CONNECTION_STR='127.0.0.1:1521/XE' DOCKER_OPTIONS='--shm-size=1g'
5152
- 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"
@@ -68,7 +69,7 @@ before_install:
6869
#- curl -LOk $(curl --silent https://api.github.com/repos/utPLSQL/utPLSQL/releases/latest | awk '/browser_download_url/ { print $2 }' | grep ".zip" | sed 's/"//g')
6970
- git clone --depth=1 --branch=${SELFTESTING_BRANCH:-master} https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR
7071
# download utPLSQL-cli develop
71-
- curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=utPLSQL-cli-develop-test3.zip
72+
- curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=${UTPLSQL_CLI_FILE}
7273

7374
install:
7475
#- unzip utPLSQL.zip

development/cleanup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ git rev-parse && cd "$(git rev-parse --show-cdup)"
66
. development/env.sh
77

88
"${SQLCLI}" sys/${ORACLE_PWD}@//${CONNECTION_STR} AS SYSDBA <<-SQL
9+
set echo on
910
drop user ${UT3_OWNER} cascade;
1011
drop user ${UT3_RELEASE_VERSION_SCHEMA} cascade;
1112
drop user ${UT3_TESTER} cascade;
@@ -15,7 +16,7 @@ begin
1516
for i in (
1617
select decode(owner,'PUBLIC','drop public synonym "','drop synonym "'||owner||'"."')|| synonym_name ||'"' drop_orphaned_synonym from dba_synonyms a
1718
where not exists (select null from dba_objects b where a.table_name=b.object_name and a.table_owner=b.owner )
18-
and a.table_owner in ('${UT3_OWNER}','${UT3_RELEASE_VERSION_SCHEMA}','${UT3_TESTER}','${UT3_USER}')
19+
and a.table_owner <> 'SYS'
1920
) loop
2021
execute immediate i.drop_orphaned_synonym;
2122
end loop;

development/refresh_sources.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ git clone --depth=1 --branch=${SELFTESTING_BRANCH:-master} https://github.com/ut
1212

1313
rm -rf utPLSQL-cli/*
1414
# download beta version of utPLSQL-cli
15-
curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=utPLSQL-cli-develop-test3.zip
15+
curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=${UTPLSQL_CLI_FILE}
1616
# unzip utPLSQL-cli and remove the zip file
1717
unzip utPLSQL-cli.zip && chmod u+x utPLSQL-cli/bin/utplsql && rm utPLSQL-cli.zip
1818

development/template.env.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ export SQLCLI=sql # For sqlcl client
44
#export SQLCLI=sqlplus # For sqlplus client
55
export CONNECTION_STR=127.0.0.1:1521/xe # Adjust the connect string
66
export ORACLE_PWD=oracle # Adjust your local SYS password
7+
export UTPLSQL_CLI_FILE="utPLSQL-cli-develop-test3.zip"
8+
export SELFTESTING_BRANCH=develop
79

810
export UTPLSQL_DIR="utPLSQL_latest_release"
9-
export SELFTESTING_BRANCH=master
1011
export UT3_OWNER=ut3
1112
export UT3_OWNER_PASSWORD=ut3
1213
export UT3_RELEASE_VERSION_SCHEMA=ut3_latest_release

test/install_and_run_tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22
set -ev
3+
#goto git root directory
4+
git rev-parse && cd "$(git rev-parse --show-cdup)"
35

46
cd test
57

test/ut_utils/test_ut_utils.pkb

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -53,33 +53,33 @@ end;]' using p_expected_list;
5353
common_clob_to_table_exec( 'abcdefg,hijk,axa,a', ',', ut3.ut_varchar2_list('abc','def','g','hij','k','axa','a'), 3);
5454
common_clob_to_table_exec( ',a,,c,d,', ',', ut3.ut_varchar2_list('','a','','c','d',''), 1000);
5555
end;
56-
56+
5757
procedure test_to_char is
5858
begin
5959
ut.expect(ut3.ut_utils.test_result_to_char(-1),'test unknown').to_equal('Unknown(-1)');
6060
ut.expect(ut3.ut_utils.test_result_to_char(null),'test unknown').to_equal('Unknown(NULL)');
6161
ut.expect(ut3.ut_utils.test_result_to_char(ut3.ut_utils.tr_success),'test unknown').to_equal(ut3.ut_utils.tr_success_char);
6262
end;
63-
63+
6464
procedure test_to_string_blob is
6565
l_text varchar2(32767) := 'A test char';
6666
l_value blob := utl_raw.cast_to_raw(l_text);
67-
l_expected varchar2(32767) := ''''||rawtohex(l_value)||'''';
67+
l_expected varchar2(32767) := ''''||rawtohex(l_value)||'''';
6868
l_result varchar2(32767);
6969
begin
7070
l_result := ut3.ut_utils.to_String(l_value);
7171
ut.expect(l_result).to_equal(l_expected);
7272
end;
73-
73+
7474
procedure test_to_string_clob is
7575
l_value clob := 'A test char';
7676
l_expected varchar2(32767) := ''''||l_value||'''';
7777
l_result varchar2(32767);
7878
begin
7979
l_result := ut3.ut_utils.to_String(l_value);
8080
ut.expect(l_result).to_equal(l_expected);
81-
end;
82-
81+
end;
82+
8383
procedure test_to_string_date is
8484
l_value date := to_date('2016-12-31 23:59:59', 'yyyy-mm-dd hh24:mi:ss');
8585
l_expected varchar2(100) := '2016-12-31T23:59:59';
@@ -88,7 +88,7 @@ end;]' using p_expected_list;
8888
l_result := ut3.ut_utils.to_String(l_value);
8989
ut.expect(l_result).to_equal(l_expected);
9090
end;
91-
91+
9292
procedure to_string_null is
9393
begin
9494
ut.expect(ut3.ut_utils.to_String(to_blob(NULL))).to_equal('NULL');
@@ -97,7 +97,7 @@ end;]' using p_expected_list;
9797
ut.expect(ut3.ut_utils.to_String(to_number(NULL))).to_equal('NULL');
9898
ut.expect(ut3.ut_utils.to_String(to_timestamp(NULL))).to_equal('NULL');
9999
end;
100-
100+
101101
procedure to_string is
102102
l_value timestamp(9) := to_timestamp('2016-12-31 23:59:59.123456789', 'yyyy-mm-dd hh24:mi:ss.ff');
103103
l_value2 timestamp(9) with local time zone:= to_timestamp('2016-12-31 23:59:59.123456789', 'yyyy-mm-dd hh24:mi:ss.ff');
@@ -109,25 +109,25 @@ end;]' using p_expected_list;
109109
begin
110110
select substr(value, 1, 1) into l_delimiter from nls_session_parameters t where t.parameter = 'NLS_NUMERIC_CHARACTERS';
111111
l_expected := '2016-12-31T23:59:59'||l_delimiter||'123456789';
112-
112+
113113
l_result := ut3.ut_utils.to_String(l_value);
114114
ut.expect(l_result,'Returns a full string representation of a timestamp with maximum precission').to_equal(l_expected);
115-
115+
116116
l_expected := '2016-12-31T23:59:59'||l_delimiter||'123456789';
117117
l_result := ut3.ut_utils.to_String(l_value2);
118-
ut.expect(l_result,'Returns a full string representation of a timestamp with maximum precission').to_equal(l_expected);
118+
ut.expect(l_result,'Returns a full string representation of a timestamp with maximum precission').to_equal(l_expected);
119119

120120
l_expected := '2016-12-31T23:59:59'||l_delimiter||'123456789 -08:00';
121-
121+
122122
l_result := ut3.ut_utils.to_String(l_value3);
123-
ut.expect(l_result,'Returns a full string representation of a timestamp with maximum precission').to_equal(l_expected);
124-
125-
l_expected := ''''||l_value4||'''';
123+
ut.expect(l_result,'Returns a full string representation of a timestamp with maximum precission').to_equal(l_expected);
124+
125+
l_expected := ''''||l_value4||'''';
126126
l_result := ut3.ut_utils.to_String(l_value4);
127-
ut.expect(l_result,'Returns a varchar2 eclosed in quotes').to_equal(l_expected);
128-
127+
ut.expect(l_result,'Returns a varchar2 eclosed in quotes').to_equal(l_expected);
128+
129129
end;
130-
130+
131131
procedure to_string_big_blob is
132132
l_text clob := lpad('A test char',32767,'1')||lpad('1',32767,'1');
133133
l_value blob;
@@ -162,7 +162,7 @@ end;]' using p_expected_list;
162162
ut.EXPECT(l_result).to_be_like('%'||ut3.ut_utils.gc_more_data_string);
163163

164164
end;
165-
165+
166166
procedure to_string_big_clob is
167167
l_value clob := lpad('A test char',32767,'1')||lpad('1',32767,'1');
168168
l_result varchar2(32767);
@@ -173,7 +173,7 @@ end;]' using p_expected_list;
173173
ut.EXPECT(length(l_result)).to_equal(ut3.ut_utils.gc_max_output_string_length);
174174
ut.EXPECT(l_result).to_be_like('%'||ut3.ut_utils.gc_more_data_string);
175175
end;
176-
176+
177177
procedure to_string_big_number is
178178
l_value number := 1234567890123456789012345678901234567890;
179179
l_expected varchar2(100) := '1234567890123456789012345678901234567890';
@@ -184,7 +184,7 @@ end;]' using p_expected_list;
184184
--Assert
185185
ut.expect(l_result).TO_equal(l_expected);
186186
end;
187-
187+
188188
procedure to_string_big_varchar2 is
189189
l_value varchar2(32767) := lpad('A test char',32767,'1');
190190
l_result varchar2(32767);
@@ -205,20 +205,20 @@ end;]' using p_expected_list;
205205
--Act
206206
select substr(value, 1, 1) into l_delimiter from nls_session_parameters t where t.parameter = 'NLS_NUMERIC_CHARACTERS';
207207
l_expected := l_delimiter||'123456789012345678901234567890123456789';
208-
208+
209209
l_result := ut3.ut_utils.to_String(l_value);
210-
210+
211211
--Assert
212212
ut.expect(l_result).TO_equal(l_expected);
213213

214214
end;
215-
215+
216216
procedure test_table_to_clob is
217217
procedure exec_table_to_clob(a_list ut3.ut_varchar2_list, a_delimiter varchar2, a_expected clob) is
218218
l_result clob;
219219
begin
220220
l_result := ut3.ut_utils.table_to_clob(a_list, a_delimiter);
221-
221+
222222
ut.expect(l_result).to_equal(a_expected, a_nulls_are_equal => true);
223223
end;
224224
begin
@@ -254,7 +254,7 @@ end;]' using p_expected_list;
254254
select value into gv_nls_value from nls_session_parameters where parameter = 'NLS_DATE_LANGUAGE';
255255
execute immediate 'alter session set nls_date_language=ENGLISH';
256256
execute immediate 'create or replace package tst_chars as
257-
-- 2) Status of the process = �PE� with no linked data
257+
-- 2) Status of the process = 😡PE😡 with no linked data
258258
end;';
259259
execute immediate 'alter session set nls_date_language=RUSSIAN';
260260

@@ -265,12 +265,12 @@ end;';
265265
execute immediate 'alter session set nls_date_language='||gv_nls_value;
266266
execute immediate 'drop package tst_chars';
267267
end;
268-
268+
269269
procedure test_clob_to_table_multibyte is
270270
l_varchar2_byte_limit integer := 32767;
271271
l_workaround_byte_limit integer := 8191;
272272
l_singlebyte_string_max_size varchar2(32767 char) := rpad('x',l_varchar2_byte_limit,'x');
273-
l_twobyte_character char(1 char) := '';
273+
l_twobyte_character char(1 char) := '😁';
274274
l_clob_multibyte clob := l_twobyte_character||l_singlebyte_string_max_size; --here we have 32769(2+32767) bytes and 32768 chars
275275
l_expected ut3.ut_varchar2_list := ut3.ut_varchar2_list();
276276
l_result ut3.ut_varchar2_list;

0 commit comments

Comments
 (0)