From 516ea5f38dd6aae4007d3b3cd02625f48c4b6ac3 Mon Sep 17 00:00:00 2001 From: Jacek Date: Tue, 22 Aug 2017 22:12:02 +0100 Subject: [PATCH 01/14] Moved `CONTRIBUTING.md` to project root to conform with github project standards. --- docs/about/CONTRIBUTING.md => CONTRIBUTING.md | 0 docs/about/project-details.md | 2 +- docs/index.md | 1 - mkdocs.yml | 1 - readme.md | 2 +- 5 files changed, 2 insertions(+), 4 deletions(-) rename docs/about/CONTRIBUTING.md => CONTRIBUTING.md (100%) diff --git a/docs/about/CONTRIBUTING.md b/CONTRIBUTING.md similarity index 100% rename from docs/about/CONTRIBUTING.md rename to CONTRIBUTING.md diff --git a/docs/about/project-details.md b/docs/about/project-details.md index d21012e0e..857fe8ab6 100644 --- a/docs/about/project-details.md +++ b/docs/about/project-details.md @@ -9,7 +9,7 @@ utPLSQL is open source project [hosted on GitHub](https://github.com/utPLSQL/utPLSQL). Contributions, help and constructive feedback is always appreciated. -If you are interested in helping please read our [guide to contributing](CONTRIBUTING.md) +If you are interested in helping please read our [guide to contributing](https://github.com/utPLSQL/utPLSQL/CONTRIBUTING.md) diff --git a/docs/index.md b/docs/index.md index 08998381c..ffcfc10c1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -21,7 +21,6 @@ The framework follows industry standards and best patterns of modern Unit Testin - [License](about/license.md) - [Support](about/support.md) - [Authors](about/authors.md) - - [Contributing](about/CONTRIBUTING.md) # Demo project diff --git a/mkdocs.yml b/mkdocs.yml index 22c0fe04c..0539827b3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -28,4 +28,3 @@ pages: - License: about/license.md - Support: about/support.md - Authors: about/authors.md - - Contributing: about/CONTRIBUTING.md diff --git a/readme.md b/readme.md index 8b4f67f33..1ecea3143 100644 --- a/readme.md +++ b/readme.md @@ -156,7 +156,7 @@ Finished in .036027 seconds # Contributing to the project We welcome new developers to join our community and contribute to the utPLSQL project. -If you are interested in helping please read our [guide to contributing](docs/about/CONTRIBUTING.md) +If you are interested in helping please read our [guide to contributing](CONTRIBUTING.md) The best place to start is to read the documentation and get familiar with the existing code base. A [slack chat](https://utplsql.slack.com/) is the place to go if you want to talk with team members. To sign up to the chat use [this link](http://utplsql-slack-invite.herokuapp.com/) From 0d017be44d3a56365571bef3236dc4beb742e819 Mon Sep 17 00:00:00 2001 From: Jacek Date: Wed, 23 Aug 2017 07:48:00 +0100 Subject: [PATCH 02/14] Moved `CONTRIBUTING.md` to project root to conform with github project standards. Updated `CONTRIBUTING.md` with additional info on project setup. --- .gitignore | 3 + CONTRIBUTING.md | 149 ++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 127 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 46b48cc7f..379f860c7 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ release/ *.gz *.zip node_modules/ +utPLSQL/ +utPLSQL-cli/ + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 51c28babe..15ada698c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,31 +7,27 @@ Changes are welcome from all members of the Community. 1. Create a [GitHub Account](https://github.com/join). 2. Fork the utPLSQL Repository and setup your local Repository. - * Each of the steps below are detailed in the [How to Fork](https://help.github.com/articles/fork-a-repo) article! + * Each of the steps below are detailed in the [how to Fork](https://help.github.com/articles/fork-a-repo) article! * Clone your Fork to your local machine. - * Configure "upstream" remote to the [master utPLSQL repository](https://github.com/utPLSQL/utPLSQL.git). - * Update the git submodules by issuing command: [git submodule update --remote --merge](http://stackoverflow.com/a/21195182) -3. For each change you want to make: - * Create a new branch for your change. + * Configure "upstream" remote to the [utPLSQL repository](https://github.com/utPLSQL/utPLSQL.git). +3. For each change you want to make: + * Make sure your forked repository is up to date with upstream before you start coding. See [syncing your local repository](https://help.github.com/articles/syncing-a-fork) with upstream utPLSQL repository. + * Create a new branch for your change. We use `feature/feature_name` or `bugfix/fixed_issue_name` to identify branch types. * Make your change in your new branch. - * Although changes can be made in the master branch, it easier long term if a new branch is used. - * Make sure your change is covered with unit tests and/or is represented in examples + * Make sure your change is covered with unit tests. * **Verify code compiles and all existing and new unit tests pass.** - * The quickest way to have a Pull Request not be accepted, is to submit code that does not compile or pass tests. + * The quickest way to have a Pull Request not approved, is to submit code that does not compile or pass tests. * Commit change to your local repository. - * Push change to your remote repository - * Submit a [Pull Request](https://help.github.com/articles/using-pull-requests). - * Note: local and remote branches can be deleted after pull request has been accepted. - -**Note:** Getting changes from others requires [Syncing your Local repository](https://help.github.com/articles/syncing-a-fork) with Master utPLSQL repository. This can happen at any time. - + * Push change to your remote repository. + * Submit a [Pull Request](https://help.github.com/articles/using-pull-requests) into develop branch. + * Note: local and remote branches can be deleted after pull request has been merged. ## Coding Standards ## -* Snake case will be used. This separates keywords in names with underscores. `execute_test` -* All names will be lower case. +* We use snake case for all identifiers in PLSQL code. This separates keywords in names with underscores. `execute_test` +* All code is lower case. * Prefixes: - * Arguments to procedures and functions will start with `a_` an Example would be procedure `is_valid(a_owner_name varchar2);` + * Arguments to procedures and functions will start with `a_` an Example would be procedure `is_valid(a_owner_name varchar2)` * Object types and packages will start with `ut_` * Local variables `l_` * Global variables `g_` @@ -41,15 +37,119 @@ Changes are welcome from all members of the Community. * varchar2 lengths are set in characters not bytes -## Testing Environment ## +## Configuring local environment ## + +Your local environment can be of any flavor (Unix/Linux/Windows/Mac). +At minimum you need to have Oracle database 11.2 XE accessible for the project and SYS account access to install and develop utPLSQL. + +We use four different database accounts (users) for development process. +* `ut3_latest_release` - holds latest released version of utPLSQL. This schema holds the testing framework used for self-testing of utPLSQL development. +* `ut3` - holds latest (current) development version of utPLSQL. This is the schema you will be working on. +* `ut3_tester` - holds unit test packages for development of utPLSQL. +* `ut3$user#` - used for testing accessibility to schema names with special characters. + + + +Snippet to get you started with development. + +_If you're using Windows, you can run below scripts using `GIT bash` - Windows-based Unix-like command line._ + +```bash +# clone your fork of utPLSQL +git clone https://github.com/your account/utPLSQL.git utPLSQL + +cd utPLSQL + +# add main porject repo as upstream +git remote add upstream https://github.com/utPLSQL/utPLSQL.git + +# fetch all remote repositories +git fetch --all + +# clone utPLSQL master branch from upstream into utPLSQL sub-directory of your project +git clone --depth=1 --branch=master https://github.com/utPLSQL/utPLSQL.git + +# download beta version of utPLSQL-cli +curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=utPLSQL-cli-develop-test3.zip +# unzip utPLSQL-cli and remove the zip file +unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli && rm utPLSQL-cli.zip + +``` + +Refreshing your local repo. +```bash +# fetch all remote repositories +git fetch --all + +# remove sub-direcotry containing master branch shallow copy +rm -rf utPLSQL/* +# clone utPLSQL master branch from upstream into utPLSQL sub-directory of your project +git clone --depth=1 --branch=master https://github.com/utPLSQL/utPLSQL.git + +rm -rf utPLSQL-cli/* +# download beta version of utPLSQL-cli +curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=utPLSQL-cli-develop-test3.zip +# unzip utPLSQL-cli and remove the zip file +unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli && rm utPLSQL-cli.zip + +``` + +Cleanup of utPLSQL installation. +```sql +drop user ut3 cascade; +drop user ut3_latest_release cascade; +drop user ut3_tester cascade; +drop user ut3$user# cascade; + +begin + for i in ( + select decode(owner,'PUBLIC','drop public synonym "','drop synonym "'||owner||'"."')|| synonym_name ||'"' drop_orphaned_synonym from dba_synonyms a + where not exists (select null from dba_objects b where a.table_name=b.object_name and a.table_owner=b.owner ) + ) loop + execute immediate i.drop_orphaned_synonym; + end loop; +end; +/ +``` -We are using docker images to test utPLSQL on our Travis CI builds. The following versions of Oracle Database are being used. +Install utPLSQL for development +```bash +export UT3_OWNER=ut3 +export UT3_OWNER_PASSWORD=ut3 +export UT3_RELEASE_VERSION_SCHEMA=ut3_latest_release +export UT3_TESTER=ut3_tester +export UT3_TESTER_PASSWORD=ut3 +export UT3_TABLESPACE=users +export UT3_USER="UT3\$USER#" +export UT3_USER_PASSWORD=ut3 +export SQLCLI=sql +export CONNECTION_STR=127.0.0.1:1521/orcl +export ORACLE_PWD=oracle + +.travis/install.sh +.travis/install_utplsql_release.sh +.travis/create_additional_grants_for_old_tests.sh +``` + +Reinstalling utPLSQL development in `ut3` schema. +```bash +cd source +sqlplus sys/oracle@orcl as sysdba <<-SQL +@uninstall ut3 +@install ut3 +SQL +``` + +## Build Environment ## + +We are using private docker images to test utPLSQL for our Travis CI builds. The following versions of Oracle Database are being used. * 11g XE R2 * 12c SE R1 * 12c SE R2 -These images are based on the official dockerfiles released by Oracle, but due to licensing restrictions, we can't make the images public. You can build your own and use it locally, or push to a private docker repository. +These images are based on the slimmed versions [official dockerfiles released by Oracle](https://github.com/utPLSQL/docker-scripts), but due to licensing restrictions, we can't make the images public. +You can build your own and use it locally, or push to a private docker repository. The build steps are simple if you already have some experience using Docker. You can find detailed information about how to build your own image with a running database in: [example of creating an image with pre-built DB](https://github.com/oracle/docker-images/blob/master/OracleDatabase/samples/prebuiltdb/README.md) @@ -57,11 +157,10 @@ The build steps are simple if you already have some experience using Docker. You > If you are new to Docker, you can start by reading the [Getting Started With Docker](https://docs.docker.com/engine/getstarted/) docs. -### Build Notes ### -* You need to comment out the VOLUME line. This step is required, because volumes are not saved when using `docker commit` command. - -* When the build proccess is complete, you will run the container to install the database. Once everything is set up and you see the message "DATABASE IS READY!", you may change the password and stop the running container. After the container is stopped, you can safely commit the container. +### Docker Build Notes ### +* You need to comment out the VOLUME line. This step is required, because volumes are not saved when using `docker commit` command. +* When the build process is complete, you will run the container to install the database. Once everything is set up and you see the message "DATABASE IS READY!", you may change the password and stop the running container. After the container is stopped, you can safely commit the container. * You can use the --squash experimental docker tag to reduce the image size. Example: ``` docker build --force-rm --no-cache --squash -t oracle/db-prebuilt . @@ -75,7 +174,7 @@ Variable | Description ### SQLCL ### -Our build configurarion uses SQLCL to run the scripts, and you need to configure a few additional secure environment variables. After the first build, the downloaded file will be cached. +Our build configuration uses SQLCL to run the scripts, and you need to configure a few additional secure environment variables. After the first build, the downloaded file will be cached. Variable | Description ---------|------------ From fc8cd0899ec64d60982fa621d183980aecd5fb5b Mon Sep 17 00:00:00 2001 From: Jacek Date: Fri, 25 Aug 2017 09:26:16 +0100 Subject: [PATCH 03/14] improvements to contributing guide, added shell scripts to simplify development work --- development/cleanup.sh | 20 ++++++++++++++++++++ development/env.sh | 16 ++++++++++++++++ development/install.sh | 9 +++++++++ development/refresh.sh | 13 +++++++++++++ development/utPSLQLv3-modules.png | Bin 0 -> 21734 bytes 5 files changed, 58 insertions(+) create mode 100755 development/cleanup.sh create mode 100755 development/env.sh create mode 100755 development/install.sh create mode 100755 development/refresh.sh create mode 100644 development/utPSLQLv3-modules.png diff --git a/development/cleanup.sh b/development/cleanup.sh new file mode 100755 index 000000000..98f315688 --- /dev/null +++ b/development/cleanup.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +"${SQLCLI}" sys/${ORACLE_PWD}@//${CONNECTION_STR} AS SYSDBA <<-SQL +drop user ${UT3_OWNER} cascade; +drop user ${UT3_RELEASE_VERSION_SCHEMA} cascade; +drop user ${UT3_TESTER} cascade; +drop user ${UT3_USER} cascade; + +begin + for i in ( + select decode(owner,'PUBLIC','drop public synonym "','drop synonym "'||owner||'"."')|| synonym_name ||'"' drop_orphaned_synonym from dba_synonyms a + where not exists (select null from dba_objects b where a.table_name=b.object_name and a.table_owner=b.owner ) + and a.table_owner in ('${UT3_OWNER}','${UT3_RELEASE_VERSION_SCHEMA}','${UT3_TESTER}','${UT3_USER}') + ) loop + execute immediate i.drop_orphaned_synonym; + end loop; +end; +/ +exit +SQL diff --git a/development/env.sh b/development/env.sh new file mode 100755 index 000000000..193a176df --- /dev/null +++ b/development/env.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +export UT3_OWNER=ut3 +export UT3_OWNER_PASSWORD=ut3 +export UT3_RELEASE_VERSION_SCHEMA=ut3_latest_release +export UT3_TESTER=ut3_tester +export UT3_TESTER_PASSWORD=ut3 +export UT3_TABLESPACE=users +export UT3_USER="UT3\$USER#" +export UT3_USER_PASSWORD=ut3 +export UTPLSQL_DIR="utPLSQL_latest_release" +export SQLCLI=sql # For sqlcl client +#export SQLCLI=sqlplus # For sqlplus client +export CONNECTION_STR=127.0.0.1:1521/xe # Adjust the connect string +export ORACLE_PWD=oracle + diff --git a/development/install.sh b/development/install.sh new file mode 100755 index 000000000..7d7f31047 --- /dev/null +++ b/development/install.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +cd $(git rev-parse --show-cdup) + +development/env.sh +development/cleanup.sh +.travis/install.sh +.travis/install_utplsql_release.sh +.travis/create_additional_grants_for_old_tests.sh diff --git a/development/refresh.sh b/development/refresh.sh new file mode 100755 index 000000000..cbc281488 --- /dev/null +++ b/development/refresh.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +cd $(git rev-parse --show-cdup) + +development/env.sh + +cd source + +"${SQLCLI}" sys/${ORACLE_PWD}@//${CONNECTION_STR} AS SYSDBA <<-SQL +@uninstall ${UT3_OWNER} +@install ${UT3_OWNER} +exit +SQL diff --git a/development/utPSLQLv3-modules.png b/development/utPSLQLv3-modules.png new file mode 100644 index 0000000000000000000000000000000000000000..eecfdf6849b6710ba2fd21b80a6d85a0d356e190 GIT binary patch literal 21734 zcmeIa2UJsA*Df3nib_XB5fBuQ6$O+gH7F`J6h)eJQHoJR?+}%y0-{F|r6Y>e1Vp5R zfQkYkA`qmDlmMZcgc3;j=SGiu&imf`|KpDPz2m$0KW7ZbI3#pSn%u9q?Gt6t*~$}MQR)B04;x$(#QcXDuV6!_G-=i2@2fycDgnmybX6l%Il zM!#c!kf01}Yk|VMATD8edl6JZ{%Nnr8W0eQtZ8K0%EKLGclYWQ$$o2InKDD(C zGv&5@n3{6`)YUb{ltXP08&F+yfiHPAa)skwp5o$Sb4ku+-b}i~r;d)1zh40(w=Wrd z-OzAKgohI@M4hiPtA1Q(eSbfg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tsCY)$trz}hvhB5*=rBYZSeBPG)&uPBj z%pQnTEN3$@$hlEy`HPsDne6Q$PQS+nw0WW?v@x5LV0^>WJX1n^32#o_FN+J=Ki^yj ztp=0B%^9AvUoXrUkYaLoU25UqA$ea_|0 z_)Vy*tC2Vi$oS^XK?H`4jEr`R^A$_{EoMSMo`lo=_>g^vpbEK|JcPwPzy0ausun?% z78gNc literal 0 HcmV?d00001 From 3236013447eb69d837d9041c0fdaeb630cf3484d Mon Sep 17 00:00:00 2001 From: Samuel Nitsche Date: Fri, 25 Aug 2017 11:44:10 +0200 Subject: [PATCH 04/14] Included the new .sh scripts into contribution page. Added some information --- CONTRIBUTING.md | 57 +++++++++++++----------------------------- development/cleanup.sh | 3 +++ 2 files changed, 21 insertions(+), 39 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 15ada698c..33b65db65 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -76,13 +76,23 @@ unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli && rm utPLSQL-cli.zip ``` +Now adjust the file ``development/env.sh`` to match your local needs. +You might have to adjust the following lines: + +````bash +export SQLCLI=sql # For sqlcl client +#export SQLCLI=sqlplus # For sqlplus client +export CONNECTION_STR=127.0.0.1:1521/xe # Adjust the connect string +export ORACLE_PWD=oracle # Adjust your local SYS password +```` + Refreshing your local repo. ```bash # fetch all remote repositories git fetch --all # remove sub-direcotry containing master branch shallow copy -rm -rf utPLSQL/* +rm -rf utPLSQL # clone utPLSQL master branch from upstream into utPLSQL sub-directory of your project git clone --depth=1 --branch=master https://github.com/utPLSQL/utPLSQL.git @@ -94,50 +104,19 @@ unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli && rm utPLSQL-cli.zip ``` -Cleanup of utPLSQL installation. -```sql -drop user ut3 cascade; -drop user ut3_latest_release cascade; -drop user ut3_tester cascade; -drop user ut3$user# cascade; - -begin - for i in ( - select decode(owner,'PUBLIC','drop public synonym "','drop synonym "'||owner||'"."')|| synonym_name ||'"' drop_orphaned_synonym from dba_synonyms a - where not exists (select null from dba_objects b where a.table_name=b.object_name and a.table_owner=b.owner ) - ) loop - execute immediate i.drop_orphaned_synonym; - end loop; -end; -/ +Cleanup of utPLSQL installation (call from your base repo directory). +```bash +development/cleanup.sh ``` -Install utPLSQL for development +Install utPLSQL for development (call from your base repo directory) ```bash -export UT3_OWNER=ut3 -export UT3_OWNER_PASSWORD=ut3 -export UT3_RELEASE_VERSION_SCHEMA=ut3_latest_release -export UT3_TESTER=ut3_tester -export UT3_TESTER_PASSWORD=ut3 -export UT3_TABLESPACE=users -export UT3_USER="UT3\$USER#" -export UT3_USER_PASSWORD=ut3 -export SQLCLI=sql -export CONNECTION_STR=127.0.0.1:1521/orcl -export ORACLE_PWD=oracle - -.travis/install.sh -.travis/install_utplsql_release.sh -.travis/create_additional_grants_for_old_tests.sh +development/install.sh ``` -Reinstalling utPLSQL development in `ut3` schema. +Reinstalling utPLSQL development in `ut3` schema (call from your base repo directory). ```bash -cd source -sqlplus sys/oracle@orcl as sysdba <<-SQL -@uninstall ut3 -@install ut3 -SQL +development/refresh.sh ``` ## Build Environment ## diff --git a/development/cleanup.sh b/development/cleanup.sh index 98f315688..a8c0415db 100755 --- a/development/cleanup.sh +++ b/development/cleanup.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +cd $(git rev-parse --show-cdup) + +development/env.sh "${SQLCLI}" sys/${ORACLE_PWD}@//${CONNECTION_STR} AS SYSDBA <<-SQL drop user ${UT3_OWNER} cascade; From 7b61f9e2e53cd7d89d7d03881d8930f0acb48794 Mon Sep 17 00:00:00 2001 From: Samuel Nitsche Date: Fri, 25 Aug 2017 11:53:15 +0200 Subject: [PATCH 05/14] Added Modules picture to CONTRIBUTING.md --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 33b65db65..b49c588d8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -119,6 +119,11 @@ Reinstalling utPLSQL development in `ut3` schema (call from your base repo direc development/refresh.sh ``` +## Modules ## + +![utPLSQL V3 Modules](development/utPSLQLv3-modules.png) + + ## Build Environment ## We are using private docker images to test utPLSQL for our Travis CI builds. The following versions of Oracle Database are being used. From 2b6d6eb4698c0fb8072f9b2f95a7aeb98c8d04b5 Mon Sep 17 00:00:00 2001 From: Samuel Nitsche Date: Fri, 25 Aug 2017 11:21:55 +0100 Subject: [PATCH 06/14] Added comment behind ORACLE_PWD env variable --- development/env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/development/env.sh b/development/env.sh index 193a176df..6c935ad9f 100755 --- a/development/env.sh +++ b/development/env.sh @@ -12,5 +12,5 @@ export UTPLSQL_DIR="utPLSQL_latest_release" export SQLCLI=sql # For sqlcl client #export SQLCLI=sqlplus # For sqlplus client export CONNECTION_STR=127.0.0.1:1521/xe # Adjust the connect string -export ORACLE_PWD=oracle +export ORACLE_PWD=oracle # Adjust your local SYS password From 3fddfbddb92b6862f5ef2d304f635b8997846693 Mon Sep 17 00:00:00 2001 From: Jacek Date: Sat, 26 Aug 2017 09:34:29 +0100 Subject: [PATCH 07/14] Changed `env.sh` to `template.env.sh`. `template.env.sh` is read-only - so developers don't change it by accident. Changed directory name to `utPLSQL_latest_release` in travis to match the `template.env.sh` and updated `.gitignore` to prevent `env.sh` and `utPLSQL_latest_release` from getting committed. --- .gitignore | 4 ++-- .travis.yml | 2 +- CONTRIBUTING.md | 2 +- development/{env.sh => template.env.sh} | 12 +++++++----- 4 files changed, 11 insertions(+), 9 deletions(-) rename development/{env.sh => template.env.sh} (99%) diff --git a/.gitignore b/.gitignore index 379f860c7..2e3cbd33e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,6 @@ release/ *.gz *.zip node_modules/ -utPLSQL/ +utPLSQL_latest_release/ utPLSQL-cli/ - +development/env.sh diff --git a/.travis.yml b/.travis.yml index 74d484d89..0f2294b8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ env: - UT3_DOCKER_REPO="utplsqlv3/oracledb" - DOCKHER_HUB_REPO="${DOCKER_BASE_TAG:-$UT3_DOCKER_REPO}" #utPLSQL released version directory - - UTPLSQL_DIR="utPLSQL" + - UTPLSQL_DIR="utPLSQL_latest_release" matrix: - ORACLE_VERSION="${DOCKER_TAG_11G:-11g-r2-xe}" CONNECTION_STR='127.0.0.1:1521/XE' DOCKER_OPTIONS='--shm-size=1g' - 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" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b49c588d8..c504b41e9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -76,7 +76,7 @@ unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli && rm utPLSQL-cli.zip ``` -Now adjust the file ``development/env.sh`` to match your local needs. +Now copy the file `development/template.env.sh` to `development/env.sh` and adjust variables to match your local needs. You might have to adjust the following lines: ````bash diff --git a/development/env.sh b/development/template.env.sh similarity index 99% rename from development/env.sh rename to development/template.env.sh index 6c935ad9f..54d9846a9 100755 --- a/development/env.sh +++ b/development/template.env.sh @@ -1,5 +1,12 @@ #!/usr/bin/env bash +export UTPLSQL_DIR="utPLSQL_latest_release" +export SQLCLI=sql # For sqlcl client +#export SQLCLI=sqlplus # For sqlplus client +export CONNECTION_STR=127.0.0.1:1521/xe # Adjust the connect string +export ORACLE_PWD=oracle # Adjust your local SYS password + + export UT3_OWNER=ut3 export UT3_OWNER_PASSWORD=ut3 export UT3_RELEASE_VERSION_SCHEMA=ut3_latest_release @@ -8,9 +15,4 @@ export UT3_TESTER_PASSWORD=ut3 export UT3_TABLESPACE=users export UT3_USER="UT3\$USER#" export UT3_USER_PASSWORD=ut3 -export UTPLSQL_DIR="utPLSQL_latest_release" -export SQLCLI=sql # For sqlcl client -#export SQLCLI=sqlplus # For sqlplus client -export CONNECTION_STR=127.0.0.1:1521/xe # Adjust the connect string -export ORACLE_PWD=oracle # Adjust your local SYS password From a082451097c97cd905248268aadbce53a52fc25d Mon Sep 17 00:00:00 2001 From: Jacek Date: Sat, 26 Aug 2017 09:38:49 +0100 Subject: [PATCH 08/14] Added missing directory name to clone of master branch from main repo. --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c504b41e9..0efac30af 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,7 +67,7 @@ git remote add upstream https://github.com/utPLSQL/utPLSQL.git git fetch --all # clone utPLSQL master branch from upstream into utPLSQL sub-directory of your project -git clone --depth=1 --branch=master https://github.com/utPLSQL/utPLSQL.git +git clone --depth=1 --branch=master https://github.com/utPLSQL/utPLSQL.git utPLSQL_latest_release # download beta version of utPLSQL-cli curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=utPLSQL-cli-develop-test3.zip From 4a1d223cedb81fbd36e00f8e7b1ce2e1384f30e2 Mon Sep 17 00:00:00 2001 From: Jacek Date: Sat, 26 Aug 2017 12:43:42 +0100 Subject: [PATCH 09/14] Update of CONTRIBUTING.md. Fixed developer scripts. --- CONTRIBUTING.md | 74 +++++++++++----------- development/cleanup.sh | 6 +- development/install.sh | 7 +- development/readme.md | 6 -- development/refresh_sources.sh | 18 ++++++ development/{refresh.sh => refresh_ut3.sh} | 5 +- development/template.env.sh | 4 +- 7 files changed, 70 insertions(+), 50 deletions(-) delete mode 100644 development/readme.md create mode 100644 development/refresh_sources.sh rename development/{refresh.sh => refresh_ut3.sh} (61%) mode change 100755 => 100644 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0efac30af..1e62f8159 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,77 +50,79 @@ We use four different database accounts (users) for development process. -Snippet to get you started with development. - -_If you're using Windows, you can run below scripts using `GIT bash` - Windows-based Unix-like command line._ +### To get started with development, follow the below steps. +_If you're using Windows, run the shell scripts using `GIT bash` - Windows-based bash command line._ + +**Clone your fork of utPLSQL git repository** ```bash # clone your fork of utPLSQL git clone https://github.com/your account/utPLSQL.git utPLSQL cd utPLSQL -# add main porject repo as upstream +# add main project repo as upstream git remote add upstream https://github.com/utPLSQL/utPLSQL.git # fetch all remote repositories git fetch --all +``` -# clone utPLSQL master branch from upstream into utPLSQL sub-directory of your project -git clone --depth=1 --branch=master https://github.com/utPLSQL/utPLSQL.git utPLSQL_latest_release - -# download beta version of utPLSQL-cli -curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=utPLSQL-cli-develop-test3.zip -# unzip utPLSQL-cli and remove the zip file -unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli && rm utPLSQL-cli.zip +**Prepare environment script** +Copy the environment variables template `development/template.env.sh` to `development/env.sh` +```bash +cp development/template.env.sh development/env.sh +chmod u+w development/env.sh ``` -Now copy the file `development/template.env.sh` to `development/env.sh` and adjust variables to match your local needs. -You might have to adjust the following lines: - -````bash +You might have to adjust the following lines in `development/env.sh`: +```bash export SQLCLI=sql # For sqlcl client #export SQLCLI=sqlplus # For sqlplus client export CONNECTION_STR=127.0.0.1:1521/xe # Adjust the connect string export ORACLE_PWD=oracle # Adjust your local SYS password -```` +``` + +**Download utPLSQL release sources and utplsq-cli** -Refreshing your local repo. +_The below script is fetching latest release version from utPLSQL repository. Latest release version is used for self-testing._ ```bash -# fetch all remote repositories -git fetch --all +development/refresh_sources.sh +``` -# remove sub-direcotry containing master branch shallow copy -rm -rf utPLSQL -# clone utPLSQL master branch from upstream into utPLSQL sub-directory of your project -git clone --depth=1 --branch=master https://github.com/utPLSQL/utPLSQL.git +**Setup local database for utPLSQL development** +```bash +development/install.sh +``` -rm -rf utPLSQL-cli/* -# download beta version of utPLSQL-cli -curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=utPLSQL-cli-develop-test3.zip -# unzip utPLSQL-cli and remove the zip file -unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli && rm utPLSQL-cli.zip +That's it! You now have the following: +- sources from `develop` branch of your fork of utPLSQL repository in `utPLSQL/ut3_latest_release` directory +- sources from `master` branch of utPLSQL/utPLSQL repository in `utPLSQL/ut3_latest_release` directory +- binaries of `utplsql-cli` in `utPLSQL/utPLSQL-cli` directory +- database users created +- utPLSQL develop version deployed to `ut3` schema +- utPLSQL released version deployed to `ut3_latest_release` -``` +At any time, if you need to refresh your database, the below scripts might be helpful. -Cleanup of utPLSQL installation (call from your base repo directory). +### Cleanup of utPLSQL installation in local database ```bash development/cleanup.sh ``` -Install utPLSQL for development (call from your base repo directory) +### Reinstalling utPLSQL development in `ut3` schema ```bash -development/install.sh +development/refresh_ut3.sh ``` -Reinstalling utPLSQL development in `ut3` schema (call from your base repo directory). -```bash -development/refresh.sh -``` +Whenever a new version of utPLSQL or a new version of utPLSQL-cli is available, use `development/refresh_sources.sh` to refresh files in your local project folders. ## Modules ## +Below diagram gives a high-level overview of utPLSQL v3 modules and their dependencies. +Dependencies to `ut_util` are not shown as most of modules are depending on it. + ![utPLSQL V3 Modules](development/utPSLQLv3-modules.png) diff --git a/development/cleanup.sh b/development/cleanup.sh index a8c0415db..10620614f 100755 --- a/development/cleanup.sh +++ b/development/cleanup.sh @@ -1,7 +1,9 @@ #!/usr/bin/env bash -cd $(git rev-parse --show-cdup) -development/env.sh +#goto git root directory +git rev-parse && cd "$(git rev-parse --show-cdup)" + +. development/env.sh "${SQLCLI}" sys/${ORACLE_PWD}@//${CONNECTION_STR} AS SYSDBA <<-SQL drop user ${UT3_OWNER} cascade; diff --git a/development/install.sh b/development/install.sh index 7d7f31047..a37dee0d2 100755 --- a/development/install.sh +++ b/development/install.sh @@ -1,9 +1,12 @@ #!/usr/bin/env bash -cd $(git rev-parse --show-cdup) +#goto git root directory +git rev-parse && cd "$(git rev-parse --show-cdup)" + +. development/env.sh -development/env.sh development/cleanup.sh + .travis/install.sh .travis/install_utplsql_release.sh .travis/create_additional_grants_for_old_tests.sh diff --git a/development/readme.md b/development/readme.md deleted file mode 100644 index 5a0d0a50c..000000000 --- a/development/readme.md +++ /dev/null @@ -1,6 +0,0 @@ -# Build Folder - - Contains the build scripts that can be run locally on a developer's machine to build, run and test utPLSQL. - - These scripts are also used by the Jenkins Continuous Integration server to check each pull request before it is merged. - diff --git a/development/refresh_sources.sh b/development/refresh_sources.sh new file mode 100644 index 000000000..d59a492fc --- /dev/null +++ b/development/refresh_sources.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +#goto git root directory +git rev-parse && cd "$(git rev-parse --show-cdup)" + +. development/env.sh + +# remove sub-direcotry containing master branch shallow copy +rm -rf ${UTPLSQL_DIR:-utPLSQL_latest_release} +# clone utPLSQL master branch from upstream into utPLSQL sub-directory of your project +git clone --depth=1 --branch=${SELFTESTING_BRANCH:-master} https://github.com/utPLSQL/utPLSQL.git ${UTPLSQL_DIR:-utPLSQL_latest_release} + +rm -rf utPLSQL-cli/* +# download beta version of utPLSQL-cli +curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=utPLSQL-cli-develop-test3.zip +# unzip utPLSQL-cli and remove the zip file +unzip utPLSQL-cli.zip && chmod u+x utPLSQL-cli/bin/utplsql && rm utPLSQL-cli.zip + diff --git a/development/refresh.sh b/development/refresh_ut3.sh old mode 100755 new mode 100644 similarity index 61% rename from development/refresh.sh rename to development/refresh_ut3.sh index cbc281488..542f5a01c --- a/development/refresh.sh +++ b/development/refresh_ut3.sh @@ -1,8 +1,9 @@ #!/usr/bin/env bash -cd $(git rev-parse --show-cdup) +#goto git root directory +git rev-parse && cd "$(git rev-parse --show-cdup)" -development/env.sh +. development/env.sh cd source diff --git a/development/template.env.sh b/development/template.env.sh index 54d9846a9..571a409c5 100755 --- a/development/template.env.sh +++ b/development/template.env.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash -export UTPLSQL_DIR="utPLSQL_latest_release" export SQLCLI=sql # For sqlcl client #export SQLCLI=sqlplus # For sqlplus client export CONNECTION_STR=127.0.0.1:1521/xe # Adjust the connect string export ORACLE_PWD=oracle # Adjust your local SYS password - +export UTPLSQL_DIR="utPLSQL_latest_release" +export SELFTESTING_BRANCH=master export UT3_OWNER=ut3 export UT3_OWNER_PASSWORD=ut3 export UT3_RELEASE_VERSION_SCHEMA=ut3_latest_release From 9c6abb8b88fdc36b43febf6b54bedf8b151b159f Mon Sep 17 00:00:00 2001 From: Jacek Date: Sat, 26 Aug 2017 12:52:52 +0100 Subject: [PATCH 10/14] changed refresh_sources.sh to be executable --- development/refresh_sources.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 development/refresh_sources.sh diff --git a/development/refresh_sources.sh b/development/refresh_sources.sh old mode 100644 new mode 100755 From ace7812ec0addf87362813815c93c8a120c1fdf7 Mon Sep 17 00:00:00 2001 From: Jacek Date: Sat, 26 Aug 2017 13:32:30 +0100 Subject: [PATCH 11/14] 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) --- .travis.yml | 3 +- development/cleanup.sh | 3 +- development/refresh_sources.sh | 2 +- development/template.env.sh | 3 +- test/install_and_run_tests.sh | 2 ++ test/ut_utils/test_ut_utils.pkb | 56 ++++++++++++++++----------------- 6 files changed, 37 insertions(+), 32 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0f2294b8c..97eeeb15c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,6 +46,7 @@ env: - DOCKHER_HUB_REPO="${DOCKER_BASE_TAG:-$UT3_DOCKER_REPO}" #utPLSQL released version directory - UTPLSQL_DIR="utPLSQL_latest_release" + - UTPLSQL_CLI_FILE="utPLSQL-cli-develop-test3.zip" matrix: - ORACLE_VERSION="${DOCKER_TAG_11G:-11g-r2-xe}" CONNECTION_STR='127.0.0.1:1521/XE' DOCKER_OPTIONS='--shm-size=1g' - 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: #- curl -LOk $(curl --silent https://api.github.com/repos/utPLSQL/utPLSQL/releases/latest | awk '/browser_download_url/ { print $2 }' | grep ".zip" | sed 's/"//g') - git clone --depth=1 --branch=${SELFTESTING_BRANCH:-master} https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR # download utPLSQL-cli develop - - curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=utPLSQL-cli-develop-test3.zip + - curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=${UTPLSQL_CLI_FILE} install: #- unzip utPLSQL.zip diff --git a/development/cleanup.sh b/development/cleanup.sh index 10620614f..7f72d093e 100755 --- a/development/cleanup.sh +++ b/development/cleanup.sh @@ -6,6 +6,7 @@ git rev-parse && cd "$(git rev-parse --show-cdup)" . development/env.sh "${SQLCLI}" sys/${ORACLE_PWD}@//${CONNECTION_STR} AS SYSDBA <<-SQL +set echo on drop user ${UT3_OWNER} cascade; drop user ${UT3_RELEASE_VERSION_SCHEMA} cascade; drop user ${UT3_TESTER} cascade; @@ -15,7 +16,7 @@ begin for i in ( select decode(owner,'PUBLIC','drop public synonym "','drop synonym "'||owner||'"."')|| synonym_name ||'"' drop_orphaned_synonym from dba_synonyms a where not exists (select null from dba_objects b where a.table_name=b.object_name and a.table_owner=b.owner ) - and a.table_owner in ('${UT3_OWNER}','${UT3_RELEASE_VERSION_SCHEMA}','${UT3_TESTER}','${UT3_USER}') + and a.table_owner <> 'SYS' ) loop execute immediate i.drop_orphaned_synonym; end loop; diff --git a/development/refresh_sources.sh b/development/refresh_sources.sh index d59a492fc..27a65a92b 100755 --- a/development/refresh_sources.sh +++ b/development/refresh_sources.sh @@ -12,7 +12,7 @@ git clone --depth=1 --branch=${SELFTESTING_BRANCH:-master} https://github.com/ut rm -rf utPLSQL-cli/* # download beta version of utPLSQL-cli -curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=utPLSQL-cli-develop-test3.zip +curl -Lk -o utPLSQL-cli.zip https://bintray.com/viniciusam/utPLSQL-cli/download_file?file_path=${UTPLSQL_CLI_FILE} # unzip utPLSQL-cli and remove the zip file unzip utPLSQL-cli.zip && chmod u+x utPLSQL-cli/bin/utplsql && rm utPLSQL-cli.zip diff --git a/development/template.env.sh b/development/template.env.sh index 571a409c5..861d7d1bd 100755 --- a/development/template.env.sh +++ b/development/template.env.sh @@ -4,9 +4,10 @@ export SQLCLI=sql # For sqlcl client #export SQLCLI=sqlplus # For sqlplus client export CONNECTION_STR=127.0.0.1:1521/xe # Adjust the connect string export ORACLE_PWD=oracle # Adjust your local SYS password +export UTPLSQL_CLI_FILE="utPLSQL-cli-develop-test3.zip" +export SELFTESTING_BRANCH=develop export UTPLSQL_DIR="utPLSQL_latest_release" -export SELFTESTING_BRANCH=master export UT3_OWNER=ut3 export UT3_OWNER_PASSWORD=ut3 export UT3_RELEASE_VERSION_SCHEMA=ut3_latest_release diff --git a/test/install_and_run_tests.sh b/test/install_and_run_tests.sh index 1685a7ba6..c5c890ea2 100644 --- a/test/install_and_run_tests.sh +++ b/test/install_and_run_tests.sh @@ -1,5 +1,7 @@ #!/bin/bash set -ev +#goto git root directory +git rev-parse && cd "$(git rev-parse --show-cdup)" cd test diff --git a/test/ut_utils/test_ut_utils.pkb b/test/ut_utils/test_ut_utils.pkb index 7fc0e737b..17e2d80db 100644 --- a/test/ut_utils/test_ut_utils.pkb +++ b/test/ut_utils/test_ut_utils.pkb @@ -53,24 +53,24 @@ end;]' using p_expected_list; common_clob_to_table_exec( 'abcdefg,hijk,axa,a', ',', ut3.ut_varchar2_list('abc','def','g','hij','k','axa','a'), 3); common_clob_to_table_exec( ',a,,c,d,', ',', ut3.ut_varchar2_list('','a','','c','d',''), 1000); end; - + procedure test_to_char is begin ut.expect(ut3.ut_utils.test_result_to_char(-1),'test unknown').to_equal('Unknown(-1)'); ut.expect(ut3.ut_utils.test_result_to_char(null),'test unknown').to_equal('Unknown(NULL)'); ut.expect(ut3.ut_utils.test_result_to_char(ut3.ut_utils.tr_success),'test unknown').to_equal(ut3.ut_utils.tr_success_char); end; - + procedure test_to_string_blob is l_text varchar2(32767) := 'A test char'; l_value blob := utl_raw.cast_to_raw(l_text); - l_expected varchar2(32767) := ''''||rawtohex(l_value)||''''; + l_expected varchar2(32767) := ''''||rawtohex(l_value)||''''; l_result varchar2(32767); begin l_result := ut3.ut_utils.to_String(l_value); ut.expect(l_result).to_equal(l_expected); end; - + procedure test_to_string_clob is l_value clob := 'A test char'; l_expected varchar2(32767) := ''''||l_value||''''; @@ -78,8 +78,8 @@ end;]' using p_expected_list; begin l_result := ut3.ut_utils.to_String(l_value); ut.expect(l_result).to_equal(l_expected); - end; - + end; + procedure test_to_string_date is l_value date := to_date('2016-12-31 23:59:59', 'yyyy-mm-dd hh24:mi:ss'); l_expected varchar2(100) := '2016-12-31T23:59:59'; @@ -88,7 +88,7 @@ end;]' using p_expected_list; l_result := ut3.ut_utils.to_String(l_value); ut.expect(l_result).to_equal(l_expected); end; - + procedure to_string_null is begin ut.expect(ut3.ut_utils.to_String(to_blob(NULL))).to_equal('NULL'); @@ -97,7 +97,7 @@ end;]' using p_expected_list; ut.expect(ut3.ut_utils.to_String(to_number(NULL))).to_equal('NULL'); ut.expect(ut3.ut_utils.to_String(to_timestamp(NULL))).to_equal('NULL'); end; - + procedure to_string is l_value timestamp(9) := to_timestamp('2016-12-31 23:59:59.123456789', 'yyyy-mm-dd hh24:mi:ss.ff'); 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; begin select substr(value, 1, 1) into l_delimiter from nls_session_parameters t where t.parameter = 'NLS_NUMERIC_CHARACTERS'; l_expected := '2016-12-31T23:59:59'||l_delimiter||'123456789'; - + l_result := ut3.ut_utils.to_String(l_value); ut.expect(l_result,'Returns a full string representation of a timestamp with maximum precission').to_equal(l_expected); - + l_expected := '2016-12-31T23:59:59'||l_delimiter||'123456789'; l_result := ut3.ut_utils.to_String(l_value2); - ut.expect(l_result,'Returns a full string representation of a timestamp with maximum precission').to_equal(l_expected); + ut.expect(l_result,'Returns a full string representation of a timestamp with maximum precission').to_equal(l_expected); l_expected := '2016-12-31T23:59:59'||l_delimiter||'123456789 -08:00'; - + l_result := ut3.ut_utils.to_String(l_value3); - ut.expect(l_result,'Returns a full string representation of a timestamp with maximum precission').to_equal(l_expected); - - l_expected := ''''||l_value4||''''; + ut.expect(l_result,'Returns a full string representation of a timestamp with maximum precission').to_equal(l_expected); + + l_expected := ''''||l_value4||''''; l_result := ut3.ut_utils.to_String(l_value4); - ut.expect(l_result,'Returns a varchar2 eclosed in quotes').to_equal(l_expected); - + ut.expect(l_result,'Returns a varchar2 eclosed in quotes').to_equal(l_expected); + end; - + procedure to_string_big_blob is l_text clob := lpad('A test char',32767,'1')||lpad('1',32767,'1'); l_value blob; @@ -162,7 +162,7 @@ end;]' using p_expected_list; ut.EXPECT(l_result).to_be_like('%'||ut3.ut_utils.gc_more_data_string); end; - + procedure to_string_big_clob is l_value clob := lpad('A test char',32767,'1')||lpad('1',32767,'1'); l_result varchar2(32767); @@ -173,7 +173,7 @@ end;]' using p_expected_list; ut.EXPECT(length(l_result)).to_equal(ut3.ut_utils.gc_max_output_string_length); ut.EXPECT(l_result).to_be_like('%'||ut3.ut_utils.gc_more_data_string); end; - + procedure to_string_big_number is l_value number := 1234567890123456789012345678901234567890; l_expected varchar2(100) := '1234567890123456789012345678901234567890'; @@ -184,7 +184,7 @@ end;]' using p_expected_list; --Assert ut.expect(l_result).TO_equal(l_expected); end; - + procedure to_string_big_varchar2 is l_value varchar2(32767) := lpad('A test char',32767,'1'); l_result varchar2(32767); @@ -205,20 +205,20 @@ end;]' using p_expected_list; --Act select substr(value, 1, 1) into l_delimiter from nls_session_parameters t where t.parameter = 'NLS_NUMERIC_CHARACTERS'; l_expected := l_delimiter||'123456789012345678901234567890123456789'; - + l_result := ut3.ut_utils.to_String(l_value); - + --Assert ut.expect(l_result).TO_equal(l_expected); end; - + procedure test_table_to_clob is procedure exec_table_to_clob(a_list ut3.ut_varchar2_list, a_delimiter varchar2, a_expected clob) is l_result clob; begin l_result := ut3.ut_utils.table_to_clob(a_list, a_delimiter); - + ut.expect(l_result).to_equal(a_expected, a_nulls_are_equal => true); end; begin @@ -254,7 +254,7 @@ end;]' using p_expected_list; select value into gv_nls_value from nls_session_parameters where parameter = 'NLS_DATE_LANGUAGE'; execute immediate 'alter session set nls_date_language=ENGLISH'; execute immediate 'create or replace package tst_chars as --- 2) Status of the process = ‘PE’ with no linked data +-- 2) Status of the process = 😡PE😡 with no linked data end;'; execute immediate 'alter session set nls_date_language=RUSSIAN'; @@ -265,12 +265,12 @@ end;'; execute immediate 'alter session set nls_date_language='||gv_nls_value; execute immediate 'drop package tst_chars'; end; - + procedure test_clob_to_table_multibyte is l_varchar2_byte_limit integer := 32767; l_workaround_byte_limit integer := 8191; l_singlebyte_string_max_size varchar2(32767 char) := rpad('x',l_varchar2_byte_limit,'x'); - l_twobyte_character char(1 char) := 'æ'; + l_twobyte_character char(1 char) := 'ðŸ˜'; l_clob_multibyte clob := l_twobyte_character||l_singlebyte_string_max_size; --here we have 32769(2+32767) bytes and 32768 chars l_expected ut3.ut_varchar2_list := ut3.ut_varchar2_list(); l_result ut3.ut_varchar2_list; From 0aee33b674c3a488458e4d5cac4a36338c4ef827 Mon Sep 17 00:00:00 2001 From: Jacek Date: Sat, 26 Aug 2017 13:35:21 +0100 Subject: [PATCH 12/14] Added sh script to run all old tests --- old_tests/runAll.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 old_tests/runAll.sh diff --git a/old_tests/runAll.sh b/old_tests/runAll.sh new file mode 100755 index 000000000..a8b52979a --- /dev/null +++ b/old_tests/runAll.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -ev +#goto git root directory +git rev-parse && cd "$(git rev-parse --show-cdup)" + +cd old_tests + +"$SQLCLI" ${UT3_OWNER}/${UT3_OWNER_PASSWORD}@//${CONNECTION_STR} @RunAll.sql From d4e289131357964cab24dd572650b4150733065b Mon Sep 17 00:00:00 2001 From: Jacek Date: Sat, 26 Aug 2017 13:42:27 +0100 Subject: [PATCH 13/14] Removed obsolete RunAll.cmd script. Added html coverage reporting to new tests. --- old_tests/RunAll.cmd | 9 --------- test/install_and_run_tests.sh | 1 + 2 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 old_tests/RunAll.cmd diff --git a/old_tests/RunAll.cmd b/old_tests/RunAll.cmd deleted file mode 100644 index 041d2be96..000000000 --- a/old_tests/RunAll.cmd +++ /dev/null @@ -1,9 +0,0 @@ -echo off -set UT3_OWNER=ut3 -set UT3_OWNER_PASSWORD=XNtxj8eEgA6X6b6f -set ORACLE_SID=XE -if not [%1] == [] (set UT3_OWNER=%1) -if not [%2] == [] (set UT3_OWNER_PASSWORD=%2) -if not [%3] == [] (set ORACLE_SID=%3) - -sqlplus %UT3_OWNER%/%UT3_OWNER_PASSWORD%@%ORACLE_SID% @RunAll.sql diff --git a/test/install_and_run_tests.sh b/test/install_and_run_tests.sh index c5c890ea2..0e000f2a2 100644 --- a/test/install_and_run_tests.sh +++ b/test/install_and_run_tests.sh @@ -14,6 +14,7 @@ utPLSQL-cli/bin/utplsql run ${UT3_TESTER}/${UT3_TESTER_PASSWORD}@${CONNECTION_ST -test_path=test -c \ -f=ut_documentation_reporter -o=test_results.log -s \ -f=ut_coverage_sonar_reporter -o=coverage.xml \ +-f=ut_coverage_html_reporter -o=coverage.html \ -f=ut_coveralls_reporter -o=coverage.json \ -f=ut_sonar_test_reporter -o=test_results.xml From 681c1fa02ad33cdf7779af2a6cf8a031f1a77547 Mon Sep 17 00:00:00 2001 From: Jacek Date: Sat, 26 Aug 2017 18:05:11 +0100 Subject: [PATCH 14/14] Final updates to CONTRIBUTING.md --- CONTRIBUTING.md | 81 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 21 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1e62f8159..ef7c4c400 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,13 +1,13 @@ -## How to contribute ## +# How to contribute The following are the guidelines everyone should use to contribute to utPLSQL. Changes are welcome from all members of the Community. -## Getting Started ## +# Getting Started 1. Create a [GitHub Account](https://github.com/join). -2. Fork the utPLSQL Repository and setup your local Repository. - * Each of the steps below are detailed in the [how to Fork](https://help.github.com/articles/fork-a-repo) article! +2. Fork the utPLSQL Repository and setup your local Repository. _See [how to Fork](https://help.github.com/articles/fork-a-repo) article_ + * Each of the steps below are detailed in **Get started with development** section. * Clone your Fork to your local machine. * Configure "upstream" remote to the [utPLSQL repository](https://github.com/utPLSQL/utPLSQL.git). 3. For each change you want to make: @@ -22,7 +22,7 @@ Changes are welcome from all members of the Community. * Submit a [Pull Request](https://help.github.com/articles/using-pull-requests) into develop branch. * Note: local and remote branches can be deleted after pull request has been merged. -## Coding Standards ## +# Coding Standards * We use snake case for all identifiers in PLSQL code. This separates keywords in names with underscores. `execute_test` * All code is lower case. @@ -37,7 +37,7 @@ Changes are welcome from all members of the Community. * varchar2 lengths are set in characters not bytes -## Configuring local environment ## +# Configuring local environment Your local environment can be of any flavor (Unix/Linux/Windows/Mac). At minimum you need to have Oracle database 11.2 XE accessible for the project and SYS account access to install and develop utPLSQL. @@ -50,11 +50,14 @@ We use four different database accounts (users) for development process. -### To get started with development, follow the below steps. +## Get started with development + +To get started with development, follow the below steps. _If you're using Windows, run the shell scripts using `GIT bash` - Windows-based bash command line._ -**Clone your fork of utPLSQL git repository** +### Clone your fork of utPLSQL git repository + ```bash # clone your fork of utPLSQL git clone https://github.com/your account/utPLSQL.git utPLSQL @@ -68,7 +71,7 @@ git remote add upstream https://github.com/utPLSQL/utPLSQL.git git fetch --all ``` -**Prepare environment script** +### Prepare environment script Copy the environment variables template `development/template.env.sh` to `development/env.sh` ```bash @@ -84,19 +87,22 @@ export CONNECTION_STR=127.0.0.1:1521/xe # Adjust the connect string export ORACLE_PWD=oracle # Adjust your local SYS password ``` -**Download utPLSQL release sources and utplsq-cli** +### Download utPLSQL release sources and utplsq-cli -_The below script is fetching latest release version from utPLSQL repository. Latest release version is used for self-testing._ +The below script is fetching latest release version from utPLSQL repository. Latest release version is used for self-testing. ```bash development/refresh_sources.sh ``` -**Setup local database for utPLSQL development** +### Setup local database for utPLSQL development + ```bash development/install.sh ``` -That's it! You now have the following: +### That's it + +You now have the following: - sources from `develop` branch of your fork of utPLSQL repository in `utPLSQL/ut3_latest_release` directory - sources from `master` branch of utPLSQL/utPLSQL repository in `utPLSQL/ut3_latest_release` directory - binaries of `utplsql-cli` in `utPLSQL/utPLSQL-cli` directory @@ -106,19 +112,52 @@ That's it! You now have the following: At any time, if you need to refresh your database, the below scripts might be helpful. -### Cleanup of utPLSQL installation in local database +## Running unit tests + +Currently we use two forms of unit tests in our CI build: +- sql scripts as unit tests in the `old_tests` directory +- utPLSQL v3 unit tests in the `test` directory + +Before you push any changes and create a pull request to the utPLSQL project repository, make sure that all of the tests are executing successfully in your local environment. + +Every new functionality needs to be documented by unit tests that cover both happy-path scenarios as well as edge-cases and exception paths. + +> **Important notice:** +> We do our best to keep utPLSQL covered with unit tests. +> Lack of sufficient unit testing is a perfect reason for PR to be rejected. + +To suite of legacy unit tests execute: +```bash +development/env.sh +old_tests/runAll.sh +``` +To run a full suite of unit tests execute: +```bash +development/env.sh +test/install_and_run_tests.sh +``` + +You can review the results of tests as well as see information about code coverage in `./old_tests/coverage.html, ./coverage.html` files. + + +## Cleanup of utPLSQL installation in local database + ```bash development/cleanup.sh ``` -### Reinstalling utPLSQL development in `ut3` schema +## Reinstalling utPLSQL development in `ut3` schema + ```bash development/refresh_ut3.sh ``` -Whenever a new version of utPLSQL or a new version of utPLSQL-cli is available, use `development/refresh_sources.sh` to refresh files in your local project folders. +## Refreshing after release + +Whenever a new version of utPLSQL or a new version of utPLSQL-cli is available, use `development/refresh_sources.sh` to refresh files in your local project folders. + -## Modules ## +## Modules Below diagram gives a high-level overview of utPLSQL v3 modules and their dependencies. Dependencies to `ut_util` are not shown as most of modules are depending on it. @@ -126,7 +165,7 @@ Dependencies to `ut_util` are not shown as most of modules are depending on it. ![utPLSQL V3 Modules](development/utPSLQLv3-modules.png) -## Build Environment ## +## Build Environment We are using private docker images to test utPLSQL for our Travis CI builds. The following versions of Oracle Database are being used. @@ -143,7 +182,7 @@ The build steps are simple if you already have some experience using Docker. You > If you are new to Docker, you can start by reading the [Getting Started With Docker](https://docs.docker.com/engine/getstarted/) docs. -### Docker Build Notes ### +### Docker Build Notes * You need to comment out the VOLUME line. This step is required, because volumes are not saved when using `docker commit` command. * When the build process is complete, you will run the container to install the database. Once everything is set up and you see the message "DATABASE IS READY!", you may change the password and stop the running container. After the container is stopped, you can safely commit the container. @@ -158,7 +197,7 @@ Variable | Description ---------|------------ **DOCKER_USER**
**DOCKER_PASSWORD** | _Your Docker Hub website credentials. They will be used to pull the private database images._ -### SQLCL ### +### SQLCL Our build configuration uses SQLCL to run the scripts, and you need to configure a few additional secure environment variables. After the first build, the downloaded file will be cached. @@ -167,7 +206,7 @@ Variable | Description **ORACLE_OTN_USER
ORACLE_OTN_PASSWORD** | _Your Oracle website credentials. They will be used to download SQLCL._ -## New to GIT ## +## New to GIT If you are new to GIT here are some links to help you with understanding how it works.