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

Skip to content

Commit 4eceba2

Browse files
committed
Testing the oracle 12 docker images.
1 parent ca9dadc commit 4eceba2

12 files changed

Lines changed: 167 additions & 25 deletions

.travis.yml

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ env:
2424
# Target Branch and Directory for Deployment of Docs
2525
- PAGES_TARGET_BRANCH="gh-pages"
2626
- PAGES_VERSION_BASE="version3"
27+
- SQLCL_FILE=sqlcl-4.2.0.16.355.0402-no-jre.zip
28+
- SQLCLI=$HOME/.cache/sqlcl/bin/sql
2729

2830
addons:
2931
apt:
@@ -32,24 +34,34 @@ addons:
3234
- bc
3335
- rpm
3436
- unzip
37+
- oracle-java8-set-default
3538

39+
services:
40+
- docker
3641

3742
cache:
3843
directories:
3944
- .cache
4045
- $HOME/.cache
4146

4247
before_install:
48+
- npm install -g phantomjs-prebuilt casperjs
49+
- bash .travis/download_sqlcl.sh
50+
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
51+
- docker pull viniciusam/oracle-12c-r1-se
4352
# On trusty, download the zip file into a cachable directory
44-
- test "$DIST" = precise || export ORACLE_ZIP_DIR=$HOME/.cache
53+
#- test "$DIST" = precise || export ORACLE_ZIP_DIR=$HOME/.cache
4554
# If the zip file already exists, do not download it again
46-
- test -f "$ORACLE_ZIP_DIR"/$(basename $ORACLE_FILE) || bash .travis/oracle/download.sh
55+
#- test -f "$ORACLE_ZIP_DIR"/$(basename $ORACLE_FILE) || bash .travis/oracle/download.sh
4756

4857
install:
4958
- sudo pip install -r .travis/python_req.txt
50-
- bash .travis/oracle/install.sh
59+
#- bash .travis/oracle/install.sh
5160

5261
script:
62+
- docker run -d --name oracle-12c-r1-se -p 1521:1521 -p 5500:5500 viniciusam/oracle-12c-r1-se
63+
- docker logs -f oracle-12c-r1-se | grep -m 1 "DATABASE IS READY TO USE!" --line-buffered
64+
- docker exec oracle-12c-r1-se ./setPassword.sh oracle
5365
- bash .travis/create_utplsql_owner.sh
5466
- bash .travis/create_utplsql_user.sh
5567
- bash .travis/install_libraries.sh
@@ -63,18 +75,18 @@ script:
6375
# - bash .travis/build_docs.sh
6476
# - bash .travis/push_docs_to_gh_pages.sh
6577

66-
deploy:
67-
provider: releases
68-
api_key: $github_api_token
69-
file:
70-
- utPLSQL$TRAVIS_TAG.zip
71-
- utPLSQL$TRAVIS_TAG.tar.gz
72-
skip_cleanup: true
73-
on:
74-
repo: utPLSQL/utPLSQL
75-
tags: true
78+
# deploy:
79+
# provider: releases
80+
# api_key: $github_api_token
81+
# file:
82+
# - utPLSQL$TRAVIS_TAG.zip
83+
# - utPLSQL$TRAVIS_TAG.tar.gz
84+
# skip_cleanup: true
85+
# on:
86+
# repo: utPLSQL/utPLSQL
87+
# tags: true
7688

77-
notifications:
78-
slack: utplsql:oiMuXO95TvKeAUENuDt4cPrB
89+
# notifications:
90+
# slack: utplsql:oiMuXO95TvKeAUENuDt4cPrB
7991

8092

.travis/create_utplsql_owner.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -ev
33

44
cd $(dirname "$(readlink -f "$0")")
55
#create user
6-
"$ORACLE_HOME/bin/sqlplus" -L -S / AS SYSDBA <<SQL
6+
"$SQLCLI" -L -S sys/oracle@//oracle-12c-r1-se:1521/ORCLCDB AS SYSDBA <<SQL
77
set echo off
88
@@create_utplsql_owner.sql $UT3_OWNER $UT3_OWNER_PASSWORD $UT3_OWNER_TABLESPACE
99
SQL

.travis/create_utplsql_user.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -ev
33

44
cd $(dirname "$(readlink -f "$0")")
55
#create user
6-
"$ORACLE_HOME/bin/sqlplus" -L -S / AS SYSDBA <<SQL
6+
"$SQLCLI" -L -S sys/oracle@//oracle-12c-r1-se:1521/ORCLCDB AS SYSDBA <<SQL
77
set echo off
88
@@create_utplsql_user.sql $UT3_USER $UT3_USER_PASSWORD $UT3_USER_TABLESPACE
99
SQL

.travis/download.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
var casper = require("casper").create({
3+
// verbose: true,
4+
// logLevel: "debug",
5+
pageSettings: {
6+
loadImages: false,
7+
loadPlugins: false
8+
}
9+
});
10+
11+
if (casper.cli.args.length < 4) {
12+
casper.echo("Missing parameters: username password agreementUrl downloadUrl").exit(1);
13+
}
14+
15+
// Script parameters.
16+
var paramUsername = casper.cli.get(0);
17+
var paramPassword = casper.cli.get(1);
18+
var agreementUrl = casper.cli.get(2);
19+
var downloadUrl = casper.cli.get(3);
20+
21+
casper.start();
22+
// TODO: Error handling.
23+
24+
// Accept the license agreement.
25+
casper.thenOpen(agreementUrl, function () {
26+
// this.echo("Accepting License");
27+
this.evaluate(function () {
28+
acceptAgreement(window.self);
29+
});
30+
});
31+
32+
// Try to access the download page, wait for redirection and submit the login form.
33+
casper.thenOpen(downloadUrl).waitForUrl(/signon\.jsp$/, function (re) {
34+
// this.echo("Injecting Login Info");
35+
this.evaluate(function (username, password) {
36+
document.getElementById("sso_username").value = username;
37+
document.getElementById("ssopassword").value = password;
38+
doLogin(document.LoginForm);
39+
}, paramUsername, paramPassword);
40+
// this.capture("Screenshot.png");
41+
});
42+
43+
casper.on("resource.received", function (resource) {
44+
if (resource.url.indexOf("AuthParam") !== -1) {
45+
// this.echo("DownloadUrl:");
46+
// Print the download url.
47+
this.echo(resource.url);
48+
// TODO: Try to download file from here. this.download is not working because of cross site request.
49+
}
50+
});
51+
52+
casper.run(function () {
53+
this.exit();
54+
});

.travis/download.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
3+
PRODUCT=""
4+
AGREEMENT_URL=""
5+
DOWNLOAD_URL=""
6+
OUTPUT_FILE=""
7+
8+
# Call the casperjs script to return the download url.
9+
# Then download the file using curl.
10+
downloadFile() {
11+
downloadUrl=$(exec casperjs download.js $ORACLE_OTN_USER $ORACLE_OTN_PASSWORD $AGREEMENT_URL $DOWNLOAD_URL)
12+
#echo "DownloadURL: $downloadUrl"
13+
curl $downloadUrl -o $OUTPUT_FILE
14+
}
15+
16+
#############################
17+
########### START ###########
18+
#############################
19+
20+
while getopts "p:" OPTNAME; do
21+
case "${OPTNAME}" in
22+
"p") PRODUCT="${OPTARG}" ;;
23+
esac
24+
done
25+
26+
if [ "$PRODUCT" = "se12c" ]; then
27+
AGREEMENT_URL="http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html"
28+
DOWNLOAD_URL="http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_se2_1of2.zip"
29+
OUTPUT_FILE="linuxamd64_12102_database_se2_1of2.zip"
30+
downloadFile
31+
AGREEMENT_URL="http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html"
32+
DOWNLOAD_URL="http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_se2_2of2.zip"
33+
OUTPUT_FILE="linuxamd64_12102_database_se2_2of2.zip"
34+
downloadFile
35+
exit 0
36+
fi
37+
38+
if [ "$PRODUCT" = "ee12c" ]; then
39+
AGREEMENT_URL="http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html"
40+
DOWNLOAD_URL="http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_1of2.zip"
41+
OUTPUT_FILE="linuxamd64_12102_database_1of2.zip"
42+
downloadFile
43+
AGREEMENT_URL="http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html"
44+
DOWNLOAD_URL="http://download.oracle.com/otn/linux/oracle12c/121020/linuxamd64_12102_database_2of2.zip"
45+
OUTPUT_FILE="linuxamd64_12102_database_2of2.zip"
46+
downloadFile
47+
exit 0
48+
fi
49+
50+
if [ "$PRODUCT" = "xe11g" ]; then
51+
AGREEMENT_URL="http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html"
52+
DOWNLOAD_URL="https://edelivery.oracle.com/akam/otn/linux/oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip"
53+
OUTPUT_FILE="oracle-xe-11.2.0-1.0.x86_64.rpm.zip"
54+
downloadFile
55+
exit 0
56+
fi
57+
58+
if [ "$PRODUCT" = "sqlcl" ]; then
59+
AGREEMENT_URL="http://www.oracle.com/technetwork/developer-tools/sqlcl/downloads/index.html"
60+
DOWNLOAD_URL="http://download.oracle.com/otn/java/sqldeveloper/sqlcl-4.2.0.16.355.0402-no-jre.zip"
61+
OUTPUT_FILE="sqlcl-4.2.0.16.355.0402-no-jre.zip"
62+
downloadFile
63+
exit 0
64+
fi
65+
66+
echo "Invalid product: $PRODUCT"
67+
exit 1

.travis/download_sqlcl.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ ! $HOME/.cache/$SQLCL_FILE ]; then
5+
.travis/download.sh -p sqlcl
6+
unzip -q $SQLCL_FILE
7+
bash mv sqlcl $HOME/.cache
8+
rm -f $SQLCL_FILE
9+
fi;

.travis/grant_user.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ set -ev
44

55
cd source
66
#grant framework user
7-
"$ORACLE_HOME/bin/sqlplus" -L -S / AS SYSDBA <<SQL
7+
"$SQLCLI" -L -S sys/oracle@//oracle-12c-r1-se:1521/ORCLCDB AS SYSDBA <<SQL
88
@create_synonyms_and_grants_for_user.sql $UT3_OWNER $UT3_USER
99
SQL

.travis/install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ set -ev
44

55
cd source
66
#install core of utplsql
7-
"$ORACLE_HOME/bin/sqlplus" $UT3_OWNER/$UT3_OWNER_PASSWORD @install.sql $UT3_OWNER
7+
"$SQLCLI" $UT3_OWNER/$UT3_OWNER_PASSWORD @install.sql $UT3_OWNER
88

99

1010
cd ..
1111
cd development
1212
#do style check
13-
"$ORACLE_HOME/bin/sqlplus" $UT3_OWNER/$UT3_OWNER_PASSWORD @utplsql_style_check.sql
13+
"$SQLCLI" $UT3_OWNER/$UT3_OWNER_PASSWORD @utplsql_style_check.sql
1414

1515
#enable plsql debug
16-
#"$ORACLE_HOME/bin/sqlplus" $UT3_OWNER/$UT3_OWNER_PASSWORD @ut_debug_enable.sql
16+
"$SQLCLI" $UT3_OWNER/$UT3_OWNER_PASSWORD @ut_debug_enable.sql

.travis/run_examples_as_owner.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
set -ev
44

55
cd examples
6-
"$ORACLE_HOME/bin/sqlplus" $UT3_OWNER/$UT3_OWNER_PASSWORD @RunAllExamplesAsTests.sql
6+
"$SQLCLI" $UT3_OWNER/$UT3_OWNER_PASSWORD @RunAllExamplesAsTests.sql

.travis/run_examples_as_user.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -ev
44

55
cd examples
6-
"$ORACLE_HOME/bin/sqlplus" $UT3_USER/$UT3_USER_PASSWORD <<SQL
6+
"$SQLCLI" $UT3_USER/$UT3_USER_PASSWORD <<SQL
77
whenever sqlerror exit failure rollback
88
whenever oserror exit failure rollback
99

0 commit comments

Comments
 (0)