Skip to content

Commit 6b1dad8

Browse files
authored
Merge pull request #1059 from utPLSQL/feature/swap_develop_schema
Feature/swap develop schema
2 parents 8d37591 + 6e2a4b4 commit 6b1dad8

File tree

79 files changed

+2207
-2212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2207
-2212
lines changed

.travis.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ services:
1616

1717
env:
1818
global:
19-
- UT3_OWNER=ut3
20-
- UT3_OWNER_PASSWORD=ut3
21-
- UT3_RELEASE_VERSION_SCHEMA=UT3_LATEST_RELEASE
19+
- UT3_DEVELOP_SCHEMA=UT3_DEVELOP
20+
- UT3_DEVELOP_SCHEMA_PASSWORD=ut3
21+
- UT3_RELEASE_VERSION_SCHEMA=UT3
22+
- UT3_RELEASE_VERSION_SCHEMA_PASSWORD=ut3
2223
- UT3_USER="UT3\$USER#"
2324
- UT3_USER_PASSWORD=ut3
24-
- UT3_TESTER=ut3_tester
25+
- UT3_TESTER=UT3_TESTER
2526
- UT3_TESTER_PASSWORD=ut3
26-
- UT3_TESTER_HELPER=ut3_tester_helper
27+
- UT3_TESTER_HELPER=UT3_TESTER_HELPER
2728
- UT3_TESTER_HELPER_PASSWORD=ut3
2829
- UT3_TABLESPACE=users
2930
# Environment for building a release

.travis/install.sh

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
cd source
44
set -ev
55

6+
INSTALL_FILE="install_headless_with_trigger.sql"
7+
if [[ ! -f "${INSTALL_FILE}" ]]; then
8+
INSTALL_FILE="install_headless.sql"
9+
fi
10+
611
#install core of utplsql
712
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
813
whenever sqlerror exit failure rollback
@@ -11,33 +16,33 @@ set verify off
1116
1217
--alter session set plsql_warnings = 'ENABLE:ALL', 'DISABLE:(5004,5018,6000,6001,6003,6009,6010,7206)';
1318
alter session set plsql_optimize_level=0;
14-
@install_headless_with_trigger.sql $UT3_OWNER $UT3_OWNER_PASSWORD
19+
@${INSTALL_FILE} $UT3_DEVELOP_SCHEMA $UT3_DEVELOP_SCHEMA_PASSWORD
1520
SQL
1621

1722
#Run this step only on second child job (12.1 - at it's fastest)
1823
if [[ "${TRAVIS_JOB_NUMBER}" =~ \.2$ ]]; then
1924

2025
#check code-style for errors
21-
time "$SQLCLI" $UT3_OWNER/$UT3_OWNER_PASSWORD@//$CONNECTION_STR @../development/utplsql_style_check.sql
26+
time "$SQLCLI" $UT3_DEVELOP_SCHEMA/$UT3_DEVELOP_SCHEMA_PASSWORD@//$CONNECTION_STR @../development/utplsql_style_check.sql
2227

2328
#test install/uninstall process
2429
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
2530
set feedback off
2631
set verify off
2732
whenever sqlerror exit failure rollback
2833
29-
@uninstall_all.sql $UT3_OWNER
34+
@uninstall_all.sql $UT3_DEVELOP_SCHEMA
3035
whenever sqlerror exit failure rollback
3136
declare
3237
v_leftover_objects_count integer;
3338
begin
3439
select sum(cnt)
3540
into v_leftover_objects_count
3641
from (
37-
select count(1) cnt from dba_objects where owner = '$UT3_OWNER'
42+
select count(1) cnt from dba_objects where owner = '$UT3_DEVELOP_SCHEMA'
3843
where object_name not like 'PLSQL_PROFILER%' and object_name not like 'DBMSPCC_%'
3944
union all
40-
select count(1) cnt from dba_synonyms where table_owner = '$UT3_OWNER'
45+
select count(1) cnt from dba_synonyms where table_owner = '$UT3_DEVELOP_SCHEMA'
4146
where table_name not like 'PLSQL_PROFILER%' and table_name not like 'DBMSPCC_%'
4247
);
4348
if v_leftover_objects_count > 0 then
@@ -52,9 +57,9 @@ SQL
5257
set verify off
5358
5459
alter session set plsql_optimize_level=0;
55-
@install.sql $UT3_OWNER
56-
@install_ddl_trigger.sql $UT3_OWNER
57-
@create_synonyms_and_grants_for_public.sql $UT3_OWNER
60+
@install.sql $UT3_DEVELOP_SCHEMA
61+
@install_ddl_trigger.sql $UT3_DEVELOP_SCHEMA
62+
@create_synonyms_and_grants_for_public.sql $UT3_DEVELOP_SCHEMA
5863
SQL
5964

6065
fi
@@ -65,8 +70,8 @@ set feedback off
6570
whenever sqlerror exit failure rollback
6671
6772
--------------------------------------------------------------------------------
68-
PROMPT Adding back create-trigger privilege to $UT3_OWNER for testing
69-
grant administer database trigger to $UT3_OWNER;
73+
PROMPT Adding back create-trigger privilege to $UT3_DEVELOP_SCHEMA for testing
74+
grant administer database trigger to $UT3_DEVELOP_SCHEMA;
7075
7176
--------------------------------------------------------------------------------
7277
PROMPT Creating $UT3_TESTER - Power-user for testing internal framework code
@@ -76,27 +81,27 @@ grant create session, create procedure, create type, create table to $UT3_TESTER
7681
7782
grant execute on dbms_lock to $UT3_TESTER;
7883
79-
PROMPT Granting $UT3_OWNER code to $UT3_TESTER
84+
PROMPT Granting $UT3_DEVELOP_SCHEMA code to $UT3_TESTER
8085
8186
begin
8287
for i in (
8388
select object_name from all_objects t
8489
where t.object_type in ('PACKAGE','TYPE')
85-
and owner = 'UT3'
90+
and owner = '$UT3_DEVELOP_SCHEMA'
8691
and generated = 'N'
8792
and object_name not like 'SYS%')
8893
loop
89-
execute immediate 'grant execute on $UT3_OWNER."'||i.object_name||'" to $UT3_TESTER';
94+
execute immediate 'grant execute on $UT3_DEVELOP_SCHEMA."'||i.object_name||'" to $UT3_TESTER';
9095
end loop;
9196
end;
9297
/
9398
94-
PROMPT Granting $UT3_OWNER tables to $UT3_TESTER
99+
PROMPT Granting $UT3_DEVELOP_SCHEMA tables to $UT3_TESTER
95100
96101
begin
97-
for i in ( select table_name from all_tables t where owner = 'UT3' and nested = 'NO' and iot_name is null)
102+
for i in ( select table_name from all_tables t where owner = '$UT3_DEVELOP_SCHEMA' and nested = 'NO' and iot_name is null)
98103
loop
99-
execute immediate 'grant select on $UT3_OWNER.'||i.table_name||' to $UT3_TESTER';
104+
execute immediate 'grant select on $UT3_DEVELOP_SCHEMA.'||i.table_name||' to $UT3_TESTER';
100105
end loop;
101106
end;
102107
/
@@ -119,11 +124,11 @@ PROMPT Grants for testing distributed transactions
119124
grant create public database link to $UT3_TESTER_HELPER;
120125
grant drop public database link to $UT3_TESTER_HELPER;
121126
122-
PROMPT Grants for testing coverage outside of main UT3 schema.
127+
PROMPT Grants for testing coverage outside of main $UT3_DEVELOP_SCHEMA schema.
123128
grant create any procedure, drop any procedure, execute any procedure, create any type, drop any type, execute any type, under any type,
124129
select any table, update any table, insert any table, delete any table, create any table, drop any table, alter any table,
125130
select any dictionary, create any synonym, drop any synonym,
126-
grant any object privilege, grant any privilege
131+
grant any object privilege, grant any privilege, create public synonym, drop public synonym
127132
to $UT3_TESTER_HELPER;
128133
129134
grant create job to $UT3_TESTER_HELPER;

.travis/install_utplsql_release.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ set trimspool on
1111
declare
1212
i integer := 0;
1313
begin
14-
dbms_output.put_line('Dropping synonyms pointing to schema '||upper('${UT3_OWNER}'));
14+
dbms_output.put_line('Dropping synonyms pointing to schema '||upper('${UT3_DEVELOP_SCHEMA}'));
1515
for syn in (
1616
select
1717
case when owner = 'PUBLIC'
1818
then 'public synonym '
1919
else 'synonym ' || owner || '.' end || synonym_name as syn_name,
2020
table_owner||'.'||table_name as for_object
2121
from all_synonyms s
22-
where table_owner = upper('${UT3_OWNER}') and table_owner != owner
22+
where table_owner = upper('${UT3_DEVELOP_SCHEMA}') and table_owner != owner
2323
)
2424
loop
2525
i := i + 1;
@@ -28,7 +28,7 @@ begin
2828
dbms_output.put_line('Dropped '||syn.syn_name||' for object '||syn.for_object);
2929
exception
3030
when others then
31-
dbms_output.put_line('FAILED to drop '||syn.syn_name||' for object '||syn.for_object);
31+
dbms_output.put_line('FAILED to drop '||syn.syn_name||' for object '||syn.for_object||' with error '||sqlerrm);
3232
end;
3333
end loop;
3434
dbms_output.put_line(i||' synonyms dropped');
@@ -45,7 +45,7 @@ fi
4545
alter session set plsql_optimize_level=0;
4646
alter session set plsql_ccflags = 'SELF_TESTING_INSTALL:TRUE';
4747
48-
@${INSTALL_FILE} ${UT3_RELEASE_VERSION_SCHEMA}
48+
@${INSTALL_FILE} ${UT3_RELEASE_VERSION_SCHEMA} ${UT3_RELEASE_VERSION_SCHEMA_PASSWORD}
4949
exit
5050
SQL
5151

.travis/run_examples.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
#!/bin/bash
22

3+
cd "$(dirname "$(readlink -f "$0")")"/../examples
4+
35
set -ev
46

5-
"$SQLCLI" $UT3_OWNER/$UT3_OWNER_PASSWORD@//$CONNECTION_STR <<SQL
6-
whenever sqlerror exit failure rollback
7-
whenever oserror exit failure rollback
7+
"$SQLCLI" $UT3_DEVELOP_SCHEMA/$UT3_DEVELOP_SCHEMA_PASSWORD@//$CONNECTION_STR <<SQL
88
9-
cd examples
109
@RunAllExamplesAsTests.sql
1110
1211
exit
1312
14-
SQL
13+
SQL

CONTRIBUTING.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ Your local environment can be of any flavor (Unix/Linux/Windows/Mac).
4343
At minimum you need to have Oracle database 11.2 XE accessible for the project and SYS account access to install and develop utPLSQL.
4444

4545
We use four different database accounts (users) for development process.
46-
* `ut3_latest_release` - holds latest released version of utPLSQL. This schema holds the testing framework used for self-testing of utPLSQL development.
47-
* `ut3` - holds the version of utPLSQL of your current branch. This is the schema you will be working on.
46+
* `ut3` - holds latest released version of utPLSQL. This schema holds the testing framework used for self-testing of utPLSQL development.
47+
* `ut3_develop` - holds the version of utPLSQL of your current branch. This is the schema you will be working on.
4848
* `ut3_tester` - holds unit test packages for development of utPLSQL.
4949
* `ut3$user#` - used for testing accessibility to schema names with special characters.
50+
* `ut3_tester_helper` - elevated privileges user, used for creating and dropping objects in other schemas during test run.
5051

5152

5253

@@ -89,12 +90,6 @@ export CONNECTION_STR=127.0.0.1:1521/xe # Adjust the connect string
8990
export ORACLE_PWD=oracle # Adjust your local SYS password
9091
```
9192

92-
### Download Oracle JDBC drivers
93-
94-
Download `ojdbc8-xxx.jar` and `orai18n-xxx.jar` from [Oracle](https://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html).
95-
Place them in `development` directory of the project.
96-
97-
9893
### Download utPLSQL release sources and utplsq-cli
9994

10095
The below script is fetching latest release version from utPLSQL repository. Latest release version is used for self-testing.

development/cleanup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ set echo on
1010
begin
1111
for x in (
1212
select * from dba_objects
13-
where owner in ( upper('${UT3_RELEASE_VERSION_SCHEMA}'), upper('${UT3_OWNER}') )
13+
where owner in ( upper('${UT3_RELEASE_VERSION_SCHEMA}'), upper('${UT3_DEVELOP_SCHEMA}') )
1414
and object_name like 'SYS_PLSQL%')
1515
loop
1616
execute immediate 'drop type '||x.owner||'.'||x.object_name||' force';
1717
end loop;
1818
end;
1919
/
2020
21-
drop user ${UT3_OWNER} cascade;
21+
drop user ${UT3_DEVELOP_SCHEMA} cascade;
2222
drop user ${UT3_RELEASE_VERSION_SCHEMA} cascade;
2323
drop user ${UT3_TESTER} cascade;
2424
drop user ${UT3_TESTER_HELPER} cascade;

development/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if ! development/cleanup.sh; then
1111
exit 1
1212
fi
1313
if ! .travis/install.sh; then
14-
echo -e ${header}"\nFailed to install utPLSQL from current branch into ${UT3_OWNER} schema\n"${header}
14+
echo -e ${header}"\nFailed to install utPLSQL from current branch into ${UT3_DEVELOP_SCHEMA} schema\n"${header}
1515
exit 1
1616
fi
1717
if ! .travis/install_utplsql_release.sh; then

development/refresh_sources.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@ curl -Lk -o utPLSQL-cli.zip https://github.com/utPLSQL/utPLSQL-cli/releases/down
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

19-
cp development/*.jar utPLSQL-cli/lib/

development/refresh_ut3.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ git rev-parse && cd "$(git rev-parse --show-cdup)"
88
cd source
99

1010
"${SQLCLI}" sys/${ORACLE_PWD}@//${CONNECTION_STR} AS SYSDBA <<-SQL
11-
@uninstall ${UT3_OWNER}
12-
@install ${UT3_OWNER}
11+
@uninstall ${UT3_DEVELOP_SCHEMA}
12+
@install ${UT3_DEVELOP_SCHEMA}
1313
exit
1414
SQL

development/template.env.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ export UTPLSQL_CLI_VERSION="3.1.6"
88
export SELFTESTING_BRANCH=develop
99

1010
export UTPLSQL_DIR="utPLSQL_latest_release"
11-
export UT3_OWNER=ut3
12-
export UT3_OWNER_PASSWORD=ut3
13-
export UT3_RELEASE_VERSION_SCHEMA=ut3_latest_release
14-
export UT3_TESTER=ut3_tester
11+
export UT3_DEVELOP_SCHEMA=UT3_DEVELOP
12+
export UT3_DEVELOP_SCHEMA_PASSWORD=ut3
13+
export UT3_RELEASE_VERSION_SCHEMA=UT3
14+
export UT3_RELEASE_VERSION_SCHEMA_PASSWORD=ut3
15+
export UT3_TESTER=UT3_TESTER
1516
export UT3_TESTER_PASSWORD=ut3
16-
export UT3_TESTER_HELPER=ut3_tester_helper
17+
export UT3_TESTER_HELPER=UT3_TESTER_HELPER
1718
export UT3_TESTER_HELPER_PASSWORD=ut3
1819
export UT3_TABLESPACE=users
1920
export UT3_USER="UT3\$USER#"

0 commit comments

Comments
 (0)