Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Added tags and random test execution parameters #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions 7 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ cache:
install:
- bash .travis/maven_cfg.sh
- bash .travis/start_db.sh
- bash .travis/install_utplsql.sh $DB_UT3_USER $DB_UT3_PASS
- bash .travis/install_utplsql.sh
- bash .travis/install_demo_project.sh
- bash .travis/install_demo_owner_project.sh

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

before_deploy:
- echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import
- echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust
- echo $GPG_SECRET_KEYS | base64 --decode | ${GPG_EXECUTABLE} --import
- echo $GPG_OWNERTRUST | base64 --decode | ${GPG_EXECUTABLE} --import-ownertrust

deploy:
- provider: script
Expand Down
50 changes: 0 additions & 50 deletions 50 .travis/install_demo_owner_project.sh

This file was deleted.

39 changes: 11 additions & 28 deletions 39 .travis/install_demo_project.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,18 @@
#!/bin/bash
set -ev

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

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

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

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

@scripts/tests/APP.TEST_PKG_TEST_ME.spc
@scripts/tests/APP.TEST_PKG_TEST_ME.bdy

exit
SQL
EOF

docker cp ./$PROJECT_FILES_SRC $ORACLE_VERSION:/$PROJECT_FILES
docker cp ./demo_project.sh.tmp $ORACLE_VERSION:/demo_project.sh
docker exec $ORACLE_VERSION bash demo_project.sh
docker run --rm -v $(pwd):${VOLUME} -w ${VOLUME} --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \
tests_owner/pass@${DB_URL} @.travis/sql/create_tests_owner_objects.sql
48 changes: 8 additions & 40 deletions 48 .travis/install_utplsql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,13 @@
set -ev
cd $(dirname $(readlink -f $0))

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

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

# Create a temporary install script.
cat > install.sh.tmp <<EOF
tar -xzf ${UTPLSQL_FILE}.tar.gz && rm ${UTPLSQL_FILE}.tar.gz
cd ${UTPLSQL_FILE}/source
sqlplus -S -L sys/oracle@//127.0.0.1:1521/xe AS SYSDBA @install_headless.sql $1 $2 users

sqlplus -S -L sys/oracle@//127.0.0.1:1521/xe AS SYSDBA << SQL
grant execute any procedure to $1;
grant create any procedure to $1;
grant execute on dbms_lob to $1;
grant execute on dbms_sql to $1;
grant execute on dbms_xmlgen to $1;
grant execute on dbms_lock to $1;


exit
SQL
EOF

# Copy utPLSQL files to the container and install it.
docker cp ./$UTPLSQL_FILE.tar.gz $ORACLE_VERSION:/$UTPLSQL_FILE.tar.gz
# docker cp ./$UTPLSQL_FILE $ORACLE_VERSION:/$UTPLSQL_FILE
docker cp ./install.sh.tmp $ORACLE_VERSION:/install.sh

# Remove temporary files.
# rm $UTPLSQL_FILE.tar.gz
rm -rf $UTPLSQL_FILE
rm install.sh.tmp

# Execute the utPLSQL installation inside the container.
docker exec $ORACLE_VERSION bash install.sh
docker run --rm -v $(pwd)/${UTPLSQL_DIR}:${VOLUME} -w ${VOLUME}/source --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \
sys/oracle@${DB_URL} as sysdba @install_headless.sql ${DB_UT3_USER} ${DB_UT3_PASS} users
12 changes: 0 additions & 12 deletions 12 .travis/maven_cfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,4 @@
set -ev
cd $(dirname $(readlink -f $0))

# Download wagon-http recommended by Oracle.
# On maven latest version this is not needed, but travis doesn't have it.
if [ ! -f $CACHE_DIR/wagon-http-2.8-shaded.jar ]; then
curl -L -O "http://central.maven.org/maven2/org/apache/maven/wagon/wagon-http/2.8/wagon-http-2.8-shaded.jar"
mv wagon-http-2.8-shaded.jar $CACHE_DIR/
sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/
else
echo "Using cached wagon-http..."
sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/
fi

cp settings.xml $MAVEN_CFG/settings.xml

23 changes: 0 additions & 23 deletions 23 .travis/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,5 @@
<username>${env.SONATYPE_USERNAME}</username>
<password>${env.SONATYPE_PASSWORD}</password>
</server>
<server>
<id>maven.oracle.com</id>
<username>${env.ORACLE_OTN_USER}</username>
<password>${env.ORACLE_OTN_PASSWORD}</password>
<configuration>
<basicAuthScope>
<host>ANY</host>
<port>ANY</port>
<realm>OAM 11g</realm>
</basicAuthScope>
<httpConfiguration>
<all>
<params>
<property>
<name>http.protocol.allow-circular-redirects</name>
<value>%b,true</value>
</property>
</params>
</all>
</httpConfiguration>
</configuration>
</server>
</servers>

</settings>
9 changes: 9 additions & 0 deletions 9 .travis/sql/create_app_objects.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
whenever sqlerror exit failure rollback
whenever oserror exit failure rollback

@src/it/resources/simple-project/scripts/sources/TO_TEST_ME.tab
@src/it/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.spc
@src/it/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy

@src/it/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc
@src/it/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy
6 changes: 6 additions & 0 deletions 6 .travis/sql/create_source_owner_objects.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
whenever sqlerror exit failure rollback
whenever oserror exit failure rollback

@src/it/resources/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab
@src/it/resources/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql
@src/it/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql
7 changes: 7 additions & 0 deletions 7 .travis/sql/create_tests_owner_objects.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
whenever sqlerror exit failure rollback
whenever oserror exit failure rollback

create synonym TO_TEST_ME for CODE_OWNER.TO_TEST_ME;
create synonym PKG_TEST_ME for CODE_OWNER.PKG_TEST_ME;
@src/it/resources/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql
@src/it/resources/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql
30 changes: 30 additions & 0 deletions 30 .travis/sql/create_users.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
whenever sqlerror exit failure rollback
whenever oserror exit failure rollback
set echo off
set verify off

define UTPLSQL_USER = 'UT3';
define APP_USER = 'APP';
define CODE_OWNER = 'CODE_OWNER';
define TESTS_OWNER = 'TESTS_OWNER';
define DB_PASS = 'pass';

grant execute any procedure to &UTPLSQL_USER;
grant create any procedure to &UTPLSQL_USER;
grant execute on dbms_lob to &UTPLSQL_USER;
grant execute on dbms_sql to &UTPLSQL_USER;
grant execute on dbms_xmlgen to &UTPLSQL_USER;
grant execute on dbms_lock to &UTPLSQL_USER;

create user &APP_USER identified by &DB_PASS quota unlimited on USERS default tablespace USERS;
grant create session, create procedure, create type, create table, create sequence, create view to &APP_USER;
grant select any dictionary to &APP_USER;

create user &CODE_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS;
grant create session, create procedure, create type, create table, create sequence, create view to &CODE_OWNER;

create user &TESTS_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS;
grant create session, create procedure, create type, create table, create sequence, create view, create synonym to &TESTS_OWNER;
grant select any dictionary to &TESTS_OWNER;
grant select any table, delete any table, drop any table to &TESTS_OWNER;
grant execute any procedure to &TESTS_OWNER;
2 changes: 1 addition & 1 deletion 2 .travis/start_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ fi

# Pull the specified db version from docker hub.
docker pull $DOCKER_REPO:$ORACLE_VERSION
docker run -d --name $ORACLE_VERSION $DOCKER_OPTIONS -p 1521:1521 $DOCKER_REPO:$ORACLE_VERSION
docker run -d --name $ORACLE_VERSION $DOCKER_OPTIONS -p 127.0.0.1:1521:1521 $DOCKER_REPO:$ORACLE_VERSION
docker logs -f $ORACLE_VERSION | grep -m 1 "DATABASE IS READY TO USE!" --line-buffered
19 changes: 15 additions & 4 deletions 19 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ Please refer to the following usage example for the parameters descriptions.
<!-- Skip the utPLSQL version compatibility check. -->
<!-- Defaults to: false -->
<skipCompatibilityCheck>false</skipCompatibilityCheck>

<!-- A list of tags to run. -->
<tags>
<tag>test_tag</tag>
</tags>

<!-- Enables random order of test executions. -->
<randomTestOrder>true</randomTestOrder>
<!-- Sets the seed to use for random test execution order. If set, it sets -random to true. -->
<randomTestOrderSeed>5</randomTestOrderSeed>

<!-- Comma-separated object list to include in the coverage report. -->
<!-- Format: [schema.]package[,[schema.]package ...]. -->
Expand Down Expand Up @@ -204,7 +214,6 @@ Please refer to the following usage example for the parameters descriptions.
<customMapping>package_bodies</customMapping>
</customTypeMapping>
</testsCustomTypeMapping>

</configuration>
</execution>
</executions>
Expand All @@ -226,12 +235,15 @@ More project samples are available in the src/test/resources directory:
| --- | --- | --- |
| -c | --color | |
| | --failure-exit-code | |
| | | ignoreFailure |
| -p | --path | paths.path |
| -f | --format | reporters.reporter.name |
| -o | | reporters.reporter.fileOutput |
| -s | | reporters.reporter.consoleOutput |
| -p | --path | paths.path |
| | | ignoreFailure |
| -scc | --skip-compatibility-check | skipCompatibilityCheck |
| | --tags | tags.tag |
| -r | --random-test-order | randomTestOrder |
| -seed | --random-test-order-seed | randomTestOrderSeed |
| -exclude | | excludeObject |
| -include | | includeObject |
| | | |
Expand All @@ -250,4 +262,3 @@ More project samples are available in the src/test/resources directory:
| -owner_subexpression | | testsOwnerSubexpression |
| -type_subexpression | | testsTypeSubexpression |
| -name_subexpression | | testsNameSubexpression |

Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.