Skip to content

Commit 703824d

Browse files
authored
Merge pull request #51 from utPLSQL/release/3.1.3
Added tags and random test execution parameters
2 parents 6f4b203 + 275e9ea commit 703824d

20 files changed

+455
-213
lines changed

.travis.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ cache:
3434
install:
3535
- bash .travis/maven_cfg.sh
3636
- bash .travis/start_db.sh
37-
- bash .travis/install_utplsql.sh $DB_UT3_USER $DB_UT3_PASS
37+
- bash .travis/install_utplsql.sh
3838
- bash .travis/install_demo_project.sh
39-
- bash .travis/install_demo_owner_project.sh
4039

4140
script:
4241
- echo "Run Unit Tests"
@@ -46,8 +45,8 @@ script:
4645
- mvn sonar:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin
4746

4847
before_deploy:
49-
- echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import
50-
- echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust
48+
- echo $GPG_SECRET_KEYS | base64 --decode | ${GPG_EXECUTABLE} --import
49+
- echo $GPG_OWNERTRUST | base64 --decode | ${GPG_EXECUTABLE} --import-ownertrust
5150

5251
deploy:
5352
- provider: script

.travis/install_demo_owner_project.sh

-50
This file was deleted.

.travis/install_demo_project.sh

+11-28
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,18 @@
11
#!/bin/bash
22
set -ev
33

4-
PROJECT_FILES_SRC="src/it/resources/simple-project"
5-
PROJECT_FILES="resources"
6-
DB_USER=app
7-
DB_PASS=app
4+
DB_URL="//127.0.0.1:1521/XE"
5+
SQLPLUS_IMAGE=${DOCKER_REPO}:${ORACLE_VERSION}
6+
VOLUME="/project"
87

9-
cat > demo_project.sh.tmp <<EOF
10-
sqlplus -S -L sys/oracle@//127.0.0.1:1521/xe AS SYSDBA <<SQL
11-
create user ${DB_USER} identified by ${DB_PASS} quota unlimited on USERS default tablespace USERS;
12-
grant create session, create procedure, create type, create table, create sequence, create view to ${DB_USER};
13-
grant select any dictionary to ${DB_USER};
14-
exit
15-
SQL
8+
docker run --rm -v $(pwd):${VOLUME} -w ${VOLUME} --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \
9+
sys/oracle@${DB_URL} as sysdba @.travis/sql/create_users.sql
1610

17-
cd ${PROJECT_FILES}
18-
sqlplus -S -L ${DB_USER}/${DB_PASS}@//127.0.0.1:1521/xe <<SQL
19-
whenever sqlerror exit failure rollback
20-
whenever oserror exit failure rollback
11+
docker run --rm -v $(pwd):${VOLUME} -w ${VOLUME} --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \
12+
app/pass@${DB_URL} @.travis/sql/create_app_objects.sql
2113

22-
@scripts/sources/TO_TEST_ME.tab
23-
@scripts/sources/APP.PKG_TEST_ME.spc
24-
@scripts/sources/APP.PKG_TEST_ME.bdy
14+
docker run --rm -v $(pwd):${VOLUME} -w ${VOLUME} --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \
15+
code_owner/pass@${DB_URL} @.travis/sql/create_source_owner_objects.sql
2516

26-
@scripts/tests/APP.TEST_PKG_TEST_ME.spc
27-
@scripts/tests/APP.TEST_PKG_TEST_ME.bdy
28-
29-
exit
30-
SQL
31-
EOF
32-
33-
docker cp ./$PROJECT_FILES_SRC $ORACLE_VERSION:/$PROJECT_FILES
34-
docker cp ./demo_project.sh.tmp $ORACLE_VERSION:/demo_project.sh
35-
docker exec $ORACLE_VERSION bash demo_project.sh
17+
docker run --rm -v $(pwd):${VOLUME} -w ${VOLUME} --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \
18+
tests_owner/pass@${DB_URL} @.travis/sql/create_tests_owner_objects.sql

.travis/install_utplsql.sh

+8-40
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,13 @@
22
set -ev
33
cd $(dirname $(readlink -f $0))
44

5-
# Download the specified version of utPLSQL.
6-
UTPLSQL_VERSION="v3.0.4"
7-
UTPLSQL_FILE="utPLSQL"
8-
curl -L -O "https://github.com/utPLSQL/utPLSQL/releases/download/$UTPLSQL_VERSION/$UTPLSQL_FILE.tar.gz"
5+
DB_URL="//127.0.0.1:1521/XE"
6+
UTPLSQL_VERSION="v3.1.9"
7+
UTPLSQL_DIR="utPLSQL"
8+
SQLPLUS_IMAGE=${DOCKER_REPO}:${ORACLE_VERSION}
9+
VOLUME="/utPLSQL"
910

10-
# Download develop branch of utPLSQL.
11-
#UTPLSQL_VERSION="develop"
12-
#UTPLSQL_FILE="utPLSQL"
13-
#git clone -b develop --single-branch https://github.com/utPLSQL/utPLSQL.git
14-
# tar -czf $UTPLSQL_FILE.tar.gz $UTPLSQL_FILE && rm -rf $UTPLSQL_FILE
11+
git clone --depth=1 --branch=${UTPLSQL_VERSION} https://github.com/utPLSQL/utPLSQL.git ${UTPLSQL_DIR}
1512

16-
# Create a temporary install script.
17-
cat > install.sh.tmp <<EOF
18-
tar -xzf ${UTPLSQL_FILE}.tar.gz && rm ${UTPLSQL_FILE}.tar.gz
19-
cd ${UTPLSQL_FILE}/source
20-
sqlplus -S -L sys/oracle@//127.0.0.1:1521/xe AS SYSDBA @install_headless.sql $1 $2 users
21-
22-
sqlplus -S -L sys/oracle@//127.0.0.1:1521/xe AS SYSDBA << SQL
23-
grant execute any procedure to $1;
24-
grant create any procedure to $1;
25-
grant execute on dbms_lob to $1;
26-
grant execute on dbms_sql to $1;
27-
grant execute on dbms_xmlgen to $1;
28-
grant execute on dbms_lock to $1;
29-
30-
31-
exit
32-
SQL
33-
EOF
34-
35-
# Copy utPLSQL files to the container and install it.
36-
docker cp ./$UTPLSQL_FILE.tar.gz $ORACLE_VERSION:/$UTPLSQL_FILE.tar.gz
37-
# docker cp ./$UTPLSQL_FILE $ORACLE_VERSION:/$UTPLSQL_FILE
38-
docker cp ./install.sh.tmp $ORACLE_VERSION:/install.sh
39-
40-
# Remove temporary files.
41-
# rm $UTPLSQL_FILE.tar.gz
42-
rm -rf $UTPLSQL_FILE
43-
rm install.sh.tmp
44-
45-
# Execute the utPLSQL installation inside the container.
46-
docker exec $ORACLE_VERSION bash install.sh
13+
docker run --rm -v $(pwd)/${UTPLSQL_DIR}:${VOLUME} -w ${VOLUME}/source --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \
14+
sys/oracle@${DB_URL} as sysdba @install_headless.sql ${DB_UT3_USER} ${DB_UT3_PASS} users

.travis/maven_cfg.sh

-12
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,4 @@
22
set -ev
33
cd $(dirname $(readlink -f $0))
44

5-
# Download wagon-http recommended by Oracle.
6-
# On maven latest version this is not needed, but travis doesn't have it.
7-
if [ ! -f $CACHE_DIR/wagon-http-2.8-shaded.jar ]; then
8-
curl -L -O "http://central.maven.org/maven2/org/apache/maven/wagon/wagon-http/2.8/wagon-http-2.8-shaded.jar"
9-
mv wagon-http-2.8-shaded.jar $CACHE_DIR/
10-
sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/
11-
else
12-
echo "Using cached wagon-http..."
13-
sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/
14-
fi
15-
165
cp settings.xml $MAVEN_CFG/settings.xml
17-

.travis/settings.xml

-23
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,5 @@
2222
<username>${env.SONATYPE_USERNAME}</username>
2323
<password>${env.SONATYPE_PASSWORD}</password>
2424
</server>
25-
<server>
26-
<id>maven.oracle.com</id>
27-
<username>${env.ORACLE_OTN_USER}</username>
28-
<password>${env.ORACLE_OTN_PASSWORD}</password>
29-
<configuration>
30-
<basicAuthScope>
31-
<host>ANY</host>
32-
<port>ANY</port>
33-
<realm>OAM 11g</realm>
34-
</basicAuthScope>
35-
<httpConfiguration>
36-
<all>
37-
<params>
38-
<property>
39-
<name>http.protocol.allow-circular-redirects</name>
40-
<value>%b,true</value>
41-
</property>
42-
</params>
43-
</all>
44-
</httpConfiguration>
45-
</configuration>
46-
</server>
4725
</servers>
48-
4926
</settings>

.travis/sql/create_app_objects.sql

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
whenever sqlerror exit failure rollback
2+
whenever oserror exit failure rollback
3+
4+
@src/it/resources/simple-project/scripts/sources/TO_TEST_ME.tab
5+
@src/it/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.spc
6+
@src/it/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy
7+
8+
@src/it/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc
9+
@src/it/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
whenever sqlerror exit failure rollback
2+
whenever oserror exit failure rollback
3+
4+
@src/it/resources/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab
5+
@src/it/resources/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql
6+
@src/it/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
whenever sqlerror exit failure rollback
2+
whenever oserror exit failure rollback
3+
4+
create synonym TO_TEST_ME for CODE_OWNER.TO_TEST_ME;
5+
create synonym PKG_TEST_ME for CODE_OWNER.PKG_TEST_ME;
6+
@src/it/resources/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql
7+
@src/it/resources/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql

.travis/sql/create_users.sql

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
whenever sqlerror exit failure rollback
2+
whenever oserror exit failure rollback
3+
set echo off
4+
set verify off
5+
6+
define UTPLSQL_USER = 'UT3';
7+
define APP_USER = 'APP';
8+
define CODE_OWNER = 'CODE_OWNER';
9+
define TESTS_OWNER = 'TESTS_OWNER';
10+
define DB_PASS = 'pass';
11+
12+
grant execute any procedure to &UTPLSQL_USER;
13+
grant create any procedure to &UTPLSQL_USER;
14+
grant execute on dbms_lob to &UTPLSQL_USER;
15+
grant execute on dbms_sql to &UTPLSQL_USER;
16+
grant execute on dbms_xmlgen to &UTPLSQL_USER;
17+
grant execute on dbms_lock to &UTPLSQL_USER;
18+
19+
create user &APP_USER identified by &DB_PASS quota unlimited on USERS default tablespace USERS;
20+
grant create session, create procedure, create type, create table, create sequence, create view to &APP_USER;
21+
grant select any dictionary to &APP_USER;
22+
23+
create user &CODE_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS;
24+
grant create session, create procedure, create type, create table, create sequence, create view to &CODE_OWNER;
25+
26+
create user &TESTS_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS;
27+
grant create session, create procedure, create type, create table, create sequence, create view, create synonym to &TESTS_OWNER;
28+
grant select any dictionary to &TESTS_OWNER;
29+
grant select any table, delete any table, drop any table to &TESTS_OWNER;
30+
grant execute any procedure to &TESTS_OWNER;

.travis/start_db.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ fi
1010

1111
# Pull the specified db version from docker hub.
1212
docker pull $DOCKER_REPO:$ORACLE_VERSION
13-
docker run -d --name $ORACLE_VERSION $DOCKER_OPTIONS -p 1521:1521 $DOCKER_REPO:$ORACLE_VERSION
13+
docker run -d --name $ORACLE_VERSION $DOCKER_OPTIONS -p 127.0.0.1:1521:1521 $DOCKER_REPO:$ORACLE_VERSION
1414
docker logs -f $ORACLE_VERSION | grep -m 1 "DATABASE IS READY TO USE!" --line-buffered

README.md

+15-4
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ Please refer to the following usage example for the parameters descriptions.
135135
<!-- Skip the utPLSQL version compatibility check. -->
136136
<!-- Defaults to: false -->
137137
<skipCompatibilityCheck>false</skipCompatibilityCheck>
138+
139+
<!-- A list of tags to run. -->
140+
<tags>
141+
<tag>test_tag</tag>
142+
</tags>
143+
144+
<!-- Enables random order of test executions. -->
145+
<randomTestOrder>true</randomTestOrder>
146+
<!-- Sets the seed to use for random test execution order. If set, it sets -random to true. -->
147+
<randomTestOrderSeed>5</randomTestOrderSeed>
138148

139149
<!-- Comma-separated object list to include in the coverage report. -->
140150
<!-- Format: [schema.]package[,[schema.]package ...]. -->
@@ -204,7 +214,6 @@ Please refer to the following usage example for the parameters descriptions.
204214
<customMapping>package_bodies</customMapping>
205215
</customTypeMapping>
206216
</testsCustomTypeMapping>
207-
208217
</configuration>
209218
</execution>
210219
</executions>
@@ -226,12 +235,15 @@ More project samples are available in the src/test/resources directory:
226235
| --- | --- | --- |
227236
| -c | --color | |
228237
| | --failure-exit-code | |
229-
| | | ignoreFailure |
238+
| -p | --path | paths.path |
230239
| -f | --format | reporters.reporter.name |
231240
| -o | | reporters.reporter.fileOutput |
232241
| -s | | reporters.reporter.consoleOutput |
233-
| -p | --path | paths.path |
242+
| | | ignoreFailure |
234243
| -scc | --skip-compatibility-check | skipCompatibilityCheck |
244+
| | --tags | tags.tag |
245+
| -r | --random-test-order | randomTestOrder |
246+
| -seed | --random-test-order-seed | randomTestOrderSeed |
235247
| -exclude | | excludeObject |
236248
| -include | | includeObject |
237249
| | | |
@@ -250,4 +262,3 @@ More project samples are available in the src/test/resources directory:
250262
| -owner_subexpression | | testsOwnerSubexpression |
251263
| -type_subexpression | | testsTypeSubexpression |
252264
| -name_subexpression | | testsNameSubexpression |
253-

0 commit comments

Comments
 (0)