Git Product home page Git Product logo

utplsql-v2-v3-migration's Introduction

build sonar

utPLSQL v2 to v3 migration utility

This project provides a migration utility to enrich utPLSQL v2 package specification with utPLSQL v3 annotations

Download

Download latest release from this location:

https://github.com/utPLSQL/utPLSQL-v2-v3-migration/releases/latest

Requirements

  • latest version of utPLSQL v2 needs to be installed
  • utPLSQL v3 needs to be installed
  • Installation needs to be done from a SYS account or as SYSDBA as utPLSQL v3 user needs to be granted execute privilege on UTL_FILE. This is required for installing utPLSQL v2 compatibility within utPLSQL v3.

Content

Migration utility contains the following components:

  • Package ut_v2_migration
  • Modified version of utassert package from utPLSQL version 2.3.1
  • Modified version of utassert2 package from utPLSQL version 2.3.1

All of above components are installed into utPLSQL v3 schema, have public synonyms created and are granted to public.

Installation

Navigate to source directory and execute install.sql script using SQLPlus or sqlcl as in the example below.

cd source
sqlplus sys/oracle@xe as sysdba @install utp ut3

The install script does the following:

  • Checks if utPLSQL v2 is installed
  • Checks if utPLSQL v3 is installed
  • Drops public synonyms for utassert and utassert2
  • Installs packages: ut_v2_migration, utassert, utassert2 into utPLSQL v3 schema
  • Creates public synonyms for utassert and utassert2 in utPLSQL v3 schema
  • Grants execute on packages: ut_v2_migration, utassert, utassert2 to PUBLIC

Migration process

Requirements

The migration process scans utPLSQL v2 meta-data tables:

  • ut_package
  • ut_suite
  • ut_config

In order to be considered by migration process, Unit Test package needs to:

  • be registered in ut_package table - this can be done either by manually registering a package or by executing test package using utPLSQL v2 framework
  • be existing in the database
  • be valid

User executing the migration needs to:

  • be the owner of migrated packages
  • have create any procedure system privilege

The migration process is designed, so that after migration, you can invoke the unit tests using both:

  • utPLSQL v2.x framework
  • utPLSQL v3.x framework

Once migration packages were installed, you can either test or execute migration of utPLSQL v2 packages.

Testing migration

You may want to execute a dry-run of migration prior to running actual process on your database. The dry-run will output results of migration to dbms_output.

There are several ways to invoke the dry-run:

  • for all utPLSQL v2 packages registered in the database
set serveroutput on
begin
  ut_v2_migration.dry_run_all;
end;
/
  • for utPLSQL v2 packages registered in a schema
set serveroutput on
begin
  ut_v2_migration.dry_run(a_owner => 'XYZ');
end;
/
  • for utPLSQL v2 suite
set serveroutput on
begin
  ut_v2_migration.dry_run_for_suite(a_suite_name => 'XYZ');
end;
/
  • for a single utPLSQL v2 package
set serveroutput on
begin
  ut_v2_migration.dry_run(a_owner => 'XYZ', a_package => 'ABC');
end;
/

Executing migration

  • for all utPLSQL v2 packages registered in the database
set serveroutput on
begin
  ut_v2_migration.run_all;
end;
/
  • for utPLSQL v2 packages registered in a schema
set serveroutput on
begin
  ut_v2_migration.run(a_owner => 'XYZ');
end;
/
  • for utPLSQL v2 suite
set serveroutput on
begin
  ut_v2_migration.run_for_suite(a_suite_name => 'XYZ');
end;
/
  • for a single utPLSQL v2 package
set serveroutput on
begin
  ut_v2_migration.run(a_owner => 'XYZ', a_package => 'ABC');
end;
/

utplsql-v2-v3-migration's People

Contributors

jgebal avatar pazus avatar puchtec avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

puchtec

utplsql-v2-v3-migration's Issues

Fix of issue #9 breaks our tests

If we use the fixed utassert2 package every of our tests fail with:
ORA-02291: integrity constraint (UT.UTR_ERROR_OUTCOME_FK) violated - parent key not found
ORA-06512: at "UT.UTRERROR", line 149
ORA-06512: at "UT.UTRERROR", line 103
ORA-06512: at "UT.UTRERROR", line 324
ORA-06512: at "UT.UTROUTCOME", line 146
ORA-01400: cannot insert NULL into ("UT"."UTR_OUTCOME"."RUN_ID")
ORA-06512: at "UT.UTROUTCOME", line 125
ORA-06512: at "UT.UTRESULT2", line 72
ORA-06512: at "UT3.UTASSERT2", line 110
ORA-06512: at "UT3.UTASSERT2", line 877
ORA-06512: at "UT3.UTASSERT", line 234
ORA-06512: at "XXX.MY_TEST", line 256
ORA-06512: at "UT.UTRERROR", line 149
ORA-06512: at "UT.UTRERROR", line 103
ORA-06512: at "UT.UTRERROR", line 324
ORA-06512: at "UT.UTROUTCOME", line 146
ORA-06512: at "UT.UTROUTCOME", line 125
ORA-06512: at "UT.UTRESULT2", line 72
ORA-06512: at "UT3.UTASSERT2", line 110
ORA-06512: at "UT3.UTASSERT2", line 877
ORA-06512: at "UT3.UTASSERT", line 234
ORA-06512: at "XXX.MY_TEST", line 256
ORA-06512: at line 6

Install executed by SYS fails on 12c

If there are trusted users that do need to inherit privileges from the DBA user, specific grants can be performed.
GRANT INHERIT PRIVILEGES ON USER dba_user TO trusted_user;
Following this grant, any invoker rights code owned by TRUSTED_USER can inherit privileges from DBA_USER when the code is called by DBA_USER. You can revoke this specific priviledge as follows.
REVOKE INHERIT PRIVILEGES ON USER dba_user FROM trusted_user;

https://oracle-base.com/articles/12c/control-invoker-rights-privileges-for-plsql-code-12cr1

Migration utility doesn't compile with utPLSQL v3.0.4

27/28 PL/SQL: Item ignored
27/43 PLS-00302: component 'TYP_ANNOTATED_PACKAGE' must be declared
39/5 PL/SQL: Statement ignored
39/5 PLS-00320: the declaration of the type of this expression is
incomplete or malformed

41/5 PL/SQL: Statement ignored
41/8 PLS-00320: the declaration of the type of this expression is
incomplete or malformed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.