+ If you want utPLSQL to automatically recompile your test packages, you
+ will need to make sure that UTL_FILE is enabled in your database (this
+ allows you to read/write operating system files). The database initialization
+ parameter file (aka, the "init.ora" file) must have at least one utl_file_dir
+ parameter in it for this to work. Here is some background and guidelines
+ for working with UTL_FILE:
+
+
+ UTL_FILE lets you read and write files accessible from the server on
+ which your database is running. So, theoretically, you could use UTL_FILE
+ to write right over your tablespace data files, control files and so on.
+ That is, of course, a very bad idea. Server security requires the ability
+ to place restrictions on where you can read and write your files.
+
+
+ UTL_FILE implements this security by limiting access to files that reside
+ in one of the directories specified in the init.ora file (parameter initialization
+ file) for the database instance on which UTL_FILE is running.
+
+
+ When you call UTL_FILE.FOPEN to open a file, you must specify both the
+ location and the name of the file, in separate arguments. This file location
+ is then checked against the list of accessible directories.
+
+
+ The format of the parameter for file access in the init.ora file is:
+
+
+utl_file_dir = <directory>
+
+
+ Include a parameter for utl_file_dir for each directory you want to make
+ accessible for UTL_FILE operations. The following entries, for example,
+ enable four different directories in Unix:
+
+ To bypass server security and allow read/write access to all directories,
+ you can use this special syntax:
+
+
+
+utl_file_dir = *
+
+
+
+ You should not use this option on production systems. In a development
+ system, this entry certainly makes it easier for developers to get up and
+ running on UTL_FILE and test their code. You should, however, only allow
+ access to a few specific directories when you move the application to production.
+
+
Some observations on working with and setting up accessible directories with UTL_FILE:
+
+ Access is not recursive through subdirectories. If the following lines
+ were in your init.ora file, for example,
+
+ then you would not be able to open a file in the c:\group\prod\oe\reports
+ subdirectory.
+
+
+ Do not include the following entry in Unix systems:
+
+
+
+utl_file_dir = .
+
+
+
+ This would allow you to read/write on the current directory in the operating
+ system.
+
+
+ Do not enclose the directory names within single or double quotes.
+
+
+ In the UNIX environment, a file created by UTL_FILE.FOPEN has as its
+ owner the shadow process running the Oracle instance. This is usually the
+ oracle owner. If you try to access these files outside of UTL_FILE, you
+ will need to have the correct privileges (or be logged in as oracle) to
+ access or change these files.
+
+
+ You should not end your directory name with a delimiter, such as the
+ forward slash in Unix. The following specification of a directory will
+ result in problems when trying to read from or write to the directory:
+
+
+
+utl_file_dir = /tmp/orafiles/
+
+
+
+ After you modify your parameter initialization file, you will need to stop
+ and then restart your database instance.
+
+
Test UTL_FILE Access
+
+ If you have never before used or relied on UTL_FILE, you should write
+ a simple test to verify that UTL_FILE is now working. You can use the code
+ shown below (after changing your directory names and names for existing
+ and new files) to make sure you've got it running properly.
+
+
+
+SET SERVEROUTPUT ON
+
+DECLARE
+ fid UTL_FILE.FILE_TYPE;
+ v VARCHAR2(32767);
+ PROCEDURE recNgo (str IN VARCHAR2)
+ IS
+ BEGIN
+ DBMS_OUTPUT.PUT_LINE ('UTL_FILE error ' || str);
+
+ UTL_FILE.FCLOSE (fid);
+ END;
+BEGIN
+ /* Change the directory name to one to which you at least
+ || THINK you have read/write access.
+ */
+ fid := UTL_FILE.FOPEN ('e:\demo', 'existing_file', 'R');
+ UTL_FILE.GET_LINE (fid, v);
+ dbms_output.put_line (v);
+
+ UTL_FILE.FCLOSE (fid);
+
+ fid := UTL_FILE.FOPEN ('e:\demo', 'new_file', 'W');
+
+ UTL_FILE.PUT_LINE (fid, v);
+
+ UTL_FILE.FCLOSE (fid);
+EXCEPTION
+ WHEN UTL_FILE.INVALID_PATH
+ THEN recNgo ('invalid_path');
+ WHEN UTL_FILE.INVALID_MODE
+ THEN recNgo ('invalid_mode');
+ WHEN UTL_FILE.INVALID_FILEHANDLE
+ THEN recNgo ('invalid_filehandle');
+ WHEN UTL_FILE.INVALID_OPERATION
+ THEN recNgo ('invalid_operation');
+ WHEN UTL_FILE.READ_ERROR
+ THEN recNgo ('read_error');
+ WHEN UTL_FILE.WRITE_ERROR
+ THEN recNgo ('write_error');
+ WHEN UTL_FILE.INTERNAL_ERROR
+ THEN recNgo ('internal_error');
+END;
+/
+
+
+ If an error occurs, it will be displayed on your screen (note: the "set
+ serveroutput on" is not required for UTL_FILE to work, but simply to display
+ any errors which might occur).
+
+
+
Join the utPLSQL Project Team
+
+
+ To take part in the utPLSQL project, have a look round the
+ utPLSQL project site,
+ in particular the CONTRIBUTING.md
+ and issues tracker.
+ Once you are up to speed on the project, you can choose a issue and begin to contribute.
+
+
+
Reporting Bugs and Enhancement Requests
+
+
+ To identify the version of utPLSQL you are running,
+ you can execute the following program in SQL*Plus:
+
+
+
+SQL> set serveroutput on
+SQL> exec dbms_output.put_line (utPLSQL.version)
+
+
+
+ You can also look inside the utPLSQL package (utPLSQL.pkb)
+ and check the value of the g_version private variable.
+
\n";
+ $footer .= "\n";
+ $footer .= "";
+
+ return $footer;
+}
\ No newline at end of file
diff --git a/documentation/src/buildpack.html b/documentation/src/buildpack.html
new file mode 100644
index 000000000..180cf2f19
--- /dev/null
+++ b/documentation/src/buildpack.html
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
Build Test Packages
+
+
+ We learn best by following the examples of those who have gone before
+ us. So you will find in this document sample test packages and different
+ approaches to using utPLSQL to test your PL/SQL code like it has never
+ been tested before!
+
+
+ Spend some time in the general How to Build a Test
+ Package so that you are comfortable with the basic steps necessary
+ to integrate your test code into the utPLSQL framework. The Test Run section
+ offers a narrative presentation of building a test package; it makes a
+ nice follow-up to the How To section if you still feel any uncertainty.
+ Then you will be more than ready to explore the Examples.
+
+
+
+
+
diff --git a/documentation/src/copyright_years.txt b/documentation/src/copyright_years.txt
new file mode 100644
index 000000000..1c07d8fc8
--- /dev/null
+++ b/documentation/src/copyright_years.txt
@@ -0,0 +1,4 @@
+# This contains a list of years for the copyright notices
+#
+2000-2005
+2014-2016
\ No newline at end of file
diff --git a/documentation/src/defsuite.html b/documentation/src/defsuite.html
new file mode 100644
index 000000000..9577786af
--- /dev/null
+++ b/documentation/src/defsuite.html
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
Defining Test Suites
+
+
+ If you define test suites and register packages
+ within those suites, then utPLSQL will run an unlimited number of
+ tests with a single command.
+
+
+
Note
+
+
+
+ All suite names are stored in upper case.
+
+
+
+ If you do not specify a directory (dir_in),
+ you will need to call utConfig.setdir if you want automatic compilation
+ of your packages to occur.
+
+
+
+ If you supply a value for seq_in, packages
+ will be compiled and tested in ascending numeric sequence order.
+
+
+
+ When you call utSuite.rem, it will remove all
+ packages for that suite by calling utPackage.rem.
+
+
+
+
utSuite - Define Test Suites
+
+
To create and remove test suites, call these programs:
+
+
+PROCEDURE utSuite.add (
+ name_in IN VARCHAR2,
+ desc_in IN VARCHAR2 := NULL,
+ rem_if_exists_in IN BOOLEAN := TRUE
+);
+
+PROCEDURE utSuite.rem (name_in IN VARCHAR2);
+
+
+
+ These programs manipulate the contents of the ut_suite
+ table. See the tables.sql file for the DDL creating this table.
+
+
+
utPackage - Define Test Packages for a Suite
+
+
To register a package in a suite, call the following:
+
+
+PROCEDURE utPackage.add (
+ suite_in IN VARCHAR2,
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ dir_in IN VARCHAR2 := NULL,
+ seq_in IN PLS_INTEGER := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ add_tests_in IN BOOLEAN := FALSE,
+ test_overloads_in IN BOOLEAN := FALSE
+);
+
+
+
+ This manipulates the contents of the ut_package
+ table. See the tables.sql file for the DDL creating this table.
+
+
+
+ Here is a sample script that defines a very small
+ portion of the PL/Vision test suite:
+
+ We learn best by following the examples of those who have gone before
+ us. So you will find in this document sample test packages and different
+ approaches to using utPLSQL to test your PL/SQL code like it has never
+ been tested before!
+
+ By default, the results of a test run are written to the screen
+ (via the default Output Reporter). The subprograms described in this
+ section were created by Rainer Medert to allow these results to be written
+ to file instead. They form part of the utConfig package. Don't forget that
+ you will first need to enable file output from the database via the
+ UTL_FILE_DIR parameter in order to do this.
+
+
+
Turning file output on
+
+
+ To turn on file output, you will need to switch to using the File
+ Reporter, or a custom reporter that uses it. See the page on Custom Reporter Packages for details.
+
+
+
Setting the directory to be used
+
+
+ Once file output has been turned on, you can specify which directory the
+ files will be written to using the following procedure:
+
+
+
+PROCEDURE setfiledir (
+ dir_in IN VARCHAR2 := NULL,
+ username_in IN VARCHAR2 := NULL
+);
+
+
+
+ the directory given will have to have been specified for output in a
+ UTL_FILE_DIR database parameter, as mentioned above.
+
+
+
To see which directory is being used for output, use the following:
+
+
+FUNCTION filedir (username_in IN VARCHAR2 := NULL) RETURN VARCHAR2;
+
+
+
Formatting the output filenames
+
+
The structure of the filenames used for output is as follows:
+
+
+<user-prefix>_[program-name_]<date><extension>
+
+
+
Each of these elements can be configured using the following procedures.
+
+
+ The user-prefix is an arbitrary string. It defaults to the username of
+ the currently connected user, but can be set (and returned) using the
+ following:
+
+
+
+-- Set the file prefix for a user
+PROCEDURE setuserprefix (
+ userprefix_in IN VARCHAR2 := NULL,
+ username_in IN VARCHAR2 := NULL
+);
+
+-- Get the file prefix for a user
+FUNCTION userprefix (username_in IN VARCHAR2 := NULL) RETURN VARCHAR2;
+
+
+
+ The program-name is the name of the tested program, or the test suite
+ being run. By default, this is element is not used in the generated filename.
+ To turn this on or off (and to determine the current setting), use the
+ following:
+
+
+
+-- Set the include program name flag for a user
+PROCEDURE setincludeprogname (
+ incname_in IN BOOLEAN := FALSE,
+ username_in IN VARCHAR2 := NULL
+);
+
+-- Get the include program name flag for a user
+FUNCTION includeprogname (username_in IN VARCHAR2 := NULL) RETURN BOOLEAN;
+
+
+
+ The date element of the filename is simply SYSDATE converted to a string.
+ The default format is 'YYYYDDMMHH24MISS', but this can be set (and
+ returned) using the following:
+
+
+
+-- Set the date format for a user
+PROCEDURE setdateformat (
+ dateformat_in IN VARCHAR2 := 'yyyyddmmhh24miss',
+ username_in IN VARCHAR2 := NULL
+);
+
+-- Get the date format for a user
+FUNCTION dateformat (username_in IN VARCHAR2 := NULL) RETURN VARCHAR2;
+
+
+
+ The final element of the filename that can be configured is the extension.
+ This defaults to ".UTF" but can be set (and returned) using the following:
+
+
+
+-- Set the file extension for a user
+PROCEDURE setfileextension (
+ fileextension_in IN VARCHAR2 := '.UTF',
+ username_in IN VARCHAR2 := NULL
+);
+
+-- Get the file extension for a user
+FUNCTION fileextension (username_in IN VARCHAR2 := NULL) RETURN VARCHAR2;
+
+
+
+ Note The initial dot must be included, otherwise there will be none
+ in the resulting filename!
+
+
+
Setting all the parameters at once
+
+
+ It is possible to set all the file output parameters at once using the
+ following procedure:
+
+
+
+PROCEDURE setfileinfo (
+ dir_in IN VARCHAR2 := NULL,
+ userprefix_in IN VARCHAR2 := NULL,
+ incname_in IN BOOLEAN := FALSE,
+ dateformat_in IN VARCHAR2 := 'yyyyddmmhh24miss',
+ fileextension_in IN VARCHAR2 := '.UTF',
+ username_in IN VARCHAR2 := NULL
+);
+
+
+
+ To get back all of the file output parameters simultaneously, use the
+ following function:
+
+
+
+FUNCTION fileinfo (username_in IN VARCHAR2 := NULL) RETURN rec_fileinfo;
+
+
+
+ The record type rec_fileinfo is defined in the utConfig
+ package and has one field for each of the parameters.
+
+ Note: if you have already installed a previous version of
+ utPLSQL, you will use these same steps to perform your install. The
+ installation procedure does not remove any objects, such as tables,
+ prior to installation. If you wish to install a fresh copy of utPLSQL, and not upgrade
+ over the existing installation, please follow the steps below for removing
+ utPLSQL.
+
+
+
+ Connect via SQL*Plus to the session that will own the
+ utPLSQL components. If you do not already have a schema defined, then you must
+ create it. The utPLSQL schema must have the authority to:
+
+
+
+
Create a session.
+
Create tables, views, packages and sequences.
+
+
+
+ If you like, you can install utPLSQL into the SYSTEM schema, which will avoid the need to create
+ a new user. However, you may prefer to keep everything in a separate place.
+ The following is an example script submitted by Bill Pribyl, which creates a user "UTP" with sufficient privileges
+ to install utPLSQL. Obviously it is only an example and will need to be changed for your environment:
+
+
+
+connect system/manager
+create user utp identified by utp default tablespace
+ users temporary tablespace temp;
+
+grant create session, create table, create procedure,
+ create sequence, create view, create public synonym,
+ drop public synonym to utp;
+
+alter user utp quota unlimited on users;
+
+
+
+ Note If the schema in question does not have the ability to create
+ and drop public synonyms or execute privilege on DBMS_PIPE, you may get
+ error messages when installing. However, utPLSQL will still function
+ correctly.
+
+
+
+ Once you have connected to the schema, run the ut_i_do.sql
+ file with the parameter "install" to install all utPLSQL objects. You should ensure that
+ the working directory of your SQL*Plus
+ session is the directory holding the utPLSQL files, then issue this as follows:
+
+
+
+SQL> @ut_i_do install
+
+
+
+ This file will create all tables, packages and other objects needed.
+ Note that the installation script
+ creates some files dynamically using the SPOOL command. For this reason, it is
+ necessary that you have write permission in the directory.
+
+
+
To check the installation of utPLSQL, examine the ut_i_install.log file.
+
+
Removing utPLSQL
+
+
+ To de-install the product, run the ut_i_do.sql
+ script again, but with the parameter "uninstall", as in:
+
+
+
+SQL> @ut_i_do uninstall
+
+
+
Step 2. Choose a program to test and identify the test cases.
+
+
+ You may want to test a single stand-alone procedure or
+ function, or a set of programs in a package. Pick the program and then come up
+ with the set of different cases you want to test. This data will determine what
+ kind of and how many tests you run for your program.
+
+
+
+ Suppose, for example, that I have created a stand alone function called
+ betwnStr (a variation on SUBSTR that returns a sub-string based on a starting
+ and ending location) that is stored in betwnstr.sf (1):
+
+
+
+CREATE OR REPLACE FUNCTION betwnStr (
+ string_in IN VARCHAR2,
+ start_in IN INTEGER,
+ end_in IN INTEGER
+)
+RETURN VARCHAR2
+IS
+BEGIN
+ RETURN (
+ SUBSTR (
+ string_in,
+ start_in,
+ end_in - start_in + 1
+ )
+ );
+END;
+
+
+
+ To test this function, I will want to pass in a variety of
+ inputs, as shown in this table:
+
+
+
+
+
+
Start
+
+
+
+
End
+
+
+
+
Result
+
+
+
+
+
+
NULL
+
+
+
NOT NULL
+
+
+
NULL
+
+
+
+
+
NOT NULL
+
+
+
NULL
+
+
+
NULL
+
+
+
+
+
NULL
+
+
+
NULL
+
+
+
NULL
+
+
+
+
+
3 (positive number)
+
+
+
1 (smaller positive number)
+
+
+
NULL
+
+
+
+
+
3 (positive number)
+
+
+
100 (larger than length of string)
+
+
+
Remainder of string from 3
+
+
+
+
+
So now I know what I want to test and how I want to test it.
+
+
Step 3. Build a test package.
+
+
+ utPLSQL offers an easy, automated way to run your tests. To
+ work automatically, though, you have to follow some rules so that utPLSQL can
+ find and execute your test code. Here are the rules:
+
+
+
The test code must be placed inside a test package.
+
+
+ The test package specification should
+ be stored in a file named ut_<program>.pks and the body must be stored in
+ a file named ut_<program>.pkb (by following this naming convention,
+ utPLSQL can be set to automatically recompile your test package before each
+ test).
+
+
+
+ The test package must contain a setup procedure called ut_setup and a teardown procedure called ut_teardown, neither of
+ which take any arguments.
+
+
+
+ The test package should have a separate procedure for each program to be
+ tested in this package.
+
+
+
+ Now, you should know that there are a number of bells and
+ whistles in utPLSQL that allow you to change many default values (such as the
+ prefixes used for the setup, teardown and test procedures) and behavior of the
+ utPLSQL packages. While you are "Getting Started", however, we will
+ rely completely on the defaults and get you up and testing ASAP.
+
+
+
+ So if I am going to test the stand-alone procedure, betwnstr, my test
+ package specification, saved in ut_betwnstr.pks(1),
+ will look like this:
+
+ Now let's build the package body, saved in ut_betwnstr.pkb(1). In this very simple
+ case, I don't have to set up any data structures and I do not, therefore, have
+ to tear anything down. My teardown procedure can be empty (but it must
+ be present). So I have:
+
+
+
+CREATE OR REPLACE PACKAGE BODY ut_betwnstr
+IS
+ PROCEDURE ut_setup IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ NULL;
+ END;
+
+
+
+ Time to build the unit test procedure. To do this, I need to
+ go back to my grid of test cases and translate those sets of data inputs and
+ results into calls to programs in the utAssert
+ package.
+
+
+
+ utAssert offers a number of "assertion routines" that test the
+ values or expression you pass to them and then record the results in utPLSQL.
+ You can, with utAssert, test for equality between two strings or files or
+ tables or collections. You can test to see if an expression evaluates to NULL.
+ I can use both of these types of assertions (equality and IS NULL) for my test
+ cases, which I repeat below:
+
+
+
+
+
+
Start
+
+
+
+
End
+
+
+
+
Result
+
+
+
+
+
+
NULL
+
+
+
NOT NULL
+
+
+
NULL
+
+
+
+
+
NOT NULL
+
+
+
NULL
+
+
+
NULL
+
+
+
+
+
NULL
+
+
+
NULL
+
+
+
NULL
+
+
+
+
+
3 (positive number)
+
+
+
1 (smaller positive number)
+
+
+
NULL
+
+
+
+
+
3 (positive number)
+
+
+
100 (larger than length of string)
+
+
+
Remainder of string
+
+
+
+
+
+ Here's how it works: for each test case, I provide a string description of
+ the case, then the expression I want to evaluate. Let's start with
+ "typical valid usage". I pass a string "abcdefg", a start
+ location of 3 and end location of 5, and betwnstr should return
+ "cde". I express that in my unit test procedure as follows:
+
+ Notice that I call utAssert.eq because I want to compare the
+ value returned by betwnstr with the string "cde". They should
+ be equal.
+
+
+
+ I can now write another call to a utAssert program for each of my cases. In
+ this very next example, I call utAssert.isnull, because I am expecting betwnstr
+ to return a NULL value.
+
+ Note: when you run your test, utPLSQL will by default
+ attempt to recompile your test package to ensure that the latest changes are
+ incorporated into the test. It is still worth doing an initial compile to make
+ sure you built your test properly. You will also need to make sure that UTL_FILE is installed and configured so that your
+ test package files can be read and compiled by utPLSQL.
+
+
+
+ So with the test package in place and compiling, now let's
+ see how we go about running the test.
+
+
+
Step 4. Run your test.
+
+
+ You've built your code, you've built your test package,
+ you've compiled that test package. Now it's time to run the test. Start up
+ SQL*Plus and connect to the schema owning the code you want to test.
+
+
+
+ Then run your test package within the utPLSQL testing framework by calling utPLSQL.test:
+
+ That second parameter in the call to utplsql.test,
+ "recompile_in => FALSE", tells utPLSQL that you have already
+ compiled your test package. You can also have utPLSQL automatically recompile your test package
+ each time you run a test.
+
+
+
+ If the test does not find any errors (which means that the assertion
+ programs did not detect any conflicts), you will see this output:
+
If the test detected a failure, you will see output along these lines:
+
+
+SQL> exec utplsql.test ('betwnstr', recompile_in => FALSE)
+FAILURE: "betwnstr"
+BETWNSTR: IS NULL: NULL start
+BETWNSTR: End larger than string length; expected "cdeg", got "cdefg"
+
+
+
+ As you can see, utPLSQL tells you the description of the
+ test case that failed, and also shows you as much as it can about what caused
+ the failure.
+
+
+
+ You have now successfully installed utPLSQL, written a test package and run
+ your test!
+
+
+
Automatic Recompilation of Test Package
+
+
+ utPLSQL will, by default, attempt to recompile your test package code
+ (which must be put in two files <name>.pks for the package specification
+ and <name>.pkb for the package body). This of course assumes that the files
+ are situated on the same machine as your database. If this is not the case, you can
+ turn off this functionality by calling utConfig.autocompile
+ as follows:
+
+
+
+utConfig.autocompile(false);
+
+
+
+ If you do wish to use this functionality, utPLSQL needs
+ the UTL_FILE package provided by Oracle to read the source code files and then
+ compile the code found in those files. Before using UTL_FILE you must configure it for use from within PL/SQL.
+ Once you have confirmed that UTL_FILE works in your database instance, you
+ must tell utPLSQL where the test package is located by calling utPLSQL.setdir.
+ If you do not do this, then utPLSQL will not be able to recompile your test
+ package before each run, and instead will display an error message.
+
+
+
+ Call the utConfig.setdir program to tell
+ utPLSQL the location of your source code. Suppose that I stored all my code in e:\utplsql\testall. Then I would make this
+ call in SQL*Plus:
+
+ In step 1, above, we described which user should own the objects which make up the utPLSQL framework.
+ However, there has often been confusion about which schema should contain the test packages and which schema to connect as
+ when running the tests. There are many ways to do it, but the simplest is as follows:
+
+
+
It doesn't matter which schema owns utPLSQL itself, so long as other users have access to it.
+
The test packages should go in the same schema as the code that is being tested.
+
You should connect as the user who owns the test packages (and hence the tested code) when running the tests
+
+
+
Where to go from here
+
+
+ If you proceeded through all four steps, you should now have
+ used utPLSQL successfully to test a very simple function (betwnstr) or your own
+ functionality. This will undoubtedly leave you very excited about using utPLSQL
+ to handle much more complex code and elaborate testing requirements.
+
+
+
+ To find out more about the different features and
+ functionality available in utPLSQL, visit the User
+ Guide.
+
+
+
+ To read through a more thorough presentation of how to build
+ test packages in utPLSQL, visit How to
+ Build Test Packages.
+
+
+
+ To see a wide array of examples of building test cases and
+ different kinds of test packages, visit the Examples
+ document.
+
+ Before diving into the details, let's make sure
+ we have a common vocabulary.
+
+
+
Unit Test
+
+
+ A test of a single unit or program. Suppose you
+ have built product.total_sales, a function to calculate and return total
+ sales of the specified product for a given date period. You will then build
+ a single procedure to perform the test for that function.
+
+
+
Test Case
+
+
+ Individual cases or test scenarios for a unit test.
+ You will want to try out different scenarios (valid and invalid product
+ Ids, various date ranges, etc.). Each different combination of inputs (parameter
+ values) is a different test case. These are bundled up and executed within
+ the single unit test procedure.
+
+
+
Package Test
+
+
+ A set of unit tests which test the functionality
+ of all programs in a single PL/SQL package (or a single stand-alone program
+ unit - procedure or function).
+
+
+
+ The way utPLSQL works today, you must define
+ your various tests cases and unit tests within a test package (though it
+ could be the same package containing the functionality).
+
+
+
Test Suite
+
+
+ A series of package tests. Obviously, any application
+ of non-trivial complexity will consist of multiple packages, each covering
+ their own area of functionality. A test suite contains a series of packages
+ that can then be tested in sequence by executing the test suite as a whole.
+
+
+
Requirements
+
+
+ If you are using Oracle8i or above, utPLSQL takes advantage
+ of a number of Oracle8i features, including autonomous transactions, invoker
+ rights and native dynamic SQL. utPLSQL will however still run on Oracle7
+ (7.3.4 and above) and Oracle8.
+
+
+
Requirements for using utPLSQL include:
+
+
+
+
+ The schema owning utPLSQL objects must have the ability to create tables and packages.
+
+
+
+
+ If you want utPLSQL to automatically recompile test packages for you, you
+ will need to have UTL_FILE installed and
+ configured to read from the directory or directories in which your package
+ source files are located.
+
+
+
+
+ Optional: The ability to create public synonyms. The installation script will attempt
+ to create public synonyms. If your schema does not have the authority to
+ do so, these commands will fail, but utPLSQL will still be available for
+ use in the owning schema.
+
+
+
+
+ Optional:Execute privilege on the DBMS_PIPE package. Without this, the UTPIPE package will not compile.
+ However, this is only required if you want to test data accessed via DBMS_PIPE.
+
+
+
+
+
Requirements for Executing Test Code
+
+
+ If you install and use utPLSQL from within a single schema (ie, the same schema that owns utPLSQL code and tables owns the code
+ you want to test, as well as the test packages), then no additional privileges are needed.
+
+
+ If, however, you install utPLSQL in a shared schema and then access it from other schemas, you may need to grant additional
+ privileges to the utPLSQL schema. utPLSQL uses dynamic PL/SQL to run the test code. It therefore requires directly granted
+ EXECUTE privileges on those code elements (both the code to be tested and the test packages) -- or the AUTHID CURRENT_USER
+ capability of Oracle8i and above.
+
+
+
For Oracle8i and above
+
+ You do not need to grant any additional privileges, unless you want to test code owned by one schema from another schema.
+ In that case, you will need to grant EXECUTE to the schema from which you run your tests on both the code to be tested and the test package.
+
+
+
For Oracle7 and Oracle8
+
+ You must grant EXECUTE to the utPLSQL schema on both the code to be tested and the test package.
+ These grants must be made directly and not through roles.
+
+ To use utPLSQL, you will build a test package containing your unit tests.
+ This test package must conform to the API (application programmatic interface)
+ rules of utPLSQL, so that utPLSQL can run your tests automatically.
+
+
+
Every test package must have:
+
+
+
+ A setup procedure - register your unit test and set
+ up any data structures needed for testing.
+
+ The names you give to your test package, setup, teardown and unit test
+ proceedures must also follow the utPLSQL Naming Conventions.
+
+
+
Setup Procedure
+
+
+ The utPLSQL.test and utPLSQL.testsuite programs
+ will call the setup procedure of your test package before it runs any unit
+ tests. Use this procedure to define your unit tests and also initialize
+ any data structures needed for your units. The package specification header
+ for this procedure must be of this form:
+
+
+
+CREATE OR REPLACE PACKAGE <prefix><package>
+IS
+ PROCEDURE <prefix>setup;
+
+
+
+ where <prefix> is the unit test prefix and <package>
+ is the name of the package (or stand alone program) to be tested. The default
+ naming convention is that your test package and all utPLSQL programs, including
+ the setup procedure, have a prefix of "ut_", as in:
+
+
+
+CREATE OR REPLACE PACKAGE ut_<program>
+IS
+ PROCEDURE ut_setup;
+
+
+
+ Note: if you are using manual
+ registration of unit tests (which is not the default setting
+ and is not recommeded), see Naming Conventions
+ for details on when and how to apply prefixes to your package and procedure
+ names.
+
+
+
+ Now let's take a look at the body/implementation
+ of the setup procedure and how you can use it to define test data structures
+ and, optionally, register unit tests.
+
+
+
Define test data structures
+
+
+ You should use the setup procedure to define data structures you
+ need in one or more of your tests. You might, for example, want to create
+ a temporary table to hold information for comparison. You might populate
+ a collection or a record a scalar global variable.
+
+
+
+ Here is an example of such a procedure (see the file ut_te_employee.pkb
+ in the Examples directory of the utPLSQL distribution for the full implementation):
+
+
+
+PROCEDURE ut_setup
+IS
+BEGIN
+ ut_teardown;
+
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_employee AS
+ SELECT * FROM employee';
+
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_DEL1 AS
+ SELECT * FROM employee';
+
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_DELBY_EMP_DEPT_LOOKUP AS
+ SELECT * FROM employee';
+END;
+
+
+
+ For each of my tests, I create a separate table to modify and then use
+ in my utAssert comparison.
+
+
+
+ You could place these statements in each of the individual unit test
+ procedures. The advantage of storing them all in the single setup procedure
+ is that they are easier to manage -- and also easier to tear down or destroy
+ when you are done.
+
+
+
Manual registration of unit tests
+
+
+ If you have decided to choose manual
+ registration of your unit test procedures, then you will need to register
+ each procedure with a call to utPLSQL.registertest
+ in the setup procedure. This is not recommended. But if you insist...
+
+
+
+ Here is an example of a setup procedure for the
+ PLVdate package:
+
+
+
+CREATE OR REPLACE PACKAGE BODY ut_plvdate
+IS
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+ utplsql.addtest ('ut_to_date');
+ utplsql.addtest ('ut_to_char');
+ END;
+
+
+
+ The names passed to the utPLSQL.addtest procedure
+ must match the interface of the defined unit test procedures
+ with the following interface. So the above two calls to addtest tell utPLSQL
+ to look for two unit test procedures named ut_to_date and ut_to_char.
+
+
+
Teardown Procedure
+
+
+ The utPLSQL.test and utPLSQL.testsuite programs
+ will call the teardown procedure of your test package after it runs all
+ unit tests. Use this procedure to destroy or remove any data structures
+ that were needed for your units. The contents of this procedure should,
+ in general, be the logical reverse of the contents of the setup
+ procedure. The package specification header for this procedure must
+ be of this form:
+
+
+
+CREATE OR REPLACE PACKAGE <prefix><package>
+IS
+ PROCEDURE <prefix>teardown;
+
+
+
+ where <prefix> is the unit test prefix and <package>
+ is the name of the package (or stand alone program) to be tested.
+
+
+
+ The default naming convention is that your test
+ package and all utPLSQL programs, including the teardown procedure, have
+ a prefix of "ut_", as in:
+
+
+
+CREATE OR REPLACE PACKAGE ut_<program>
+IS
+ PROCEDURE ut_teardown;
+
+
+
+ Note: if you are using manual
+ registration of unit tests (which is not the default setting
+ and is not recommeded), see Naming Conventions
+ for details on when and how to apply prefixes to your package and procedure
+ names.
+
+
+
+ Now let's take a look at the body/implementation
+ of the teardown procedure and how you can use it to remove test data structures.
+
+
+
+ Here is an example of the most common type of teardown
+ procedure -- it does nothing:
+
+
+
+CREATE OR REPLACE PACKAGE ut_sales_pkg
+IS
+ PROCEDURE teardown
+ IS
+ BEGIN
+ NULL;
+ END;
+
+
+
+ This is what your teardown procedure will look like
+ when you do not need to create any special data structures for your tests.
+ If I were testing a simple string utility, for example, I do not need a
+ database table or collection to run my tests. Note that even if your teardown
+ procedure does nothing, it still must be present in the package specification
+ and body. utPLSQL will look for and try to execute the procedure as
+ part of its S.O.P. (standard operating procedure).
+
+
+
+ Now, if your setup procedure creates something,
+ you should probably destroy it in teardown. You might drop or truncate
+ tables, do a ROLLBACK or simply make sure files and cursors are closed.
+ Here is an example of such a procedure:
+
+ The unit test procedure is, of course, where it
+ gets really interesting and very application specific.
+
+
+
The general format for a test procedure is as follows:
+
+
+CREATE OR REPLACE PACKAGE <prefix><package>
+IS
+ PROCEDURE <prefix><program>;
+
+
+
+ where <prefix> is the unit test prefix and <package>
+ is the name of the package (or stand alone program) to be tested. The default
+ naming convention is that your test package and the unit test procedure
+ each have a prefix of "ut_". You can override that prefix with another
+ of your own choosing in your call to utPLSQL.test
+ or utPLSQL.testsuite. Under some circumstances, you can drop
+ the prefix on the unit test procedure, but this is not recommended. see
+ Naming Conventions. for details.
+
+
+
+ Here is a very generic version of a unit test package
+ specification and a single unit test procedure:
+
+
+
+-- Test package for stand alone program
+CREATE OR REPLACE PACKAGE ut_<package>
+IS
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+ PROCEDURE ut_<program>;
+END;
+
+
+
+ The body of your unit test procedure is, well, mostly
+ yours to figure out, since we don't know what you are testing and how you
+ need to test it. The basic format of this test procedure, however, should
+ be:
+
+
+
+PROCEDURE <myprogram>
+IS
+BEGIN
+ <run package.myprogram or set up for test>
+
+ -- call a utAssert assertion to check results:
+ utAssert.<assertion> (...);
+
+ <repeat of the above for different test cases>
+EXCEPTION
+ WHEN OTHERS
+ THEN
+ utAssert.this (
+ 'Unknown failure of <package.myprogram>: ' || SQLERRM,
+ FALSE);
+END;
+
+
+
+ You should include a call to a utAssert assertion program in the exception
+ section to trap unexpected errors and register a test failure (I pass FALSE
+ for the second argument, which guarantees a failure!). You might, of course,
+ have other handlers to trap specific exceptions like NO_DATA_FOUND and
+ either register a failure or ignore the exception, since it might not be
+ an actual test failure.
+
+
+
+ Here is an example of a unit test procedure that contains multiple calls
+ to assertion programs for different test cases.
+
+ In the above case, I am testing a function, so I call the function "in
+ line" with the assertion program. When testing a procedure, you will call
+ the procedure first and then call the appropriate assertion program to
+ test the outcome.
+
+
+
+ Explore the Examples to learn about different
+ ways to write unit test procedures.
+
+
+
Naming Conventions
+
+
+ When you execute a test or test suite, utPLSQL looks for a test package,
+ based on the name of the program you are testing. It then attempts to execute
+ specific programs within that package. utPLSQL allows you to test stand-alone
+ programs (procedure or function) or package-based programs. When testing
+ the contents of a package, you can place your unit test procedures in the
+ same
+ package or a separate test package. That's a lot of flexibility, and
+ flexibility generally leads to confusion.
+
+
+
+ To make things as simple as possible, the default mode of utPLSQL follows
+ this simple rule:
+
+
+
+ Your unit test package and each utPLSQL-related program in that package
+ (setup, teardown and unit tests) must all use the same prefix.
+
+
+
+ The default prefix is "ut_", but you can override that with your own.
+ If you follow this rule (and you can follow it very easily by using the
+ utGen
+ package to generate a starting point for your test packages), utPLSQL
+
+
+
+ If you are following the utPLSQL defaults and letting the utility automatically
+ detect and execute unit tests, do not read any further!
+
+
+
+ If you choose to perform manual
+ registration of your unit tests, then read the following sections carefully,
+ as there is a scenario in which you should not apply the utPLSQL
+ prefix to your unit test procedures.
+
+
+
+ This section describes the conventions or rules that utPLSQL follows
+ to locate and execute your unit tests. There are three different "scenarios"
+ to consider:
+
+ While these rules might seem confusing at first glance, you will find
+ over time that they are designed to make the issue of what things are named
+ as transparent as possible when you run your tests. In other words, you
+ simply ask to test "mypackage"; you don't have to run some oddly-named
+ program with a prefix in front of it.
+
+
+
+ In addition, you can use the utGen package to
+ generate a starting point for your test packages. utGen will automatically
+ follow the rules; you only need to "fill in the blanks" of your unit test
+ procedures within the established headers.
+
+
+
Separate test package to test package-based programs
+
+
+ If you are placing your unit test code in a package separate from your
+ source code (the default setting), then the name of that test package must
+ be of the form:
+
+
+
+<prefix><package>
+
+
+
+ where <prefix> is the utPLSQL prefix and <package> is the name of
+ the package containing the programs to be tested.
+
+
+
You specify the prefix in one of the following ways:
+
+
+
+ When you call utPLSQL.test or utPLSQL.testsuite, you can pass a value for
+ the prefix_in parameter (the default is "ut_").
+
+
+
+ When you call utPackage.add to add a package
+ to a suite, you can pass a value for the prefix_in parameter (the default
+ is "ut_"). This prefix is then stored in the ut_package table.
+
+
+
+
+ The names of the test package programs, on the other hand, should not
+ have a prefix before them. These prefixes are not necessary to distinguish
+ the test procedure with the program being tested, since they are defined
+ in different packages.
+
+
+
Separate test package to test a stand-alone program
+
+
+ If you are placing your unit test code in a package separate from your
+ source code (the default setting), then the name of that test package must
+ be of the form:
+
+
+
+<prefix><program>
+
+
+
+ where <prefix> is the utPLSQL prefix and <program> is the name of
+ the stand-alone program you plan to test.
+
+
+ You specify the prefix in one of the following ways:
+
+
+
+
+ When you call utPLSQL.test or utPLSQL.testsuite, you can pass a value for
+ the prefix_in parameter (the default is "ut_").
+
+
+
+ When you call utPackage.add to add a package
+ to a suite, you can pass a value for the prefix_in parameter (the default
+ is "ut_"). This prefix is then stored in the ut_package table.
+
+
+
+
+ The names of the test package programs, on the other hand, also must have
+ the same prefix. This is necessary to avoid confusing naming conflicts
+ between the program you are testing and the name of the unit test procedure
+ for that program, as in the following package that tests the betwnstr function:
+
+ I suppose that looks odd; I have created a function named ut_betwnstr.ut_betwnstr
+ and it would be very strange to write code like that. But that is the whole
+ point of utPLSQL: I don't have to write code like that. I just run
+ my test with nothing more than this:
+
+
+
+SQL> exec utPLSQL.test ('betwnstr')
+
+
+
Single package containing both source to be tested and unit test programs
+
+
+ Finally, there is the scenario in which a developer places all of her test
+ programs (setup, teardown and unit tests) in the same package as the code
+ to be tested. In this case, there is no separate test package, so all of
+ the test programs must use the utPLSQL prefix, as in:
+
+
+
+CREATE OR REPLACE PACKAGE str
+IS
+ FUNCTION betwn (
+ string_in IN VARCHAR2,
+ start_in IN PLS_INTEGER,
+ end_in IN PLS_INTEGER
+ )
+ RETURN VARCHAR2;
+
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+ PROCEDURE ut_betwn;
+
+END str;
+/
+
+
+
You specify the prefix in one of the following ways:
+
+
+
+
+ When you call utPLSQL.test or utPLSQL.testsuite, you can pass a value for
+ the prefix_in parameter (the default is "ut_"). When you call utPackage.add
+ to add a package to a suite, you can pass a value for the prefix_in parameter
+ (the default is "ut_"). This prefix is then stored in the ut_package table.
+
+ This document tells you the minimum you need
+ to know in order to get started with utPLSQL: how to install the software,
+ build simple test packages, and run your tests.
+
+ utPLSQL provides with you a framework in which
+ to run your tests. You still have to write your test code, and that code
+ must follow some rules if utPLSQL is going to know how to run those tests.
+
+ Once you are familiar with utPLSQL basics, have
+ run some tests, and are ready to learn and use more of the many utPLSQL
+ features, the User Guide will tell you all you need to know about the different
+ features and programs of utPLSQL.
+
For support, bug reports or enhancement ideas, you can always visit the issue tracker page.
+
+
+
+
+
+
diff --git a/documentation/src/map.txt b/documentation/src/map.txt
new file mode 100644
index 000000000..b974631a9
--- /dev/null
+++ b/documentation/src/map.txt
@@ -0,0 +1,35 @@
+# This file contains a list of files and titles to
+# make up the documentation. The filename and title
+# should be separated by a comma. An asterisk after
+# the title means that that file gets added to the
+# Navigation Bar and is highlighted in the document
+# Map. Note that the document map is not in this list
+# but is added automatically at the end.
+#
+index.html,Home*
+started.html,Getting Started*
+glossreq.html,Glossary and Requirements
+fourstep.html,The Four Step Program to using utPLSQL
+admin.html,Administrative Topics
+buildpack.html,Build Test Packages*
+howto.html,How to build a test package
+testrun.html,A 'Test Run' with utPLSQL
+examples.html,Examples*
+testproc.html,Test a Procedure
+testfunc.html,Test a Function
+testapi.html,Test an Entire Package API
+samepack.html,Put Test Code in Same Package
+prefix.html,Use Non-Default Prefix
+suite.html,Create and Run a Test Suite
+userguide.html,User Guide*
+utplsql.html,utPLSQL Package
+utconfig.html,utConfig Package
+utresult.html,utResult Package
+utassert.html,utAssert Package
+utgen.html,utGen Package
+utoutput.html,utOutput Package
+utreceq.html,utRecEq Package
+defsuite.html,Defining Test Suites
+reporter.html,Custom Reporter Packages
+fileout.html,Configuring the File Reporter
+release.html,Release Notes*
diff --git a/documentation/src/prefix.html b/documentation/src/prefix.html
new file mode 100644
index 000000000..fcf968062
--- /dev/null
+++ b/documentation/src/prefix.html
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
Use Non-Default Prefix
+
+
+ The default prefix for utPLSQL is "ut_", but you don't have to use that
+ prefix. There are some situations where you absolutely will not want to
+ use the default prefix. Suppose, for example, that you have written a package
+ with ten procedures, each of which already have "ut_" as a prefix
+ (it might stand for "Unified Technologies" or "Underside Treatment: or...well,
+ you get the picture).
+
+
+
+ Since this prefix is not hard-coded into utPLSQL, you can very easily
+ specify your own prefix. You can do this when you run a test, as in:
+
+ Of course, when you specify a non-default prefix, you must also build your
+ test package using that prefix. If you plan to generate a starting point
+ for your package with utGen, be sure to specify your prefix at that point,
+ as in:
+
+ For an example of a package with a non-default prefix, check out test_te_employee.pks
+ and test_te_employee.pkb (Both to be found in the Examples directory of the utPLSQL distribution).
+
+
+
+
+
diff --git a/documentation/src/readme.txt b/documentation/src/readme.txt
new file mode 100644
index 000000000..3c81d826f
--- /dev/null
+++ b/documentation/src/readme.txt
@@ -0,0 +1,71 @@
+==================================
+HOW TO BUILD UTPLSQL DOCUMENTATION
+==================================
+$Id$
+==================================
+
+The utPLSQL documentation is built from a series of simple HTML files in the
+src directory. These files have none of the navigation bars, logos or
+next/previous links which appear in the final documentation. They are also
+stripped of font, color and style information at compile-time to let the
+stylesheet (utplsql.css) determine the overall look-and-feel.
+
+---------
+THE FILES
+---------
+
+The files are compiled into a documentation set situated in the top-level
+documentation directory using the 2 control files, map.txt and authors.txt.
+The first of these is the driving file, giving a list of the files to be
+included. The second gives a list of authors to be included in the copyright
+notice on each page and referenced in the Meta tags.
+
+The format of map.txt is as follows:
+
+ # Any line starting with a # is
+ # considered a comment
+ #
+ index.html,Home*
+ started.html,Getting Started*
+ another.html,Further Docs
+ another2.html,Yet more docs
+
+Each line consists of the filename to be included and the title of the page,
+separated with a comma. Any file whose title is followed by an asterisk is
+considered the start of a new section. This means a link to the file will
+appear in the navigation bar at the top of each page and it will appear in
+bold in the document map. Note that the document map itself does not appear
+in map.txt, but is always added at the end and is considered a new section.
+This page is entirely generated at compile-time.
+
+The format of authors.txt is as follows:
+
+ # Again, lines starting # are ignored
+ #
+ Steven Feuerstein,steven@stevenfeuerstein.com
+ Chris Rimmer,c@24.org.uk
+ A N Other,ano@ther.net
+
+Each line in this file simply gives the name of the author and their email
+address, separated with a comma.
+
+-----------
+THE SCRIPTS
+-----------
+
+The 2 Perl scripts used to build the documentation are clean_html.pl and
+build_docs.pl.
+
+The first of these simply strips HTML files down to the basics, removing
+everything from the header and removing Javascript, fonts, color etc. It
+requires the HTML::TagFilter module which in turn also requires the
+HTML::Parser and HTML::Tagset modules (all available from search.cpan.org).
+
+The second script goes through each file listed in map.txt, cleans it using
+the previous script and then adds logos, navigation bars, next/previous links,
+copyright information etc. The resulting files are put in the top-level
+documentation directory.
+
+NOTE: Anything within a source file before the
+"" comment line and after the
+"" comment line is ignored.
diff --git a/documentation/src/release.html b/documentation/src/release.html
new file mode 100644
index 000000000..b63702964
--- /dev/null
+++ b/documentation/src/release.html
@@ -0,0 +1,693 @@
+
+
+
+
+
+
+
+
+
+
Release Notes
+
+
Known Issues
+
utPLSQL version 2.x
+
+
+ There is an issue surrounding the use of utPLSQL on Oracle 8.1.7 where
+ the tests use database links. This is because Oracle will consider
+ the transaction to be distributed and utPLSQL v2 uses autonomous transactions
+ while the tests are running. This situation causes ORA-00164 in 8.1.7
+ (and apparently should not have been allowed in 8.1.5 or 8.1.6 either). It
+ is possible to work around this problem by turning off autonomous transactions
+ , but this can cause other problems if the tests themselves have rollbacks
+ within them.
+
+
+
+ The utAssert.eqtable assertion program will not work with tables that
+ contain non-scalar datatypes, such as LOBs, XMLType, collections and so on.
+
+ Bug 35: Fixed an issue with utAssert.eqQuery failing with long select statements.
+
+
+ Bug 39: Corrected a spelling mistake in the documentation.
+
+
+
+
utPLSQL version 2.2.2 (4th May 2014)
+
+
+
+ Bug 32: Fixed issue with "eqquery" failing if a statement contained "UNION ALL".
+
+
+ Bug 33: Fixed issue which meant tests ran in an undetermined order (they will now run in alphabetical order).
+
+
+
+
utPLSQL version 2.2.1 (6th April 2014)
+
+
+
+ Bug 29: Fixed issue with the Uninstall leaving two views behind.
+
+
+ Bug 38: Fixed issue which prevented building the documentation depending on the build environment.
+
+
+ Feature Request 6: Updated documentation and made it all valid XHTML.
+
+
+
+
utPLSQL version 2.2
+
+
+
+ This version introduces the concept of Output Reporters. The existing code to output to DBMS_OUPUT or to file has been refactored to
+ fit into this framework. As a result of this, the pl procedure in the utplsql package has been moved to the utreport package.
+
+
+ The installation procedure has been changed so that the database version is picked up more robustly. Version 2.2 works with 10g,
+ which previous versions did not. It should also work with future versions (so long as the version is to be found in the same place
+ in the data dictionary).
+
+
+ There are also a variety of small fixes in this release.
+
+
+
+
utPLSQL version 2.1.1
+
+
+
+ This version has a variety of small fixes and is released to coincide
+ with OUnit version 1.0.
+
+
+ The installation procedure has been changed and a variety of bugs with it have been fixed.
+
+
+ utGen.exe has been removed from the "core" utPLSQL distribution. The functionallity it supplied will be included in a future version of Ounit.
+
+
+
+
utPLSQL version 2.0.10.1
+
+
+
+ Allow user to specify (as part of their individual configuration) that they
+ only want to show failed tests, and then whether all information or just the
+ description (request from Heinz of UBS). Supersedes the
+ utresult.ignore_successes and utresult.include_successes (whose settings do not
+ persist across sessions).
+
+
+ Support for testing contents of REF CURSORs (cursor variables) has been added
+ (provided by Venky Mangapillai) with the eq_refc_table and eq_refc_query
+ assertion routines.
+
+
+ Adds testpkg_from_table to utgen to allow generation of a test package directly
+ from the new ut_grid table (provided by Patrick Barel). Patrick has also built
+ a Windows-based front end, utGen.exe, that allows us to populate this grid very
+ easily. Thanks, Patrick!
+
+
+ Add ut_outcome_seq sequence for ut_outcome table.
+
+
+ Add control_info and test_info columns to ut_outcome table.
+
+
+ Add ability to direct output from utPLSQL's test run (the test results) to a
+ file instead of to the screen. This functionality was provided by Rainer
+ Medert. The documentation for this feature has not yet been integrated into the
+ documentation set. You will find the "beta" documentation in the
+ file_output_spec.doc in the doc directory.
+
+
+
+
utPLSQL version 2.0.9.2
+
+
+
+ Surround AUTHID CURRENT_USER clause of utreceq.pks to allow for installation on
+ Oracle7 and Oracle8.
+
+
+ Add override_package_in argument to utPLSQL.test so that you can bypass the
+ standard ut_<package> naming conventions for testing. This is useful
+ when your package name's length is 28 or above. By passing in the override
+ package name, you can avoid the name limitation.
+
+
+ New assertion programs to validate DBMS_OUTPUT text that is generated from
+ within a program.
+
+
+ Add utplsql.run and utplsql.runsuite to run a named test package directly, and
+ not correlate it via the name of the program being tested.
+
+
+
+
utPLSQL version 2.0.9.1
+
+
+
+ Add ut_reqeq table and utreceq package to support the creation of "record
+ equal" functions (contributed by Dan Spencer).
+
+
+ Modify utPLSQL.test so that the record comparison functions are generated
+ and recompiled whenever the source code is recompiled.
+ Call utreceq.add to register a package-table combination.
+
+
+ Modified utpackage.id_from_name to take an owner_in parameter with a
+ NULL default value. v_owner is set to nvl(owner_in,user). added
+ owner = v_owner and suite_id is null to the WHERE clause.
+
+
+ Modified utpackage.add to add in a record with suite_id NULL if one
+ doesn't exist.
+
+
+ Modified utpackage.upd - changed parameter suite_in to suite_id_in (the
+ type was INTEGER). Changed the UPDATE WHERE clause first line
+ to NVL(suite_id,0) = NVL(suite_id_in,0).
+
+
+ Modified utplsql.testsuite - v_suite (the suite id) was in the
+ call to utplsql.test while the utplsql.test parameter list was expecting
+ the suite name. The results of a test run are now logged to the
+ appropriate record in ut_package [the record for the suite if run from
+ testsuite, the record with suite_id NULL if run via an EXEC UTPLSQL.TEST('packagename')].
+
+
+ Add objExists and objNotExists assertion programs
+
+
+ Changes to utPLSQL.test engine so that you can test programs define
+ in one schema from another schema.
+
+
+ Add previous_passed and previous_failed to utAssert and utAssert2
+
+
+ Set order in which test case results are displayed to the order in which
+ they are run by adding the tc_run_id to the utr_outcome table.
+
+
+
+
utPLSQL version 2.0.8.2
+
+
+
+ Change ut_utp LOB column to VARCHAR2 for the time being.
+
+
+ Fixed ALTER TABLE statement in ut_config.tab.
+
+
+ Change utplsql.test to allow for compilation of test package before
+ extracting list of test procedures from that package (avoids the "
+ Warning...no tests were identified for execution!" message).
+
+
+
+ Add utAssert2.eval generic comparison program, and also utAssert.eval,
+ with an overloading for just two values, to make it really easy to use.
+
+
+ Add utGen.receq_package procedure. It currently ONLY writes the code
+ out to the screen via DBMS_OUTPUT.PUT_LINE. It does not, in other words,
+ support the multiple outputs of utGen.testpkg.
+
+
+ Update the utplsql_install.sql script to recognize Oracle9.0 and Oracle9.1
+ versions and install all 8i features for those versions (there is nothing
+ specific to 9i at this time).
+
+
+
+
utPLSQL version 2.0.8.1
+
+
+
+ Fixes to a number of minor installation errors.
+
+
+ Offers option in utPLSQL.test to request that setup and teardown is
+ executed with each test procedure and not the test package level.
+ Implements a new features in utPLSQL.test that allows you to specify
+ that you want to run the setup and teardown procedures before and after
+ EACH unit test procedure, as opposed to running them once for the unit
+ test package as a whole. To utilize this feature, simply pass a value
+ of TRUE to the new per_method_setup_in parameter of utPLSQL.test as
+ shown below:
+
+ Revamp utAssert2.define_message implement to simplify creation of new assertion
+ programs
+
+
+ Modify implementation if ieqminus to avoid duplicate column
+
+
+ Change naming conventions for utPLSQL2 from prefix to delimiter driven
+ (utconfig.delimiter):QU##NNN. This affects only those test packages
+ which use the utPLSQL2.test program to run the tests (ie for version 1
+ utPLSQL test packages and utPLSQL.test, you can still use your prefix-based approaches).
+
+
+ Add utAssert2.fileExists
+
+
+ Compile utAssert2 with AUTHID CURRENT_USER for Oracle8i and above.
+
+
+ (2.0.7.2) Fix index creation for ut_assertion table.
+
+
+ (2.0.7.2) Fix foreign key definition in ut_argument.
+
+
+ (2.0.7.2) Fix foreign key definition in uta_eq.
+
+
+
+
utPLSQL version 2.0.6
+
+
+
+ Fix to utgen.pkb to allow generation of procedure bodies when no grid is used.
+
+
+ Allow developers to turn off display of successful results (utResult.include_successes)
+
+
+
+
utPLSQL version 2.0.5
+
+
+
+ Allow user to specify individual program or programs (via wildcard) to be tested
+ from a whole package.
+
+
+ Add ut_deterministic and ut_deterministic_arg tables to facilitate generate of
+ test packages for deterministic functions.
+
+
+ Add ut_deterministic.fmx Oracle Forms GUI to allow easy generation of test packages
+ for deterministic functions.
+
+
+
+
utPLSQL version 2.0.4
+
+
+
+ Implement test suite execution in utPLSQL2.
+
+
+ Implement ut_suite_utp table (and the corresponding utsuiteutp package) as an intersection
+ of ut_suite and ut_utp, defining all those UTPs in a given suite.
+
+
+ Improved error handling with utrerror assertions and general reporting mechanisms.
+ Assertion and error handling logic applied to define-time packages like utsuite
+ and utsuiteutp.
+
+
+ Revamp installation process; no longer use OraShare, remove testcase2 entirely.
+
+
+ Create stand alone utverify procedure.
+
+
+
+
utPLSQL version 2.0.3
+
+
+
+ Add utr_error table and utrerror package; now all errors are logged to the table
+ for viewing afterwards. utPLSQL NEVER passes back an unhandled exception
+ to the console.
+
+
+ utAssert.eqfile now flags problems when opening files.
+
+
+
+
utPLSQL version 2.0.2
+
+
+
+ Clarify how that null_ok_in is supposed to work. For utAssert.this, it should
+ mean that if the value of the Boolean expression coming in is null, then
+ that means "success". For eq, it shoudl mean that if BOTH values coming in
+ are NULL, that is "success". For eqfile, if both files are empty...etc.
+
+
+ Add null_ok_in to eqqueryvalue assertions.
+
+
+ Add utassert.eqqueryvalue for NUMBER
+
+
+ Enhance utgen to properly generate code for overloaded programs in packages
+
+
+
+
utPLSQL version 2.0.1
+
+
+
+ Store results in utr_outcome tables
+
+
+ Support results reporting compatibility with V1
+
+
+ Display results of all test, success and failure.
+
+
+
+
utPLSQL version 1.5.6
+
+
+
+ New version of documentation courtesy of Chris Rimmer. Thanks, Chris!
+
+
+ utAssert fix in eqcoll to check for both values being null.
+
+
+ Enhancements to utGen to generate more self-explanatory code; comments
+ are now inserted to show the different sections in a standard test case
+ sequence.
+
+
+ Revamped installation procedure based on OraShare utility.
+
+
+ Add utGen.testpkg overloadings and new programs to support passing of
+ argument grids via collection, file or string (this feature is currently
+ undocumented outside of the release notes).
+
+
+
+
utPLSQL version 1.5.5
+
+
Bug Fixes
+
+
+
+ Change calls from DBMS_OUTPUT.PUT_LINE to utPLSQL.pl to avoid output
+ errors.
+
+
+ Avoid use of DBMS_SQL to obtain sequence values for Oracle7 and Oracle8
+ installations of utPLSQL.
+
+
+
+
Enhancements
+
+
+
+ Addition of utConfig package (created and integrated by Chris Rimmer)
+ to isolate all tester configuration information.
+
+
+
+
utPLSQL version 1.5.4
+
+
Bug Fixes
+
+
+
+ utPLSQL.setconfig now sets the user information properly when
+ the package is first initialized (bug introduced in 1.5.3).
+
+
+
+
utPLSQL version 1.5.3
+
+
Documentation and Usage Changes
+
+
+
+ If you choose to manually register your tests with calls to utPLSQL.addtest
+ in your setup procedure, you must now INCLUDE the unit test prefix,
+ as in:
+
+
+
+
+utPLSQL.addtest ('ut_betwnstr');
+
+
+ utPLSQL
+ will no longer add the prefix for you. This means that you may need to change
+ your calls to addtest -- or remove them entirely and rely on auto-registration.
+
+
+
+
Bug Fixes
+
+
+
+ Auto-registration (using the ALL_ARGUMENTS data dictionary view) now
+ correctly ignores the setup and teardown procedures.
+
+
+
+
Enhancements
+
+
+
+ If no tests are run for the specified program, then a warning is displayed,
+ after which the SUCCESS message is displayed.
+
+
+
+
utPLSQL version 1.5.2
+
+
Bug Fixes
+
+
+
+ Fix setting of default prefix value in utPLSQL.pkb.
+
+
+
+ If you request execution of a test suite that does not exist, that failure
+ will be reported.
+
+
+ If you request execution of a test for a program or package that does
+ not exist, that failure will be reported.
+
+
+ Unique index on ut_package changed to allow multiple entries for same
+ package, in different suites.
+
+
+
+
Known Problems
+
+
+
+ When running a suite of test packages, the SUCCESS and FAILURE headers
+ will display for each package, and not for the overall suite.
+
+
+
+
Enhancements
+
+
+
+ The utAssert package now offers isnull and isnotnull assertions overloaded
+ for Boolean values.
+
+
+
+
utPLSQL version 1.5.1
+
+
Support for Oracle7.3, Oracle8 and Oracle8i
+
+
+ utPLSQL can now be used on any version of Oracle from 7.3.4 and above! The
+ installation script automatically detects your Oracle RDBMS version and adjusts
+ the code accordingly (Using a great SQL*Plus trick, courtesy of Vladimir
+ Trusevich; check out the references to &start81 and &start73 in the
+ source code, as well as the queries in code.sql, to get a sense of how we
+ can maintain a single base of code for all these versions!).
+
+
+
There are some differences in how the code works:
+
+
+
+ In Oracle8i, the autonomous transaction feature is used to immediately
+ COMMIT any changes to underlying utPLSQL tables (such as defining a
+ test suite). In earlier versions, no COMMITs are performed by utPLSQL.
+
+
+
+
+ In Oracle8i, the Invoker Rights model is used to allow all of utPLSQL code
+ to run under the authority of the invoker, not the owner/definer. In earlier
+ versions, the Definer Rights model is followed. So if you define utPLSQL
+ in a central schema and then share it with others via GRANTs and synonyms,
+ you may need to grant additional authority to the utPLSQL schema.
+
+
+
+
Stores Additional Configuration Information
+
+
+ When you set the directory for your test code (through a call to
+ utPLSQL.setdir
+ , utPLSQL.test or utPLSQL.testsuite), that value is stored in the uPLSQL
+ configuration table (ut_config). It will be used for current and future sessions
+ as the default, until you change it.
+
+
+
+ The prefix you specify in calls to utPLSQL.setprefix
+ , utPLSQL.test or utPLSQL.testsuite will also be saved in the uPLSQL configuration
+ table. It will be used for current and future sessions as the default, until
+ you change it.
+
+
+
Shows All Configuration Information
+
+
+ Call the utPLSQL.showconfig
+ procedure to display all of the stored configuration values for the specified
+ schema.
+
+
+
utPLSQL version 1.4.1
+
+
Automatic Test Registration
+
+
+ You no longer have to manually register
+ your unit test procedures
+ in the setup procedure. Instead, utPLSQL will (in default mode) read and
+ execute the list of public procedures and functions from the ALL_ARGUMENTS
+ data dictionary view that conform to utPLSQL naming conventions. This enhancement
+ makes utPLSQL much easier and simpler to use than before. Simply use the
+ designated prefix (default being "ut_") on your program names, and they will
+ be executed.
+
+
+
Improved error handling and reporting
+
+
Rather than display a small, easily missed test result, as in :
+
+
+SUCCESS: PLVstr
+
+
+
+ utPLSQL now displays a much more noticeable (though still lacking in
+ colors, as in red for failure and green for success) display of the "big
+ picture", as in:
+
+
+
+SQL> exec utplsql.test ('str', dir_in=>'e:\openoracle\utplsql\utinstall\examples')
+.
+> SSSS U U CCC CCC EEEEEEE SSSS SSSS
+> S S U U C C C C E S S S S
+> S U U C C C C E S S
+> S U U C C E S S
+> SSSS U U C C EEEE SSSS SSSS
+> S U U C C E S S
+> S U U C C C C E S S
+> S S U U C C C C E S S S S
+> SSSS UUU CCC CCC EEEEEEE SSSS SSSS
+.
+ SUCCESS: "str"
+
+
+
utPLSQL version 1.3.2
+
+
Improved Statistics Recording
+
+
+ utPLSQL will now record the status of the last test run in the ut_package
+ and ut_suite tables. It also correctly updates those tables with a count
+ of executions and failures. Finally, it is no longer necessary to define
+ your package in and run it from a test suite for results to be recorded.
+
+
+
New Assertions and Assertion Features
+
+
+ utAssert now offers assertion routines that allow you to easily validate
+ the contents of PL/SQL collections (index-by tables, nested tables and varying
+ arrays) by running either the utassert.eqcoll
+ or utassert.ecollAPI
+ assertions.
+
+
+
+ You can also now request that utAssert show the
+ results of a test immediately
+ after execution. This allows you to build small test scripts without have
+ to create a test package and run it through the utPLSQL test engine.
+
+
+
Bug Fixes
+
+
+ Generally, error handling is now improved, particularly for compile errors
+ on test packages and modifications to underlying tables, such as ut_package.
+
+
+
+ When a test has been completed, utPLSQL clears out the results information.
+
+ Generally, the default output provided by utPLSQL is sufficient. This
+ just writes to the screen using DBMS_OUTPUT. If you are running it
+ interactively while doing some development, you just need to know if the
+ tests are passing and details of the failing tests. However, there are
+ cases where you'd like the results to be reported in a different format,
+ especially when the tests are being run in batch mode. To support this,
+ utPLSQL has the concept of Reporter Packages. utPLSQL is distributed with
+ the following reporter packages as standard:
+
+ The naming convention is that reporter packages are called
+ UT<NAME>REPORTER. To set which reporter is used, you will
+ need to call utConfig.Setreporter, passing the name of the reporter.
+ To use the HTML reporter for example, you should issue the following command:
+
+
+
+BEGIN
+ utConfig.setreporter('HTML');
+END;
+
+
+
+ For more details of how to develop your own custom
+ reporter package, see below.
+
+
+
Output Reporter
+
+
+ Contained in the UTOUTPUTREPORTER package, this simply encapsulates the
+ standard behaviour, whereby the output is written out to DBMS_OUTPUT. When a
+ problem occurs with another reporter, utPLSQL will automatically fall back on
+ this mechanism to report problems. This means it is wise to have DBMS_OUTPUT
+ enabled even if you are using another output method.
+
+
+
File Reporter
+
+
+ This reporter, contained in the UTFILEREPORTER package, writes test results
+ out to a file. For details on how to configure this process, see the details
+ which can be found here. This functionality was
+ available before version 2.2 of utPLSQL, but has now been moved into its own
+ package.
+
+
+
HTML Reporter
+
+
+ The package UTHTMLREPORTER is really just an example package to be used as
+ a basis for your own custom reporters. It builds on the filereporter described above to
+ send results to a file. The difference is that the results are presented in a (rather crude)
+ HTML table.
+
+
+
Writing your own Reporter
+
+
+ To define your own reporter package you need it conform to a particular API. The various
+ procedures are then registered as 'callbacks' for utPLSQL to use.
+ An example package spec is given below.
+
+
+
+CREATE OR REPLACE PACKAGE utMyRssReporter
+IS
+
+ PROCEDURE open;
+ PROCEDURE pl (str IN VARCHAR2);
+
+ PROCEDURE before_results(run_id IN utr_outcome.run_id%TYPE);
+ PROCEDURE show_failure;
+ PROCEDURE show_result;
+ PROCEDURE after_results(run_id IN utr_outcome.run_id%TYPE);
+
+ PROCEDURE before_errors(run_id IN utr_error.run_id%TYPE);
+ PROCEDURE show_error;
+ PROCEDURE after_errors(run_id IN utr_error.run_id%TYPE);
+
+ PROCEDURE close;
+
+ PROCEDURE before_suite_results(suite_id IN ut_suite.id%TYPE);
+
+END utMyRssReporter;
+/
+
+
+
+ Your reporter package can define other functions and procedures, for
+ example to allow configuration, but all the procedures shown above should
+ be defined. The usage of these procedures follows. Note If you
+ want to keep the format of the output the same as for the Output Reporter,
+ but wish to send it elsewhere, you can define open, close and pl, but
+ simply call the equivalent procedure in utOutputReporter for the others.
+ For an example of this, see the File Reporter.
+
+
+
open
+
+
+ This is called at the very start of the process and is the ideal place to
+ do initialization, such as opening any files that you will be writing to.
+
+
+
pl
+
+ This is a general routine to simply write out the given string for purposes of logging etc.
+ If you don't want this to show up in your output, you can simply call utoutputreporter.pl to send this to DBMS_OUTPUT instead.
+
+
+
before_results
+
+
+ As the name suggests, this is called before the results are output. Note that the tests have already completed at this point,
+ so it is possible to call utresult.success (run_id) to determine if the run was a success or not and display a large banner.
+
+
+
show_failure
+
+
+ This is called when a failure is reported and we are only showing failures (i.e. utconfig.showfailuresonly has been set).
+ To get details of the failure, you will need to examine the package level record utreport.outcome.
+
+
+
show_result
+
+
+ This is called whenever a result is reported and we are showing all
+ results. To get details, you will need to examine
+ utreport.outcome. See below for details.
+
+
+
after_results
+
This is called after all the results have been sent for output.
+
+
before_errors
+
This is called before any errors are sent for output.
+
+
show_error
+
+ This is called for each error to output. To get details, you will need
+ to examine the package level record utreport.error.
+ See below for details.
+
+
+
after_errors
+
This is called after any errors have been sent for output.
+
+
before_suite_results
+
+ This is called only when a suite is executed. It displays the overall
+ banner and suite execution statistics.
+
+
+
Outcome and Error records
+
+ In order to keep the API as simple as possible, many of the procedures defined above take no parameters. In particular, details of the outcome or error which
+ triggered the callback are not passed through to your procedure. These are stored as package level records in the utReport package as shown below.
+
status - This is a string which is either "SUCCESS" or "FAILURE" depending on the outcome of this test.
+
description - The text describing the success or failure.
+
+
+
The important fields in the error record are:
+
+
+
errlevel - The Error Level
+
errcode - The Error Code
+
errtext - The Description of the error that occurred
+
+
+
Using Your Custom Reporter
+
+ To use your custom reporter, you simply call utConfig.Setreporter with the name of your reporter. So if
+ you have defined your reporter in the utMyRssReporter package, you need to call:
+
+
+
+BEGIN
+ utConfig.setreporter('MyRss');
+END;
+
+
+
+ Then you just run your tests as usual and hopefully your reporter will
+ format the results as you expect.
+
+
+
Sending output to the current reporter
+
+ If you wish to send output to the current reporter, for example, for logging purposes, you should call utReport.pl.
+ This is part of the utReport package, which acts as a facade and passes any calls through to the current reporter package.
+ So if you have set up a custom reporter package 'utMyRssReporter' as shown above and called utConfig.setreporter('MyRss'),
+ any calls such as the following:
+
+ In some cases (usually when your packages are small and the code you
+ need to write to construct your tests is also constrained), you will not
+ want to bother with creating a separate package to test your code. To do
+ this, you will put the setup, teardown and unit test procedures inside
+ the package specification and body. We look at two examples:
+
+ Suppose I have my basic sting package, containing (for now at least) just
+ a single function:
+
+
+
+/*file str.pks */
+CREATE OR REPLACE PACKAGE str
+IS
+ FUNCTION betwn (
+ string_in IN VARCHAR2,
+ start_in IN PLS_INTEGER,
+ end_in IN PLS_INTEGER
+ )
+ RETURN VARCHAR2;
+END str;
+/
+
+
+
+ Now it is time to test the function. I really don't want to bother with
+ a separate package; let's keep it together. To do this, I change the specification
+ to:
+
+
+
+CREATE OR REPLACE PACKAGE str
+IS
+ FUNCTION betwn (
+ string_in IN VARCHAR2,
+ start_in IN PLS_INTEGER,
+ end_in IN PLS_INTEGER
+ )
+ RETURN VARCHAR2;
+
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+
+ -- For each program to test...
+ PROCEDURE ut_betwn;
+
+END str;
+/
+
+
+
+ The package body contains nothing unusual; it is the same test for str.betwn
+ that you can find in the Testing
+ a Scalar Function example. But when I execute my test, I need to tell
+ utPLSQL that my test code is located in the same package:
+
+
+
+SQL> exec utconfig.showconfig
+=============================================================
+utPLSQL Configuration for SCOTT
+ Directory: e:\openoracle\utplsql\utinstall\examples
+ Autcompile? Y
+ Manual test registration? N
+ Prefix = ut_
+=============================================================
+
+PL/SQL procedure successfully completed.
+
+SQL> exec utPLSQL.test ('str', samepackage_in => TRUE)
+.
+> SSSS U U CCC CCC EEEEEEE SSSS SSSS
+> S S U U C C C C E S S S S
+> S U U C C C C E S S
+> S U U C C E S S
+> SSSS U U C C EEEE SSSS SSSS
+> S U U C C E S S
+> S U U C C C C E S S
+> S S U U C C C C E S S S S
+> SSSS UUU CCC CCC EEEEEEE SSSS SSSS
+.
+ SUCCESS: "str"
+
+ Collections are very useful structures, but they can be difficult to analyze
+ and compare. utPLSQL provides the utAssert.eqColl and utAssert.eqCollAPI
+ programs to help you do this.
+
+
+ For this example, consider the fileIO package: it implements a path
+ feature for the UTL_FILE package. In other words, you request to open a
+ file and your file-opening program will search through each of the directories
+ in the path in sequence until it finds the file or exhausts the list. Here
+ is the specification of this package:
+
+
+/*file filepath1.pkg */
+CREATE OR REPLACE PACKAGE fileIO
+IS
+ c_delim CHAR(1) := ';';
+
+ dirs dirs_tabtype := dirs_tabtype ();
+
+ -- Unit test list
+ ut_dirs dirs_tabtype := dirs_tabtype ();
+
+ PROCEDURE setpath (str IN VARCHAR2, delim IN VARCHAR2 := c_delim);
+ FUNCTION path RETURN VARCHAR2;
+ FUNCTION pathlist RETURN dirs_tabtype;
+
+ FUNCTION open (file IN VARCHAR2, loc IN VARCHAR2 := NULL) RETURN UTL_FILE.FILE_TYPE;
+
+ -- Unit test code in same package
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+ PROCEDURE ut_setpath;
+END;
+/
+
+
+
A few things to notice about this package:
+
+
+ It declares a publicly available collection, fileIO.dirs, in which the
+ path is deposited. Because it is declared in the package specification,
+ I can use the utAssert.eqColl procedure (if the collection was hidden in
+ the package body, I would have to use utAssert.eqCollAPI).
+
+
+ The test code is in the same package: the setup,
+ teardown and test pogram for fileIO.setpath.
+
+
+ I declare a second, publicly available collection,
+ fileIO.ut_dirs, against which I will compare the path that is populated
+ by fileIO.setpath.
+
+
+
+
Given that, let's take a look at the implementation of the test program:
+ Populate the test collection with direct assignments. Call the setPath
+ program to populate the actual collection (fileIO.dirs). Call the assertion
+ program to compare the two. Notice that I pass the names of the
+ collections to the assertion program. utAssert uses dynamic SQL to build
+ a PL/SQL block "on the fly" that compares values from the collections.
+
+ This document gives you all the information you need to get started
+ with utPLSQL: how to install the product, build a test package and run
+ your test. If you are new to unit testing, you should take a few moments
+ to review the Glossary to familiarize yourself with the terminology.
+
+
+
+ And it is always worthwhile reviewing requirements before installing
+ the software!
+
+ Usually our applications are composed of multiple packages. To test
+ our application, we must test all of the packages. utPLSQL makes it easier
+ for you to do that by offering test suites.
+
+
+ Here is an example of a script that defines a (partial) test suite for
+ PL/Vision, a code library available from RevealNet
+ as part of its Active PL/SQL Knowledge Base:
+
+
+
+/*file plvision.tst */
+BEGIN
+ -- Define a test suite for PL/Vision
+ utsuite.add ('PLVision');
+
+ -- Add packages for testing
+ utpackage.add (
+ 'PLVision', 'PLVstr', dir_in => 'e:\openoracle\utplsql\examples');
+ utpackage.add (
+ 'PLVision', 'PLVdate', dir_in => 'e:\openoracle\utplsql\examples');
+END;
+/
+
+
+
+ This is a very simple test suite definition. I rely on all defaults, but
+ I specify a location for my test package code. By doing this, utPLSQL will
+ be able to find my test packages even if the default/current utPLSQL directory
+ is set to another location.
+
+
+ If I want to, I can also specify the order in which packages are tested
+ by passing a value for the seq_in argument. I can request that the test
+ code be looked for in the same package as the source code, and so on. Here
+ is a rewriting of the above sutie creation script that demonstrates these
+ options:
+
+ Most packages consist of lots more than a single program, and you will
+ generally want to test each and every of the programs listed in the package
+ specification. When you generate a test package with utGen,
+ it will produce a template unit test procedure for each program in the
+ package specification. You will then need to modify each of these programs.
+
+
+ One example of this more complex package structure is the table encapsulation
+ package. This kind of package establishes a layer of code and therefore
+ control between application requirements and underlying data structures.
+ While the building of such a layer is uncommon in the world of PL/SQL developers,
+ it is strongly recommended practice. A variety of tools, in fact, offer
+ automated table encapsulation package generation, including Oracle
+ Designer, RevealNet's PL/Generator
+ and a variety of IDE (integrated development environment) tools.
+
+
+ Suppose, then, that I used PL/Generator to generate a table encapsulation
+ package for the employee table. It would look like the code found in te_employee.pks
+ and te_employee.pkb(1) (being rather
+ lengthy, we will not reproduce it in the documentation. If you take a look,
+ you will see that their are dozens of programs in the API, which means
+ that you would have lots of work to do in building your unit test cases.
+ In addition, many of the programs will be performing DML operations (updating,
+ deleting, inserting). How you can easily and dependably test those programs?
+
+
+ When you are dealing with lots of programs that have a uniform structure
+ and behavior (which should be the case if you are building table
+ API packages), then you should look for ways to generate, rather
+ than write manually, your test package. utGen cannot do this generation
+ work for you, since the logic in your encapsulation package is specific
+ to your environment.
+
+
+ You can, instead, build your own custom generator or use an existing
+ generator that is sufficiently flexible to meet your needs. The original
+ creator of utPLSQL, Steven Feuerstein,
+ has also been working on generator utilities for a number of years. One
+ of these utilities, currently "code named" GenX, came in very handy for
+ creating a test package for his PL/Generator-generated encapsulation packages.
+
+
+ Using CGML (Code Generation Markup Language), Steven created a template
+ (See te_utpkg.gdr in the Examples directory of the utPLSQL distribution)
+ that reads information from the data dictionary and defines the setup,
+ teardown and at least a good starting point for the unit test procedures.
+ Here is the template logic for the setup procedure:
+
+
+ PROCEDURE {utprefix}setup
+ IS
+ BEGIN
+ -- Clean start
+ {utprefix}teardown;
+[ASIS]
+ -- Generic copy of base table for testing
+ EXECUTE IMMEDIATE
+ 'CREATE TABLE {tabprefix}[objname] AS
+ SELECT * FROM [objname]';
+
+[ENDASIS]
+ [FOREACH]prog
+ [IF]{allprogs}[EQ]Y[OR][progname][LIKE]UPD%[OR][progname][LIKE]INS%[OR][progname][LIKE]DEL%
+ -- Create copy of base table for this unit test.
+ EXECUTE IMMEDIATE
+ 'CREATE TABLE ^{progtab}^ AS
+[ASIS]
+ SELECT * FROM [objname]';
+[ENDASIS]
+
+ [ENDIF]
+ [ENDFOREACH]
+ END;
+
+
+
+ You are not, of course, expected to understand all the logic and syntax
+ in this fragment. If you are interested in pursuing these sorts of genreation
+ opportunities and would like to check out GenX, drop a note to Steven
+ Feuerstein.
+
+
+ Here is a portion of the generated logic (found in ut_te_employee.pks
+ and ut_te_employee.pkb"(1)), the
+ program that tests the delete operation in the encapsulation package:
+
+
+
+ PROCEDURE ut_del1
+ IS
+ fdbk PLS_INTEGER;
+ BEGIN
+ /* Delete that finds now rows. */
+
+ EXECUTE IMMEDIATE '
+ DELETE FROM ut_DEL1
+ WHERE employee_id = -1
+ ';
+ te_employee.del (-1, rowcount_out => fdbk);
+ -- Test results
+ utassert.eqtable ('Delete rows', 'EMPLOYEE', 'ut_DEL1');
+ /* Successful delete */
+
+ EXECUTE IMMEDIATE '
+ DELETE FROM ut_DEL1
+ WHERE employee_id between 7800 and 7899
+ ';
+
+ FOR rec IN (SELECT *
+ FROM employee
+ WHERE employee_id BETWEEN 7800 AND 7899)
+ LOOP
+ te_employee.del (
+ rec.employee_id,
+ rowcount_out => fdbk
+ );
+ END LOOP;
+
+ -- Test results
+ utassert.eqtable ('Delete rows', 'EMPLOYEE', 'ut_DEL1');
+ ROLLBACK;
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ utassert.this (
+ 'DEL1 exception ' || SQLERRM,
+ SQLCODE = 0
+ );
+ END;
+
+
+
+ In this procedure, I test for two scenarios: a delete that removes zero
+ rows and a delete that removes a specific set of rows. In both cases, I
+ perform the explicit (non-encapsulated) DML logic against a copy
+ of the actual table (this copy is created in the setup
+ procedure; that is the reason I use dynamic SQL to refer to this table
+ -- it doesn't exist when the package is compiled!). Then I do the (hopefully)
+ same operation by using the API program. Finally, I call the appropriate
+ utAssert assertion program to compare the results -- and at the end of
+ the procedure issue a ROLLBACK so that my "source" table (employee, in
+ this case), i set back to the original data state. Notice that I also put
+ an assertion program in the exception section to trap any errors and flag
+ it as a failed test.
+
+
+ That should give you a good feel for the kind of code you might write
+ to test a table encapsulation package. The next two sections show you how
+ I used the setup and teardown procedures to manage the data structures
+ I use in my tests.
+
+
+
Set Up Data Structures
+
+
+ As I contemplated how best to test these large packages, I revisited some
+ of my testing principles and found one to be of particular importance:
+
+
+
Build isolated tests.
+
+
+ This principle is important because it allows you to run one, all or
+ a subset of your tests without having to worry about the impact or dependencies
+ on the other tests. And test isolation is particularly important
+ when testing DML operations. The way to validate a successful DML operation
+ is by analyzing the contents of the "source" table against a "test" table.
+ If all the tests modify the same test table, ti will be very difficult
+ if not impossible to verify success or notice failure.
+
+
+ So I decided that the best way to run my unit tests for DML operations
+ was to create a separate test table for each unit test. As a consequence,
+ my setup procedure for the te_employee package looks like this:
+ (See ut_te_employee.pkb in the Examples directory of the utPLSQL distribution)
+
+
+
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+ ut_teardown;
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_employee AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_DEL1 AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_DELBY_EMP_DEPT_LOOKUP AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_DELBY_EMP_JOB_LOOKUP AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_DELBY_EMP_MGR_LOOKUP AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_INS1 AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_UPD1 AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_UPD$HIRE_DATE1 AS
+ SELECT * FROM employee';
+ EXECUTE IMMEDIATE 'CREATE TABLE ut_UPD$SALARY1 AS
+ SELECT * FROM employee';
+ END;
+
+
+
+ I first remove all my data structures using the teardown procedure to make
+ sure I have a clean start. Then I use dynamic SQL (the Oracle8i version)
+ to create all my tables. I must rely on dynamic SQL because PL/SQL does
+ not yet support native DDL statements, such as CREATE TABLE.
+
+
+ Then I am set to test.
+
+
+
Tear Down Data Structures
+
+
+ Well, if I am going to create a whole bunch of data structures to run my
+ tests, I had better get rid of those structures when I am done. Here is
+ the teardown program I generated for the te_employee package:
+
+
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_employee';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_DEL1';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_DELBY_EMP_DEPT_LOOKUP';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_DELBY_EMP_JOB_LOOKUP';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_DELBY_EMP_MGR_LOOKUP';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_INS1';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_UPD1';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_UPD$HIRE_DATE1';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ BEGIN
+ EXECUTE IMMEDIATE 'DROP TABLE ut_UPD$SALARY1';
+ EXCEPTION
+ WHEN OTHERS
+ THEN
+ NULL;
+ END;
+
+ END;
+
+
+
+ Again, I use dynamic SQL, but enclose each DROP TABLE statement inside
+ its own exception section so that if for any reason the DROP fails, I continue
+ on in an attempt to get as much done as possible.
+
+ As with the procedure, there are a couple of scenarios to consider:
+
+
+
+
+ The function returns a scalar value (number,
+ date, string, Boolean). In this case, you can embed your call to the function
+ directly inside a call to a uAssert assertion program, making your test
+ procedure very concise and easy to write.
+
+
+ The function returns a non-scalar value,
+ such as an object or a collection. In this case, you will need to call
+ the function and then evaluate the contents of the returned structure.
+
+
+ A third situation to consider is that your function returns a value, but
+ it also takes a number of other actions, the success of which is not reflected
+ in the returned value. Fully testing such a function (one with "side effects")
+ can be very difficult, since you must test for a variety of conditions.
+
+
+
+
Testing a Scalar Function
+
+
+ First, a test of a function returning a scalar value. Consider the following
+ packaged function:
+
+
+
+/*file str.pks and str.pkb */
+CREATE OR REPLACE PACKAGE str
+IS
+ FUNCTION betwn (
+ string_in IN VARCHAR2,
+ start_in IN PLS_INTEGER,
+ end_in IN PLS_INTEGER
+ )
+ RETURN VARCHAR2;
+END str;
+/
+
+
+
+ The str.betwn function returns the sub-string of a string_in that is found
+ between the start and end locations specified by start_in and end_in.
+
+
+
+ So...time to test! I generate a test package
+ and then modify the unit test procedure to check for various conditions:
+
+
+
+/*file ut_str.pkb */
+CREATE OR REPLACE PACKAGE BODY ut_str
+IS
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ -- For each program to test...
+ PROCEDURE ut_betwn IS
+ BEGIN
+ utAssert.eq (
+ 'Typical Valid Usage',
+ str.betwn ('this is a string', 3, 7),
+ 'is is'
+ );
+
+ utAssert.eq (
+ 'Test Negative Start',
+ str.betwn ('this is a string', -3, 7),
+ 'ing'
+ );
+
+ utAssert.isNULL (
+ 'Start bigger than end',
+ str.betwn ('this is a string', 3, 1)
+ );
+ END ut_betwn;
+
+END ut_str;
+/
+
+
+
+ As you can see, my calls to str.betwn are embedded right within calls to
+ utAssert.eq and utAssert.isNULL, making my test code compact.
+
+ The procedure runs some code and then passes back results through the parameter
+ list. In this case, I can write a unit test that analyzes the OUT and IN
+ OUT argument values.
+
+
+ The procedure runs some code, which changes
+ other elements of the application (such as a database table or a file).
+ The parameter list does not contain arguments that can be analyzed for
+ successful execution. So to assert success, I will need to analyze/compare
+ the data structures that have been modified.
+
+
+
+
Test Success Through Parameters
+
+
+ We'll start with a really simple example. I
+ have built a procedure that accepts two dates and returns the number of
+ seconds between them. Here it is:
+
+
+
+/*file calc_secs_between.sp */
+CREATE OR REPLACE PROCEDURE calc_secs_between (
+ date1 IN DATE,
+ date2 IN DATE,
+ secs OUT NUMBER)
+IS
+BEGIN
+ -- 24 hours in a day,
+ -- 60 minutes in an hour,
+ -- 60 seconds in a minute...
+ secs := (date2 - date1) * 24 * 60 * 60;
+END;
+/
+
+SQL> SET SERVEROUTPUT ON FORMAT WRAPPED
+SQL> exec utGen.testpkg ('calc_secs_between ')
+CREATE OR REPLACE PACKAGE ut_calc_secs_between
+IS
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+
+ -- For each program to test...
+ PROCEDURE ut_CALC_SECS_BETWEEN;
+END ut_calc_secs_between;
+/
+CREATE OR REPLACE PACKAGE BODY ut_calc_secs_between
+IS
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ -- For each program to test...
+ PROCEDURE ut_CALC_SECS_BETWEEN IS
+ BEGIN
+ CALC_SECS_BETWEEN (
+ DATE1 => ''
+ ,
+ DATE2 => ''
+ ,
+ SECS => ''
+ );
+
+ utAssert.this (
+ 'Test of CALC_SECS_BETWEEN',
+ '<boolean expression>'
+ );
+ END ut_CALC_SECS_BETWEEN;
+
+END ut_calc_secs_between;
+/
+
+
+
+ I generated the output to the screen, but it
+ is actually easier to deposit the code directly into two separate files
+ for package spec and body, ut_calc_secs_between.pks and ut_calc_secs_between.pkb,
+ which I do as follows:
+
+ By conforming to this standard, utPLSQL can
+ automatically compile this code before each test. I now edit the ut_calc_secs_between
+ procedure to test for various cases:
+
+SQL> exec utplsql.test ('calc_secs_between')
+.
+> SSSS U U CCC CCC EEEEEEE SSSS SSSS
+> S S U U C C C C E S S S S
+> S U U C C C C E S S
+> S U U C C E S S
+> SSSS U U C C EEEE SSSS SSSS
+> S U U C C E S S
+> S U U C C C C E S S
+> S S U U C C C C E S S S S
+> SSSS UUU CCC CCC EEEEEEE SSSS SSSS
+.
+ SUCCESS: "calc_secs_between"
+
+
+
+ Certainly, there are a variety of other conditions
+ to test, but this should give you a good idea of how to go about it!
+
+
+
Test Success by Analyzing Impact
+
+
+ Now let's consider a more complicated situation.
+ I have a procedure that truncates all the rows in the specified table.
+ To do this I just use dynamic SQL, as you can see in:
+
+ After I run this test, I cannot simply check
+ the value returned by the procedure. Instead, I must check to see how many
+ rows are left in the table. Fortunately, I have another dynamic SQL utility
+ to help me out here, one that returns the count of rows in any table:
+ (Note that you could also use utAssert.eqqueryvalue here.)
+
+
+
+/*file tabcount.sf */
+CREATE OR REPLACE FUNCTION tabcount (
+ sch IN VARCHAR2,
+ tab IN VARCHAR2)
+ RETURN INTEGER
+IS
+ retval INTEGER;
+BEGIN
+ EXECUTE IMMEDIATE
+ 'SELECT COUNT(*) FROM ' || sch || '.' || tab
+ INTO retval;
+ RETURN retval;
+EXCEPTION
+ WHEN OTHERS
+ THEN
+ RETURN NULL;
+END;
+/
+
+
+
+ So I will generate a package
+ to test truncit and then modify the package body:
+
+
+
+SQL> SET SERVEROUTPUT ON FORMAT WRAPPED
+SQL> exec utGen.testpkg ('truncit', output_type_in => utGen.c_file)
+
+
+
+ To run my test, I need to truncate a table.
+ That is an irreversible action, so I will create a "temporary" table in
+ the setup procedure and drop it in the teardown procedure. Then I will
+ run my code and use tabCount to validate the results:
+
+
+
+/*file ut_truncit.pkb */
+CREATE OR REPLACE PACKAGE BODY ut_truncit
+IS
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+ EXECUTE IMMEDIATE
+ 'CREATE TABLE temp_emp AS SELECT * FROM employee';
+ END;
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ EXECUTE IMMEDIATE
+ 'DROP TABLE temp_emp';
+ END;
+
+ -- For each program to test...
+ PROCEDURE ut_TRUNCIT IS
+ BEGIN
+ TRUNCIT (
+ TAB => 'temp_emp'
+ ,
+ SCH => USER
+ );
+
+ utAssert.eq (
+ 'Test of TRUNCIT',
+ tabcount (USER, 'temp_emp'),
+ 0
+ );
+ END ut_TRUNCIT;
+
+END ut_truncit;
+/
+
+
+
+ Not quite as straightforward as checking values
+ returned in OUT or IN OUT arguments, but not too awful, right? Of course,
+ things can get considerably more complicated as your code (and the results
+ you must test for) grows more complex. Regardless, you will find it easier
+ to build and run your tests through utPLSQL than through more ad hoc and
+ considerably less organized approaches.
+
+ I will put utPLSQL to work in a small-scale development
+ effort, to show you how it all hangs together. I've got a "hangnail" in
+ my PL/SQL development work, called SUBSTR. This function bothers me and
+ I want to take care of it. What's the problem? SUBSTR is great when you
+ know the starting location of a string and number of characters you want. In
+ many situations, though, I have the start and end locations and I need
+ to figure out the number of characters I then want. Is it:
+
+ Why should I have to remember stuff like this? I
+ never do, and so I take out a scrap of paper, write down 'abcdefgh', put
+ a mark over the "c" and another over the "g", count on my fingers and then
+ remember that of course the formula is "end - start + 1".
+
+
+
+ All right, so I did that a dozen times, I am sick
+ of it and determined to stop wasting my time in the future. I will write
+ a function called "str.betwn" (the betwn function defined in the str package)
+ that does the work and the remembering for me.
+
+
+
+ Instead of immediately coding the function, however,
+ I will first write my unit tests with utPLSQL! Since my source package
+ is named "str", I will create a test package named "ut_str". I am a lazy
+ fellow, so I will take the lazy way out and generate the starting point
+ for my package:
+
+ Note: for the above call to work, I must have already
+ set my default directory for utPLSQL, which I do via a SQL*Plus login script
+ that looks like this:
+
+
+
+exec utplsql.setdir ('e:\utplsql\test')
+
+SET SERVEROUTPUT ON SIZE 1000000 FORMAT WRAPPED
+
+
+
+ Otherwise, I would need to specify the directory
+ in my call to genpkg, as in:
+
I then will find this package spec in the ut_str.pks file:
+
+
+CREATE OR REPLACE PACKAGE ut_str
+IS
+ PROCEDURE ut_setup;
+ PROCEDURE ut_teardown;
+
+ -- For each program to test...
+ PROCEDURE ut_betwn;
+END ut_str;
+/
+
+
+
+ And I don't really have to modify the specification
+ at all. The body will, on the other hand, require some work, since I haven't
+ yet figured out a way to automatically generate the test code itself. Here
+ is the purely generated test package body found
+ in the ut_str.pkb file:
+
+
+
+CREATE OR REPLACE PACKAGE BODY ut_str
+IS
+ PROCEDURE ut_setup
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ PROCEDURE ut_teardown
+ IS
+ BEGIN
+ NULL;
+ END;
+
+ -- For each program to test...
+ PROCEDURE ut_betwn
+ IS
+ BEGIN
+ utAssert.this (
+ 'Test of betwn',
+ <boolean expression>,
+ );
+ END;
+
+END ut_str;
+/
+
+
+
+ The setup and teardown procedures are fine (I don't
+ have any special setup and therefore teardown requirements), but the ut_betwn
+ needs lots of work. It doesn't really test anything yet.
+
+
+
+ Before I start writing my test code, however, I
+ will just sit back and think about what I want to test. Here are some inputs
+ that I can think of:
+
+
+
+
+
String
+
Start
+
End
+
Expected Result
+
+
+
"this is a string"
+
3 (positive number)
+
7 (bigger positive number)
+
"is is"
+
+
+
"this is a string"
+
-3 (invalid negative number)
+
7 (bigger positive number)
+
"ing" (consistent with SUBSTR behavior)
+
+
+
"this is a string"
+
3 (positive number)
+
1 (smaller positive number)
+
NULL
+
+
+
+
+
+ We could easily come up with a whole lot more test
+ cases - and if this was real life and not product documentation, I would
+ not move forward until I had identified all interesting tests. So let's
+ suppose I have done that and now I am ready to do some coding. Since I
+ am testing a function, I will want to compare the result of the function
+ call to my expected results. I will therefore change my assertion from
+ the generic "assert this" procedure to the utAssert.eq program, and put
+ the call to the function right into the assertion routine. Here, then,
+ is my first crack at transforming my ut_betwn procedure:
+
+
+
+PROCEDURE ut_betwn IS
+BEGIN
+ utAssert.eq (
+ 'Test of betwn',
+ str.betwn ('this is a string', 3, 7),
+ 'is is'
+ );
+END;
+
+
+
+ Following the Extreme Programming philosophy ("code
+ a little, test a lot"), I will test this test case before I add all the
+ other test cases. I do this with a very simple call:
+
+
+
+SQL> exec utplsql.test ('str')
+
+> SSSS U U CCC CCC EEEEEEE SSSS SSSS
+> S S U U C C C C E S S S S
+> S U U C C C C E S S
+> S U U C C E S S
+> SSSS U U C C EEEE SSSS SSSS
+> S U U C C E S S
+> S U U C C C C E S S
+> S S U U C C C C E S S S S
+> SSSS UUU CCC CCC EEEEEEE SSSS SSSS
+
+>SUCCESS: "str"
+
+
+
+ Now, you could say: "Great it worked!" Or you could
+ say: "I have no idea if it worked. Maybe it always says success."
+ I go for the latter, so let's deliberately cause a failure:
+
+
+
+PROCEDURE ut_betwn IS
+BEGIN
+ utAssert.eq (
+ 'Test of betwn',
+ str.betwn ('this is a string', 3, 7),
+ 'this is a pipe'
+ );
+END;
+
+
+
+ Saving the file (but not bothering to recompile,
+ since utPLSQL will do it for me automagically),
+ I then run my test again:
+
+
+
+SQL> exec utplsql.test ('str', recompile_in=>false)
+
+> FFFFFFF AA III L U U RRRRR EEEEEEE
+> F A A I L U U R R E
+> F A A I L U U R R E
+> F A A I L U U R R E
+> FFFF A A I L U U RRRRRR EEEE
+> F AAAAAAAA I L U U R R E
+> F A A I L U U R R E
+> F A A I L U U R R E
+> F A A III LLLLLLL UUU R R EEEEEEE
+
+FAILURE: "str"
+
+BETWN: Typical Valid Usage; expected "is is", got "this is a pipe"
+
+
+
+ Now I have a higher degree of confidence that I
+ am getting this right. Excellent! Now I will add the other test cases:
+
+
+
+PROCEDURE ut_betwn IS
+BEGIN
+ utAssert.eq (
+ 'Typical Valid Usage',
+ str.betwn ('this is a string', 3, 7),
+ 'is is'
+ );
+
+ utAssert.eq (
+ 'Test Negative Start',
+ str.betwn ('this is a string', -3, 7),
+ 'ing'
+ );
+
+ utAssert.isNULL (
+ 'Start bigger than end',
+ str.betwn ('this is a string', 3, 1)
+ );
+END;
+
+
+
+ I will deliberately cause each of these tests to
+ fail, to give you a sense of the quality of feedback:
+
+
+
+> FFFFFFF AA III L U U RRRRR EEEEEEE
+> F A A I L U U R R E
+> F A A I L U U R R E
+> F A A I L U U R R E
+> FFFF A A I L U U RRRRRR EEEE
+> F AAAAAAAA I L U U R R E
+> F A A I L U U R R E
+> F A A I L U U R R E
+> F A A III LLLLLLL UUU R R EEEEEEE
+
+FAILURE: "str"
+betwn: Typical Valid Usage; expected "is is", got "this is a pipe"
+betwn: Test Negative Start; expected "ing", got "BRRRING"
+betwn: IS NOT NULL: Start bigger than end
+
+
+
+ Faced with these results, I can zoom in on the code
+ within str.betwn that is causing these incorrect results. I resist the
+ temptation to fix the code for all my tests all at once. Instead, I make
+ one change at a time, then run my test again. I do that over and over again
+ until the failure for the single test case goes away. Then I move to the
+ next one. Eventually, I get a green light and am highly confident of my
+ program - if, of course, I really did come up with an exhaustive list of
+ tests.
+
+
+
+ As I think of another test case, I add a call to
+ utAssert to run that test.
+
+
+
+ As a bug is reported to me, I add a call to utAssert
+ to reproduce that bug. Then I repair my code.
+
+ The utAssert package provides a set of assertion routines ("assert that
+ the following condition is true") that you will use to register the outcome
+ of a test case. You must call a utAssert assertion program after (or containing)
+ a test case so that the results of that test can be recorded and then reported.
+ See Build Test Packages for many examples and
+ more details on this process. Here is a very simple example, though, to give
+ you an idea of the code you would write:
+
+ utAssert offers a wide (and ever expanding) set of assertion programs that
+ allow you to efficiently (a) test the outcome of your unit test and (b) report
+ the results of that test to utPLSQL. You should review
+ Common Assertion Parameters and Behavior before using any specific assertion
+ program. It is also possible to build your own assertion
+ routine. Note: all utAssert assertions are defined in the ut_assertion
+ table, as well as actually coded in the utAssert package.
+
+
+
Common Assertion Parameters and Behavior
+
+
+ Each type of assertion routine accepts different kinds of data, but there
+ are lots of similarities between the assertions, as well. Here is an explanation
+ of the common assertion parameters:
+
+
+
+
+
msg_in
+
+ A message to be displayed if the assertion
+ fails. This is the first argument and is mandatory, because the tests need
+ to be self documenting.
+
+
+
+
check_this_in
+
+ The value to be checked.. If a Boolean expression,
+ this will usually include the invocation of the method being tested, resulting
+ in a single line of code for the entire test case.
+
+
+
+
against_this_in
+
+ For assert_eq, the assertion routine will
+ check the check_this_in value against the against_this_in value. This parameter
+ should be the certifiably correct value.
+
+
+
+
null_ok_in
+
+ TRUE if a NULL value should be interpreted
+ as a successful test, FALSE if NULL indicates failure.
+
+
+
+
raise_exc_in
+
+ TRUE if it is OK for the assertion routine
+ to allow an exception to be propagated out unhandled.
+
+
+
+
+
Generic "Assert This" Assertion Procedure
+
+
+ This most generic assertion program simply says "assert this" and passes
+ a Boolean expression. It is used by all the other assertion routines, which
+ construct a Boolean expression from their specific values and logic.
+
+
+
+ PROCEDURE utAssert.this (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+
+
+ Use utAssert.this when you have a Boolean expression that you want to check,
+ as in:
+
+ You can also use this assertion to register a failure, most usually in
+ an exception section, as in:
+
+
+
+EXCEPTION
+ WHEN OTHERS
+ THEN
+ utAssert.this (
+ SQLERRM,
+ FALSE
+ );
+
+
+
+ Generally, you should avoid utAssert.this and instead use a specialized
+ assertion routine, documented below. Most of the assertions give you the
+ ability check for equality (of scalars, such as strings, or more complex
+ data structures like tables, pipes and files): does the data generated by
+ my code match the expected value(s)?
+
+
+
Check for NULL and NOT NULL Values
+
+
+ You can check to see if a value is NULL or is NOT NULL with the following
+ assertions:
+
+
+
+PROCEDURE utAssert.isnotnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+PROCEDURE utAssert.isnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+PROCEDURE utAssert.isnotnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+PROCEDURE utAssert.isnull (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ Use these assertions when you simply want to check if a scalar expression
+ (string, date, number and Boolean are supported) is NULL or NOT NULL, as
+ in:
+
+ If you need to compare two dates or two strings or two numbers or two Booleans,
+ use the utAssert.eq assertion program.
+
+
+
Here is the header for the scalar equality check assertion:
+
+
+PROCEDURE utAssert.eq (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2|BOOLEAN|DATE|NUMBER,
+ against_this_in IN VARCHAR2|BOOLEAN|DATE|NUMBER,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ If the two values are equal, your code gets a green light. Otherwise, utAssert
+ writes the test results to the utResult package, resulting in a red light
+ for the test. If NULL values are considered value for this test, pass TRUE
+ for null_ok_in. If you want the assertion to raise an exception on failure
+ and stop the test from proceeding, pass TRUE for raise_exc_in. Here is an
+ example of using the utAssert.eq program:
+
+
+
+ PROCEDURE ut_emp_dept_lookuprowcount
+ IS
+ l_rowcount1 PLS_INTEGER;
+ l_rowcount2 PLS_INTEGER;
+ BEGIN
+ -- Run baseline code.
+ SELECT COUNT (*)
+ INTO l_rowcount1
+ FROM employee
+ WHERE department_id = 30;
+
+ -- Compare to program call:
+ l_rowcount2 := te_employee.emp_dept_lookuprowcount (30);
+
+ -- Test results
+ utassert.eq (
+ 'Successful EMP_DEPT_LOOKUPROWCOUNT',
+ l_rowcount2,
+ l_rowcount1
+ );
+ END;
+
+
+
Check Equality of DatabaseTables
+
+
+ If your test performs DML operations (update, insert or delete), you will
+ need to check your results in a database table. You could do this by querying
+ the results into local variables and then calling utAssert.eq to check those
+ values against your expected data. That can be a very laborious process,
+ so utAssert offers the eqtable and equerry assertion routines to streamline
+ the process. Both these procedures use the MINUS SQL operator to essentially
+ "subtract" the contents of one table (query) from the other. If anything
+ is left, then the two tables (queries) are not the same and the test is given
+ a red light. As you can probably see, the structure of the two tables (queries)
+ must be identical for this assertion to work properly. The utAssert.eqtable
+ allows you to compare the contents of your data table (changed by your code)
+ against another table, which you can preset with the data you expect to see
+ after the test. Here is the header for eqtable:
+
+
+
+PROCEDURE utAssert.eqtable (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ where check_this_in and against_this_in are the names of tables or views.
+ You can supply an optional WHERE clause to restrict the rows you wish to
+ compare. Here is an example that calls eqTable twice, to test two different
+ conditions.
+
+
+
+PROCEDURE ut_del1
+IS
+ fdbk PLS_INTEGER;
+BEGIN
+ /* Delete that finds now rows. */
+
+ EXECUTE IMMEDIATE '
+ DELETE FROM ut_DEL1
+ WHERE employee_id = -1
+ ';
+ te_employee.del (-1, rowcount_out => fdbk);
+
+ -- Test results
+ utassert.eqtable ('Delete rows', 'EMPLOYEE', 'ut_DEL1');
+
+ /* Successful delete */
+
+ EXECUTE IMMEDIATE '
+ DELETE FROM ut_DEL1
+ WHERE employee_id between 7800 and 7899
+ ';
+
+ FOR rec IN (SELECT *
+ FROM employee
+ WHERE employee_id BETWEEN 7800 AND 7899)
+ LOOP
+ te_employee.del (
+ rec.employee_id,
+ rowcount_out => fdbk
+ );
+ END LOOP;
+
+ -- Test results
+ utassert.eqtable ('Delete rows', 'EMPLOYEE', 'ut_DEL1');
+ ROLLBACK;
+EXCEPTION
+ WHEN OTHERS
+ THEN
+ utassert.this (
+ 'DEL1 exception ' || SQLERRM,
+ SQLCODE = 0
+ );
+END;
+
+
+
Check Equality of Table Counts
+
+
+ If your tests simply produce the right number of rows in a table but not
+ a fixed set of values, you will not be able to use
+ utAssert.eqtable above. However, utAssert.eqtabcount allows you to simply
+ test that the numbers of rows are equal. The declaration of the procedure
+ is as follows:
+
+
+
+PROCEDURE utAssert.eqtabcount (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ check_where_in IN VARCHAR2 := NULL,
+ against_where_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ where check_this_in and against_this_in are the names of tables or views.
+ As in utAssert.eqtable, you can supply an optional WHERE clause to restrict
+ the rows you wish to compare. The following test will compare the number
+ of rows in the CD_COLLECTION and UT_TEST_5_1 tables where the given condition
+ holds:
+
+ The utAssert.eqquery allows you to compare the data returned by two queries
+ (strings that are contained in the check_this_in and against_this_in parameters).
+ In this case, you specify the full SELECT statements for each query as the
+ parameters. By using equery, you may be able to avoid constructing a separate
+ table with preset data.
+
+
+
+PROCEDURE utAssert.eqquery (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ If you want the assertion to raise an exception on failure and stop the
+ test from proceeding, pass TRUE for raise_exc_in. Here is an example of
+ using eqQuery:
+
+
+
+PROCEDURE ut_upd1
+IS
+BEGIN
+ /* Update 3 columns by ID */
+ EXECUTE IMMEDIATE '
+ UPDATE ut_UPD1 SET
+ FIRST_NAME = ''SILLY'',
+ HIRE_DATE = trunc (SYSDATE+100),
+ COMMISSION = 5000
+ WHERE
+ EMPLOYEE_ID = 7600
+ ';
+ te_employee.upd (
+ 7600,
+ first_name_in => 'SILLY',
+ commission_in => 5000,
+ hire_date_in => TRUNC (SYSDATE + 100),
+ rowcount_out => fdbk
+ );
+ -- Test results (audit fields are different so do a query)
+ utassert.eqquery (
+ 'Update three columns',
+ 'select first_name, commission, hire_date from EMPLOYEE',
+ 'select first_name, commission, hire_date from ut_upd1'
+ );
+ ROLLBACK;
+END;
+
+
+
Check Query Equality against a Single Value
+
+ Often we will wish to test the result of a query against a single value rather
+ than another query as in utAssert.eqquery above.
+ It is possible to get around this problem by using a trivial query of the
+ form:
+
+
+
+SELECT fixed_value
+FROM DUAL;
+
+
+
+ Unfortunately, if the query returns multiple values or the wrong value we
+ will only be told that the test has failed with no details. This is where
+ utAssert.eqqueryvalue comes to the rescue. The procedure is declared as
+ follows:
+
+
+
+PROCEDURE utAssert.eqqueryvalue (
+ msg_in IN VARCHAR2,
+ check_query_in IN VARCHAR2,
+ against_value_in IN VARCHAR2|NUMBER|DATE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ Where check_query_in is the query in question and against_value_in is the
+ value to check it against. If the query returns more than one value, the
+ resulting error message will tell you this. Similarly, if the query returns
+ the wrong value, the message will state the expected and obtained values.
+ The following call compares the maximum value found in a table against a
+ given number value:
+
+
+
+utAssert.eqqueryvalue('Maximum value test',
+ 'SELECT MAX(MEMORY)
+ FROM COMPUTERS
+ WHERE OS IN (''Linux'', ''Unix'')',
+ 256);
+
+
+
+ Obviously this should only return a single value, but if it returns something
+ other than 256, we'll know about it.
+
+
+
Check Equality of Files
+
+
+ Many programs generate output to operating system files; alternatively,
+ you might write data to a file simply to test results. Use the eqfile assertion
+ for either of these scenarios. This procedure uses PL/SQL's UTL_FILE package
+ to compare the contents of two different files. Note: If you have not used
+ UTL_FILE in the past, you must configure
+ it before it can be used -- by utPLSQL or by your own code. UTL_FILE must
+ be allowed accss to either or both of the directories you specify (this involves
+ setting the utl_file_dir database parameter).
+
+
+
+PROCEDURE utAssert.eqfile (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ check_this_dir_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ against_this_dir_in IN VARCHAR2 := NULL,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ If you want the assertion to raise an exception on failure and stop the
+ test from proceeding, pass TRUE for raise_exc_in. You must specify the directory
+ containing the "check this" file; if you do not specify a directory for the
+ "against this" file, the "check this" directory will be used. Here is an
+ example of using eqFile (see ut_DEPARTMENT2file.pkg in the Examples directory
+ for the full implementation):
+
+ Database pipes offer a handy mechanism for passing data between different
+ sessions connected to the RDBMS. It is important to know that pipes are being
+ filled properly; use the eqpipe to check this condition. With the eqpipe
+ procedure, you compare the contents of two different pipes.
+
+
+
+PROCEDURE utAssert.eqpipe (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ against_this_in IN VARCHAR2,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ If you want the assertion to raise an exception on failure and stop the
+ test from proceeding, pass TRUE for raise_exc_in. To check the contents
+ of a pipe based on the execution of code, you will need to populate a pipe
+ against which to test equality. The employee_pipe.pkg file in the Examples
+ directory contains a demonstration of the kind of code you might write to
+ do this. This package contains all of the unit test code within the same
+ package. Here is my unit test program, which relies on the utAssert.eqpipe
+ program:
+
+
+
+PROCEDURE ut_fillpipe IS
+ stat PLS_INTEGER;
+BEGIN
+ emptypipe ('emps');
+ emptypipe ('emps2');
+
+ fillpipe ('emps');
+
+ /* Direct filling of pipe. */
+
+ FOR rec IN (SELECT *
+ FROM employee)
+ LOOP
+ DBMS_PIPE.RESET_BUFFER;
+ DBMS_PIPE.PACK_MESSAGE (rec.EMPLOYEE_ID);
+ DBMS_PIPE.PACK_MESSAGE (rec.LAST_NAME);
+ DBMS_PIPE.PACK_MESSAGE (rec.FIRST_NAME);
+ DBMS_PIPE.PACK_MESSAGE (rec.MIDDLE_INITIAL);
+ DBMS_PIPE.PACK_MESSAGE (rec.JOB_ID);
+ DBMS_PIPE.PACK_MESSAGE (rec.MANAGER_ID);
+ DBMS_PIPE.PACK_MESSAGE (rec.HIRE_DATE);
+ DBMS_PIPE.PACK_MESSAGE (rec.SALARY);
+ DBMS_PIPE.PACK_MESSAGE (rec.COMMISSION);
+ DBMS_PIPE.PACK_MESSAGE (rec.DEPARTMENT_ID);
+ DBMS_PIPE.PACK_MESSAGE (rec.CHANGED_BY);
+ DBMS_PIPE.PACK_MESSAGE (rec.CHANGED_ON);
+
+ stat := DBMS_PIPE.SEND_MESSAGE ('emps2', 0);
+ END LOOP;
+
+ /* Compare the two */
+ utassert.eqpipe (
+ 'Two employee pipes', 'emps', 'emps2');
+
+END ut_fillpipe;
+
+
+
+ Since I have stored my unit test logic with my source code package, I would
+ run my test as follows:
+
+ Collections are as close as you come to arrays in PL/SQL. They are very
+ useful for managing lists of information, but can be difficult to debug and
+ maintain. With the eqcoll and eqcollAPI procedures, you can compare the
+ contents of two different arrays. Use the eqColl procedure when you want
+ to compare two collections that are defined in the specification of a package.
+ Use the eqCollAPI procedure when you want to compare two collections that
+ are defined in the body of a package, with programs defined in the specification
+ (an API) to access and manipulate the collections. The collection equality
+ check headers are:
+
+
+
+ /* Direct access to collections */
+ PROCEDURE utAssert.eqcoll (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2, /* pkg1.coll */
+ against_this_in IN VARCHAR2, /* pkg2.coll */
+ eqfunc_in IN VARCHAR2 := NULL,
+ check_startrow_in IN PLS_INTEGER := NULL,
+ check_endrow_in IN PLS_INTEGER := NULL,
+ against_startrow_in IN PLS_INTEGER := NULL,
+ against_endrow_in IN PLS_INTEGER := NULL,
+ match_rownum_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+ /* API based access to collections */
+ PROCEDURE utAssert.eqcollapi (
+ msg_in IN VARCHAR2,
+ check_this_pkg_in IN VARCHAR2,
+ against_this_pkg_in IN VARCHAR2,
+ eqfunc_in IN VARCHAR2 := NULL,
+ countfunc_in IN VARCHAR2 := 'COUNT',
+ firstrowfunc_in IN VARCHAR2 := 'FIRST',
+ lastrowfunc_in IN VARCHAR2 := 'LAST',
+ nextrowfunc_in IN VARCHAR2 := 'NEXT',
+ getvalfunc_in IN VARCHAR2 := 'NTHVAL',
+ check_startrow_in IN PLS_INTEGER := NULL,
+ check_endrow_in IN PLS_INTEGER := NULL,
+ against_startrow_in IN PLS_INTEGER := NULL,
+ against_endrow_in IN PLS_INTEGER := NULL,
+ match_rownum_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+ );
+
+
+
where the eqcoll-specific parameters are as follows:
+
+
+
+
Parameter
+
Description
+
+
+
msg_in
+
The message to be displayed if the test failes
+
+
+
check_this_in
+
+ The name of the collection to be checked.
+ Format: package.collection. In other words, the collection must be defined
+ in a package specification. Use eqCollAPI (and check_this_pkg_in) if you
+ want to hide the declaration of your collection in your package body (recommended).
+
+
+
+
against_this_in
+
+ The name of the collection to be checked
+ against. Format: package.collection. In other words, the collection must
+ be defined in a package specification. Use eqCollAPI (and check_this_pkg_in)
+ if you want to hide the declaration of your collection in your package body
+ (recommended).
+
+
+
+
+
and the eqcollAPI-specific parameters are as follows:
+
+
+
+
Parameter
+
Description
+
+
+
msg_in
+
The message to be displayed if the test failes
+
+
+
check_this_pkg_in
+
+ The name of the package that contains the
+ collection to be checked.
+
+
+
+
against_this_pkg_in
+
+ The name of the package that contains the
+ collection to be checked against.
+
+
+
+
countfunc_in
+
+ The name of the function in the package that
+ returns the number of rows defined in the collection.
+
+
+
+
firstrowfunc_in
+
+ The name of the function in the package that
+ returns the first defined row in the collection.
+
+
+
+
lastrowfunc_in
+
+ The name of the function in the package that
+ returns the last defined row in the collection.
+
+
+
+
nextrowfunc_in
+
+ The name of the function in the package that
+ returns the next defined row in the collection from the specified row.
+
+
+
+
getvalfunc_in
+
+ The name of the function in the package that
+ returns the contents of the specified row.
+
+
+
+
+
The parameters common to both eqColl and eqCollAPI are as follows
+
+
+
+
Parameter
+
Description
+
+
+
eqfunc_in
+
+ The function used to determine if the contents
+ of each row of the two collections are the same. If you pass NULL for this
+ argument, then a standard equality check will be used. This is fine for scalar
+ values, but will not work, for example, with tables of records.
+
+
+
+
check_startrow_in
+
+ The starting row in the check collection
+ for comparison. If NULL, then first row is used.
+
+
+
+
check_endrow_in
+
+ The ending row in the check collection for
+ comparison. If NULL, then last row is used.
+
+
+
+
against_startrow_in
+
+ The starting row in the against collection
+ for comparison. If NULL, then first row is used.
+
+
+
+
against_endrow_in
+
+ The ending row in the against collection
+ for comparison. If NULL, then last row is used.
+
+
+
+
match_rownum_in
+
+ Pass TRUE if you want to make sure that the
+ same row numbers are used in each collection. If FALSE, then the row numbers
+ can be different, but the contents of each corresponding row must be the same.
+
+
+
+
null_ok_in
+
+ Pass TRUE if the assertion routine should
+ consider two NULL collections to be equal.
+
+
+
+
raise_exc_in
+
+ If you want the assertion to raise an exception
+ on failure and stop the test from proceeding, pass TRUE for raise_exc_in.
+
+
+
+
+
+ Here is an example of a script that uses utAssert.eqColl (taken from filepath1.pkg
+ in the Examples directory):
+
Checking a Procedure or Function throws an exception
+
+
+ Sometimes we design a procedure or function to throw an exception under certain
+ circumstances. This is something we'd like to be able to test for. Obviously
+ this is not particularly easy due to the way exceptions propagate through
+ the call stack. If we simply call the procedure in our test code, the exception
+ will have no chance of being caught within the utAssert package! Therefore,
+ we need to pass the tested call in to the package as a string. The procedure
+ utAssert.throws allows us to do this:
+
+
+
+PROCEDURE throws (
+ msg_in VARCHAR2,
+ check_call_in IN VARCHAR2,
+ against_exc_in IN VARCHAR2|NUMBER
+ );
+
+
+ Where check_call_in is the call to be made, complete with parameters and
+ terminating semicolon. The argument against_exc_in is the exception we expect
+ to be thrown. This can be specified either as a named exception, or a SQLCODE
+ value.
+
+
The following example shows both usages:
+
+
+/* Test the Except Function */
+PROCEDURE ut_except
+IS
+BEGIN
+
+ /* Call the procedure with a negative number */
+ /* We expect a NO_DATA_FOUND exception */
+ utAssert.throws('Negative Number',
+ 'Except(-1);',
+ 'NO_DATA_FOUND'
+ );
+
+ /* Call the procedure with zero and a string */
+ /* over 2 in length - We expect a SQLCODE of -1 */
+ utAssert.throws('Zero and String',
+ 'Except(0, ''Hello'');',
+ -1
+ );
+END;
+
+
+
+ Note how we have to quote the string parameters to the call and terminate
+ the string with a semicolon.
+
+
+
Check if the Previous Assertion Passed or Failed
+
+
+ Sometimes, a procedure may have a large number of effects that need to be
+ tested. For example, it might insert and update data in a series of
+ tables. To test all of these changes, it will be necessary to make
+ a series of calls to utAssert. This can have the effect that if the
+ procedure is not behaving as expected, then the user is presented with a
+ screenful of errors. To avoid this and just present them with a single
+ error, the functions previous_passed and previous_failed can be used.
+ These return a BOOLEAN argument giving the success or failure of the previously
+ called assertion.
+
+
+
The following example gives a demonstration:
+
+
+/* Test the BookTrips Procedure */
+PROCEDURE ut_bookTrips
+IS
+BEGIN
+
+ /* Call the procedure */
+ Vacation.bookTrips(5, 'Rio de Janeiro');
+
+ /* Did it insert 5 rows into TRIPS table */
+ utAssert.eqqueryvalue('Insert 5 rows',
+ 'SELECT COUNT(*)
+ FROM TRIPS
+ WHERE CITY = ''Rio de Janeiro''',
+ 5);
+
+ /* If that worked, look in more detail */
+ IF utAssert.previous_passed THEN
+
+ /* Do they all have today's date? */
+ utAssert.eqqueryvalue('All with todays date',
+ 'SELECT COUNT(*)
+ FROM TRIPS
+ WHERE CITY = ''Rio de Janeiro'''
+ AND TRUNC(CREATED) = TRUNC(SYSDATE)',
+ 5);
+
+ /* Do they all have a hotel specified? */
+ utAssert.eqqueryvalue('Hotel Specfied',
+ 'SELECT COUNT(*)
+ FROM TRIPS T, HOTELS H
+ WHERE T.CITY = ''Rio de Janeiro'''
+ AND T.HOTEL = H.ID',
+ 5);
+
+ END IF;
+
+END;
+
+ To complement the utOutput package, these
+ assertions allow you to easily compare collections of the type
+ DBMS_OUTPUT.CHARARR. Unlike the eqcoll and
+ eqcollapi assertions, this allows the comparison of locally defined
+ collections. The procedures are declared as follows:
+
+
+
+PROCEDURE eqoutput (
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN DBMS_OUTPUT.CHARARR,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+PROCEDURE eqoutput (
+ msg_in IN VARCHAR2,
+ check_this_in IN DBMS_OUTPUT.CHARARR,
+ against_this_in IN VARCHAR2,
+ line_delimiter_in IN CHAR := NULL,
+ ignore_case_in IN BOOLEAN := FALSE,
+ ignore_whitespace_in IN BOOLEAN := FALSE,
+ null_ok_in IN BOOLEAN := TRUE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ The first version simply compares two collections, whereas the second compares a collection against a delimited string. The delimiter
+ can be specified by the line_delimiter_in parameter. If NULL is passed in (which is the default) then the lines are delimited by carriage returns.
+ Thus to test a collection mybuff which should look like:
+
+ The following assertions (created by Raji) check that a named database
+ object exists or does not exist:
+
+
+
+PROCEDURE objExists (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+PROCEDURE objnotExists (
+ msg_in IN VARCHAR2,
+ check_this_in IN VARCHAR2,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE
+);
+
+
+
+ In both cases, the check_this_in parameter gives the name of the object to
+ check for. So passing 'MYTHING' will check if the MYTHING object exists. This
+ is assumed to be in the current schema. To check for objects in a schema other
+ than the current one, simply add the name of the schema, separated by a dot.
+ So passing 'ANOTHER.THATTHING' will check for the existence of the THATTHING
+ object in the ANOTHER schema.
+
+
+
Check Equality of RefCursor and Query
+
+
+ If you have a procedure or function that returns a REF CURSOR type you
+ often would like to compare the data of the REF CURSOR against a query (if
+ your REF CURSOR returns a complete table you can use
+ utAssert.eq_refc_table below). In this case,
+ you specify the REF CURSOR of the procedure or function and the full
+ SELECT statement as parameters. By using eq_refc_query, you may be able to
+ avoid the huge workload of constructing separate tables with preset data.
+
+
+
+ Before calling the comparison you have to specifiy the parameters of the procedure or function you are going to use.
+ This is done with the procedures utPLSQL_Util.reg_In_Param, utPLSQL_Util.reg_InOut_Param or utPLSQL_Util.reg_Out_Param.
+ The details of the parameters are built up in a variable of type utplsql_util.utplsql_params, which is then passed into eq_refc_query.
+
+
+
+PROCEDURE utPLSQL_Util.reg_In_Param (
+ par_pos PLS_INTEGER,
+ par_val VARCHAR2 | NUMBER | DATE,
+ params IN OUT utplsql_util.utplsql_params );
+
+PROCEDURE utPLSQL_Util.reg_InOut_Param (
+ par_pos PLS_INTEGER,
+ par_val VARCHAR2 | NUMBER | DATE,
+ params IN OUT utplsql_util.utplsql_params );
+
+PROCEDURE utPLSQL_Util.reg_Out_Param (
+ par_pos PLS_INTEGER,
+ par_type VARCHAR2,
+ params IN OUT utplsql_util.utplsql_params );
+
+
+
+ Having specified all the parameters for the procedure or function
+ returning the REF CURSOR, the comparison can be started.
+
+
+
+PROCEDURE utAssert.eq_refc_query (
+ p_msg_nm IN VARCHAR2,
+ proc_name IN VARCHAR2,
+ params IN utplsql_util.utplsql_params,
+ cursor_position IN PLS_INTEGER,
+ qry IN VARCHAR2 );
+
+
+
where the reg_In_Param, reg_InOut_Param and reg_Out_Param-specific parameters are as follows:
+
+
+
+
Parameter
+
Description
+
+
+
par_pos
+
Defines the parameter position beginning with 1, or 0 specifying the return value
+
+
+
par_type
+
Specifies the data type of the return value and must be one out of 'NUMBER', 'VARCHAR', 'CHAR' or 'REFCURSOR'
+
+
+
params
+
The local variable to keep the values that is used as a parameter for eq_refc_query
+
+
+
+
and the eq_refc_query-specific parameters are as follows:
+
+
+
+
Parameter
+
Description
+
+
+
p_msg_nm
+
The message to be displayed if the test fails
+
+
+
proc_name
+
Specifies the procedure or function that delivers the REF CURSOR
+
+
+
params
+
The parameter setting for the procedure or function
+
+
+
cursor_position
+
Position of the REF CURSOR parameter to be checked, beginning with 1, or 0 to specify the return value of a function
+
+
+
qry
+
The SELECT statement to be checked against
+
+
+
+
Finally, note that only the record itself is compared. These assertions do not care about how the records within the cursor are numbered.
+
+
+
Check Equality of RefCursor and Database Table
+
+
+ If you have a procedure or function that returns a REF CURSOR type that represents a complete table or view you
+ often would like to compare the data of this REF CURSOR against the table or view
+ (if your REF CURSOR doesn't return a complete table or view you can use utAssert.eq_refc_query above).
+ In this case, you specify the REF CURSOR of the procedure or function and the table or view name as parameters.
+ By using eq_refc_table, you may be able to avoid the huge workload of constructing separate tables with preset data.
+
+
+
+ Before calling the comparison you have to specifiy the parameters of the procedure or function you are going to use.
+ This is done with the procedures utPLSQL_Util.reg_In_Param, utPLSQL_Util.reg_InOut_Param or utPLSQL_Util.reg_Out_Param.
+ The details of the parameters are built up in a variable of type utplsql_util.utplsql_params, which is then passed into eq_refc_query.
+
+
+
+PROCEDURE utPLSQL_Util.reg_In_Param (
+ par_pos PLS_INTEGER,
+ par_val VARCHAR2 | NUMBER | DATE,
+ params IN OUT utplsql_util.utplsql_params );
+
+PROCEDURE utPLSQL_Util.reg_InOut_Param (
+ par_pos PLS_INTEGER,
+ par_val VARCHAR2 | NUMBER | DATE,
+ params IN OUT utplsql_util.utplsql_params );
+
+PROCEDURE utPLSQL_Util.reg_Out_Param (
+ par_pos PLS_INTEGER,
+ par_type VARCHAR2,
+ params IN OUT utplsql_util.utplsql_params );
+
+
+
Having specified all the parameters for the procedure or function returning the REF CURSOR, the comparison can be started.
+
+
+PROCEDURE utAssert.eq_refc_table (
+ p_msg_nm IN VARCHAR2,
+ proc_name IN VARCHAR2,
+ params IN utplsql_util.utplsql_params,
+ cursor_position IN PLS_INTEGER,
+ table_name IN VARCHAR2 );
+
+
+
where the reg_In_Param, reg_InOut_Param and reg_Out_Param-specific parameters are as follows:
+
+
+
+
Parameter
+
Description
+
+
+
par_pos
+
Defines the parameter position beginning with 1, or 0 specifying the return value
+
+
+
par_type
+
Specifies the data type of the return value and must be one out of 'NUMBER', 'VARCHAR', 'CHAR' or 'REFCURSOR'
+
+
+
params
+
The local variable to keep the values that is used as a parameter for eq_refc_query
+
+
+
+
and the eq_refc_query-specific parameters are as follows:
+
+
+
+
Parameter
+
Description
+
+
+
p_msg_nm
+
The message to be displayed if the test fails
+
+
+
proc_name
+
Specifies the procedure or function that delivers the REF CURSOR
+
+
+
params
+
The parameter setting for the procedure or function
+
+
+
cursor_position
+
Position of the REF CURSOR parameter to be checked, beginning with 1, or 0 to specify the return value of a function
+
+
+
table_name
+
The name of the table name or view to be checked against
+
+
+
+
Finally, note that only the record itself is compared. These assertions do not care about how the records within the cursor are numbered.
+
+
Building Your Own Assertion
+
+
+ You may want to build assertion routines that fit your specific needs.
+ If PL/SQL supported inheritance, you could extend the utAssert assertion
+ routines and then customize them through polymorphism. Lacking this feature,
+ however, you will write your own procedures that follow the same steps as
+ the pre-build assertions. In order to integrate the results of your assertion
+ test into the utResult package, you will want to mimic the utAssert.this procedure.
+ Here is its current implementation (Release 1.3.2); check the body of the
+ utAssert package for any changes.
+
+
+
+PROCEDURE this (
+ msg_in IN VARCHAR2,
+ check_this_in IN BOOLEAN,
+ null_ok_in IN BOOLEAN := FALSE,
+ raise_exc_in IN BOOLEAN := FALSE,
+ register_in IN BOOLEAN := TRUE
+ )
+IS
+BEGIN
+ IF NOT check_this_in
+ OR ( check_this_in IS NULL
+ AND NOT null_ok_in)
+ THEN
+ IF register_in
+ THEN
+ -- Registers the results in the utResult databank.
+ utresult.report (msg_in);
+ ELSE
+ utreport.pl (msg_in); -- used to be utplsql.pl (msg_in) (PBA 20050621)
+ END IF;
+
+ IF showing_results AND register_in
+ THEN
+ -- Show the results of the test more recently run.
+ utresult.showlast;
+ END IF;
+
+ IF raise_exc_in
+ THEN
+ RAISE test_failure;
+ END IF;
+ END IF;
+END;
+
+
+
+ The most important statement to include in your assertion routine is the
+ call to utResult.report, which will log the results of the test.
+
+ To make it as easy as possible for you to run your tests, utPLSQL stores
+ various pieces of configuration data in the ut_config table. This data
+ is stored by schema name and is automatically loaded into utPLSQL the first
+ time you use this utility in your session. This configuration information
+ is also automatically updated whenever you call utPLSQL.test -- or any
+ of the utPLSQL programs specifically designed to change the configuration
+ settings.
+
+
+
+ You can at any time view the utPLSQL configuration for the currently-connected
+ schema or for another schema (there is not at this point any schema-level
+ security; all utPLSQL users can view the configurations of all other users).
+
+
+
The data that is currently maintained for a utPLSQL user are:
+
+
+ Test package directory - the location of the test package code
+ you want to run. You must specify a directory in order to allow utPLSQL
+ to automatically compile your test packages before each test run.
+
+
+
+ Unit test prefix - the prefix used for test package names and
+ the program names within the package. If you do not specify a prefix, the
+ default of "ut_" is automatically applied.
+
+
+
+ Unit test registration mode - This setting determines whether
+ utPLSQL will automatically identify the unit tests to be run (strongly
+ recommended) or if you have chosen to manually register your unit tests
+ in the test package setup procedure.
+
+
+
+ Auto-compilation of test packages - By default, utPLSQL will
+ recompile your test package before execution. You can turn off this feature
+ and manually recompile only when you desire (a fine idea if your test package
+ has gotten very large!).
+
+
+
Return whose configuration is being used
+
+
+ By default, the configuration stored for the currently-connected user will
+ be used. However, it is possible to use configurations stored against
+ other usernames. To show whose configuration is currently being used
+ the following function is used:
+
+
+
+FUNCTION utConfig.tester RETURN VARCHAR2;
+
+
+
Set whose configuration is being used
+
+
+ This returns the configuration that will be used whenever a username is
+ not specified. To set this, the following procedure is used:
+
+
+
+PROCEDURE utConfig.settester (username_in IN VARCHAR2 := USER);
+
+
+
View a schema's configuration
+
+
+ Call the utconfig.showconfig procedure to view the configuration for a specified
+ schema. The header is:
+
+
+
+PROCEDURE utConfig.showconfig (username_in IN VARCHAR2 := NULL);
+
+
+
+ If you do not specify a schema, then the currently
+ used configuration is returned. Here is an example of output from this
+ procedure:
+
+
+
+SQL> exec utconfig.showconfig
+=============================================================
+utPLSQL Configuration for SCOTT
+ Directory: /apps/utplsql/code
+ Autcompile? Y
+ Manual test registration? N
+ Prefix = test_
+=============================================================
+
+
+
And here is an example of calling showConfig for a different schema:
+
+
+SQL> exec utconfig.showconfig ('COMP')
+=============================================================
+utPLSQL Configuration for COMP
+ Directory: M:\shared_apps\utplsql\comp
+ Autcompile? N
+ Manual test registration? N
+ Prefix = ut_
+=============================================================
+
+
+
+ You might want to put a call to showConfig in your SQL*Plus login file
+ so that you are reminded on startup as to what the current settings are.
+ Here is such a script (to be found in Examples\login_sample.sql):
+
+
+
+exec utconfig.setdir ('e:\openoracle\utplsql\utinstall\examples')
+SET SERVEROUTPUT ON SIZE 1000000 FORMAT WRAPPED
+exec utconfig.showconfig
+
+
+
Set the directory containing the test package code
+
+
+ If you want utPLSQL to compile your test package, you must tell it the
+ directory in which your code is found. You can do this either when you
+ define your test suite and packages within the suite, or you can call the
+ utConfig.setdir procedure to set the directory for your current session.
+
+
+
+ Note: as of v1.5.1, the value you pass in any of these programs is saved
+ in the configuration table and will be used in the future -- until you
+ change it by passing a different value.
+
+
+
The header for this procedure is:
+
+
+PROCEDURE utConfig.setdir (dir_in IN VARCHAR2, username_in IN VARCHAR2 := NULL);
+
+
+
+ where dir_in is the directory and username_in is the name of the schema
+ to which this directory applies (NULL means the currently
+ used configuration is set), as in:
+
+
+
+SQL> exec utconfig.setdir ('e:\demo\utplsql');
+
+
+
or, with the specification of a non-current schema:
Note that this directory must be accessible through UTL_FILE.
+
+
+ You might consider putting the the call to utConfig.setdir into your
+ login.sql so that it is run automatically, each time your start up SQL*Plus
+ -- if you are always working from the same directory.
+
+
+
Return the directory containing the test package code
+
+
You can obtain the current directory with a call to utConfig.dir:
+ The unit test prefix is very important in utPLSQL; the utility uses the
+ prefix to associate source code to be tested with the test package. The
+ prefix also allows utPLSQL to automatically identify the programs within
+ a test package that are to be executed as unit tests.
+
+
+
+ The default prefix in utPLSQL is "ut_", but you can override this when
+ you call utPLSQL.test or by calling the utConfig.setprefix procedure:
+
+
+
+PROCEDURE utConfig.setPrefix (
+ prefix_in IN VARCHAR2, username_in IN VARCHAR2 := NULL)
+
+
+
+ where prefix_in is the prefix and username_in is the name of the schema
+ to which this prefix applies (NULL means the currently
+ used configuration is set), as in:
+
+
+
+SQL> exec utconfig.setPrefix ('tst#');
+
+
+
or, with the specification of a non-current schema:
+ uPLSQL currently does not support the use of a suffix, or combination of
+ suffix and prefix, to identify test packages and unit test procedures.
+
+
+
Set the registration mode (manual or automatic).
+
+
+ As of utPLSQL v1.5.1, you no longer have to register your unit test procedures
+ in the setup procedure of your test package. Instead, utPLSQL will scan
+ the data dictionary (via theALL_ARGUMENTS view) for the names of all the
+ unit test procedures you have defined, and then run them. utPLSQL identifies
+ these programs by looking for all programs whose names start with the specified
+ prefix.
+
+
+
+ If you so choose, you can request that utPLSQL turn off automatic detection
+ of unit test procedures and only run those programs listed in the setup
+ procedure. To do this, you call the utConfig.registerTest procedure:
+
+
+
+PROCEDURE utConfig.registerTest (
+ onoff_in IN BOOLEAN,
+ username_in IN VARCHAR2 := NULL
+ );
+
+
+
as in:
+
+
+SQL> exec utConfig.registerTest (TRUE)
+
+
+
+ Note: if you are using automatic unit test detection, any calls to utPLSQL.addtest
+ in the setup procedure will be ignored.
+
+
+
You can return the current registration mode using the following function:
This returns TRUE if the registration mode has been set to manual and FALSE otherwise.
+
+
Set autocompile feature
+
+
+ The default settings for utPLSQL is to re-compile
+ your base package before each unit test. This guarantees that any recent
+ changes will be tested. It also saves you the step of doing an explicit
+ compile.
+
+
+
In order to perform automatic compilation:
+
+
+
+ Your schema will need to
+ have either CREATE PROCEDURE or CREATE ANY PROCEDURE privileges granted
+ directly;
+ you cannot grant these privileges through roles.
+
+
+
+ You will need to set or
+ pass the location of the source code. You can do this by calling utConfig.setdir
+ or by including the directory location in your call to utPLSQL.test
+ or utPLSQL.testsuite (the dir_in
+ parameter).
+
+
+
+ The package specification
+ must be contained in a file named <package>.pks; the body must be stored
+ in <package>.pkb.
+
+
+
+ You must have configured
+ the
+ UTL_FILE built-in package for use
+ on your database instance.
+
+
+
+
+ In general (and the default), you should allow your
+ test package to be recompiled with each execution. You might want to avoid
+ recompilation if:
+
+
+
+
+ You have made a copy of the package body with some
+ temporary changes and already compiled that. If you recompile automatically,
+ you will wipe out those changes.
+
+
+ You have not set up UTL_FILE
+ and you don't want to deal with it.
+
+
+ You are running the tests
+ on a server to which you have no access other than via a database connection.
+
+
+
+
Turning off Auto-compile
+
+
+ If you are working with products like SQL*Navigator,
+ you may be always editing from code stored in the database. In this case,
+ you will never want to have utPLSQL recompile your code for you - it will
+ already be compiled and you do not need to hassle with UTL_FILE.
+
+
+
You can avoid auto-recompilation in two ways:
+
+
+ 1. Pass a value of FALSE for the recompile_in argument
+ to utPLSQL.test or utPLSQL.testsuite. Here is an example:
+
+
+
+BEGIN
+ -- Define a test suite for PL/Vision
+ utsuite.add ('PLVision');
+
+ -- Add two packages for testing
+ utsuite.addpkg (
+ 'PLVision', 'PLVstr', dir_in => 'e:\utplsql');
+ utsuite.addpkg (
+ 'PLVision', 'PLVdate', dir_in => 'e:\utplsql');
+
+ -- Run the test suite
+ utplsql.testsuite (
+ 'PLVision', recompile_in => FALSE);
+END;
+/
+
+
+ If you know that you will never want to recompilation,
+ however, you can set the default behavior at the schema level by calling
+ the autocompile procedure
+
+
+
+ PROCEDURE utConfig.autocompile (
+ onoff_in IN BOOLEAN,
+ username_in IN VARCHAR2 := NULL
+ );
+
+
+
+ So I can make the following
+ call to turn off autocompilation for the SCOTT schema:
+
+ This program updates the ut_config table with your information and then
+ commits the setting.
+
+
+
+ You can determine the current
+ setting for auto-compilation at any time by calling the following function:
+
+
+
+ FUNCTION utConfig.autocompiling (username_in IN VARCHAR2 := NULL)
+ RETURN BOOLEAN;
+
+
+
+ Note: When you set the schema-level recompilation
+ value to FALSE, that will override anything you pass in a call to utPLSQL.test
+ or utPLSQL.testsuite.
+
+
+
V2 Delimiter
+
+
You can set the delimiter to be used in V2 procedure names using the following procedure:
+
+
+PROCEDURE setdelimiter (
+ delimiter_in IN VARCHAR2,
+ username_in IN VARCHAR2 := NULL
+);
+
+
+
while the current delimiter can be obtained by the function:
+ By default, the results of all the tests are shown. This includes both successful and unsuccessful
+ results. The following procedure allows you to limit the tests shown to only those that have failed:
+
+
+
+PROCEDURE showfailuresonly (
+ onoff_in IN BOOLEAN,
+ username_in IN VARCHAR2 := NULL
+ );
+
+
+
the current setting can be obtained by the function:
+ By default, all results are sent to the screen via DBMS_OUTPUT. However, it is possible to use other output reporters as described in more detail
+ on this page. The following procedure allows you to set which output reporter should be used by default:
+
+
+
+PROCEDURE setreporter (
+ reporter_in IN VARCHAR2
+ ,username_in IN VARCHAR2 := NULL
+ );
+
+
+
as usual, the current setting can be obtain by the following function:
+ The utGen contains a procedure that allows you to generate a starting point
+ for a unit test package. This package can be sent to the screen,
+ a file, a delimited string or
+ an array (best for interfacing with a front end).
+ You can generate a stand-alone test package or code "fragments" to be placed
+ inside an existing source package.
+
+
+
+ We strongly recommend that you use utGen.testpkg
+ as a starting point for all of your utPLSQL unit test construction. By
+ taking this approach, you will most easily (and transparently) conform
+ to the most up to date guidelines for utPLSQL test packages.
+
+
+
+ Note: While utGen.testpkg goes as far as
+ possible to generate sensible unit test code, you will need to edit this
+ code before you can compile and use it.
+
+
+
Here is the header of the testpkg procedure:
+
+
+ PROCEDURE utGen.testpkg (
+ package_in IN VARCHAR2,
+ program_in IN VARCHAR2 := '%',
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ schema_in IN VARCHAR2 := NULL,
+ output_type_in IN PLS_INTEGER := c_screen,
+ dir_in IN VARCHAR2 := NULL,
+ delim_in IN VARCHAR2 := c_delim
+ );
+
+
+
And here is a description of the parameters:
+
+
+
+
Parameter Name
+
Usage
+
+
+
package_in
+
+ The name of the package or stand-alone program for
+ which a test package is to be generated.
+
+
+
+
program_in
+
+ The filter to be applied to the list of programs
+ for which unit test procedures will be generated. So if you only wanted
+ to generate unit tests for programs that start with "UPD", you would pass
+ 'UPD%' for this argument.
+
+
+
+
samepackage_in
+
+ TRUE if you plan to insert the generated code into
+ the source package, FALSE if you want a stand-alone test package.
+
+
+
+
prefix_in
+
+ The prefix to be used for the test package and/or
+ unit test procedures. See section " Organizing Your Test Code" for details.
+
+
+
+
schema_in
+
+ The schema that owns the package or program specified
+ by package_in. The default is the currently connected schema.
+
+
+
+
output_type_in
+
+ The type of output that will receive the generated
+ code. Valid options are defined as packaged constants:
+
+
utGen.c_file
+
utGen.c_screen
+
utGen.c_string
+
utGen.c_array
+
+ The following sections explain the way you would
+ work with these constants and the resulting generated code.
+
+
+
+
dir_in
+
+ The location of the file containing the generated
+ code. Used only if you specify utGen.c_file for the output type.
+
+
+
+
delim_in
+
+ The delimiter used to separate lines of generated
+ code. Used only if you specify utGen.c_string for the output type.
+
+
+
+
+
+ Before you use utGen.testpkg, you should make a few
+ decisions about your generated code:
+
+
+
+
+ Do you want the generated test code to be a stand-alone package or to be
+ inserted into an existing package? The default is stand-alone. Pass TRUE
+ for samepackage_in if you want to generate code that can be easily cut
+ and pasted into your source package. Note that utGen.testpkg does not
+ actually modify your source package.
+
+
+
+ Do you want to generate a unit test program
+ for every procedure and function in your package? If so, then go with the
+ default for program_in. If, on the other hand, your package has one hundred
+ programs and you only want to test, say, only those programs that perform
+ updates, you might want to pass a non-trivial filter, such as "UPD%".
+
+
+
+ Where do you want to send your output? You
+ can display to the screen, which can then be grabbed and put into a file
+ (or in SQL*Plus spool it directly to a file). You can send the code to
+ a file. You can deposit the code in a delimited string and then parse it
+ within your own environment. Finally -- and of most relevance if you are
+ building a GUI interface to utPLSQL -- you can generate to an internal
+ array and then retrieve individual rows of the arrays through the utGen
+ API.
+
+
+
+
Here are some examples of using utGen.testpkg:
+
+
+
+ Generate to the screen a stand-alone test package for the STR package:
+
+
+
+
+
+
+SQL> exec utGen.testpkg ('str')
+
+
+
+
+
+
+ Generate to the screen unit test code to be embedded inside the STR package:
+
+ Now let's explore how to direct the generated code
+ to different types of output.
+
+
+
Generating to Screen
+
+
+ The default behavior of utGen.testpkg is to generate
+ code to your screen (via DBMS_OUTPUT.PUT_LINE). So unless you specify some
+ other value for output_type_in, the code will be displayed on your screen
+ or within a window of your PL/SQL IDE (such as TOAD or SQL*Programmer and
+ so on). You can then transfer that content to a file, or move it to another
+ window for immediate editing and compilation.
+
+
+ Here is an example of using utGen.testpkg, while
+ also spooling to a file:
+
+
+
+SQL> set serveroutput on size 1000000
+SQL> spool str.pkg
+SQL> exec utgen.testpkg ('str')
+
+
+
...out comes the code...
+
+
+SQL> spool off
+
+
+
+ If DBMS_OUTPUT is not enabled in your session, then
+ utGen.testpkg will not generate any output.
+
+
+
Generating to File
+
+
+ If you are working with utGen in a command line
+ style (ie, you are not using a utGen-enabled GUI), then you will probably
+ find it most useful to generate testing code directly to file. You do this
+ by specifying utGen.c_file for the output type. You must also specify the
+ directory in which you want the files (one for the package specification
+ and another for the body)created.
+
+
+
+ Here's a generation request that creates two files
+ named ut_str.pks and ut_str.pkb in the /newcode directory:
+
+ You do not have to specify a directory if you have previously (in your
+ current session) called utConfig.setdir to set the default directory for
+ all file-related utPLSQL operations. The following two lines of code are,
+ in other words, equivalent to the single line shown above:
+
+ You set up the UTL_FILE package (add at least one utl_file_dir entry in
+ your database parameter initialization file) and make sure your directory
+ is accessible through UTL_FILE, before this operation can succeed.
+
+
+
+
Generating to String
+
+
+ If you are accessing utPLSQL functionality through
+ a GUI, you might find it more useful to direct output to a string (or array,
+ see next section). You probably don't want to hassle with UTL_FILE (server-based
+ file IO) and grabbing information from DBMS_OUTPUT.PUT_LINE is just a general
+ hassle.
+
+
+
+ If you generate to a string, you can then retrieve
+ that string value into a local variable and then parse it for display and
+ manipulation. Here is an example of redirection to string:
+
+ The generated code is composed of multiple lines
+ of information, so they need to be separated by a delimiter. The default
+ delimiter is the vertical bar, '|'. You can override that and provide your
+ own delimiter. In the following example, I have decided to use the carriage
+ return character as my delimiter:
+
+ Great, so the code has been put in a string. How
+ do you get all that generated code? Call the utGen.pkgstring function:
+
+
+
+FUNCTION utGen.pkgString RETURN VARCHAR2;
+
+
+
Generating to Array
+
+
+ If you are accessing utPLSQL functionality through
+ a GUI, you might find it more useful to direct output to an array. You
+ probably don't want to hassle with UTL_FILE (server-based file IO) and
+ grabbing information from DBMS_OUTPUT.PUT_LINE is just a general hassle.
+
+
+
+ If you generate to an array, you can then retrieve
+ the individual lines of code in the array through an API provided by utGen
+ (the array itself is "hidden"). Here is an example of redirection to the
+ utGen array:
+
+ Great, so the code has been put in an array. How
+ do you get all that generated code? Take advantage of the utGen
+ API to retrieve individual rows in the array, which offers these features:
+
+
+
Get the number of rows currently in the array:
+
+
+ FUNCTION utGen.countRows RETURN PLS_INTEGER;
+
+
+
Get the absolute index of the first row in the array:
+
+
+ FUNCTION utGen.firstRow RETURN PLS_INTEGER;
+
+
+
Get the absolute index of the last row in the array:
+
+
+ FUNCTION utGen.lastRow RETURN PLS_INTEGER;
+
+
+
+ The API offers a set of programs to iterate through
+ the array, by maintaining a "current row" inside the package. You can:
+
+
+
+ Find out if you are positioned at the first row
+ in the set:
+
+
+
+ FUNCTION utGen.atFirstRow RETURN BOOLEAN;
+
+
+
+ Find out if you are positioned at the last row in
+ the set:
+
+
+
+ FUNCTION utGen.atLastRow RETURN BOOLEAN;
+
+
+
+ Find the first relative row containing the start
+ of the package body definition. This is handy when you want to put the
+ code for the specification and body in separate windows and/or files:
+
+
+
+ FUNCTION utGen.firstBodyRow RETURN PLS_INTEGER;
+
+
+
+ Retrieve the text in the Nth row of the array. This
+ gives you "random access" to the contents of the array. You can even specify
+ a negative direction to get the Nth row from the end of the array.
+
+
+
+ FUNCTION utGen.nthRow (nth IN PLS_INTEGER, direction utGen.IN SIGNTYPE := 1) RETURN codeline_t;
+
+
+
+ Set the pointer in the array to the specified row
+ number. This allows you then move either forward or backward from that
+ row in the array (using nextRow and prevRow, respectively):
+
+
+
+ PROCEDURE utGen.setRow (nth IN PLS_INTEGER);
+
+
+
+ Retrieve the line of code stored in the current
+ row in the array (set via setRow, nextRow or prevRow):
+
+
+
+ FUNCTION utGen.getRow RETURN codeline_t;
+
+
+
Go to the next row in the array:
+
+
+ PROCEDURE utGen.nextRow;
+
+
+
Go to the previous row in the array:
+
+
+ PROCEDURE utGen.prevRow;
+
+
+
Show the contents of the array using DBMS_OUTPUT.PUT_LINE:
+
+
+ PROCEDURE utGen.showRows (
+ startRow IN PLS_INTEGER := NULL,
+ endRow IN PLS_INTEGER := NULL);
+
+
+
+ Here is the code I would write in PL/SQL using this
+ API to display the contents of the array (actually, it is the implementation
+ of showRows):
+
+
+
+ PROCEDURE showrows (
+ startrow IN PLS_INTEGER := NULL,
+ endrow IN PLS_INTEGER := NULL
+ )
+ IS
+ v_start PLS_INTEGER
+ := NVL (startrow, 1);
+ v_end PLS_INTEGER
+ := NVL (endrow, utGen.countRows);
+ BEGIN
+ FOR indx IN 1 .. utGen.countRows
+ LOOP
+ DBMS_OUTPUT.put_line (utGen.getRow (indx));
+ END LOOP;
+ END;
+
+
+
+ Here is the code I would write to separate out the
+ contents of the specification from the body:
+
+
+
+ PROCEDURE showrows (
+ startrow IN PLS_INTEGER := NULL,
+ endrow IN PLS_INTEGER := NULL
+ )
+ IS
+ v_start PLS_INTEGER
+ := NVL (startrow, 1);
+ v_end PLS_INTEGER
+ := NVL (endrow, utGen.countRows);
+ BEGIN
+ FOR indx IN 1 .. utGen.countRows
+ LOOP
+ IF indx = utGen.firstBodyRow
+ THEN
+ -- switch to Body window or file
+ END IF;
+ write_to_target (utGen.getRow (indx));
+ END LOOP;
+ END;
+
+
+
+
Generating Test Packages with Test Cases
+
+
+ The procedures to generate test packages with test cases are similar to
+ testpkg above, but with a number of extra parameters:
+
+
+
+ PROCEDURE testpkg (
+ package_in IN VARCHAR2,
+ grid_in IN grid_tt,
+ program_in IN VARCHAR2 := '%',
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ schema_in IN VARCHAR2 := NULL,
+ output_type_in IN PLS_INTEGER := c_screen,
+ dir_in IN VARCHAR2 := NULL,
+ delim_in IN VARCHAR2 := c_delim,
+ date_format_in IN VARCHAR2 := 'MM/DD/YYYY',
+ only_if_in_grid_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE testpkg_from_file (
+ package_in IN VARCHAR2,
+ gridfile_loc_in IN VARCHAR2,
+ gridfile_in IN VARCHAR2,
+ program_in IN VARCHAR2 := '%',
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ schema_in IN VARCHAR2 := NULL,
+ output_type_in IN PLS_INTEGER := c_screen,
+ dir_in IN VARCHAR2 := NULL,
+ field_delim_in IN VARCHAR2 := '|',
+ arg_delim_in IN VARCHAR2 := c_delim,
+ date_format_in IN VARCHAR2 := 'MM/DD/YYYY',
+ only_if_in_grid_in IN BOOLEAN := FALSE
+ );
+
+ PROCEDURE testpkg_from_string (
+ package_in IN VARCHAR2,
+ grid_in IN VARCHAR2,
+ program_in IN VARCHAR2 := '%',
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ schema_in IN VARCHAR2 := NULL,
+ output_type_in IN PLS_INTEGER := c_screen,
+ dir_in IN VARCHAR2 := NULL,
+ line_delim_in IN VARCHAR := CHR (10),
+ field_delim_in IN VARCHAR2 := '|',
+ arg_delim_in IN VARCHAR2 := c_delim,
+ date_format_in IN VARCHAR2 := 'MM/DD/YYYY',
+ only_if_in_grid_in IN BOOLEAN := FALSE
+ );
+
+
+
+ In each case, the idea is the same. We have to provide not only the
+ arguments supplied to the basic version of testpkg, but also details of each of
+ the test cases in a grid. In the first case, this is as a PL/SQL table, in the
+ second this is as a file and in the final case, this is as a string.
+
+
+
The PL/SQL table passed to testpkg is defined as follows:
+
+
+TYPE grid_rt IS RECORD (
+ progname VARCHAR2 (100),
+ overload PLS_INTEGER,
+ tcname VARCHAR2 (100),
+ message VARCHAR2 (2000),
+ arglist VARCHAR2 (2000),
+ return_value VARCHAR2 (2000),
+ assertion_type VARCHAR2 (100));
+
+ TYPE grid_tt IS TABLE OF grid_rt
+ INDEX BY BINARY_INTEGER;
+
+
+
Where the definitions of the fields are as follows:
+
+
+
progname - This is the name of the subprogram to be tested.
+
+ overload - This is the version of the subprogram where
+ overladed versions exist. (You may have to look in the data dictionary to
+ work this out).
+
+
tcname - The name of the test case.
+
message - The message to be used in the assertion code.
+
arglist - The list of arguments to be passed to the subprogram.
+
return_value - The return value to be checked against.
+
+ assertion_type - The type of assertion to be used.
+ Currently this is ignored unless it contains 'EQ' or 'ISNULL'
+
+
+
+
+ In testpkg_from_file and testpkg_from_string, exactly the same fields need
+ to be passed (and in the same order). These fields are separated by the
+ character given by the field_delim_in parameter which defaults to '|', the pipe
+ symbol. In the case of testpkg_from_string, we can also specify the line
+ delimiter in the line_delim_in parameter, which defaults to an ASCII linefeed
+ character.
+
+
+
+ In all cases, the arguments specified in the arglist field are separated
+ by yet another delimiter, which is passed in the arg_delim_in parameter (
+ or just delim_in in the case of testpkg). This defaults to a semicolon.
+
+
+
+ The remaining arguments passed to these routines are date_format_in and
+ only_if_in_grid_in. The former gives the date format used in dates passed
+ through the arglist and return_values fields. The latter specifies if
+ tests should only be generated for subprograms listed in the grid or not.
+
+
+
An Example
+
+
All of this is probably best explained with an example. Suppose I have a package defined as:
+
+
+CREATE OR REPLACE PACKAGE lottery AS
+ FUNCTION Draw (seed_in NUMBER := NULL, when_in DATE := NULL) RETURN VARCHAR2;
+END;
+
+
+
+ This returns a string describing a lottery draw, given a seed and a date. I
+ want to test the following conditions: (It doesn't make much sense, but hey,
+ it's only an example)
+
+
+
+
Passing both parameters as NULL, we should get back '01 02 03 04 05 06'.
+
Passing in 7 for the seed and 1 January 2001 for the date, we should get back '23 24 27 37 39 48'.
+
Passing in 0 for the seed and today's date, we should get back NULL
+
+
+
So to generate the skeleton I require I could run the following through SQL*Plus:
+set serveroutput on size 1000000
+begin
+ utgen.testpkg_from_string (
+ package_in => 'LOTTERY',
+ grid_in =>
+'Draw||Test Case 1|The First Test||01 02 03 04 05 06|EQ
+Draw||Test Case 2|The Second Test|7;2001-01-01|23 24 27 37 39 48|EQ
+Draw||Test Case 3|The Third Test|0;!SYSDATE||ISNULL',
+ date_format_in => 'YYYY-MM-DD'
+ );
+end;
+/
+
+
+
which generate the following for the body of ut_draw (tidied up a little for compactness):
+
+
+PROCEDURE ut_DRAW
+IS
+ -- Verify and complete data types.
+ against_this VARCHAR2(2000);
+ check_this VARCHAR2(2000);
+BEGIN
+
+ -- Define "control" operation for "Test Case 1"
+ against_this := '01 02 03 04 05 06';
+
+ -- Execute test code for "Test Case 1"
+ check_this :=
+ LOTTERY.DRAW (SEED_IN => '', WHEN_IN => '');
+
+ -- Assert success for "Test Case 1"
+ -- Compare the two values.
+ utAssert.eq ( 'The First Test', check_this, against_this);
+
+ -- End of test for "Test Case 1"
+
+ -- Define "control" operation for "Test Case 2"
+ against_this := '23 24 27 37 39 48';
+
+ -- Execute test code for "Test Case 2"
+ check_this := LOTTERY.DRAW (SEED_IN => 7, WHEN_IN => TO_DATE ('2001-01-01', 'YYYY-MM-DD'));
+
+ -- Assert success for "Test Case 2"
+ -- Compare the two values.
+ utAssert.eq ( 'The Second Test', check_this, against_this);
+
+ -- End of test for "Test Case 2"
+
+ -- Define "control" operation for "Test Case 3"
+ against_this := NULL;
+
+ -- Execute test code for "Test Case 3"
+ check_this :=
+ LOTTERY.DRAW (SEED_IN => 0, WHEN_IN => SYSDATE);
+
+ -- Assert success for "Test Case 3"
+ -- Check for NULL return value.
+ utAssert.isNULL ( 'The Third Test', check_this);
+
+ -- End of test for "Test Case 3"
+
+END ut_DRAW;
+
+
+
+ Note that the different data types are handled automatically. So '2001-01-01' is converted to
+ a date using TO_DATE and the specified date format. However, we wanted to enter SYSDATE for our
+ argument in one of these cases. How do we stop this being converted into a date? The answer
+ is that we need to prefix the value with a '!' (an exclamation mark). This causes utGen to
+ pass this along 'as is' without attempting any conversion. Note that this cannot currently
+ be overridden, so if your data starts with an exclamation mark, you'll have to work around
+ this problem.
+
+ The problem with attempting to test output in PL/SQL is that there is a single
+ DBMS_OUTPUT buffer. When your test is run, there may already be output in the
+ buffer from other tests, or from the tested code. So what state should you
+ leave it in once you have finished? Perhaps you want all the output created by
+ your tested code to end up in the buffer as if it had been run normally (i.e.
+ not from within utPLSQL), or maybe you want only the text that was in the
+ buffer before you started to be left.
+
+
+
+ This package attempts to allow to do any of these. There is a flag in the
+ package to determine whether text pulled from the output buffer should be
+ saved. This is set with 'save' and 'nosave' and returned by
+ 'saving'. Data is pulled from the buffer using 'extract',
+ while the procedure 'replace' puts any saved data back into the output
+ buffer.
+
+
+
The intent is that it is used like this:
+
+
+PROCEDURE ut_my_test IS
+BEGIN
+
+ --Pull out any text already in the output buffer
+ utoutput.save;
+ utoutput.extract;
+
+ --Your testing code here, with saving turned on or off as you see fit
+
+ --Put text back in the output buffer
+ utoutput.replace;
+
+END;
+
+
+
+ So to start with, we save any text already in the buffer. We then carry out
+ our testing. If we want the output generated by the testing to end up back in
+ the output buffer, we turn on saving. Finally, we put the saved text back.
+
+
+
Warning
+
+
+ In the current version of utPLSQL (2.0.9.1) use of this package is virtually impossible with
+ utPLSQL tracing turned on. The reason for this is that this facility writes output using
+ DBMS_OUTPUT every time an assertion is called.
+
+ The raise_exc_in flag determines if the function should throw the
+ exception utOutput.EMPTY_OUTPUT_BUFFER when asked for the next line from
+ an empty buffer. If no exception is thrown, NULL is returned. As with
+ extract, the save_in flag simply overrides the global save flag setting.
+
+ With utPLSQL, you can run all the unit tests contained in a
+ single test package, or run the tests for a series of test packages defined in
+ a test suite.
+
+
+
+ The utPLSQL package offers two procedures, test and testsuite, to make it
+ easy for you to run "red light, green light" tests. Before you can
+ use these programs, however, you must build
+ your own test package.
+
+
+
To run a test for a single package, use the utPLSQL.test procedure:
+
+
+PROCEDURE utPLSQL.test (
+ package_in IN VARCHAR2,
+ samepackage_in IN BOOLEAN := FALSE,
+ prefix_in IN VARCHAR2 := NULL,
+ recompile_in IN BOOLEAN := TRUE,
+ dir_in IN VARCHAR2 := NULL,
+ suite_in in VARCHAR2 := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ reset_results_in IN BOOLEAN := TRUE ,
+ from_suite_in IN BOOLEAN := FALSE,
+ subprogram_in IN VARCHAR2 := '%',
+ per_method_setup_in IN BOOLEAN := FALSE
+);
+
+
+
where the parameters are defined as follows:
+
+
+
+
+ package_in
+
+
+ The name of the package or stand-alone program to be tested.
+
+
+
+
+ samepackage_in
+
+
+ Pass TRUE if your unit test programs are defined in the same
+ package as the source code to be tested. The default is that you have created
+ a separate package.
+
+
+
+
+ prefix_in
+
+
+ The prefix to be appended to package_in to come up with
+ the name of the test package. If you do not provide a value, the last prefix
+ you specified (or the default) will be used.
+
+
+
+
+ recompile_in
+
+
+ Pass FALSE if you do not want utPLSQL to automatically recompile your test package
+ before running the test.
+
+
+
+
+ dir_in
+
+
+ The directory containing the test package source code. If
+ you do not provide a value in your call to utPLSQL.test (the default) and if
+ you have not turned off automatic recompilation, utPLSQL will look for the
+ test package source code in the directory specified by a call to utConfig.setdir. If you do not provide a
+ value, the last directory you specified (if any) will be used.
+
+
+
+
+ suite_in
+
+
+ The name of the suite that contains the specified test
+ package. This is an optional value and is used to update statistics
+ for the test.
+
+
+
+
+ owner_in
+
+
+ The name of the schema that was specified when the test
+ suite was defined and the packaged added to the suite. This is an
+ optional value and is used to update statistics for
+ the test.
+
+
+
+
+ reset_results_in
+
+
+ Pass FALSE to tell utPLSQL to not reset the results
+ information, in which case you will still be able to view results by calling utResult.show . Otherwise, utPLSQL clears the result
+ data after each test.
+
+
+
+
+ from_suite_in
+
+
+ Pass TRUE to tell utPLSQL that this test is being run from
+ within a test suite (for internal use only).
+
+
+
+
+ subprogram_in
+
+
+ Pass a string to restrict which of the test procedures
+ will be executed for this run. Default of % means all tests will be run.
+
+
+
+
+ per_method_setup_in
+
+
+ Pass TRUE to run the setup and teardown procedure before
+ and after each unit test procedure is executed. Default of FALSE means that
+ these programs will be run once, at the start and end of the package test
+ execution as a whole.
+
+
+
+
+
+ override_package_in
+
+
+ Override the automatic determination of package names thus removing the
+ one to one relationship between test package and package to test.
+ Default is NULL. Instead of using this parameter consider the procedure run.
+
+
+
+
+
+
Here are some examples of using the utPLSQL.test procedure:
+
+
+ 1. Run the unit test for the betwnstr function (by executing the ut_betwnstr
+ test package, since the default prefix is used). Do not recompile the test
+ package.
+
+ 2. Run all of the unit tests for the te_employee package,
+ stored in a test package called "test_te_employee" in the /tmp
+ directory. Recompile the test package before execution.
+
+ Since utPLSQL follows the red light-green light approach on
+ reporting results, each time you run utPLSQL.test, it will display the results.
+ If successful, you will see output like this:
+
+
+
+SUCCESS: "betwnstr"
+
+
+
If the test fails at some point, you will see output like this:
+
+
+FAILURE: "betwnstr"
+BETWNSTR: IS NULL: NULL start
+BETWNSTR: End larger than string length; expected "cdeg", got "cdefg"
+
+
+
+
Running a Test the other way
+
+
+ The normal usage of the test procedure as described above assumes that for
+ each package you want to test, say mypackage, has a package for
+ testing this package having the same name but with an additional prefix:
+ ut_mypackage. Instead of using this approach, you can use the procedure
+ run. This procedure runs a test package directly without any further
+ conditions on the name or other packages. The only condition that still applies
+ is the naming conventions necessary to make it a valid test package.
+
+
+
+PROCEDURE run (
+ testpackage_in IN VARCHAR2,
+ prefix_in IN VARCHAR2 := NULL,
+ suite_in IN VARCHAR2 := NULL,
+ owner_in IN VARCHAR2 := NULL,
+ reset_results_in IN BOOLEAN := TRUE,
+ from_suite_in IN BOOLEAN := FALSE,
+ subprogram_in IN VARCHAR2 := '%',
+ per_method_setup_id IN BOOLEAN := FALSE);
+
+
+
where the parameters are defined as follows:
+
+
+
+
+ test_package_in
+
+
+ The name of the test package to run.
+
+
+
+
+ prefix_in
+
+
+ The prefix to be appended to package_in to come up with
+ the name of the test package. If you do not provide a value, NULL is used as
+ a default. i.e. the package name is used as provided in the first parameter
+
+
+
+
+ suite_in
+
+
+ The name of the suite that contains the specified test
+ package. This is an optional value and is used to update statistics
+ for the test.
+
+
+
+
+ owner_in
+
+
+ The name of the schema that was specified when the test
+ suite was defined and the packaged added to the suite. This is an
+ optional value and is used to update statistics for
+ the test.
+
+
+
+
+ reset_results_in
+
+
+ Pass FALSE to tell utPLSQL to not reset the results
+ information, in which case you will still be able to view results by calling utResult.show . Otherwise, utPLSQL clears the result
+ data after each test.
+
+
+
+
+ from_suite_in
+
+
+ Pass TRUE to tell utPLSQL that this test is being run from
+ within a test suite (for internal use only).
+
+
+
+
+ subprogram_in
+
+
+ Pass a string to restrict which of the test procedures
+ will be executed for this run. Default of '%' means all tests will be run.
+
+
+
+
+ per_method_setup_in
+
+
+ Pass TRUE to run the setup and teardown procedure before
+ and after each unit test procedure is executed. Default of FALSE means that
+ these programs will be run once, at the start and end of the package test
+ execution as a whole.
+
+
+
+
+
+
+
Running a Test Suite
+
+
+ In addition to running a test for a single test package, you
+ can set up a test suite that consists of one or more test packages. You can
+ then run an entire suite of tests with a call to utPLSQL.testsuite:
+
+
+
+PROCEDURE utPLSQL.testsuite (
+ suite_in IN VARCHAR2,
+ recompile_in IN BOOLEAN := TRUE,
+ reset_results_in IN BOOLEAN := TRUE
+ per_method_setup_in in BOOLEAN := FALSE
+ );
+
+
+
+ where suite_in is the name of the suite and recompiled_in
+ determines the auto compilation behavior.
+
+
+
+ Here is an example of the call I would make to run all my tests for the
+ PL/Vision library:
+
+
+
+SQL> exec utplsql.testsuite ('plvision');
+
+
+
+ The parameter list for utPLSQL.testSuite is much shorter
+ than utPLSQL.test; rather than pass information like directory, owner name and
+ same-package through a parameter list, you define these characteristics in the
+ suite itself (stored in a series of utPLSQL tables).
+
+ Similiar to the run procedure for single packages, there is the
+ runsuite procedure to run testsuites. When you use this procedure
+ there is no relationship assumed between the names of test packages specified in the
+ test suite and the procedures to be tested.
+
+
+
+PROCEDURE utPLSQL.runsuite (
+ suite_in IN VARCHAR2,
+ reset_results_in IN BOOLEAN := TRUE
+ per_method_setup_in in BOOLEAN := FALSE
+ );
+
+
+
+ The usage of the parameters is just as in testsuite.
+
+
+
+
Recording and Accessing Test Statistics
+
+
+ If you have defined test suites, and packages within those
+ test suites, utPLSQL will update those definitions with the follow statistics
+ after each test is run:
+
+
+
+
Status of last run: success or failure?
+
Start and end times of last run
+
Total number of failures
+
Total number of executions of the test
+
+
+
+ All of this is done for you automatically. You can then write queries and reports against the
+ ut_package and ut_suite tables.
+
+
+
+
Return utPLSQL version
+
+
+ Run the utPLSQL.version function to return the version of
+ utPLSQL you have installed:
+
+
+
+FUNCTION utPLSQL.version RETURN VARCHAR2
+
+
+
utPLSQL Trace
+
+
These routines are very simple and take no arguments:
+ The procedures trc and notrc are used to turn tracing on and off
+ respectively. The function tracing returns TRUE if tracing is currently turned
+ on and FALSE otherwise. This facility is useful when writing code in utPLSQL
+ (the framework itself, not your test code). An example of the output generated
+ is:
+
+
+
+Initialized utPLSQL session...
+Setpkg to Lottery
+Package and program = ut_Lottery
+Same package? N
+Is package? Y
+Prefix = ut_
+Recompiling ut_Lottery in
+Runprog of ut_SETUP
+Package and program = ut_Lottery.ut_SETUP
+Same package? N
+Is package? Y
+Prefix = ut_
+Addtest
+Package and program = Lottery.UT_DRAW
+Same package? N
+Override? Y
+Prefix = ut_
+Runprog of UT_DRAW
+Package and program = ut_Lottery.UT_DRAW
+Same package? N
+Is package? Y
+Prefix = ut_
+.
+> FFFFFFF AA III L U U RRRRR EEEEEEE
+> F A A I L U U R R E
+> F A A I L U U R R E
+> F A A I L U U R R E
+> FFFF A A I L U U RRRRRR EEEE
+> F AAAAAAAA I L U U R R E
+> F A A I L U U R R E
+> F A A I L U U R R E
+> F A A III LLLLLLL UUU R R EEEEEEE
+.
+FAILURE: "Lottery"
+.
+> Individual Test Case Results:
+>
+FAILURE - EQ "Test of DRAW" Expected "01 02 05 27 43 49" and got "02 04 27 28 31 33"
+>
+>
+> Errors recorded in utPLSQL Error Log:
+>
+> NONE FOUND
+Runprog of ut_TEARDOWN
+Package and program = ut_Lottery.ut_TEARDOWN
+Same package? N
+Is package? Y
+Prefix = ut_
+
+PL/SQL procedure successfully completed.
+
+
+
Register a Unit Test
+
+
+ As of version 1.4.1, you
+ no longer have to explicitly register a unit test! The default
+ behavior of utPLSQL is now to extract from the data dictionary (via the
+ ALL_ARGUMENTS data dictionary view) the names of all the unit test procedures
+ you have defined, and then run them. utPLSQL identifies these programs by
+ looking for all programs whose names start with the specified prefix.
+
+
+
+ If you decide that you want to explicitly register your unit
+ tests, then you will need to turn on manual registration:
+
+
+
+SQL> exec utConfig.registertest (TRUE)
+
+
+
+ This setting is immediately saved in the database for your
+ schema. To turn off manual registration:
+
+
+
+SQL> exec utConfig.registertest (FALSE)
+
+
+
+ So read no further unless you have turned on manual
+ registration! You might do this, for example, if you have already built a
+ number of test packages in a version of utPLSQL prior to 1.4.1 and do not want
+ to make any changes to your test package code.
+
+
+
+ All aspects of manual registration of unit tests for a
+ program or package actually occur within the Unit Test Package itself, in the setup procedure. No persistent unit test information
+ is stored between runs of the unit test, unless you define that unit test
+ within a test suite.
+
+
+
Use the utPLSQL.addtest procedure to register a unit test.
+
+
+ PROCEDURE utPLSQL.addtest (
+ NAME_IN IN VARCHAR2,
+ utprefix_in IN VARCHAR2,
+ iterations_in IN PLS_INTEGER := 1
+ );
+
+ PROCEDURE utPLSQL.addtest (
+ package_in IN VARCHAR2,
+ NAME_IN IN VARCHAR2,
+ utprefix_in IN VARCHAR2,
+ iterations_in IN PLS_INTEGER := 1
+ );
+
+
+
where
+
+
+ name_in is the name of the program you are
+ testing. Note that this is the name of the unit test procedure itself,
+ including the unit test prefix..
+
+
+
+ utprefix_in is the prefix to be applied to
+ name_in to construct the unit tst procedure. This is currently NOT IN USE; only
+ the package prefix specified in your call to utPLSQL.test and utPLSQL.testsuite
+ is used.
+
+
+
+ iterations_in is the number of times you wish to
+ run the test (currently NOT IN USE).
+
+
+
+ package_in is the name of the package containing
+ the unit test procedure. If you provide a package name when you call
+ utPLSQL.addtest, you will override the package name set when you called
+ utPLSQL.test -- but only for that one test. We recommend that you not change
+ the package name.
+
+
+
+ Here is a setup procedure that sets up a series of tests for
+ a query-only encapsulation of the employee table:
+
+ This package (created by Dan Spencer) allows the creation of functions to
+ allow the comparison of record types based on tables or views (%ROWTYPE
+ records in other words). They are generated by the add procedure:
+
+
+
+PROCEDURE add(
+ pkg_name_in IN ut_package.name%TYPE,
+ record_in IN ut_receq.name%TYPE,
+ rec_owner_in IN ut_receq.created_by%TYPE := USER
+);
+
+
+
+ The pkg_name_in parameter contains the name of a tested package you wish to
+ associate with this record type. Note that this package name should already
+ exist in the ut_package table. The record_in parameter contains the name of
+ the view or table whose record type is to be compared. The final (optional)
+ parameter contains the name of the schema in which the table or view exists.
+ It defaults to the current user.
+
+
+
+ The generated function will be named EQ_{Record_Schema_}Record_Name. The
+ schema is only inserted when the record type is not within the current one. The
+ function will return TRUE if the two records are identical on a field-by-field
+ comparison and FALSE otherwise. Note that NULL fields are considered
+ equal.
+
+
+
+ The details of the EQ_* functions and their association with tested packages held in two tables:
+
+
+
+
+ UT_RECEQ - This table holds a list of the EQ_* functions including the
+ target table/view and the schema in which it is found.
+
+
+ UT_RECEQ_PKG - This table cross-references the tested packages against the functions listed in UT_RECEQ.
+
+
+
+
Compile a package's record comparison functions
+
+
This routine recompiles all the EQ_* functions associated with a given package:
+
+
+PROCEDURE compile(pkg_name_in IN ut_package.name%TYPE);
+
+
+
+ when autocompiling is turned on, this is called by
+ utplsql.test or utplsql.testsuite before the test packages themselves are recompiled.
+
+
+
Remove record comparison functions
+
+
To remove record comparison functions, use the following:
+
+
+PROCEDURE rem(
+ name_in IN ut_receq.name%TYPE,
+ rec_owner_in IN ut_receq.created_by%TYPE := USER
+ for_package_in IN BOOLEAN := FALSE
+);
+
+
+
+ If for_package_in is FALSE, then name_in is taken to refer to a record type to
+ remove, with rec_owner_in specifying the schema the record type is in. All package associations for this record type are removed and the EQ_* function is dropped.
+
+
+
+ On the other hand, if for_package_in is TRUE, then name_in is taken to refer
+ to a package. In this case, all the package's associations are removed. If no
+ other package is associated with a given record, then the EQ_* function is
+ dropped. (Note that the rec_owner_in parameter is ignored here).
+
+ The utResult package offers an API to the information
+ sent by the various utAssert assertion routines after a test is run. If
+ you employ the utPLSQL.test and utPLSQL.testsuite to run your tests, then
+ the results will be displayed by calling the utResult.show procedure.
+
+
+ So, generally, you do not have to do anything to see or evaluate the results of
+ a test (or suite of tests). The information will be displayed on your screen
+ using DBMS_OUTPUT, or elsewhere if you use a custom output reporter. You might,
+ however, want to access this information in another environment (say, Oracle
+ Forms or Java, etc.). You might also want to build your own assertion logic or
+ test engine. In either of these cases, you will want to use the programs in the
+ utResult package.
+
+
+
Initialize
+
+
Initialize the utResult data, setting it all back to NULL:
+
+
+PROCEDURE utResult.init;
+
+
+
Show Results
+
+
Show the results of your test with one of the following three procedures.
+
+
+PROCEDURE utResult.show (reset_in IN BOOLEAN := FALSE);
+PROCEDURE utResult.showone (indx_in in pls_integer);
+PROCEDURE utResult.showlast;
+
+
+
+ Use the show procedure to display the full set of results stored
+ in the utResult array. If you pass TRUE for its single argument, the results
+ informatino will be initialized.
+
+
+
Use the showone procedure to show the Nth result.
+
+
Use the showlast procedure to show the results of the last test run.
+
+
Retrieve Test Status
+
+
+ The success and failure functions return the status of the most recently
+ executed test.
+
+ The utPLSQL.show procedure iterates through the contents of the utResult
+ array and displays the information found there. You can write the same
+ kind of logic by calling a combination of the following programs:
+
+
+
+PROCEDURE utResult.firstresult;
+
+FUNCTION utResult.nextresult RETURN utResult.result_rt;
+
+PROCEDURE utResult.nextresult (
+ name_out OUT VARCHAR2,
+ msg_out OUT VARCHAR2,
+ case_indx_out OUT PLS_INTEGER
+);
+
+FUNCTION utResult.nthresult (indx_in IN PLS_INTEGER)
+ RETURN utResult.result_rt;
+
+PROCEDURE utResult.nthresult (
+ indx_in IN PLS_INTEGER,
+ name_out OUT VARCHAR2,
+ msg_out OUT VARCHAR2,
+ case_indx_out OUT PLS_INTEGER
+);
+
+FUNCTION utResult.resultcount RETURN PLS_INTEGER;
+
+
+
Control the Display of Success Messages
+
+
+ The following procedures turn on or off the display of success messages. In other words,
+ when turned on (as is the default) a message will be displayed for each successful assertion.
+ The specifications are as follows:
+
+
+
+
+
diff --git a/documentation/src/writedoc.html b/documentation/src/writedoc.html
new file mode 100644
index 000000000..376fc10b6
--- /dev/null
+++ b/documentation/src/writedoc.html
@@ -0,0 +1,149 @@
+
+
+
+
+ How to add to the utPLSQL documentation set
+
+
+
+
Writing Documentation
+
+
+ The utPLSQL documentation is built from a series of simple HTML files in the
+ src directory. These files have none of the navigation bars, logos or
+ next/previous links which appear in the final documentation. They are also
+ stripped of font, color and style information at compile-time to let the
+ stylesheet (utplsql.css) determine the overall look-and-feel.
+
+
+
+ Like the code, the documentation is held within GIT.
+ Changes should be made to the documentation/src directory.
+ Details on how to change and submit the changes back to the
+ project can be found in the CONTRIBUTING.md
+
+
+
The HTML Files
+
+
+ As described above, the base files in the src directory are used to generate the final
+ product. To add new documentation to one of these files, or to correct errors,
+ simply edit it. It makes sense to follow the layout that is already present in the
+ file, adding links at the top of the page where appropriate. The HTML should be
+ kept simple, so use the relevant header styles (<H1>...<H6>) to label your sections
+ and subsections, use <pre> to mark sections of code etc. Let the stylesheet
+ do the work of setting the colors and fonts.
+
+
+
+ If you are adding an entirely new file to the documentation, use the file
+ template.html as a basis. This contains the relevant comment
+ lines which tell the scripts which parts of the file to use
+ (see the note below). Finally, you will need to
+ edit map.txt to ensure that the file is linked from the other pages in
+ the documentation. This is described in the next section.
+
+
+
The Control Files
+
+
+ The files are compiled into a documentation set situated in the top-level
+ documentation directory using the 3 control files: map.txt, authors.txt and copyright_years.txt.
+ The first of these is the driving file, giving a list of the files to be
+ included. The second gives a list of authors to be included in the copyright
+ notice on each page and referenced in the Meta tags (this is for
+ historical reasons and lists the original contributors of the
+ documentation - to keep it in line with the policy for source-code, all
+ future contributions will go under the name of "the utPLSQL Project"). The
+ third file lists the years for the copyright statement - i.e. years when
+ significant changes were published.
+
+
+
The format of map.txt is as follows:
+
+
+ # Any line starting with a # is
+ # considered a comment
+ #
+ index.html,Home*
+ started.html,Getting Started*
+ another.html,Further Docs
+ another2.html,Yet more docs
+
+
+
+ Each line consists of the filename to be included and the title of the page,
+ separated with a comma. Any file whose title is followed by an asterisk is
+ considered the start of a new section. This means a link to the file will
+ appear in the navigation bar at the top of each page and it will appear in
+ bold in the document map. Note that the document map itself does not appear
+ in map.txt, but is always added at the end and is considered a new section.
+ This page is entirely generated at compile-time.
+
+
+
+ To add a new page to the documentation, simply add it to this file in the
+ correct position. Note that generally you will not be adding a new section!
+
+
+
The format of authors.txt is as follows:
+
+
+ # Again, lines starting # are ignored
+ #
+ Steven Feuerstein,steven@stevenfeuerstein.com
+ Chris Rimmer,c@24.org.uk
+ A N Other,ano@ther.net
+
+
+
+ Each line in this file simply gives the name of the author and their email
+ address, separated with a comma. So if you've made a contribution and your name
+ is not listed, add it!
+
+ Each line will be separated by a comma in the copyright statement, so the
+ above will generate: "2000-2005, 2014"
+
+
+
The Scripts
+
+
+ The Perl script used to build the documentation is build_docs.pl.
+
+
+
+ The script goes through each file listed in map.txt, cleans it up
+ and then adds logos, navigation bars, next/previous links,
+ copyright information etc. The resulting files are put in the top-level
+ documentation directory.
+
+
+
+ The "cleaning" strips the source HTML files down to the basics, removing
+ everything from the header and removing Javascript, fonts, color, etc. It
+ requires the HTML::TagFilter module which in turn also requires the
+ HTML::Parser and HTML::Tagset modules (all available from search.cpan.org).
+
+
+
+ NOTE: Anything within a source file before the
+ <!-- Begin utPLSQL Body --> comment line and after the
+ <!-- End utPLSQL Body --> comment line is ignored.
+
+
+
Copyright 2002, 2014 Chris Rimmer and the utPLSQL Project. All rights reserved
utPLSQL has been supported by Redgate in the form of sponsored stickers and t-shirts. Thank you for helping us spreading the word!
-
-
-
-
diff --git a/sonar-project.properties b/sonar-project.properties
deleted file mode 100644
index f23e8cf71..000000000
--- a/sonar-project.properties
+++ /dev/null
@@ -1,38 +0,0 @@
-# must be unique in a given SonarQube instance
-sonar.organization=utplsql
-sonar.projectKey=utPLSQL_utPLSQL
-# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
-sonar.projectName=utPLSQL
-sonar.projectVersion=v3.1.14-develop
-
-# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
-# Since SonarQube 4.2, this property is optional if sonar.modules is set.
-# If not set, SonarQube starts looking for source code from the directory containing
-# the sonar-project.properties file.
-sonar.sources=./source
-sonar.coverageReportPaths=coverage.xml
-sonar.coverage.exclusions=**/*.sql,**/*.pks
-sonar.tests=./test
-sonar.testExecutionReportPaths=./test_results.xml
-sonar.links.issue=https://github.com/utPLSQL/utPLSQL/issues
-sonar.links.ci=https://travis-ci.org/utPLSQL/utPLSQL
-sonar.links.homepage=https://github.com/utPLSQL/utPLSQL
-sonar.projectDescription=PL/SQL Unit Testing Framework
-sonar.plsql.file.suffixes=sql,tab,pkb,tpb
-sonar.language=plsql
-
-
-sonar.exclusions=**/*.sql
-
-sonar.pullrequest.provider=github
-sonar.pullrequest.github.endpoint=https://api.github.com/
-sonar.pullrequest.github.repository=utPLSQL/utPLSQL
-
-sonar.plsql.jdbc.driver.class=oracle.jdbc.OracleDriver
-sonar.plsql.jdbc.user=UT3_DEVELOP
-sonar.plsql.jdbc.password=ut3
-sonar.plsql.defaultSchema=UT3_DEVELOP
-
-
-# Encoding of the source code. Default is default system encoding
-#sonar.sourceEncoding=UTF-8
diff --git a/source/api/be_between.syn b/source/api/be_between.syn
deleted file mode 100644
index c0972595d..000000000
--- a/source/api/be_between.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym be_between for ut_be_between;
diff --git a/source/api/be_empty.syn b/source/api/be_empty.syn
deleted file mode 100644
index a8e28de6e..000000000
--- a/source/api/be_empty.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym be_empty for ut_be_empty;
diff --git a/source/api/be_false.syn b/source/api/be_false.syn
deleted file mode 100644
index c2665bbcb..000000000
--- a/source/api/be_false.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym be_false for ut_be_false;
diff --git a/source/api/be_greater_or_equal.syn b/source/api/be_greater_or_equal.syn
deleted file mode 100644
index 386fe7f32..000000000
--- a/source/api/be_greater_or_equal.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym be_greater_or_equal for ut_be_greater_or_equal;
diff --git a/source/api/be_greater_than.syn b/source/api/be_greater_than.syn
deleted file mode 100644
index 6f97b7d22..000000000
--- a/source/api/be_greater_than.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym be_greater_than for ut_be_greater_than;
diff --git a/source/api/be_less_or_equal.syn b/source/api/be_less_or_equal.syn
deleted file mode 100644
index b2f836144..000000000
--- a/source/api/be_less_or_equal.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym be_less_or_equal for ut_be_less_or_equal;
diff --git a/source/api/be_less_than.syn b/source/api/be_less_than.syn
deleted file mode 100644
index fbef3b4c3..000000000
--- a/source/api/be_less_than.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym be_less_than for ut_be_less_than;
diff --git a/source/api/be_like.syn b/source/api/be_like.syn
deleted file mode 100644
index a8be1de71..000000000
--- a/source/api/be_like.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym be_like for ut_be_like;
diff --git a/source/api/be_not_null.syn b/source/api/be_not_null.syn
deleted file mode 100644
index d6458683a..000000000
--- a/source/api/be_not_null.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym be_not_null for ut_be_not_null;
diff --git a/source/api/be_null.syn b/source/api/be_null.syn
deleted file mode 100644
index 42f6516c3..000000000
--- a/source/api/be_null.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym be_null for ut_be_null;
diff --git a/source/api/be_true.syn b/source/api/be_true.syn
deleted file mode 100644
index bf7392a62..000000000
--- a/source/api/be_true.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym be_true for ut_be_true;
diff --git a/source/api/be_within.syn b/source/api/be_within.syn
deleted file mode 100644
index e00005bb7..000000000
--- a/source/api/be_within.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym be_within for ut_be_within;
diff --git a/source/api/be_within_pct.syn b/source/api/be_within_pct.syn
deleted file mode 100644
index 40e3fb8b9..000000000
--- a/source/api/be_within_pct.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym be_within_pct for ut_be_within_pct;
diff --git a/source/api/contain.syn b/source/api/contain.syn
deleted file mode 100644
index 5bce7d1d2..000000000
--- a/source/api/contain.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym contain for ut_contain;
diff --git a/source/api/equal.syn b/source/api/equal.syn
deleted file mode 100644
index 71ba58b53..000000000
--- a/source/api/equal.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym equal for ut_equal;
diff --git a/source/api/have_count.syn b/source/api/have_count.syn
deleted file mode 100644
index a406d47ec..000000000
--- a/source/api/have_count.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym have_count for ut_have_count;
diff --git a/source/api/match.syn b/source/api/match.syn
deleted file mode 100644
index ffbda35b1..000000000
--- a/source/api/match.syn
+++ /dev/null
@@ -1 +0,0 @@
-create synonym match for ut_match;
diff --git a/source/api/ut.pkb b/source/api/ut.pkb
deleted file mode 100644
index cff35b771..000000000
--- a/source/api/ut.pkb
+++ /dev/null
@@ -1,827 +0,0 @@
-create or replace package body ut is
-
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- g_nls_date_format varchar2(4000);
- gc_fail_on_errors constant boolean := false;
-
- g_result_line_no binary_integer;
- g_result_lines ut_varchar2_list := ut_varchar2_list();
-
- function version return varchar2 is
- begin
- return ut_runner.version();
- end;
-
- function expect(a_actual in anydata, a_message varchar2 := null) return ut_expectation_compound is
- begin
- return ut_expectation_compound(ut_data_value_anydata(a_actual), a_message);
- end;
-
- function expect(a_actual in blob, a_message varchar2 := null) return ut_expectation is
- begin
- return ut_expectation(ut_data_value_blob(a_actual), a_message);
- end;
-
- function expect(a_actual in boolean, a_message varchar2 := null) return ut_expectation is
- begin
- return ut_expectation(ut_data_value_boolean(a_actual), a_message);
- end;
-
- function expect(a_actual in clob, a_message varchar2 := null) return ut_expectation is
- begin
- return ut_expectation(ut_data_value_clob(a_actual), a_message);
- end;
-
- function expect(a_actual in date, a_message varchar2 := null) return ut_expectation is
- begin
- return ut_expectation(ut_data_value_date(a_actual), a_message);
- end;
-
- function expect(a_actual in number, a_message varchar2 := null) return ut_expectation is
- begin
- return ut_expectation(ut_data_value_number(a_actual), a_message);
- end;
-
- function expect(a_actual in timestamp_unconstrained, a_message varchar2 := null) return ut_expectation is
- begin
- return ut_expectation(ut_data_value_timestamp(a_actual), a_message);
- end;
-
- function expect(a_actual in timestamp_ltz_unconstrained, a_message varchar2 := null) return ut_expectation is
- begin
- return ut_expectation(ut_data_value_timestamp_ltz(a_actual), a_message);
- end;
-
- function expect(a_actual in timestamp_tz_unconstrained, a_message varchar2 := null) return ut_expectation is
- begin
- return ut_expectation(ut_data_value_timestamp_tz(a_actual), a_message);
- end;
-
- function expect(a_actual in varchar2, a_message varchar2 := null) return ut_expectation is
- begin
- return ut_expectation(ut_data_value_varchar2(a_actual), a_message);
- end;
-
- function expect(a_actual in sys_refcursor, a_message varchar2 := null) return ut_expectation_compound is
- begin
- return ut_expectation_compound(ut_data_value_refcursor(a_actual), a_message);
- end;
-
- function expect(a_actual in yminterval_unconstrained, a_message varchar2 := null) return ut_expectation is
- begin
- return ut_expectation(ut_data_value_yminterval(a_actual), a_message);
- end;
-
- function expect(a_actual in dsinterval_unconstrained, a_message varchar2 := null) return ut_expectation is
- begin
- return ut_expectation(ut_data_value_dsinterval(a_actual), a_message);
- end;
-
- function expect(a_actual in json_element_t , a_message varchar2 := null) return ut_expectation_json is
- begin
- return ut_expectation_json(ut_data_value_json(a_actual), a_message);
- end;
-
- function expect(a_actual in json , a_message varchar2 := null) return ut_expectation_json is
- begin
- return ut_expectation_json(ut_data_value_json(a_actual), a_message);
- end;
-
- procedure fail(a_message in varchar2) is
- begin
- ut_expectation_processor.report_failure(a_message);
- end;
-
- procedure raise_if_packages_invalidated is
- e_package_invalidated exception;
- pragma exception_init (e_package_invalidated, -04068);
- begin
- if ut_expectation_processor.invalidation_exception_found() then
- ut_expectation_processor.reset_invalidation_exception();
- raise e_package_invalidated;
- end if;
- end;
-
-
- procedure run_autonomous(
- a_paths ut_varchar2_list,
- a_reporter in out nocopy ut_reporter_base,
- a_color_console integer,
- a_coverage_schemes ut_varchar2_list,
- a_source_file_mappings ut_file_mappings,
- a_test_file_mappings ut_file_mappings,
- a_include_objects ut_varchar2_list,
- a_exclude_objects ut_varchar2_list,
- a_client_character_set varchar2,
- a_random_test_order integer,
- a_random_test_order_seed positive,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) is
- pragma autonomous_transaction;
- begin
- a_reporter := coalesce(a_reporter,ut_documentation_reporter());
- ut_runner.run(
- a_paths,
- ut_reporters(a_reporter),
- ut_utils.int_to_boolean(a_color_console),
- a_coverage_schemes,
- a_source_file_mappings,
- a_test_file_mappings,
- a_include_objects,
- a_exclude_objects,
- gc_fail_on_errors,
- a_client_character_set,
- false,
- ut_utils.int_to_boolean(a_random_test_order),
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- rollback;
- end;
-
- procedure run_autonomous(
- a_paths ut_varchar2_list,
- a_reporter in out nocopy ut_reporter_base,
- a_color_console integer,
- a_coverage_schemes ut_varchar2_list,
- a_source_files ut_varchar2_list,
- a_test_files ut_varchar2_list,
- a_include_objects ut_varchar2_list,
- a_exclude_objects ut_varchar2_list,
- a_client_character_set varchar2,
- a_random_test_order integer,
- a_random_test_order_seed positive,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) is
- pragma autonomous_transaction;
- begin
-
- a_reporter := coalesce(a_reporter,ut_documentation_reporter());
- ut_runner.run(
- a_paths,
- ut_reporters(a_reporter),
- ut_utils.int_to_boolean(a_color_console),
- a_coverage_schemes,
- ut_file_mapper.build_file_mappings(a_source_files),
- ut_file_mapper.build_file_mappings(a_test_files),
- a_include_objects,
- a_exclude_objects,
- gc_fail_on_errors,
- a_client_character_set,
- false,
- ut_utils.int_to_boolean(a_random_test_order),
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- rollback;
- end;
-
- function get_report_outputs( a_cursor sys_refcursor ) return varchar2 is
- l_clob clob;
- l_item_type varchar2(32767);
- l_result varchar2(4000);
- begin
- if g_result_line_no is null then
- fetch a_cursor into l_clob, l_item_type;
- if a_cursor%notfound then
- close a_cursor;
- g_result_line_no := null;
- g_result_lines := ut_varchar2_list();
- raise_if_packages_invalidated();
- raise no_data_found;
- end if;
- if l_clob is not null and l_clob != empty_clob() then
- if length(l_clob) > ut_utils.gc_max_storage_varchar2_len then
- g_result_lines := ut_utils.clob_to_table(l_clob, ut_utils.gc_max_storage_varchar2_len);
- else
- g_result_lines := ut_varchar2_list(l_clob);
- end if;
- g_result_line_no := g_result_lines.first;
- end if;
- end if;
- if g_result_line_no is not null then
- l_result := g_result_lines(g_result_line_no);
- g_result_line_no := g_result_lines.next(g_result_line_no);
- end if;
- return l_result;
- end;
-
- function run(
- a_reporter ut_reporter_base := null,
- a_color_console integer := 0,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_random_test_order integer := 0,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) return ut_varchar2_rows pipelined is
- l_reporter ut_reporter_base := a_reporter;
- l_results sys_refcursor;
- begin
- run_autonomous(
- ut_varchar2_list(),
- l_reporter,
- a_color_console,
- a_coverage_schemes,
- a_source_file_mappings,
- a_test_file_mappings,
- a_include_objects,
- a_exclude_objects,
- a_client_character_set,
- a_random_test_order,
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- if l_reporter is of (ut_output_reporter_base) then
- l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
- g_result_lines := ut_varchar2_list();
- loop
- pipe row( get_report_outputs( l_results ) );
- end loop;
- end if;
- return;
- end;
-
- function run(
- a_reporter ut_reporter_base := null,
- a_color_console integer := 0,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_files ut_varchar2_list,
- a_test_files ut_varchar2_list,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_random_test_order integer := 0,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) return ut_varchar2_rows pipelined is
- l_reporter ut_reporter_base := a_reporter;
- l_results sys_refcursor;
- begin
- run_autonomous(
- ut_varchar2_list(),
- l_reporter,
- a_color_console,
- a_coverage_schemes,
- a_source_files,
- a_test_files,
- a_include_objects,
- a_exclude_objects,
- a_client_character_set,
- a_random_test_order,
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- if l_reporter is of (ut_output_reporter_base) then
- l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
- g_result_lines := ut_varchar2_list();
- loop
- pipe row( get_report_outputs( l_results ) );
- end loop;
- end if;
- return;
- end;
-
- function run(
- a_paths ut_varchar2_list,
- a_reporter ut_reporter_base := null,
- a_color_console integer := 0,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_random_test_order integer := 0,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) return ut_varchar2_rows pipelined is
- l_reporter ut_reporter_base := a_reporter;
- l_results sys_refcursor;
- begin
- run_autonomous(
- a_paths,
- l_reporter,
- a_color_console,
- a_coverage_schemes,
- a_source_file_mappings,
- a_test_file_mappings,
- a_include_objects,
- a_exclude_objects,
- a_client_character_set,
- a_random_test_order,
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- if l_reporter is of (ut_output_reporter_base) then
- l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
- g_result_lines := ut_varchar2_list();
- loop
- pipe row( get_report_outputs( l_results ) );
- end loop;
- end if;
- return;
- end;
-
- function run(
- a_paths ut_varchar2_list,
- a_reporter ut_reporter_base := null,
- a_color_console integer := 0,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_files ut_varchar2_list,
- a_test_files ut_varchar2_list,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_random_test_order integer := 0,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) return ut_varchar2_rows pipelined is
- l_reporter ut_reporter_base := a_reporter;
- l_results sys_refcursor;
- begin
- run_autonomous(
- a_paths,
- l_reporter,
- a_color_console,
- a_coverage_schemes,
- a_source_files,
- a_test_files,
- a_include_objects,
- a_exclude_objects,
- a_client_character_set,
- a_random_test_order,
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- if l_reporter is of (ut_output_reporter_base) then
- l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
- g_result_lines := ut_varchar2_list();
- loop
- pipe row( get_report_outputs( l_results ) );
- end loop;
- end if;
- return;
- end;
-
- function run(
- a_path varchar2,
- a_reporter ut_reporter_base := null,
- a_color_console integer := 0,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_random_test_order integer := 0,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) return ut_varchar2_rows pipelined is
- l_reporter ut_reporter_base := a_reporter;
- l_results sys_refcursor;
- begin
- run_autonomous(
- ut_varchar2_list(a_path),
- l_reporter,
- a_color_console,
- a_coverage_schemes,
- a_source_file_mappings,
- a_test_file_mappings,
- a_include_objects,
- a_exclude_objects,
- a_client_character_set,
- a_random_test_order,
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- if l_reporter is of (ut_output_reporter_base) then
- l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
- g_result_lines := ut_varchar2_list();
- loop
- pipe row( get_report_outputs( l_results ) );
- end loop;
- end if;
- return;
- end;
-
- function run(
- a_path varchar2,
- a_reporter ut_reporter_base := null,
- a_color_console integer := 0,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_files ut_varchar2_list,
- a_test_files ut_varchar2_list,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_random_test_order integer := 0,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) return ut_varchar2_rows pipelined is
- l_reporter ut_reporter_base := a_reporter;
- l_results sys_refcursor;
- begin
- run_autonomous(
- ut_varchar2_list(a_path),
- l_reporter,
- a_color_console,
- a_coverage_schemes,
- a_source_files,
- a_test_files,
- a_include_objects,
- a_exclude_objects,
- a_client_character_set,
- a_random_test_order,
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- if l_reporter is of (ut_output_reporter_base) then
- l_results := treat(l_reporter as ut_output_reporter_base).get_lines_cursor();
- g_result_lines := ut_varchar2_list();
- loop
- pipe row( get_report_outputs( l_results ) );
- end loop;
- end if;
- return;
- end;
-
- procedure run(
- a_paths ut_varchar2_list,
- a_reporter ut_reporter_base := null,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) is
- l_reporter ut_reporter_base := a_reporter;
- begin
- if a_force_manual_rollback then
- l_reporter := coalesce(l_reporter,ut_documentation_reporter());
- ut_runner.run(
- a_paths,
- ut_reporters(l_reporter),
- a_color_console,
- a_coverage_schemes,
- a_source_file_mappings,
- a_test_file_mappings,
- a_include_objects,
- a_exclude_objects,
- gc_fail_on_errors,
- a_client_character_set,
- a_force_manual_rollback,
- a_random_test_order,
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- else
- run_autonomous(
- a_paths,
- l_reporter,
- ut_utils.boolean_to_int(a_color_console),
- a_coverage_schemes,
- a_source_file_mappings,
- a_test_file_mappings,
- a_include_objects,
- a_exclude_objects,
- a_client_character_set,
- ut_utils.boolean_to_int(a_random_test_order),
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- end if;
- if l_reporter is of (ut_output_reporter_base) then
- treat(l_reporter as ut_output_reporter_base).lines_to_dbms_output();
- end if;
- raise_if_packages_invalidated();
- end;
-
- procedure run(
- a_paths ut_varchar2_list,
- a_reporter ut_reporter_base := null,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_files ut_varchar2_list,
- a_test_files ut_varchar2_list,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) is
- l_reporter ut_reporter_base := a_reporter;
- begin
- ut.run(
- a_paths,
- l_reporter,
- a_color_console,
- a_coverage_schemes,
- ut_file_mapper.build_file_mappings(a_source_files),
- ut_file_mapper.build_file_mappings(a_test_files),
- a_include_objects,
- a_exclude_objects,
- a_client_character_set,
- a_force_manual_rollback,
- a_random_test_order,
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- end;
-
- procedure run(
- a_reporter ut_reporter_base := null,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) is
- begin
- ut.run(
- ut_varchar2_list(),
- a_reporter,
- a_color_console,
- a_coverage_schemes,
- a_source_file_mappings,
- a_test_file_mappings,
- a_include_objects,
- a_exclude_objects,
- a_client_character_set,
- a_force_manual_rollback,
- a_random_test_order,
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- end;
-
- procedure run(
- a_reporter ut_reporter_base := null,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_files ut_varchar2_list,
- a_test_files ut_varchar2_list,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) is
- begin
- ut.run(
- ut_varchar2_list(),
- a_reporter,
- a_color_console,
- a_coverage_schemes,
- a_source_files,
- a_test_files,
- a_include_objects,
- a_exclude_objects,
- a_client_character_set,
- a_force_manual_rollback,
- a_random_test_order,
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- end;
-
- procedure run(
- a_path varchar2,
- a_reporter ut_reporter_base := null,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) is
- begin
- ut.run(
- ut_varchar2_list(a_path),
- a_reporter,
- a_color_console,
- a_coverage_schemes,
- a_source_file_mappings,
- a_test_file_mappings,
- a_include_objects,
- a_exclude_objects,
- a_client_character_set,
- a_force_manual_rollback,
- a_random_test_order,
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- end;
-
- procedure run(
- a_path varchar2,
- a_reporter ut_reporter_base := null,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_files ut_varchar2_list,
- a_test_files ut_varchar2_list,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) is
- begin
- ut.run(
- ut_varchar2_list(a_path),
- a_reporter,
- a_color_console,
- a_coverage_schemes,
- a_source_files,
- a_test_files,
- a_include_objects,
- a_exclude_objects,
- a_client_character_set,
- a_force_manual_rollback,
- a_random_test_order,
- a_random_test_order_seed,
- a_tags,
- a_include_schema_expr,
- a_include_object_expr,
- a_exclude_schema_expr,
- a_exclude_object_expr
- );
- end;
-
-
- procedure set_nls is
- begin
- if g_nls_date_format is null then
- select /*+ no_parallel */ nsp.value
- into g_nls_date_format
- from nls_session_parameters nsp
- where parameter = 'NLS_DATE_FORMAT';
- end if;
- execute immediate 'alter session set nls_date_format = '''||ut_utils.gc_date_format||'''';
- end;
-
- procedure reset_nls is
- begin
- if g_nls_date_format is not null then
- execute immediate 'alter session set nls_date_format = '''||g_nls_date_format||'''';
- end if;
- g_nls_date_format := null;
- end;
-
-end ut;
-/
diff --git a/source/api/ut.pks b/source/api/ut.pks
deleted file mode 100644
index f72c82a0c..000000000
--- a/source/api/ut.pks
+++ /dev/null
@@ -1,299 +0,0 @@
-create or replace package ut authid current_user as
-
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- function version return varchar2;
-
- function expect(a_actual in anydata, a_message varchar2 := null) return ut_expectation_compound;
-
- function expect(a_actual in blob, a_message varchar2 := null) return ut_expectation;
-
- function expect(a_actual in boolean, a_message varchar2 := null) return ut_expectation;
-
- function expect(a_actual in clob, a_message varchar2 := null) return ut_expectation;
-
- function expect(a_actual in date, a_message varchar2 := null) return ut_expectation;
-
- function expect(a_actual in number, a_message varchar2 := null) return ut_expectation;
-
- function expect(a_actual in sys_refcursor, a_message varchar2 := null) return ut_expectation_compound;
-
- function expect(a_actual in timestamp_unconstrained, a_message varchar2 := null) return ut_expectation;
-
- function expect(a_actual in timestamp_ltz_unconstrained, a_message varchar2 := null) return ut_expectation;
-
- function expect(a_actual in timestamp_tz_unconstrained, a_message varchar2 := null) return ut_expectation;
-
- function expect(a_actual in varchar2, a_message varchar2 := null) return ut_expectation;
-
- function expect(a_actual in yminterval_unconstrained, a_message varchar2 := null) return ut_expectation;
-
- function expect(a_actual in dsinterval_unconstrained, a_message varchar2 := null) return ut_expectation;
-
- function expect(a_actual in json_element_t , a_message varchar2 := null) return ut_expectation_json;
-
- function expect(a_actual in json , a_message varchar2 := null) return ut_expectation_json;
-
- procedure fail(a_message in varchar2);
-
- function run(
- a_reporter ut_reporter_base := null,
- a_color_console integer := 0,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_random_test_order integer := 0,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) return ut_varchar2_rows pipelined;
-
- function run(
- a_reporter ut_reporter_base := null,
- a_color_console integer := 0,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_files ut_varchar2_list,
- a_test_files ut_varchar2_list,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_random_test_order integer := 0,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) return ut_varchar2_rows pipelined;
-
- function run(
- a_paths ut_varchar2_list,
- a_reporter ut_reporter_base := null,
- a_color_console integer := 0,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_random_test_order integer := 0,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) return ut_varchar2_rows pipelined;
-
- function run(
- a_paths ut_varchar2_list,
- a_reporter ut_reporter_base := null,
- a_color_console integer := 0,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_files ut_varchar2_list,
- a_test_files ut_varchar2_list,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_random_test_order integer := 0,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) return ut_varchar2_rows pipelined;
-
- function run(
- a_path varchar2,
- a_reporter ut_reporter_base := null,
- a_color_console integer := 0,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_random_test_order integer := 0,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) return ut_varchar2_rows pipelined;
-
- function run(
- a_path varchar2,
- a_reporter ut_reporter_base := null,
- a_color_console integer := 0,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_files ut_varchar2_list,
- a_test_files ut_varchar2_list,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_random_test_order integer := 0,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) return ut_varchar2_rows pipelined;
-
- procedure run(
- a_reporter ut_reporter_base := null,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- );
-
- procedure run(
- a_reporter ut_reporter_base := null,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_files ut_varchar2_list,
- a_test_files ut_varchar2_list,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- );
-
- procedure run(
- a_paths ut_varchar2_list,
- a_reporter ut_reporter_base := null,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- );
-
- procedure run(
- a_paths ut_varchar2_list,
- a_reporter ut_reporter_base := null,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_files ut_varchar2_list,
- a_test_files ut_varchar2_list,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- );
-
- procedure run(
- a_path varchar2,
- a_reporter ut_reporter_base := null,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- );
-
- procedure run(
- a_path varchar2,
- a_reporter ut_reporter_base := null,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_files ut_varchar2_list,
- a_test_files ut_varchar2_list,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- );
-
- /**
- * Helper procedure to set NLS session parameter for date processing in refcursor.
- * It needs to be called before refcursor is open in order to have DATE data type data in refcursor
- * properly transformed into XML format as a date-time element.
- * If the function is not called before opening a cursor to be compared, the DATE data is compared using default NLS setting for date.
- */
- procedure set_nls;
-
- /**
- * Helper procedure to reset NLS session parameter to it's original state.
- * It needs to be called after refcursor is open in order restore the original session state and keep the NLS date setting at default.
- */
- procedure reset_nls;
-
-end ut;
-/
diff --git a/source/api/ut_runner.pkb b/source/api/ut_runner.pkb
deleted file mode 100644
index 3ec2a5393..000000000
--- a/source/api/ut_runner.pkb
+++ /dev/null
@@ -1,272 +0,0 @@
-create or replace package body ut_runner is
-
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Private functions
- */
-
- procedure finish_run(a_run ut_run, a_force_manual_rollback boolean) is
- begin
- ut_event_manager.trigger_event(ut_event_manager.gc_finalize, a_run);
- ut_metadata.reset_source_definition_cache;
- ut_utils.read_cache_to_dbms_output();
- ut_coverage_helper.cleanup_tmp_table();
- ut_compound_data_helper.cleanup_diff();
- if not a_force_manual_rollback then
- rollback;
- end if;
- end;
-
-
- /**
- * Public functions
- */
- function version return varchar2 is
- begin
- return ut_utils.gc_version;
- end;
-
- function version_compatibility_check( a_requested varchar2, a_current varchar2 := null ) return integer is
- l_result boolean := false;
- l_requested ut_utils.t_version := ut_utils.to_version(a_requested);
- l_current ut_utils.t_version := ut_utils.to_version(coalesce(a_current,version()));
- begin
- if l_requested.major = l_current.major
- and (l_requested.minor < l_current.minor or l_requested.minor is null
- or l_requested.minor = l_current.minor and (l_requested.bugfix <= l_current.bugfix or l_requested.bugfix is null)) then
- l_result := true;
- end if;
- return ut_utils.boolean_to_int(l_result);
- end;
-
- procedure run(
- a_paths ut_varchar2_list,
- a_reporters ut_reporters,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_fail_on_errors boolean := false,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- ) is
- l_run ut_run;
- l_coverage_schema_names ut_varchar2_rows;
- l_paths ut_varchar2_list;
- l_random_test_order_seed positive;
- begin
- ut_event_manager.initialize();
- if a_reporters is not empty then
- for i in 1 .. a_reporters.count loop
- ut_event_manager.add_listener( a_reporters(i) );
- end loop;
- else
- ut_event_manager.add_listener( ut_documentation_reporter() );
- end if;
- ut_event_manager.add_listener( ut_session_info() );
-
- ut_event_manager.trigger_event(ut_event_manager.gc_initialize);
- ut_event_manager.trigger_event(ut_event_manager.gc_debug, ut_run_info());
-
- if a_random_test_order_seed is not null then
- l_random_test_order_seed := a_random_test_order_seed;
- elsif a_random_test_order then
- dbms_random.seed( to_char(systimestamp,'yyyyddmmhh24missffff') );
- l_random_test_order_seed := trunc(dbms_random.value(1, 1000000000));
- end if;
-
- l_paths := ut_utils.filter_list(ut_utils.string_table_to_table(a_paths,','), '.+');
- if l_paths is null or l_paths is empty then
- l_paths := ut_varchar2_list(sys_context('userenv', 'current_schema'));
- end if;
-
- begin
- ut_expectation_processor.reset_invalidation_exception();
- ut_utils.save_dbms_output_to_cache();
-
- ut_console_reporter_base.set_color_enabled(a_color_console);
-
- if a_coverage_schemes is not empty then
- l_coverage_schema_names := ut_utils.convert_collection(a_coverage_schemes);
- else
- l_coverage_schema_names := ut_suite_manager.get_schema_names(l_paths);
- end if;
-
- l_run := ut_run(
- a_run_paths => l_paths,
- a_coverage_options => ut_coverage_options(
- coverage_run_id => ut_coverage.get_coverage_run_id(),
- schema_names => l_coverage_schema_names,
- exclude_objects => ut_utils.convert_collection(a_exclude_objects),
- include_objects => ut_utils.convert_collection(a_include_objects),
- file_mappings => set(a_source_file_mappings),
- include_schema_expr => a_include_schema_expr,
- include_object_expr => a_include_object_expr,
- exclude_schema_expr => a_exclude_schema_expr,
- exclude_object_expr => a_exclude_object_expr
- ),
- a_test_file_mappings => set(a_test_file_mappings),
- a_client_character_set => a_client_character_set,
- a_random_test_order_seed => l_random_test_order_seed,
- a_run_tags => a_tags
- );
-
- ut_suite_manager.configure_execution_by_path(l_paths, l_run.items, l_random_test_order_seed, a_tags);
- if a_force_manual_rollback then
- l_run.set_rollback_type( a_rollback_type => ut_utils.gc_rollback_manual, a_force => true );
- end if;
-
- l_run.do_execute();
- finish_run(l_run, a_force_manual_rollback);
- exception
- when others then
- finish_run(l_run, a_force_manual_rollback);
- dbms_output.put_line(dbms_utility.format_error_backtrace);
- dbms_output.put_line(dbms_utility.format_error_stack);
- raise;
- end;
- if a_fail_on_errors and l_run.result in (ut_utils.gc_failure, ut_utils.gc_error) then
- raise_application_error(ut_utils.gc_some_tests_failed, 'Some tests failed');
- end if;
- end;
-
- procedure rebuild_annotation_cache(a_object_owner varchar2, a_object_type varchar2 := null) is
- begin
- ut_annotation_manager.rebuild_annotation_cache(a_object_owner, coalesce(a_object_type,'PACKAGE'));
- end;
-
- procedure purge_cache(a_object_owner varchar2 := null, a_object_type varchar2 := null) is
- begin
- ut_annotation_manager.purge_cache(a_object_owner, a_object_type);
- end;
-
- function get_suites_info(a_owner varchar2, a_package_name varchar2) return ut_suite_items_info pipelined is
- l_cursor sys_refcursor;
- l_results ut_suite_items_info;
- c_bulk_limit constant integer := 100;
- l_path varchar2(4000) := nvl(a_owner,sys_context('userenv', 'current_schema'))||'.'||nvl(a_package_name,'*');
- begin
-
- l_cursor := ut_suite_manager.get_suites_info(ut_varchar2_list(l_path));
- loop
- fetch l_cursor bulk collect into l_results limit c_bulk_limit;
- for i in 1 .. l_results.count loop
- pipe row (l_results(i));
- end loop;
- exit when l_cursor%notfound;
- end loop;
- close l_cursor;
- return;
- end;
-
- function get_suites_info(a_path varchar2 := null) return ut_suite_items_info pipelined is
- l_cursor sys_refcursor;
- l_results ut_suite_items_info;
- c_bulk_limit constant integer := 100;
- i pls_integer;
- begin
- l_cursor := ut_suite_manager.get_suites_info(ut_varchar2_list(nvl(a_path,sys_context('userenv', 'current_schema'))));
- loop
- fetch l_cursor bulk collect into l_results limit c_bulk_limit;
- i := l_results.first;
- while (i is not null) loop
- pipe row (l_results(i));
- i := l_results.next(i);
- end loop;
- exit when l_cursor%notfound;
- end loop;
- close l_cursor;
- return;
- end;
-
- function is_test(a_owner varchar2, a_package_name varchar2, a_procedure_name varchar2) return boolean is
- l_result boolean := false;
- begin
- if a_owner is not null and a_package_name is not null and a_procedure_name is not null then
-
- l_result := ut_suite_manager.suite_item_exists( a_owner, a_package_name, a_procedure_name );
-
- end if;
-
- return l_result;
- end;
-
- function is_suite(a_owner varchar2, a_package_name varchar2) return boolean is
- l_result boolean := false;
- begin
- if a_owner is not null and a_package_name is not null then
-
- l_result := ut_suite_manager.suite_item_exists( a_owner, a_package_name );
-
- end if;
-
- return l_result;
- end;
-
- function has_suites(a_owner varchar2) return boolean is
- l_result boolean := false;
- begin
- if a_owner is not null then
-
- l_result := ut_suite_manager.suite_item_exists( a_owner );
-
- end if;
-
- return l_result;
- end;
-
- function get_reporters_list return tt_reporters_info pipelined is
- l_owner varchar2(128) := upper(ut_utils.ut_owner());
- l_reporters ut_reporters_info;
- l_result t_reporter_rec;
- begin
- loop
- l_reporters := ut_utils.get_child_reporters( l_reporters );
- exit when l_reporters is null or l_reporters.count = 0;
- for i in 1 .. l_reporters.count loop
- if l_reporters(i).is_instantiable = 'Y' then
- l_result.reporter_object_name := l_owner||'.'||l_reporters(i).object_name;
- l_result.is_output_reporter := l_reporters(i).is_output_reporter;
- pipe row( l_result );
- end if;
- end loop;
- end loop;
- end;
-
- procedure coverage_start(a_coverage_run_id raw) is
- begin
- ut_coverage.coverage_start(a_coverage_run_id);
- end;
-
- procedure coverage_stop is
- begin
- ut_coverage.coverage_stop;
- end;
-
-end ut_runner;
-/
diff --git a/source/api/ut_runner.pks b/source/api/ut_runner.pks
deleted file mode 100644
index 85eff1c93..000000000
--- a/source/api/ut_runner.pks
+++ /dev/null
@@ -1,159 +0,0 @@
-create or replace package ut_runner authid current_user is
-
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- function version return varchar2;
-
- /**
- * Check if version is compatible with another version (by default the current framework version)
- * Version is compatible if:
- * a_current.major = a_requested.major
- * a_requested.minor < a_current.minor or a_requested.minor = a_current.minor and a_requested.bugfix <= a_current.bugfix
- *
- * @param a_requested requested utPLSQL version string
- * @param a_current current utPLSQL version string, if null is passed, defaults to current framework version
- * @return 1/0 1-true, 0-false
- * @exception 20214 if passed version string is not matching version pattern
- */
- function version_compatibility_check( a_requested varchar2, a_current varchar2 := null ) return integer;
-
- /**
- * Execute specified suites/tests by paths
- * @param a_paths list of schemes, packages, procedures or suite-paths to execute
- * @param a_reporters list of reporter objects (formats) to use for reporting
- * @param a_color_console true/false - should the console format reporters use ANSI color tags
- * @param a_coverage_schemes list of database schemes to include in coverage
- * @param a_source_file_mappings list of project source files mapped to DB objects that coverage should be reported on
- * @param a_test_file_mappings list of project test files mapped to DB objects that test results should be reported on
- * @param a_include_objects list of database objects (in format 'owner.name') that coverage should be reported on
- * @param a_exclude_objects list of database objects (in format 'owner.name') that coverage should be skipped for
- * @param a_fail_on_errors true/false - should an exception be thrown when tests are completed with failures/errors
- * @param a_client_character_set if provided, affects some of reporters by setting specific character set for XML/HTML reports
- * @param a_force_manual_rollback true/false - should the transaction control be forced to --%rollback(manual) and no rollback issued at the end of the run
- *
- * @example
- * Parameter `a_paths` accepts values of the following formats:
- * schema - executes all suites in the schema
- * schema:suite1[.suite2] - executes all items of suite1 (suite2) in the schema.
- * suite1.suite2 is a suitepath variable
- * schema:suite1[.suite2][.test1] - executes test1 in suite suite1.suite2
- * schema.suite1 - executes the suite package suite1 in the schema "schema"
- * all the parent suites in the hiearcy setups/teardown procedures as also executed
- * all chile items are executed
- * schema.suite1.test2 - executes test2 procedure of suite1 suite with execution of all parent setup/teardown procedures
- */
- procedure run(
- a_paths ut_varchar2_list,
- a_reporters ut_reporters,
- a_color_console boolean := false,
- a_coverage_schemes ut_varchar2_list := null,
- a_source_file_mappings ut_file_mappings := null,
- a_test_file_mappings ut_file_mappings := null,
- a_include_objects ut_varchar2_list := null,
- a_exclude_objects ut_varchar2_list := null,
- a_fail_on_errors boolean := false,
- a_client_character_set varchar2 := null,
- a_force_manual_rollback boolean := false,
- a_random_test_order boolean := false,
- a_random_test_order_seed positive := null,
- a_tags varchar2 := null,
- a_include_schema_expr varchar2 := null,
- a_include_object_expr varchar2 := null,
- a_exclude_schema_expr varchar2 := null,
- a_exclude_object_expr varchar2 := null
- );
-
- /**
- * Rebuilds annotation cache for a specified schema and object type.
- * It can be used to speedup execution of utPLSQL on a given schema
- * if it is executed before initial call made to `ut.run` or `ut_runner.run` procedure.
- *
- * @param a_object_owner owner of objects to get annotations for
- * @param a_object_type optional type of objects to get annotations for (defaults to 'PACKAGE')
- */
- procedure rebuild_annotation_cache(a_object_owner varchar2, a_object_type varchar2 := null);
-
- /**
- * Removes cached information about annotations for objects of specified type and specified owner
- *
- * @param a_object_owner optional - owner of objects to purge annotations for. If null (default) then all schemas are purged
- * @param a_object_type optional - type of objects to purge annotations for. If null (default) then cache for all object types is purged
- */
- procedure purge_cache(a_object_owner varchar2 := null, a_object_type varchar2 := null);
-
-
- /**
- * Returns a pipelined collection containing information about unit test suites and the tests contained in them
- *
- * @param a_owner owner of unit tests to retrieve (optional), if NULL, current schema is used
- * @param a_package_name name of unit test package to retrieve (optional), if NULL all unit test packages are returned
- * @return ut_suite_items_info table of objects
- */
- function get_suites_info(a_owner varchar2, a_package_name varchar2) return ut_suite_items_info pipelined;
-
- /**
- * Returns a pipelined collection containing information about unit test suites and the tests contained in them
- *
- * @param a_path a path from which we lookg for object or suite
- */
- function get_suites_info(a_path varchar2 := null) return ut_suite_items_info pipelined;
-
-
- /**
- * Returns true if given procedure is a test in a test suite, false otherwise
- *
- * @param a_owner owner of test package
- * @param a_package_name name of test package
- * @param a_procedure_name name of test procedure
- */
- function is_test(a_owner varchar2, a_package_name varchar2, a_procedure_name varchar2) return boolean;
-
- /**
- * Returns true if given package is a test suite, false otherwise
- *
- * @param a_owner owner of test package
- * @param a_package_name name of test package
- */
- function is_suite(a_owner varchar2, a_package_name varchar2) return boolean;
-
- /**
- * Returns true if given schema contains test suites, false otherwise
- *
- * @param a_owner owner of test package
- */
- function has_suites(a_owner varchar2) return boolean;
-
-
- type t_reporter_rec is record (
- reporter_object_name varchar2(250), -- full reporter name in format: owner.name
- is_output_reporter varchar2(1) -- Y/N indication of reporter providing output for API
- );
- type tt_reporters_info is table of t_reporter_rec ;
-
- /** Returns a list of available reporters. Gives information about whether a reporter is an output reporter or not
- *
- * @return tt_reporters_info
- */
- function get_reporters_list return tt_reporters_info pipelined;
-
- procedure coverage_start(a_coverage_run_id raw);
-
- procedure coverage_stop;
-
-end ut_runner;
-/
diff --git a/source/api/ut_suite_item_info.tpb b/source/api/ut_suite_item_info.tpb
deleted file mode 100644
index 3315f7a16..000000000
--- a/source/api/ut_suite_item_info.tpb
+++ /dev/null
@@ -1,42 +0,0 @@
-create or replace type body ut_suite_item_info is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- constructor function ut_suite_item_info(a_object_owner varchar2, a_object_name varchar2, a_item_name varchar2,
- a_item_description varchar2, a_item_type varchar2, a_item_line_no integer, a_path varchar2, a_disabled_flag integer,
- a_disabled_reason varchar2, a_tags ut_varchar2_rows) return self as result is
- begin
- self.object_owner := a_object_owner;
- self.object_name := a_object_name;
- self.item_name := a_item_name;
- self.item_description := a_item_description;
- self.item_type := a_item_type;
- self.item_line_no := a_item_line_no;
- self.path := a_path;
- self.disabled_flag := a_disabled_flag;
- self.disabled_reason := case when
- a_disabled_flag = 1 then a_disabled_reason
- else null
- end;
- self.tags := case
- when a_tags is null then null
- when a_tags.count = 0 then null
- else ut_utils.to_string(ut_utils.table_to_clob(a_tags,',') ,a_quote_char => null)
- end;
- return;
- end;
-end;
-/
diff --git a/source/api/ut_suite_item_info.tps b/source/api/ut_suite_item_info.tps
deleted file mode 100644
index 2c92f261d..000000000
--- a/source/api/ut_suite_item_info.tps
+++ /dev/null
@@ -1,32 +0,0 @@
-create or replace type ut_suite_item_info as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- object_owner varchar2( 250 ), -- the owner of test suite packages
- object_name varchar2( 250 ), -- the name of test suite package
- item_name varchar2( 250 ), -- the name of suite/test
- item_description varchar2( 4000 ), -- the description of suite/suite item
- item_type varchar2( 250 ), -- the type of item (UT_SUITE/UT_SUITE_CONTEXT/UT_TEST)
- item_line_no integer, -- line_number where annotation identifying the item exists
- path varchar2( 4000 ),-- suitepath of the item
- disabled_flag integer, -- 0 (zero) if item is not disabled, 1 if item is disabled by --%disabled annotation
- disabled_reason varchar2(4000), -- if disable flag is set then you can pass reason
- tags varchar2(4000),
- constructor function ut_suite_item_info(a_object_owner varchar2, a_object_name varchar2, a_item_name varchar2,
- a_item_description varchar2, a_item_type varchar2, a_item_line_no integer, a_path varchar2, a_disabled_flag integer,
- a_disabled_reason varchar2, a_tags ut_varchar2_rows) return self as result
-)
-/
diff --git a/source/api/ut_suite_items_info.tps b/source/api/ut_suite_items_info.tps
deleted file mode 100644
index 208098f9d..000000000
--- a/source/api/ut_suite_items_info.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_suite_items_info as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of ut_suite_item_info
-/
diff --git a/source/check_object_grants.sql b/source/check_object_grants.sql
deleted file mode 100644
index 5f560e6b1..000000000
--- a/source/check_object_grants.sql
+++ /dev/null
@@ -1,46 +0,0 @@
-declare
- $if dbms_db_version.version >= 18 $then
- c_expected_grants constant dbmsoutput_linesarray := dbmsoutput_linesarray('DBMS_CRYPTO');
- $else
- c_expected_grants constant dbmsoutput_linesarray := dbmsoutput_linesarray('DBMS_LOCK','DBMS_CRYPTO');
- $end
- l_missing_grants varchar2(4000);
- l_target_table varchar2(128);
- l_owner_column varchar2(128);
-
- function get_view(a_dba_view_name varchar2) return varchar2 is
- l_invalid_object_name exception;
- l_result varchar2(128) := lower(a_dba_view_name);
- pragma exception_init(l_invalid_object_name,-44002);
- begin
- l_result := dbms_assert.sql_object_name(l_result);
- return l_result;
- exception
- when l_invalid_object_name then
- return replace(l_result,'dba_','all_');
- end;
-
-begin
- l_target_table := get_view('dba_tab_privs');
- l_owner_column := case when l_target_table like 'dba%' then 'owner' else 'table_schema' end;
- execute immediate q'[
- select /*+ no_parallel */ listagg(' - '||object_name,CHR(10)) within group(order by object_name)
- from (
- select column_value as object_name
- from table(:l_expected_grants)
- minus
- select table_name as object_name
- from ]'||l_target_table||q'[
- where grantee = SYS_CONTEXT('userenv','current_schema')
- and ]'||l_owner_column||q'[ = 'SYS')]'
- into l_missing_grants using c_expected_grants;
- if l_missing_grants is not null then
- raise_application_error(
- -20000
- , 'The following object grants are missing for user "'||SYS_CONTEXT('userenv','current_schema')||'" to install utPLSQL:'||CHR(10)
- ||l_missing_grants||CHR(10)
- ||'Please read the installation documentation at http://utplsql.org/utPLSQL/'
- );
- end if;
-end;
-/
diff --git a/source/check_sys_grants.sql b/source/check_sys_grants.sql
deleted file mode 100644
index 79b657328..000000000
--- a/source/check_sys_grants.sql
+++ /dev/null
@@ -1,47 +0,0 @@
-define expected_grants = "&1"
-declare
- c_expected_grants constant dbmsoutput_linesarray := dbmsoutput_linesarray( &expected_grants );
-
- l_expected_grants dbmsoutput_linesarray := c_expected_grants;
- l_missing_grants varchar2(4000);
-begin
- if user != SYS_CONTEXT('userenv','current_schema') then
- for i in 1 .. l_expected_grants.count loop
- if l_expected_grants(i) != 'ADMINISTER DATABASE TRIGGER' then
- l_expected_grants(i) := replace(l_expected_grants(i),' ',' ANY ');
- end if;
- end loop;
- end if;
-
- with
- x as (
- select '' as remove from dual
- union all
- select ' ANY' as remove from dual
- )
- select listagg(' - '||privilege,CHR(10)) within group(order by privilege)
- into l_missing_grants
- from (
- select column_value as privilege
- from table(l_expected_grants)
- minus (
- select replace(p.privilege, x.remove) as privilege
- from role_sys_privs p
- join session_roles r using (role)
- cross join x
- union all
- select replace(p.privilege, x.remove) as privilege
- from user_sys_privs p
- cross join x
- )
- );
- if l_missing_grants is not null then
- raise_application_error(
- -20000
- , 'The following privileges are required for user "'||user||'" to install into schema "'||SYS_CONTEXT('userenv','current_schema')||'"'||CHR(10)
- ||l_missing_grants
- ||'Please read the installation documentation at http://utplsql.org/utPLSQL/'
- );
- end if;
-end;
-/
diff --git a/source/core/annotations/ut_annotated_object.tps b/source/core/annotations/ut_annotated_object.tps
deleted file mode 100644
index 3fda363fe..000000000
--- a/source/core/annotations/ut_annotated_object.tps
+++ /dev/null
@@ -1,25 +0,0 @@
-create type ut_annotated_object as object(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- object_owner varchar2(250),
- object_name varchar2(250),
- object_type varchar2(50),
- parse_time timestamp,
- annotations ut_annotations
-)
-/
-
diff --git a/source/core/annotations/ut_annotated_objects.tps b/source/core/annotations/ut_annotated_objects.tps
deleted file mode 100644
index c67c1bd53..000000000
--- a/source/core/annotations/ut_annotated_objects.tps
+++ /dev/null
@@ -1,20 +0,0 @@
-create type ut_annotated_objects as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-table of ut_annotated_object
-/
-
diff --git a/source/core/annotations/ut_annotation.tps b/source/core/annotations/ut_annotation.tps
deleted file mode 100644
index 3d0311571..000000000
--- a/source/core/annotations/ut_annotation.tps
+++ /dev/null
@@ -1,24 +0,0 @@
-create type ut_annotation as object(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- position number(5,0),
- name varchar2(1000),
- text varchar2(4000),
- subobject_name varchar2(250)
-)
-/
-
diff --git a/source/core/annotations/ut_annotation_cache.sql b/source/core/annotations/ut_annotation_cache.sql
deleted file mode 100644
index 67149ce60..000000000
--- a/source/core/annotations/ut_annotation_cache.sql
+++ /dev/null
@@ -1,25 +0,0 @@
-create table ut_annotation_cache (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- cache_id number(20,0) not null,
- annotation_position number(5,0) not null,
- annotation_name varchar2(1000) not null,
- annotation_text varchar2(4000),
- subobject_name varchar2(250),
- constraint ut_annotation_cache_pk primary key(cache_id, annotation_position),
- constraint ut_annotation_cache_fk foreign key(cache_id) references ut_annotation_cache_info(cache_id) on delete cascade
-);
-
-create index ut_annotation_cache_fk on ut_annotation_cache(cache_id);
-
diff --git a/source/core/annotations/ut_annotation_cache_info.sql b/source/core/annotations/ut_annotation_cache_info.sql
deleted file mode 100644
index 167973a04..000000000
--- a/source/core/annotations/ut_annotation_cache_info.sql
+++ /dev/null
@@ -1,24 +0,0 @@
-create table ut_annotation_cache_info (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- cache_id number(20,0) not null,
- object_owner varchar2(250) not null,
- object_name varchar2(250) not null,
- object_type varchar2(250) not null,
- parse_time timestamp not null,
- constraint ut_annotation_cache_info_pk primary key(cache_id) using index,
- constraint ut_annotation_cache_info_uk unique (object_owner, object_type, object_name) using index,
- constraint ut_annotation_cache_info_fk foreign key(object_owner, object_type) references ut_annotation_cache_schema(object_owner, object_type) on delete cascade
-) organization index;
-
diff --git a/source/core/annotations/ut_annotation_cache_manager.pkb b/source/core/annotations/ut_annotation_cache_manager.pkb
deleted file mode 100644
index e1131b3bd..000000000
--- a/source/core/annotations/ut_annotation_cache_manager.pkb
+++ /dev/null
@@ -1,226 +0,0 @@
-create or replace package body ut_annotation_cache_manager as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- procedure update_cache(a_object ut_annotated_object) is
- l_cache_id integer;
- l_timestamp timestamp := systimestamp;
- pragma autonomous_transaction;
- begin
- update /*+ no_parallel */ ut_annotation_cache_schema s
- set s.max_parse_time = l_timestamp
- where s.object_type = a_object.object_type and s.object_owner = a_object.object_owner;
-
- if sql%rowcount = 0 then
- insert /*+ no_parallel */ into ut_annotation_cache_schema s
- (object_owner, object_type, max_parse_time)
- values (a_object.object_owner, a_object.object_type, l_timestamp);
- end if;
-
- -- if not in trigger, or object has annotations
- if a_object.annotations is not null and a_object.annotations.count > 0 then
-
- update /*+ no_parallel */ ut_annotation_cache_info i
- set i.parse_time = l_timestamp
- where (i.object_owner, i.object_name, i.object_type)
- in ((a_object.object_owner, a_object.object_name, a_object.object_type))
- returning cache_id into l_cache_id;
-
- if sql%rowcount = 0 then
-
- insert /*+ no_parallel */ into ut_annotation_cache_info
- (cache_id, object_owner, object_name, object_type, parse_time)
- values (ut_annotation_cache_seq.nextval, a_object.object_owner, a_object.object_name, a_object.object_type, l_timestamp)
- returning cache_id into l_cache_id;
- end if;
-
- delete /*+ no_parallel */ from ut_annotation_cache c where cache_id = l_cache_id;
-
- insert /*+ no_parallel */ into ut_annotation_cache
- (cache_id, annotation_position, annotation_name, annotation_text, subobject_name)
- select /*+ no_parallel */ l_cache_id, a.position, a.name, a.text, a.subobject_name
- from table(a_object.annotations) a;
- elsif a_object.annotations is null or a_object.annotations.count = 0 then
- ut_annotation_cache_manager.remove_from_cache(
- ut_annotation_objs_cache_info(
- ut_annotation_obj_cache_info(a_object.object_owner, a_object.object_name, a_object.object_type, 'Y', null)
- )
- );
- end if;
- commit;
- end;
-
-
- procedure reset_objects_cache(a_objects ut_annotation_objs_cache_info) is
- l_timestamp timestamp := systimestamp;
- pragma autonomous_transaction;
- begin
-
- delete /*+ no_parallel */ from ut_annotation_cache c
- where c.cache_id
- in (select /*+ no_parallel */ i.cache_id
- from ut_annotation_cache_info i
- join table (a_objects) o
- on o.object_name = i.object_name
- and o.object_type = i.object_type
- and o.object_owner = i.object_owner
- and o.needs_refresh = 'Y'
- );
-
- update /*+ no_parallel */ ut_annotation_cache_schema s
- set s.max_parse_time = l_timestamp
- where (s.object_owner, s.object_type)
- in (
- select /*+ no_parallel */ o.object_owner, o.object_type
- from table(a_objects) o
- where o.needs_refresh = 'Y'
- );
-
- if sql%rowcount = 0 then
- insert /*+ no_parallel */ into ut_annotation_cache_schema s
- (object_owner, object_type, max_parse_time)
- select /*+ no_parallel */ distinct o.object_owner, o.object_type, l_timestamp
- from table(a_objects) o
- where o.needs_refresh = 'Y';
- end if;
-
- merge /*+ no_parallel */
- into ut_annotation_cache_info i
- using (select /*+ no_parallel */ o.object_name, o.object_type, o.object_owner
- from table(a_objects) o
- where o.needs_refresh = 'Y'
- ) o
- on (o.object_name = i.object_name
- and o.object_type = i.object_type
- and o.object_owner = i.object_owner)
- when matched then
- update
- set parse_time = l_timestamp
- when not matched then insert
- (cache_id, object_owner, object_name, object_type, parse_time)
- values (ut_annotation_cache_seq.nextval, o.object_owner, o.object_name, o.object_type, l_timestamp);
-
- commit;
- end;
-
- function get_cached_objects_list(a_object_owner varchar2, a_object_type varchar2, a_parsed_after timestamp := null) return ut_annotation_objs_cache_info is
- l_result ut_annotation_objs_cache_info;
- begin
- select /*+ no_parallel */ ut_annotation_obj_cache_info(
- object_owner => i.object_owner,
- object_name => i.object_name,
- object_type => i.object_type,
- needs_refresh => 'N',
- parse_time => i.parse_time
- )
- bulk collect into l_result
- from ut_annotation_cache_info i
- where i.object_owner = a_object_owner
- and i.object_type = a_object_type
- and (i.parse_time > a_parsed_after or a_parsed_after is null);
- return l_result;
- end;
-
- function get_cache_schema_info(a_object_owner varchar2, a_object_type varchar2) return t_cache_schema_info is
- l_result t_cache_schema_info;
- begin
- begin
- select /*+ no_parallel */ *
- into l_result
- from ut_annotation_cache_schema s
- where s.object_type = a_object_type and s.object_owner = a_object_owner;
- exception
- when no_data_found then
- null;
- end;
- return l_result;
- end;
-
- procedure set_fully_refreshed(a_object_owner varchar2, a_object_type varchar2) is
- pragma autonomous_transaction;
- begin
- update /*+ no_parallel */ ut_annotation_cache_schema s
- set s.full_refresh_time = s.max_parse_time
- where s.object_owner = a_object_owner
- and s.object_type = a_object_type;
- commit;
- end;
-
- procedure remove_from_cache(a_objects ut_annotation_objs_cache_info) is
- pragma autonomous_transaction;
- begin
-
- delete /*+ no_parallel */ from ut_annotation_cache_info i
- where exists (
- select /*+ no_parallel */ 1 from table (a_objects) o
- where o.object_name = i.object_name
- and o.object_type = i.object_type
- and o.object_owner = i.object_owner
- );
-
- commit;
- end;
-
- function get_annotations_parsed_since(a_object_owner varchar2, a_object_type varchar2, a_parsed_after timestamp) return sys_refcursor is
- l_results sys_refcursor;
- begin
- open l_results for
- select /*+ no_parallel */ ut_annotated_object(
- i.object_owner, i.object_name, i.object_type, i.parse_time,
- cast(
- collect(
- ut_annotation(
- c.annotation_position, c.annotation_name, c.annotation_text, c.subobject_name
- ) order by c.annotation_position
- ) as ut_annotations
- )
- ) as annotated_object
- from ut_annotation_cache_info i
- join ut_annotation_cache c on i.cache_id = c.cache_id
- where i.object_owner = a_object_owner and i.object_type = a_object_type
- and (i.parse_time > a_parsed_after or a_parsed_after is null)
- group by i.object_owner, i.object_type, i.object_name, i.parse_time;
- return l_results;
- end;
-
- procedure purge_cache(a_object_owner varchar2, a_object_type varchar2) is
- l_filter varchar2(32767);
- l_cache_filter varchar2(32767);
- pragma autonomous_transaction;
- begin
- if a_object_owner is null and a_object_type is null then
- l_filter := ':a_object_owner is null and :a_object_type is null';
- l_cache_filter := l_filter;
- else
- l_filter := case when a_object_owner is null then ':a_object_owner is null' else 'object_owner = :a_object_owner' end;
- l_filter := l_filter || ' and ' || case when a_object_type is null then ':a_object_type is null' else 'object_type = :a_object_type' end;
- l_cache_filter := ' c.cache_id in (select /*+ no_parallel */ i.cache_id from ut_annotation_cache_info i where ' || l_filter || ' )';
- end if;
- execute immediate 'delete /*+ no_parallel */ from ut_annotation_cache c where ' || l_cache_filter
- using a_object_owner, a_object_type;
-
- execute immediate ' delete /*+ no_parallel */ from ut_annotation_cache_info i where ' || l_filter
- using a_object_owner, a_object_type;
-
- execute immediate ' delete /*+ no_parallel */ from ut_annotation_cache_schema s where ' || l_filter
- using a_object_owner, a_object_type;
-
- commit;
- end;
-
-end;
-/
diff --git a/source/core/annotations/ut_annotation_cache_manager.pks b/source/core/annotations/ut_annotation_cache_manager.pks
deleted file mode 100644
index 1e9734934..000000000
--- a/source/core/annotations/ut_annotation_cache_manager.pks
+++ /dev/null
@@ -1,72 +0,0 @@
-create or replace package ut_annotation_cache_manager authid definer as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- subtype t_cache_schema_info is ut_annotation_cache_schema%rowtype;
-
- /**
- * Populates cache with information about object and it's annotations
- * Cache information for individual object is modified by this code
- * We do not pass a collection here to avoid excessive memory usage
- * when dealing with large number of objects
- *
- * @param a_object a `ut_annotated_object` containing object name, type, owner and `ut_annotations`
- */
- procedure update_cache(a_object ut_annotated_object);
-
- /**
- * Returns a ref_cursor containing `ut_annotated_object` as result
- * Range of data returned is limited by the input collection o cache object info
- *
- * @param a_cached_objects - list of `ut_annotation_objs_cache_info` containing objects to get from cache
- * @param a_min_parse_time - limit results to annotations parsed after specified time only,
- * if null - all cached annotations for given objects are returned
- */
- function get_annotations_parsed_since(a_object_owner varchar2, a_object_type varchar2, a_parsed_after timestamp) return sys_refcursor;
-
- procedure set_fully_refreshed(a_object_owner varchar2, a_object_type varchar2);
-
- function get_cache_schema_info(a_object_owner varchar2, a_object_type varchar2) return t_cache_schema_info;
-
- /**
- * Returns information about all objects stored in annotation cache
- */
- function get_cached_objects_list(a_object_owner varchar2, a_object_type varchar2, a_parsed_after timestamp := null) return ut_annotation_objs_cache_info;
-
- /**
- * Resets cached information about annotations for objects on the list and updates parse_time in cache info table.
- *
- * @param a_objects a `ut_annotation_objs_cache_info` list with information about objects to remove annotations for
- */
- procedure reset_objects_cache(a_objects ut_annotation_objs_cache_info);
-
- /**
- * Removes information about objects on the list
- *
- * @param a_objects a `ut_annotation_objs_cache_info` list with information about objects to remove from cache
- */
- procedure remove_from_cache(a_objects ut_annotation_objs_cache_info);
-
- /**
- * Removes cached information about annotations for objects of specified type and specified owner
- *
- * @param a_object_owner owner of objects to purge annotations for
- * @param a_object_type type of objects to purge annotations for
- */
- procedure purge_cache(a_object_owner varchar2, a_object_type varchar2);
-
-end;
-/
diff --git a/source/core/annotations/ut_annotation_cache_schema.sql b/source/core/annotations/ut_annotation_cache_schema.sql
deleted file mode 100644
index 8889b9abf..000000000
--- a/source/core/annotations/ut_annotation_cache_schema.sql
+++ /dev/null
@@ -1,21 +0,0 @@
-create table ut_annotation_cache_schema (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- object_owner varchar2(250) not null,
- object_type varchar2(250) not null,
- max_parse_time date not null,
- full_refresh_time timestamp,
- constraint ut_annotation_cache_schema_pk primary key(object_owner, object_type)
-) organization index;
-
diff --git a/source/core/annotations/ut_annotation_cache_seq.sql b/source/core/annotations/ut_annotation_cache_seq.sql
deleted file mode 100644
index b371b382b..000000000
--- a/source/core/annotations/ut_annotation_cache_seq.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-create sequence ut_annotation_cache_seq
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-cache 100;
-
diff --git a/source/core/annotations/ut_annotation_manager.pkb b/source/core/annotations/ut_annotation_manager.pkb
deleted file mode 100644
index 65f7b3e40..000000000
--- a/source/core/annotations/ut_annotation_manager.pkb
+++ /dev/null
@@ -1,326 +0,0 @@
-create or replace package body ut_annotation_manager as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- ------------------------------
- --private definitions
-
- function user_can_see_whole_schema( a_schema_name varchar2 ) return boolean is
- begin
- return sys_context('userenv','current_user') = a_schema_name
- or ut_metadata.user_has_execute_any_proc()
- or ut_metadata.is_object_visible('dba_objects');
- end;
-
- function get_non_existing_objects( a_object_owner varchar2, a_object_type varchar2 ) return ut_annotation_objs_cache_info is
- l_objects_view varchar2(200) := ut_metadata.get_objects_view_name();
- l_object_to_delete ut_annotation_objs_cache_info := ut_annotation_objs_cache_info();
- l_cached_objects ut_annotation_objs_cache_info;
- begin
- l_cached_objects := ut_annotation_cache_manager.get_cached_objects_list( a_object_owner, a_object_type );
-
- if l_cached_objects is not empty then
- execute immediate 'select /*+ no_parallel cardinality(i '||ut_utils.scale_cardinality(cardinality(l_cached_objects))||') */
- value(i)
- from table( :l_data ) i
- where
- not exists (
- select 1 from '||l_objects_view||q'[ o
- where o.owner = i.object_owner
- and o.object_name = i.object_name
- and o.object_type = i.object_type
- and o.owner = ']'||ut_utils.qualified_sql_name(a_object_owner)||q'['
- and o.object_type = ']'||ut_utils.qualified_sql_name(a_object_type)||q'['
- )]'
- bulk collect into l_object_to_delete
- using l_cached_objects;
- end if;
- return l_object_to_delete;
- end;
-
- function get_objects_to_refresh(
- a_object_owner varchar2,
- a_object_type varchar2,
- a_modified_after timestamp
- ) return ut_annotation_objs_cache_info is
- l_ut_owner varchar2(250) := ut_utils.ut_owner;
- l_refresh_needed boolean;
- l_objects_view varchar2(200) := ut_metadata.get_objects_view_name();
- l_cached_objects ut_annotation_objs_cache_info;
- l_result ut_annotation_objs_cache_info := ut_annotation_objs_cache_info();
- begin
- ut_event_manager.trigger_event( 'get_objects_to_refresh - start', ut_key_anyvalues().put('ut_trigger_check.is_alive()',ut_trigger_check.is_alive()) );
-
- l_refresh_needed := ( ut_trigger_check.is_alive() = false ) or a_modified_after is null;
- if l_refresh_needed then
- --limit the list to objects that exist and are visible to the invoking user
- --enrich the list by info about cache validity
- l_cached_objects := ut_annotation_cache_manager.get_cached_objects_list( a_object_owner, a_object_type, a_modified_after );
- execute immediate
- 'select /*+ no_parallel cardinality(i '||ut_utils.scale_cardinality(cardinality(l_cached_objects))||') */
- '||l_ut_owner||q'[.ut_annotation_obj_cache_info(
- object_owner => o.owner,
- object_name => o.object_name,
- object_type => o.object_type,
- needs_refresh => 'Y',
- parse_time => c.parse_time
- )
- from ]'||l_objects_view||' o
- left join table( cast(:l_cached_objects as '||l_ut_owner||q'[.ut_annotation_objs_cache_info ) ) c
- on o.owner = c.object_owner
- and o.object_name = c.object_name
- and o.object_type = c.object_type
- where o.owner = ']'||ut_utils.qualified_sql_name(a_object_owner)||q'['
- and o.object_type = ']'||ut_utils.qualified_sql_name(a_object_type)||q'['
- and case when o.last_ddl_time < cast(c.parse_time as date) then 'N' else 'Y' end = 'Y'
- and ]'
- || case
- when a_modified_after is null
- then ':a_modified_after is null'
- else 'o.last_ddl_time >= cast(:a_modified_after as date)'
- end
- bulk collect into l_result using l_cached_objects, a_modified_after;
- end if;
- ut_event_manager.trigger_event('get_objects_to_refresh - end (count='||l_result.count||')');
- return l_result;
- end;
-
- function get_sources_to_annotate(a_object_owner varchar2, a_object_type varchar2, a_objects_to_refresh ut_annotation_objs_cache_info) return sys_refcursor is
- l_result sys_refcursor;
- l_sources_view varchar2(200) := ut_metadata.get_source_view_name();
- l_card natural;
- begin
- l_card := ut_utils.scale_cardinality(cardinality(a_objects_to_refresh));
- open l_result for
- q'[select /*+ no_parallel */ x.name, x.text
- from (select /*+ cardinality( r ]'||l_card||q'[ )*/
- s.name, s.text, s.line,
- max(case when s.text like '%--%\%%' escape '\'
- and regexp_like(s.text,'^\s*--\s*%')
- then 'Y' else 'N' end
- )
- over(partition by s.name) is_annotated
- from table(:a_objects_to_refresh) r
- join ]'||l_sources_view||q'[ s
- on s.name = r.object_name
- and s.owner = r.object_owner
- and s.type = r.object_type
- where s.owner = ']'||ut_utils.qualified_sql_name(a_object_owner)||q'['
- and s.type = ']'||ut_utils.qualified_sql_name(a_object_type)||q'['
- ) x
- where x.is_annotated = 'Y'
- order by x.name, x.line]'
- using a_objects_to_refresh;
-
- return l_result;
- end;
-
- procedure build_annot_cache_for_sources(
- a_object_owner varchar2,
- a_object_type varchar2,
- a_sources_cursor sys_refcursor
- ) is
- l_annotations ut_annotations;
- c_lines_fetch_limit constant integer := 10000;
- l_lines dbms_preprocessor.source_lines_t;
- l_names dbms_preprocessor.source_lines_t;
- l_name varchar2(250);
- l_object_lines dbms_preprocessor.source_lines_t;
- l_parse_time date := sysdate;
- pragma autonomous_transaction;
- begin
- loop
- fetch a_sources_cursor bulk collect into l_names, l_lines limit c_lines_fetch_limit;
- for i in 1 .. l_names.count loop
- if l_names(i) != l_name then
- l_annotations := ut_annotation_parser.parse_object_annotations(l_object_lines, a_object_type);
- ut_annotation_cache_manager.update_cache(
- ut_annotated_object(a_object_owner, l_name, a_object_type, l_parse_time, l_annotations)
- );
- l_object_lines.delete;
- end if;
-
- l_name := l_names(i);
- l_object_lines(l_object_lines.count+1) := l_lines(i);
- end loop;
- exit when a_sources_cursor%notfound;
-
- end loop;
- if a_sources_cursor%rowcount > 0 then
- l_annotations := ut_annotation_parser.parse_object_annotations(l_object_lines, a_object_type);
- ut_annotation_cache_manager.update_cache(
- ut_annotated_object(a_object_owner, l_name, a_object_type, l_parse_time, l_annotations)
- );
- l_object_lines.delete;
- end if;
- close a_sources_cursor;
- end;
-
-
- procedure validate_annotation_cache(
- a_object_owner varchar2,
- a_object_type varchar2,
- a_modified_after timestamp := null
- ) is
- l_objects_to_refresh ut_annotation_objs_cache_info;
- l_modified_after timestamp := a_modified_after;
- begin
- if ut_annotation_cache_manager.get_cache_schema_info(a_object_owner, a_object_type).full_refresh_time is null then
- l_modified_after := null;
- end if;
-
- l_objects_to_refresh := get_objects_to_refresh(a_object_owner, a_object_type, l_modified_after);
-
- ut_event_manager.trigger_event('validate_annotation_cache - start (l_objects_to_refresh.count = '||l_objects_to_refresh.count||')');
-
-
- if user_can_see_whole_schema( a_object_owner ) then
- --Remove non existing objects from cache only when user can see whole schema
- ut_annotation_cache_manager.remove_from_cache( get_non_existing_objects( a_object_owner, a_object_type ) );
- end if;
-
- --if some source needs parsing and putting into cache
- if l_objects_to_refresh.count > 0 then
- --Delete annotations for objects that are to be refreshed
- ut_annotation_cache_manager.reset_objects_cache(l_objects_to_refresh);
- --Rebuild cache from objects source
- build_annot_cache_for_sources(
- a_object_owner, a_object_type,
- get_sources_to_annotate(a_object_owner, a_object_type, l_objects_to_refresh)
- );
- end if;
-
- if l_modified_after is null then
- if user_can_see_whole_schema( a_object_owner ) then
- ut_annotation_cache_manager.set_fully_refreshed( a_object_owner, a_object_type );
- else
- -- if user cannot see full schema - we dont mark it as fully refreshed
- -- it will get refreshed each time until someone with proper privs will refresh it
- null;
- end if;
- end if;
- ut_event_manager.trigger_event('validate_annotation_cache - end');
- end;
-
- ------------------------------------------------------------
- --public definitions
- ------------------------------------------------------------
- procedure rebuild_annotation_cache(a_object_owner varchar2, a_object_type varchar2) is
- begin
- validate_annotation_cache( a_object_owner, a_object_type );
- end;
-
- procedure trigger_obj_annotation_rebuild is
- l_sql_text ora_name_list_t;
- l_parts binary_integer;
- l_restricted_users ora_name_list_t;
-
- function get_source_from_sql_text(a_object_name varchar2, a_sql_text ora_name_list_t, a_parts binary_integer) return sys_refcursor is
- l_sql_clob clob;
- l_sql_lines ut_varchar2_rows := ut_varchar2_rows();
- l_result sys_refcursor;
- begin
- if a_parts > 0 then
- for i in 1..a_parts loop
- ut_utils.append_to_clob(l_sql_clob, a_sql_text(i));
- end loop;
- l_sql_clob := ut_utils.replace_multiline_comments(l_sql_clob);
- -- replace comment lines that contain "-- create or replace"
- l_sql_clob := regexp_replace(l_sql_clob, '^.*[-]{2,}\s*create(\s+or\s+replace).*$', modifier => 'mi');
- -- remove the "create [or replace] [[non]editionable] " so that we have only "type|package" for parsing
- -- needed for dbms_preprocessor
- l_sql_clob := regexp_replace(l_sql_clob, '^(.*?\s*create(\s+or\s+replace)?(\s+(editionable|noneditionable))?\s+?)((package|type).*)', '\5', 1, 1, 'ni');
- -- remove "OWNER." from create or replace statement.
- -- Owner is not supported along with AUTHID - see issue https://github.com/utPLSQL/utPLSQL/issues/1088
- l_sql_clob := regexp_replace(l_sql_clob, '^(package|type)\s+("?[[:alpha:]][[:alnum:]$#_]*"?\.)(.*)', '\1 \3', 1, 1, 'ni');
- l_sql_lines := ut_utils.convert_collection( ut_utils.clob_to_table(l_sql_clob) );
- end if;
- open l_result for
- select /*+ no_parallel */ a_object_name as name, column_value||chr(10) as text from table(l_sql_lines);
- return l_result;
- end;
-
- function get_source_for_object(a_object_owner varchar2, a_object_name varchar2, a_object_type varchar2) return sys_refcursor is
- l_result sys_refcursor;
- l_sources_view varchar2(200) := ut_metadata.get_source_view_name();
- begin
- open l_result for
- q'[select /*+ no_parallel */ :a_object_name, s.text
- from ]'||l_sources_view||q'[ s
- where s.type = :a_object_type
- and s.owner = :a_object_owner
- and s.name = :a_object_name
- order by s.line]'
- using a_object_name, a_object_type, a_object_owner, a_object_name;
- return l_result;
- end;
-
- begin
- if ora_dict_obj_type in ('PACKAGE','PROCEDURE','FUNCTION','TYPE') then
- $if dbms_db_version.version < 12 $then
- l_restricted_users := ora_name_list_t(
- 'ANONYMOUS','APPQOSSYS','AUDSYS','DBSFWUSER','DBSNMP','DIP','GGSYS','GSMADMIN_INTERNAL',
- 'GSMCATUSER','GSMUSER','ORACLE_OCM','OUTLN','REMOTE_SCHEDULER_AGENT','SYS','SYS$UMF',
- 'SYSBACKUP','SYSDG','SYSKM','SYSRAC','SYSTEM','WMSYS','XDB','XS$NULL');
- $else
- select /*+ no_parallel */ username bulk collect into l_restricted_users
- from all_users where oracle_maintained = 'Y';
- $end
- if ora_dict_obj_owner member of l_restricted_users then
- return;
- end if;
-
- if ora_sysevent = 'CREATE' then
- l_parts := ORA_SQL_TXT(l_sql_text);
- build_annot_cache_for_sources(
- ora_dict_obj_owner, ora_dict_obj_type,
- get_source_from_sql_text(ora_dict_obj_name, l_sql_text, l_parts)
- );
- elsif ora_sysevent = 'ALTER' then
- build_annot_cache_for_sources(
- ora_dict_obj_owner, ora_dict_obj_type,
- get_source_for_object(ora_dict_obj_owner, ora_dict_obj_name, ora_dict_obj_type)
- );
- elsif ora_sysevent = 'DROP' then
- ut_annotation_cache_manager.remove_from_cache(
- ut_annotation_objs_cache_info(
- ut_annotation_obj_cache_info(ora_dict_obj_owner, ora_dict_obj_name, ora_dict_obj_type, 'Y', null)
- )
- );
- end if;
- end if;
- end;
-
- function get_annotated_objects(a_object_owner varchar2, a_object_type varchar2, a_modified_after timestamp) return sys_refcursor is
- l_cursor sys_refcursor;
- begin
- ut_event_manager.trigger_event('get_annotated_objects - start: a_modified_after='||ut_utils.to_string(a_modified_after));
- validate_annotation_cache(a_object_owner, a_object_type, a_modified_after);
-
- --pipe annotations from cache
- l_cursor := ut_annotation_cache_manager.get_annotations_parsed_since(a_object_owner, a_object_type, a_modified_after);
- ut_event_manager.trigger_event('get_annotated_objects - end');
- return l_cursor;
- end;
-
- procedure purge_cache(a_object_owner varchar2, a_object_type varchar2) is
- begin
- ut_annotation_cache_manager.purge_cache(a_object_owner, a_object_type);
- end;
-
-end;
-/
diff --git a/source/core/annotations/ut_annotation_manager.pks b/source/core/annotations/ut_annotation_manager.pks
deleted file mode 100644
index 20fcd810f..000000000
--- a/source/core/annotations/ut_annotation_manager.pks
+++ /dev/null
@@ -1,60 +0,0 @@
-create or replace package ut_annotation_manager authid current_user as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Builds annotations out of database source code by reading it from cache
- */
-
- /**
- * Gets annotations for all objects of a specified type for database schema.
- * Annotations that are stale or missing are parsed and placed in persistent cache.
- * After placing in cache, annotation data is returned as ref_cursor.
- *
- * @param a_object_owner owner of objects to get annotations for
- * @param a_object_type type of objects to get annotations for
- * @param a_modified_after return only objects modified after thr timestamp
- * @return cursor containing annotated objects along with annotations for each object (nested)
- */
- function get_annotated_objects(a_object_owner varchar2, a_object_type varchar2, a_modified_after timestamp) return sys_refcursor;
-
- /**
- * Rebuilds annotation cache for a specified schema and object type.
- * It can be used to speedup initial execution of utPLSQL on a given schema
- * if it is executed before any call is made to `ut.run` or `ut_runner.run` procedure.
- *
- * @param a_object_owner owner of objects to get annotations for
- * @param a_object_type type of objects to get annotations for
- */
- procedure rebuild_annotation_cache(a_object_owner varchar2, a_object_type varchar2);
-
- /**
- * Rebuilds annotation cache for a specified object.
- */
- procedure trigger_obj_annotation_rebuild;
-
- /**
- * Removes cached information about annotations for objects of specified type and specified owner
- *
- * @param a_object_owner owner of objects to purge annotations for
- * @param a_object_type type of objects to purge annotations for
- */
- procedure purge_cache(a_object_owner varchar2, a_object_type varchar2);
-
-
-end;
-/
diff --git a/source/core/annotations/ut_annotation_obj_cache_info.tps b/source/core/annotations/ut_annotation_obj_cache_info.tps
deleted file mode 100644
index 1db3fd190..000000000
--- a/source/core/annotations/ut_annotation_obj_cache_info.tps
+++ /dev/null
@@ -1,24 +0,0 @@
-create type ut_annotation_obj_cache_info as object(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- object_owner varchar2(250),
- object_name varchar2(250),
- object_type varchar2(250),
- needs_refresh varchar2(1),
- parse_time timestamp
- )
-/
diff --git a/source/core/annotations/ut_annotation_objs_cache_info.tps b/source/core/annotations/ut_annotation_objs_cache_info.tps
deleted file mode 100644
index fc96e7d25..000000000
--- a/source/core/annotations/ut_annotation_objs_cache_info.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create type ut_annotation_objs_cache_info as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-table of ut_annotation_obj_cache_info
-/
diff --git a/source/core/annotations/ut_annotation_parser.pkb b/source/core/annotations/ut_annotation_parser.pkb
deleted file mode 100644
index 10bb76b3c..000000000
--- a/source/core/annotations/ut_annotation_parser.pkb
+++ /dev/null
@@ -1,252 +0,0 @@
-create or replace package body ut_annotation_parser as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- ------------------------------
- --private definitions
-
- type tt_comment_list is table of varchar2(32767) index by binary_integer;
-
- gc_annotation_qualifier constant varchar2(1) := '%';
- gc_annot_comment_pattern constant varchar2(30) := '^( |'||chr(09)||')*-- *('||gc_annotation_qualifier||'.*?)$'; -- chr(09) is a tab character
- gc_comment_replacer_patter constant varchar2(50) := '{COMMENT#%N%}';
- gc_comment_replacer_regex_ptrn constant varchar2(25) := '{COMMENT#(\d+)}';
- gc_regexp_identifier constant varchar2(50) := '[[:alpha:]][[:alnum:]$#_]*';
- gc_annotation_block_pattern constant varchar2(200) := '(({COMMENT#.+}'||chr(10)||')+)( |'||chr(09)||')*(procedure|function)\s+(' ||
- gc_regexp_identifier || ')';
- gc_annotation_pattern constant varchar2(50) := gc_annotation_qualifier || gc_regexp_identifier || '[ '||chr(9)||']*(\(.*?\)\s*?$)?';
-
-
- procedure add_annotation(
- a_annotations in out nocopy ut_annotations,
- a_position positiven,
- a_comment varchar2,
- a_subobject_name varchar2 := null
- ) is
- l_annotation_str varchar2(32767);
- l_annotation_text varchar2(32767);
- l_annotation_name varchar2(1000);
- begin
- -- strip everything except the annotation itself (spaces and others)
- l_annotation_str := regexp_substr(a_comment, gc_annotation_pattern, 1, 1, modifier => 'i');
- if l_annotation_str is not null then
-
- -- get the annotation name and it's parameters if present
- l_annotation_name := lower(regexp_substr(l_annotation_str ,'%(' || gc_regexp_identifier || ')', subexpression => 1));
- l_annotation_text := trim(regexp_substr(l_annotation_str, '\((.*?)\)\s*$', subexpression => 1));
-
- a_annotations.extend;
- a_annotations( a_annotations.last) :=
- ut_annotation(a_position, l_annotation_name, l_annotation_text, a_subobject_name);
- end if;
- end;
-
- procedure delete_processed_comments( a_comments in out nocopy tt_comment_list, a_annotations ut_annotations ) is
- l_loop_index binary_integer := 1;
- begin
- l_loop_index := a_annotations.first;
- while l_loop_index is not null loop
- a_comments.delete( a_annotations(l_loop_index).position );
- l_loop_index := a_annotations.next( l_loop_index );
- end loop;
- end;
-
- procedure add_annotations(
- a_annotations in out nocopy ut_annotations,
- a_source varchar2,
- a_comments tt_comment_list,
- a_subobject_name varchar2 := null
- ) is
- l_loop_index binary_integer := 1;
- l_annotation_index binary_integer;
- begin
- -- loop while there are unprocessed comment blocks
- while 0 != nvl(regexp_instr(srcstr => a_source
- ,pattern => gc_comment_replacer_regex_ptrn
- ,occurrence => l_loop_index
- ,subexpression => 1)
- ,0) loop
-
- -- define index of the comment block and get it's content from cache
- l_annotation_index := regexp_substr( a_source ,gc_comment_replacer_regex_ptrn ,1 ,l_loop_index ,subexpression => 1);
- add_annotation( a_annotations, l_annotation_index, a_comments( l_annotation_index ), a_subobject_name );
- l_loop_index := l_loop_index + 1;
- end loop;
-
- end add_annotations;
-
- procedure add_procedure_annotations(a_annotations in out nocopy ut_annotations, a_source clob, a_comments in out nocopy tt_comment_list) is
- l_proc_comments varchar2(32767);
- l_proc_name varchar2(250);
- l_annot_proc_ind number;
- l_annot_proc_block varchar2(32767);
- begin
- -- loop through procedures and functions of the package and get all the comment blocks just before it's declaration
- l_annot_proc_ind := 1;
- loop
- --find annotated procedure index
- l_annot_proc_ind := regexp_instr(srcstr => a_source
- ,pattern => gc_annotation_block_pattern
- ,occurrence => 1
- ,modifier => 'i'
- ,position => l_annot_proc_ind);
- exit when l_annot_proc_ind = 0;
-
- --get the annotations with procedure name
- l_annot_proc_block := regexp_substr(srcstr => a_source
- ,pattern => gc_annotation_block_pattern
- ,position => l_annot_proc_ind
- ,occurrence => 1
- ,modifier => 'i');
-
- --extract the annotations
- l_proc_comments := trim(regexp_substr(srcstr => l_annot_proc_block
- ,pattern => gc_annotation_block_pattern
- ,modifier => 'i'
- ,subexpression => 1));
- --extract the procedure name
- l_proc_name := trim(regexp_substr(srcstr => l_annot_proc_block
- ,pattern => gc_annotation_block_pattern
- ,modifier => 'i'
- ,subexpression => 5));
-
- -- parse the comment block for the syntactically correct annotations and store them as an array
- add_annotations(a_annotations, l_proc_comments, a_comments, l_proc_name);
-
- l_annot_proc_ind := instr(a_source, ';', l_annot_proc_ind + length(l_annot_proc_block) );
- end loop;
- end add_procedure_annotations;
-
- function extract_and_replace_comments(a_source in out nocopy clob) return tt_comment_list is
- l_comments tt_comment_list;
- l_comment_pos binary_integer;
- l_comment_line binary_integer;
- l_comment_replacer varchar2(50);
- l_source clob := a_source;
- begin
- l_comment_pos := 1;
- loop
-
- l_comment_pos := regexp_instr(srcstr => a_source
- ,pattern => gc_annot_comment_pattern
- ,occurrence => 1
- ,modifier => 'm'
- ,position => l_comment_pos);
-
- exit when l_comment_pos = 0;
-
- -- position index is shifted by 1 because gc_annot_comment_pattern contains ^ as first sign
- -- but after instr index already points to the char on that line
- l_comment_pos := l_comment_pos-1;
- l_comment_line := length(substr(a_source,1,l_comment_pos))-length(replace(substr(a_source,1,l_comment_pos),chr(10)))+1;
- l_comments(l_comment_line) := trim(regexp_substr(srcstr => a_source
- ,pattern => gc_annot_comment_pattern
- ,occurrence => 1
- ,position => l_comment_pos
- ,modifier => 'm'
- ,subexpression => 2));
-
- l_comment_replacer := replace(gc_comment_replacer_patter, '%N%', l_comment_line);
-
- l_source := regexp_replace(srcstr => a_source
- ,pattern => gc_annot_comment_pattern
- ,replacestr => l_comment_replacer
- ,position => l_comment_pos
- ,occurrence => 1
- ,modifier => 'm');
- dbms_lob.freetemporary(a_source);
- a_source := l_source;
- dbms_lob.freetemporary(l_source);
- l_comment_pos := l_comment_pos + length(l_comment_replacer);
-
- end loop;
-
- ut_utils.debug_log(a_source);
- return l_comments;
- end extract_and_replace_comments;
-
- ------------------------------------------------------------
- --public definitions
- ------------------------------------------------------------
-
- function parse_object_annotations(a_source clob) return ut_annotations is
- l_source clob := a_source;
- l_comments tt_comment_list;
- l_annotations ut_annotations := ut_annotations();
- l_result ut_annotations;
- l_comment_index positive;
- begin
-
- l_source := ut_utils.replace_multiline_comments(l_source);
-
- -- replace all single line comments with {COMMENT#12} element and store it's content for easier processing
- -- this call modifies l_source
- l_comments := extract_and_replace_comments(l_source);
-
- add_procedure_annotations(l_annotations, l_source, l_comments);
-
- delete_processed_comments(l_comments, l_annotations);
-
- --at this point, only the comments not related to procedures are left, so we process them all as top-level
- l_comment_index := l_comments.first;
- while l_comment_index is not null loop
- add_annotation( l_annotations, l_comment_index, l_comments( l_comment_index ) );
- l_comment_index := l_comments.next(l_comment_index);
- end loop;
-
- dbms_lob.freetemporary(l_source);
-
- select /*+ no_parallel */ value(x) bulk collect into l_result from table(l_annotations) x order by x.position;
-
- return l_result;
- end parse_object_annotations;
-
- function parse_object_annotations(a_source_lines dbms_preprocessor.source_lines_t, a_object_type varchar2) return ut_annotations is
- l_processed_lines dbms_preprocessor.source_lines_t;
- l_source clob;
- l_annotations ut_annotations := ut_annotations();
- ex_package_is_wrapped exception;
- pragma exception_init(ex_package_is_wrapped, -24241);
- source_text_is_empty exception;
- pragma exception_init(source_text_is_empty, -24236);
- begin
- if a_source_lines.count > 0 then
- --convert to post-processed source clob
- begin
- --get post-processed source
- if a_object_type = 'TYPE' then
- l_processed_lines := a_source_lines;
- else
- l_processed_lines := sys.dbms_preprocessor.get_post_processed_source(a_source_lines);
- end if;
- --convert to clob
- for i in 1..l_processed_lines.count loop
- ut_utils.append_to_clob(l_source, replace(l_processed_lines(i), chr(13)||chr(10), chr(10)));
- end loop;
- --parse annotations
- l_annotations := parse_object_annotations(l_source);
- dbms_lob.freetemporary(l_source);
- exception
- when ex_package_is_wrapped or source_text_is_empty then
- null;
- end;
- end if;
- return l_annotations;
- end;
-
-end;
-/
diff --git a/source/core/annotations/ut_annotation_parser.pks b/source/core/annotations/ut_annotation_parser.pks
deleted file mode 100644
index 2f474c883..000000000
--- a/source/core/annotations/ut_annotation_parser.pks
+++ /dev/null
@@ -1,44 +0,0 @@
-create or replace package ut_annotation_parser authid current_user as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Parses the source passed as input parameter and returns annotations
- */
-
- /**
- * Runs the source lines through dbms_preprocessor to remove lines that were not compiled (conditional compilation)
- * Parses the processed source code and converts it to annotations
- *
- * @param a_source_lines ordered lines of source code to be parsed
- * @return array containing annotations
- */
- function parse_object_annotations(a_source_lines dbms_preprocessor.source_lines_t, a_object_type varchar2) return ut_annotations;
-
-
- /**
- *
- * @private
- * Parses source code and converts it to annotations
- *
- * @param a_source_lines ordered lines of source code to be parsed
- * @return array containing annotations
- */
- function parse_object_annotations(a_source clob) return ut_annotations;
-
-end;
-/
diff --git a/source/core/annotations/ut_annotations.tps b/source/core/annotations/ut_annotations.tps
deleted file mode 100644
index a6579d236..000000000
--- a/source/core/annotations/ut_annotations.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create type ut_annotations
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-as table of ut_annotation
-/
diff --git a/source/core/annotations/ut_trigger_annotation_parsing.trg b/source/core/annotations/ut_trigger_annotation_parsing.trg
deleted file mode 100644
index 437b7742d..000000000
--- a/source/core/annotations/ut_trigger_annotation_parsing.trg
+++ /dev/null
@@ -1,18 +0,0 @@
-create or replace trigger ut_trigger_annotation_parsing
- after create or alter or drop
-on database
-begin
- if (ora_dict_obj_owner = UPPER('&&UT3_OWNER')
- and ora_dict_obj_name = 'UT3_TRIGGER_ALIVE'
- and ora_dict_obj_type = 'SYNONYM')
- then
- execute immediate 'begin ut_trigger_check.is_alive(); end;';
- elsif ora_dict_obj_type in ('PACKAGE','PROCEDURE','FUNCTION','TYPE')
- and not (ora_dict_obj_type = 'TYPE' and ora_dict_obj_name like 'SYS\_PLSQL\_%' escape '\')
- then
- execute immediate 'begin ut_annotation_manager.trigger_obj_annotation_rebuild; end;';
- end if;
-exception
- when others then null;
-end;
-/
diff --git a/source/core/annotations/ut_trigger_check.pkb b/source/core/annotations/ut_trigger_check.pkb
deleted file mode 100644
index 34e43ba46..000000000
--- a/source/core/annotations/ut_trigger_check.pkb
+++ /dev/null
@@ -1,39 +0,0 @@
-create or replace package body ut_trigger_check is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- gc_check_object_name constant varchar2(128) := 'UT3_TRIGGER_ALIVE';
- g_is_trigger_live boolean := false;
-
- function is_alive return boolean is
- pragma autonomous_transaction;
- begin
- execute immediate 'create or replace synonym '||ut_utils.ut_owner||'.'||gc_check_object_name||' for no_object';
- return g_is_trigger_live;
- end;
-
- procedure is_alive is
- begin
- if ora_dict_obj_owner is not null and ora_dict_obj_name is not null and ora_dict_obj_type is not null then
- g_is_trigger_live := true;
- else
- g_is_trigger_live := false;
- end if;
- end;
-
-end;
-/
diff --git a/source/core/annotations/ut_trigger_check.pks b/source/core/annotations/ut_trigger_check.pks
deleted file mode 100644
index cee0b06fd..000000000
--- a/source/core/annotations/ut_trigger_check.pks
+++ /dev/null
@@ -1,31 +0,0 @@
-create or replace package ut_trigger_check authid definer is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * checks if the trigger &&UT3_OWNER._PARSE is enabled and operational.
- */
- function is_alive return boolean;
-
- /**
- * If called from a DDL trigger sets alive flag to true.
- * If called outside of DDL trigger, sets alive flag to false.
- */
- procedure is_alive;
-
-end;
-/
diff --git a/source/core/coverage/dbms_plssqlcode.sql b/source/core/coverage/dbms_plssqlcode.sql
deleted file mode 100644
index 1ae287207..000000000
--- a/source/core/coverage/dbms_plssqlcode.sql
+++ /dev/null
@@ -1,67 +0,0 @@
-declare
- l_tab_exist number;
-begin
- select count(*) into l_tab_exist from
- (select table_name from all_tables where table_name = 'DBMSPCC_BLOCKS' and owner = sys_context('USERENV','CURRENT_SCHEMA')
- union all
- select synonym_name from all_synonyms where synonym_name = 'DBMSPCC_BLOCKS' and owner = sys_context('USERENV','CURRENT_SCHEMA'));
- if l_tab_exist = 0 then
- execute immediate q'[
- create table dbmspcc_blocks (
- run_id number(38, 0),
- object_id number(38, 0),
- block number(38, 0),
- line number(38, 0) constraint dbmspcc_blocks_line_nn not null enable,
- col number(38, 0) constraint dbmspcc_blocks_col_nn not null enable,
- covered number(1, 0) constraint dbmspcc_blocks_covered_nn not null enable,
- not_feasible number(1, 0) constraint dbmspcc_blocks_not_feasible_nn not null enable,
- constraint dbmspcc_blocks_block_ck check ( block >= 0 ) enable,
- constraint dbmspcc_blocks_line_ck check ( line >= 0 ) enable,
- constraint dbmspcc_blocks_col_ck check ( col >= 0 ) enable,
- constraint dbmspcc_blocks_covered_ck check ( covered in ( 0, 1 ) ) enable,
- constraint dbmspcc_blocks_not_feasible_ck check ( not_feasible in ( 0, 1 ) ) enable,
- constraint dbmspcc_blocks_pk primary key ( run_id, object_id, block ) using index
- )]';
- end if;
-end;
-/
-declare
- l_tab_exist number;
-begin
- select count(*) into l_tab_exist from
- (select table_name from all_tables where table_name = 'DBMSPCC_RUNS' and owner = sys_context('USERENV','CURRENT_SCHEMA')
- union all
- select synonym_name from all_synonyms where synonym_name = 'DBMSPCC_RUNS' and owner = sys_context('USERENV','CURRENT_SCHEMA'));
- if l_tab_exist = 0 then
- execute immediate q'[
- create table dbmspcc_runs (
- run_id number(38, 0),
- run_comment varchar2(4000 byte),
- run_owner varchar2(128 byte) constraint dbmspcc_runs_run_owner_nn not null enable,
- run_timestamp date constraint dbmspcc_runs_run_timestamp_nn not null enable,
- constraint dbmspcc_runs_pk primary key ( run_id ) using index enable
- )]';
- end if;
-end;
-/
-declare
- l_tab_exist number;
-begin
- select count(*) into l_tab_exist from
- (select table_name from all_tables where table_name = 'DBMSPCC_UNITS' and owner = sys_context('USERENV','CURRENT_SCHEMA')
- union all
- select synonym_name from all_synonyms where synonym_name = 'DBMSPCC_UNITS' and owner = sys_context('USERENV','CURRENT_SCHEMA'));
- if l_tab_exist = 0 then
- execute immediate q'[
- create table dbmspcc_units (
- run_id number(38, 0),
- object_id number(38, 0),
- owner varchar2(128 byte) constraint dbmspcc_units_owner_nn not null enable,
- name varchar2(128 byte) constraint dbmspcc_units_name_nn not null enable,
- type varchar2(12 byte) constraint dbmspcc_units_type_nn not null enable,
- last_ddl_time date constraint dbmspcc_units_last_ddl_time_nn not null enable,
- constraint dbmspcc_units_pk primary key ( run_id, object_id ) using index enable
- )]';
- end if;
-end;
-/
diff --git a/source/core/coverage/proftab.sql b/source/core/coverage/proftab.sql
deleted file mode 100644
index 62c69dc9a..000000000
--- a/source/core/coverage/proftab.sql
+++ /dev/null
@@ -1,106 +0,0 @@
-declare
- l_tab_exist number;
-begin
- select count(*) into l_tab_exist from
- (select table_name from all_tables where table_name = 'PLSQL_PROFILER_RUNS' and owner = sys_context('USERENV','CURRENT_SCHEMA')
- union all
- select synonym_name from all_synonyms where synonym_name = 'PLSQL_PROFILER_RUNS' and owner = sys_context('USERENV','CURRENT_SCHEMA'));
- if l_tab_exist = 0 then
- execute immediate q'[create table plsql_profiler_runs
-(
- runid number primary key, -- unique run identifier,
- -- from plsql_profiler_runnumber
- related_run number, -- runid of related run (for client/
- -- server correlation)
- run_owner varchar2(128), -- user who started run
- run_date date, -- start time of run
- run_comment varchar2(2047), -- user provided comment for this run
- run_total_time number, -- elapsed time for this run
- run_system_info varchar2(2047), -- currently unused
- run_comment1 varchar2(2047), -- additional comment
- spare1 varchar2(256) -- unused
-)]';
- execute immediate q'[comment on table plsql_profiler_runs is
- 'Run-specific information for the PL/SQL profiler']';
- dbms_output.put_line('PLSQL_PROFILER_RUNS table created');
- end if;
-end;
-/
-
-declare
- l_tab_exist number;
-begin
- select count(*) into l_tab_exist from
- (select table_name from all_tables where table_name = 'PLSQL_PROFILER_UNITS' and owner = sys_context('USERENV','CURRENT_SCHEMA')
- union all
- select synonym_name from all_synonyms where synonym_name = 'PLSQL_PROFILER_UNITS' and owner = sys_context('USERENV','CURRENT_SCHEMA'));
- if l_tab_exist = 0 then
- execute immediate q'[create table plsql_profiler_units
-(
- runid number references plsql_profiler_runs,
- unit_number number, -- internally generated library unit #
- unit_type varchar2(128), -- library unit type
- unit_owner varchar2(128), -- library unit owner name
- unit_name varchar2(128), -- library unit name
- -- timestamp on library unit, can be used to detect changes to
- -- unit between runs
- unit_timestamp date,
- total_time number DEFAULT 0 NOT NULL,
- spare1 number, -- unused
- spare2 number, -- unused
- --
- primary key (runid, unit_number)
-)]';
- execute immediate q'[comment on table plsql_profiler_units is
- 'Information about each library unit in a run']';
- dbms_output.put_line('PLSQL_PROFILER_UNITS table created');
- end if;
-end;
-/
-
-declare
- l_tab_exist number;
-begin
- select count(*) into l_tab_exist from
- (select table_name from all_tables where table_name = 'PLSQL_PROFILER_DATA' and owner = sys_context('USERENV','CURRENT_SCHEMA')
- union all
- select synonym_name from all_synonyms where synonym_name = 'PLSQL_PROFILER_DATA' and owner = sys_context('USERENV','CURRENT_SCHEMA'));
- if l_tab_exist = 0 then
- execute immediate q'[create table plsql_profiler_data
-(
- runid number, -- unique (generated) run identifier
- unit_number number, -- internally generated library unit #
- line# number not null, -- line number in unit
- total_occur number, -- number of times line was executed
- total_time number, -- total time spent executing line
- min_time number, -- minimum execution time for this line
- max_time number, -- maximum execution time for this line
- spare1 number, -- unused
- spare2 number, -- unused
- spare3 number, -- unused
- spare4 number, -- unused
- --
- primary key (runid, unit_number, line#),
- foreign key (runid, unit_number) references plsql_profiler_units
-)]';
- execute immediate q'[comment on table plsql_profiler_data is
- 'Accumulated data from all profiler runs']';
- dbms_output.put_line('PLSQL_PROFILER_DATA table created');
- end if;
-end;
-/
-
-declare
- l_seq_exist number;
-begin
- select count(*) into l_seq_exist from
- (select sequence_name from all_sequences where sequence_name = 'PLSQL_PROFILER_RUNNUMBER' and sequence_owner = sys_context('USERENV','CURRENT_SCHEMA')
- union all
- select synonym_name from all_synonyms where synonym_name = 'PLSQL_PROFILER_RUNNUMBER' and owner = sys_context('USERENV','CURRENT_SCHEMA'));
- if l_seq_exist = 0 then
- execute immediate q'[create sequence plsql_profiler_runnumber start with 1 nocache]';
- dbms_output.put_line('Sequence PLSQL_PROFILER_RUNNUMBER created');
- end if;
-end;
-/
-
diff --git a/source/core/coverage/ut_coverage.pkb b/source/core/coverage/ut_coverage.pkb
deleted file mode 100644
index 7eb5a34c2..000000000
--- a/source/core/coverage/ut_coverage.pkb
+++ /dev/null
@@ -1,327 +0,0 @@
-create or replace package body ut_coverage is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- g_develop_mode boolean not null := false;
- g_is_started boolean not null := false;
- g_coverage_run_id raw(32);
-
- procedure set_develop_mode(a_develop_mode in boolean) is
- begin
- g_develop_mode := a_develop_mode;
- end;
-
- function is_develop_mode return boolean is
- begin
- return g_develop_mode;
- end;
-
- function get_cov_sources_sql(a_coverage_options ut_coverage_options, a_skip_objects ut_object_names) return varchar2 is
- l_result varchar2(32767);
- l_full_name varchar2(32767);
- l_join_mappings varchar2(32767);
- l_filters varchar2(32767);
- l_mappings_cardinality integer := 0;
- l_regex_exc_filters varchar2(32767);
- begin
- l_result := q'[
- with
- sources as (
- select /*+ cardinality(f {mappings_cardinality}) */
- {l_full_name} as full_name, s.owner, s.name, s.type,
- s.line
- - case
- when s.type = 'TRIGGER'
- then
- /* calculate offset of line number for trigger source in coverage reporting */
- min(case when lower(s.text) like '%begin%' or lower(s.text) like '%declare%' or lower(s.text) like '%compound%' then s.line-1 end)
- over (partition by s.owner, s.type, s.name)
- else 0
- end as line,
- s.text
- from {sources_view} s {join_file_mappings}
- where s.type in ('PACKAGE BODY', 'TYPE BODY', 'PROCEDURE', 'FUNCTION', 'TRIGGER')
- {filters}
- {regex_exc_filters}
- and not exists (
- select /*+ cardinality(el {excuded_objects_cardinality})*/ 1
- from table(:l_excluded_objects) el
- where s.owner = el.owner and s.name = el.name
- )
- ),
- coverage_sources as (
- select full_name, owner, name, type, line, text,
- case
- when
- -- to avoid execution of regexp_like on every line
- -- first do a rough check for existence of search pattern keyword
- (lower(s.text) like '%procedure%'
- or lower(s.text) like '%function%'
- or lower(s.text) like '%begin%'
- or lower(s.text) like '%end%'
- or lower(s.text) like '%package%'
- ) and
- regexp_like(
- s.text,
- '^([\t ]*(((not)?\s*(overriding|final|instantiable)[\t ]*)*(static|constructor|member)?[\t ]*(procedure|function)|package([\t ]+body)|begin|end([\t ]+\S+)*[ \t]*;))', 'i'
- )
- then 'Y'
- end as to_be_skipped
- from sources s
- )
- select /*+ no_parallel */ full_name, owner, name, type, line, to_be_skipped, text
- from coverage_sources s
- -- Exclude calls to utPLSQL framework, Unit Test packages and objects from a_exclude_list parameter of coverage reporter
- where not exists (
- select /*+ cardinality(el {skipped_objects_cardinality})*/ 1
- from table(:l_skipped_objects) el
- where s.owner = el.owner and s.name = el.name
- )
- and line > 0
- ]';
-
- if a_coverage_options.file_mappings is not empty then
- l_mappings_cardinality := ut_utils.scale_cardinality(cardinality(a_coverage_options.file_mappings));
- l_full_name := 'f.file_name';
- l_join_mappings := '
- join table(:file_mappings) f
- on s.name = f.object_name
- and s.type = f.object_type
- and s.owner = f.object_owner';
- elsif coalesce(a_coverage_options.include_schema_expr,a_coverage_options.include_object_expr) is not null then
- l_full_name := q'[lower(s.type||' '||s.owner||'.'||s.name)]';
- if a_coverage_options.include_schema_expr is not null then
- l_filters := q'[and regexp_like(s.owner,:a_include_schema_expr,'i')]';
- else
- l_filters := 'and :a_include_schema_expr is null';
- end if;
- if a_coverage_options.include_object_expr is not null then
- l_filters := l_filters|| q'[ and regexp_like(s.name,:a_include_object_expr,'i')]';
- else
- l_filters := l_filters|| 'and :a_include_object_expr is null';
- end if;
- else
- l_full_name := q'[lower(s.type||' '||s.owner||'.'||s.name)]';
- l_filters := case
- when a_coverage_options.include_objects is not empty then '
- and (s.owner, s.name) in (
- select /*+ cardinality(il '||ut_utils.scale_cardinality(cardinality(a_coverage_options.include_objects))||') */
- il.owner, il.name
- from table(:include_objects) il
- )'
- else '
- and s.owner in (
- select /*+ cardinality(t '||ut_utils.scale_cardinality(cardinality(a_coverage_options.schema_names))||') */
- upper(t.column_value)
- from table(:l_schema_names) t)'
- end;
- end if;
-
-
- if a_coverage_options.exclude_schema_expr is not null then
- l_regex_exc_filters := q'[ and not regexp_like(s.owner,:a_exclude_schema_expr,'i')]';
- else
- l_regex_exc_filters := ' and :a_exclude_schema_expr is null ';
- end if;
-
- if a_coverage_options.exclude_object_expr is not null then
- l_regex_exc_filters := l_regex_exc_filters||q'[ and not regexp_like(s.name,:a_exclude_obj_expr,'i')]';
- else
- l_regex_exc_filters := l_regex_exc_filters||'and :a_exclude_obj_expr is null ';
- end if;
-
-
-
- l_result := replace(l_result, '{sources_view}', ut_metadata.get_source_view_name());
- l_result := replace(l_result, '{l_full_name}', l_full_name);
- l_result := replace(l_result, '{join_file_mappings}', l_join_mappings);
- l_result := replace(l_result, '{filters}', l_filters);
- l_result := replace(l_result, '{mappings_cardinality}', l_mappings_cardinality);
- l_result := replace(l_result, '{skipped_objects_cardinality}', ut_utils.scale_cardinality(cardinality(a_skip_objects)));
- l_result := replace(l_result, '{excuded_objects_cardinality}', ut_utils.scale_cardinality(cardinality(coalesce(a_coverage_options.exclude_objects, ut_object_names()))));
- l_result := replace(l_result, '{regex_exc_filters}', l_regex_exc_filters);
-
- return l_result;
-
- end;
-
- function get_cov_sources_cursor(a_coverage_options in ut_coverage_options) return sys_refcursor is
- l_cursor sys_refcursor;
- l_skip_objects ut_object_names;
- l_excluded_objects ut_object_names;
- l_sql varchar2(32767);
- begin
- if not is_develop_mode() then
- --skip all the utplsql framework objects and all the unit test packages that could potentially be reported by coverage.
- l_skip_objects := coalesce( ut_utils.get_utplsql_objects_list() multiset union all ut_suite_manager.get_schema_ut_packages(a_coverage_options.schema_names, a_coverage_options.include_schema_expr) , ut_object_names() );
- end if;
-
- --Regex exclusion override the standard exclusion objects.
- if a_coverage_options.exclude_schema_expr is null and a_coverage_options.exclude_object_expr is null then
- l_excluded_objects := coalesce(a_coverage_options.exclude_objects, ut_object_names());
- end if;
-
- l_sql := get_cov_sources_sql(a_coverage_options, l_skip_objects);
-
- ut_event_manager.trigger_event(ut_event_manager.gc_debug, ut_key_anyvalues().put('l_sql',l_sql) );
-
- if a_coverage_options.file_mappings is not empty then
- open l_cursor for l_sql using a_coverage_options.file_mappings, a_coverage_options.exclude_schema_expr,
- a_coverage_options.exclude_object_expr, l_excluded_objects, l_skip_objects;
- elsif coalesce(a_coverage_options.include_schema_expr,a_coverage_options.include_object_expr) is not null then
- open l_cursor for l_sql using a_coverage_options.include_schema_expr, a_coverage_options.include_object_expr,
- a_coverage_options.exclude_schema_expr, a_coverage_options.exclude_object_expr,
- l_excluded_objects, l_skip_objects;
- elsif a_coverage_options.include_objects is not empty then
- open l_cursor for l_sql using a_coverage_options.include_objects, a_coverage_options.exclude_schema_expr,
- a_coverage_options.exclude_object_expr, l_excluded_objects, l_skip_objects;
- else
- open l_cursor for l_sql using a_coverage_options.schema_names, a_coverage_options.exclude_schema_expr,
- a_coverage_options.exclude_object_expr, l_excluded_objects, l_skip_objects;
- end if;
- return l_cursor;
- end;
-
- procedure populate_tmp_table(a_coverage_options ut_coverage_options) is
- pragma autonomous_transaction;
- l_cov_sources_crsr sys_refcursor;
- l_cov_sources_data ut_coverage_helper.t_coverage_sources_tmp_rows;
- begin
-
- if not ut_coverage_helper.is_tmp_table_populated() or is_develop_mode() then
- ut_coverage_helper.cleanup_tmp_table();
- l_cov_sources_crsr := get_cov_sources_cursor(a_coverage_options);
-
- loop
- fetch l_cov_sources_crsr bulk collect into l_cov_sources_data limit 10000;
-
- ut_coverage_helper.insert_into_tmp_table(l_cov_sources_data);
-
- exit when l_cov_sources_crsr%notfound;
- end loop;
-
- close l_cov_sources_crsr;
- end if;
- commit;
- end;
-
-
- /**
- * Public functions
- */
- procedure coverage_start(a_coverage_run_id t_coverage_run_id) is
- l_run_comment varchar2(200) := 'utPLSQL Code coverage run '||ut_utils.to_string(systimestamp);
- l_line_coverage_id integer;
- l_block_coverage_id integer;
- begin
- if not is_develop_mode() and not g_is_started then
- g_coverage_run_id := a_coverage_run_id;
- l_line_coverage_id := ut_coverage_helper_profiler.coverage_start( l_run_comment );
- l_block_coverage_id := ut_coverage_helper_block.coverage_start( l_run_comment );
- g_is_started := true;
- ut_coverage_helper.set_coverage_run_ids(a_coverage_run_id, l_line_coverage_id, l_block_coverage_id);
- end if;
- end;
-
- procedure coverage_pause is
- begin
- if not is_develop_mode() then
- ut_coverage_helper_profiler.coverage_pause();
- end if;
- end;
-
- procedure coverage_resume is
- begin
- ut_coverage_helper_profiler.coverage_resume();
- end;
-
- procedure coverage_stop is
- begin
- if not is_develop_mode() then
- g_is_started := false;
- g_coverage_run_id := null;
- ut_coverage_helper_block.coverage_stop();
- ut_coverage_helper_profiler.coverage_stop();
- end if;
- end;
-
- function get_coverage_data(a_coverage_options ut_coverage_options) return t_coverage is
- l_result_block ut_coverage.t_coverage;
- l_result_profiler_enrich ut_coverage.t_coverage;
- l_object ut_coverage.t_object_name;
- l_line_no binary_integer;
- l_coverage_options ut_coverage_options := a_coverage_options;
- begin
- --prepare global temp table with sources
- ut_event_manager.trigger_event('about to populate coverage temp table');
- populate_tmp_table(l_coverage_options);
- ut_event_manager.trigger_event('coverage temp table populated');
-
- -- Get raw data for both reporters, order is important as tmp table will skip headers and dont populate
- -- tmp table for block again.
- l_result_profiler_enrich := ut_coverage_profiler.get_coverage_data( l_coverage_options );
- ut_event_manager.trigger_event('profiler coverage data retrieved');
-
- -- If block coverage available we will use it.
- $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
- l_result_block := ut_coverage_block.get_coverage_data( l_coverage_options );
- ut_event_manager.trigger_event('block coverage data retrieved');
-
- -- Enrich profiler results with some of the block results
- l_object := l_result_profiler_enrich.objects.first;
- while (l_object is not null) loop
-
- l_line_no := l_result_profiler_enrich.objects(l_object).lines.first;
-
- -- to avoid no data found check if we got object in profiler
- if l_result_block.objects.exists(l_object) then
- while (l_line_no is not null) loop
- -- To avoid no data check for object line
- if l_result_block.objects(l_object).lines.exists(l_line_no) then
- -- enrich line level stats
- l_result_profiler_enrich.objects(l_object).lines(l_line_no).partcove := l_result_block.objects(l_object).lines(l_line_no).partcove;
- l_result_profiler_enrich.objects(l_object).lines(l_line_no).covered_blocks := l_result_block.objects(l_object).lines(l_line_no).covered_blocks;
- l_result_profiler_enrich.objects(l_object).lines(l_line_no).no_blocks := l_result_block.objects(l_object).lines(l_line_no).no_blocks;
- -- enrich object level stats
- l_result_profiler_enrich.objects(l_object).partcovered_lines := nvl(l_result_profiler_enrich.objects(l_object).partcovered_lines,0) + l_result_block.objects(l_object).lines(l_line_no).partcove;
- end if;
- --At the end go to next line
- l_line_no := l_result_profiler_enrich.objects(l_object).lines.next(l_line_no);
- end loop;
- --total level stats enrich
- l_result_profiler_enrich.partcovered_lines := nvl(l_result_profiler_enrich.partcovered_lines,0) + l_result_profiler_enrich.objects(l_object).partcovered_lines;
- -- At the end go to next object
- end if;
-
- l_object := l_result_profiler_enrich.objects.next(l_object);
- end loop;
- ut_event_manager.trigger_event('coverage data combined');
- $end
-
- return l_result_profiler_enrich;
- end get_coverage_data;
-
- function get_coverage_run_id return raw is
- begin
- if g_coverage_run_id is null then
- g_coverage_run_id := sys_guid();
- end if;
- return g_coverage_run_id;
- end;
-
-end;
-/
diff --git a/source/core/coverage/ut_coverage.pks b/source/core/coverage/ut_coverage.pks
deleted file mode 100644
index 21f3b1f9e..000000000
--- a/source/core/coverage/ut_coverage.pks
+++ /dev/null
@@ -1,80 +0,0 @@
-create or replace package ut_coverage authid current_user is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- subtype t_coverage_run_id is raw(32) not null;
-
- -- total run coverage information
- subtype t_object_name is varchar2(257);
- subtype t_line_no is binary_integer;
-
- type t_line_executions is record(
- executions binary_integer
- ,partcove binary_integer
- ,no_blocks binary_integer
- ,covered_blocks binary_integer);
-
- -- line coverage information indexed by line no.
- type tt_lines is table of t_line_executions index by t_line_no;
-
- --unit coverage information record
- type t_unit_coverage is record(
- owner varchar2(128)
- ,name varchar2(128)
- ,covered_lines binary_integer := 0
- ,uncovered_lines binary_integer := 0
- ,partcovered_lines binary_integer := 0
- ,total_blocks binary_integer default null
- ,covered_blocks binary_integer default null
- ,uncovered_blocks binary_integer default null
- ,total_lines binary_integer := 0
- ,executions number(38, 0) := 0
- ,lines tt_lines);
-
- -- coverage information indexed by full object name (schema.object)
- type tt_program_units is table of t_unit_coverage index by t_object_name;
-
- -- total run coverage information
- type t_coverage is record(
- covered_lines binary_integer := 0
- ,uncovered_lines binary_integer := 0
- ,partcovered_lines binary_integer := 0
- ,total_lines binary_integer default null
- ,total_blocks binary_integer default null
- ,covered_blocks binary_integer default null
- ,uncovered_blocks binary_integer default null
- ,executions number(38, 0) := 0
- ,objects tt_program_units);
-
- procedure set_develop_mode(a_develop_mode in boolean);
-
- function is_develop_mode return boolean;
-
- procedure coverage_start(a_coverage_run_id t_coverage_run_id);
-
- procedure coverage_stop;
-
- procedure coverage_pause;
-
- procedure coverage_resume;
-
- function get_coverage_data(a_coverage_options ut_coverage_options) return t_coverage;
-
- function get_coverage_run_id return raw;
-
-end;
-/
diff --git a/source/core/coverage/ut_coverage_block.pkb b/source/core/coverage/ut_coverage_block.pkb
deleted file mode 100644
index a906b81a3..000000000
--- a/source/core/coverage/ut_coverage_block.pkb
+++ /dev/null
@@ -1,160 +0,0 @@
-create or replace package body ut_coverage_block is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-
- type t_source_lines is table of binary_integer;
-
- /**
- * Public functions
- */
-
- function get_coverage_data(a_coverage_options ut_coverage_options) return ut_coverage.t_coverage is
- l_line_calls ut_coverage_helper.t_unit_line_calls;
- l_result ut_coverage.t_coverage;
- l_new_unit ut_coverage.t_unit_coverage;
- l_line_no binary_integer;
- l_source_objects_crsr ut_coverage_helper.t_tmp_table_objects_crsr;
- l_source_object ut_coverage_helper.t_tmp_table_object;
- begin
-
- $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
- l_source_objects_crsr := ut_coverage_helper.get_tmp_table_objects_cursor();
- loop
- fetch l_source_objects_crsr
- into l_source_object;
- exit when l_source_objects_crsr%notfound;
-
- --get coverage data
- l_line_calls := ut_coverage_helper_block.get_raw_coverage_data(l_source_object, a_coverage_options.coverage_run_id);
- --if there is coverage, we need to filter out the garbage (badly indicated data)
- if l_line_calls.count > 0 then
- --remove lines that should not be indicted as meaningful
- for i in 1 .. l_source_object.to_be_skipped_list.count loop
- if l_source_object.to_be_skipped_list(i) is not null then
- l_line_calls.delete(l_source_object.to_be_skipped_list(i));
- end if;
- end loop;
- end if;
-
- --if there are no file mappings or object was actually captured by profiler
- if a_coverage_options.file_mappings is null or l_line_calls.count > 0 then
-
- --populate total stats
- l_result.total_lines := nvl(l_result.total_lines,0) + l_source_object.lines_count;
-
- --populate object level coverage stats
- if not l_result.objects.exists(l_source_object.full_name) then
- l_result.objects(l_source_object.full_name) := l_new_unit;
- l_result.objects(l_source_object.full_name).owner := l_source_object.owner;
- l_result.objects(l_source_object.full_name).name := l_source_object.name;
- l_result.objects(l_source_object.full_name).total_lines := l_source_object.lines_count;
- end if;
- --map to results
- l_line_no := l_line_calls.first;
- if l_line_no is null then
- l_result.uncovered_lines := l_result.uncovered_lines + l_source_object.lines_count;
- l_result.objects(l_source_object.full_name).uncovered_lines := l_source_object.lines_count;
- else
- loop
- exit when l_line_no is null;
-
- --turn the block coverage into a line coverage format to allow for reading.
- --whenever the linst is a part covered treat that line as a hit and execution but only part covered
-
- --total stats
- --Get total blocks ,blocks covered, blocks not covered this will be used for PCT calc
- l_result.total_blocks := nvl(l_result.total_blocks, 0) + l_line_calls(l_line_no).blocks;
- l_result.covered_blocks := nvl(l_result.covered_blocks, 0) + l_line_calls(l_line_no).covered_blocks;
- l_result.uncovered_blocks := nvl(l_result.uncovered_blocks, 0) +
- (l_line_calls(l_line_no).blocks - l_line_calls(l_line_no).covered_blocks);
-
- --If line is partially covered add as part line cover and covered for line reporter
- if l_line_calls(l_line_no).partcovered = 1 then
- l_result.partcovered_lines := l_result.partcovered_lines + 1;
- end if;
-
- if l_line_calls(l_line_no).covered_blocks > 0 then
- l_result.covered_lines := l_result.covered_lines + 1;
- end if;
-
- -- Use nvl as be default is null and screw the calcs
- --Increase total blocks
- l_result.objects(l_source_object.full_name).lines(l_line_no).no_blocks := l_line_calls(l_line_no).blocks;
- l_result.objects(l_source_object.full_name).lines(l_line_no).covered_blocks := l_line_calls(l_line_no).covered_blocks;
- l_result.objects(l_source_object.full_name).total_blocks := nvl(l_result.objects(l_source_object.full_name)
- .total_blocks
- ,0) + l_line_calls(l_line_no).blocks;
-
- --Total uncovered blocks is a line blocks minus covered blocsk
- l_result.objects(l_source_object.full_name).uncovered_blocks := nvl(l_result.objects(l_source_object.full_name)
- .uncovered_blocks
- ,0) +
- (l_line_calls(l_line_no).blocks - l_line_calls(l_line_no)
- .covered_blocks);
-
- --If we have any covered blocks in line
- if l_line_calls(l_line_no).covered_blocks > 0 then
- --If any block is covered then we have a hit on that line
- l_result.executions := l_result.executions + 1;
- --object level stats
- --If its part covered then mark it else treat as full cov
- if l_line_calls(l_line_no).partcovered = 1 then
- l_result.objects(l_source_object.full_name).partcovered_lines := l_result.objects(l_source_object.full_name)
- .partcovered_lines + 1;
- end if;
- l_result.objects(l_source_object.full_name).covered_lines := l_result.objects(l_source_object.full_name)
- .covered_lines + 1;
-
- --How many blocks we covered
- l_result.objects(l_source_object.full_name).covered_blocks := nvl(l_result.objects(l_source_object.full_name)
- .covered_blocks
- ,0) + l_line_calls(l_line_no)
- .covered_blocks;
-
- --Object line executions
- l_result.objects(l_source_object.full_name).executions := nvl(l_result.objects(l_source_object.full_name)
- .executions
- ,0) + 1;
-
- l_result.objects(l_source_object.full_name).lines(l_line_no).executions := 1;
-
- --Whenever there is no covered block treat as uncovered (query returns only lines where the blocks are in code so we
- --dont have a false results here when there is no blocks
- elsif l_line_calls(l_line_no).covered_blocks = 0 then
- l_result.uncovered_lines := l_result.uncovered_lines + 1;
- l_result.objects(l_source_object.full_name).uncovered_lines := l_result.objects(l_source_object.full_name)
- .uncovered_lines + 1;
- l_result.objects(l_source_object.full_name).lines(l_line_no).executions := 0;
- end if;
- --increase part covered counter (+ 1/0)
- l_result.objects(l_source_object.full_name).lines(l_line_no).partcove := l_line_calls(l_line_no).partcovered;
- l_line_no := l_line_calls.next(l_line_no);
- end loop;
- end if;
- end if;
-
- end loop;
-
- close l_source_objects_crsr;
- $end
-
- return l_result;
- end get_coverage_data;
-
-end;
-/
diff --git a/source/core/coverage/ut_coverage_block.pks b/source/core/coverage/ut_coverage_block.pks
deleted file mode 100644
index 01caca035..000000000
--- a/source/core/coverage/ut_coverage_block.pks
+++ /dev/null
@@ -1,22 +0,0 @@
-create or replace package ut_coverage_block authid current_user is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- function get_coverage_data(a_coverage_options ut_coverage_options) return ut_coverage.t_coverage;
-
-end;
-/
diff --git a/source/core/coverage/ut_coverage_helper.pkb b/source/core/coverage/ut_coverage_helper.pkb
deleted file mode 100644
index e249b3381..000000000
--- a/source/core/coverage/ut_coverage_helper.pkb
+++ /dev/null
@@ -1,97 +0,0 @@
-create or replace package body ut_coverage_helper is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-
-
- type t_proftab_row is record (
- line binary_integer,
- calls number(38,0)
- );
-
- type t_proftab_rows is table of t_proftab_row;
-
- type t_block_row is record(
- line binary_integer
- ,blocks binary_integer
- ,covered_blocks binary_integer);
-
- type t_block_rows is table of t_block_row;
-
- procedure insert_into_tmp_table(a_data t_coverage_sources_tmp_rows) is
- begin
- forall i in 1 .. a_data.count
- insert /*+ no_parallel */ into ut_coverage_sources_tmp
- (full_name,owner,name,type,line,text,to_be_skipped)
- values(a_data(i).full_name,a_data(i).owner,a_data(i).name,a_data(i).type,a_data(i).line,a_data(i).text,a_data(i).to_be_skipped);
- end;
-
- procedure cleanup_tmp_table is
- pragma autonomous_transaction;
- begin
- execute immediate 'truncate table ut_coverage_sources_tmp';
- end;
-
- function is_tmp_table_populated return boolean is
- l_result integer;
- begin
- select /*+ no_parallel */ 1 into l_result from ut_coverage_sources_tmp where rownum = 1;
- return (l_result = 1);
- exception
- when no_data_found then
- return false;
- end;
-
- function get_tmp_table_objects_cursor return t_tmp_table_objects_crsr is
- l_result t_tmp_table_objects_crsr;
- begin
- open l_result for
- select /*+ no_parallel */ o.owner, o.name, o.type, o.full_name, max(o.line) as lines_count,
- cast(
- collect(decode(to_be_skipped, 'Y', to_char(line))) as ut_varchar2_list
- ) as to_be_skipped_list
- from ut_coverage_sources_tmp o
- group by o.owner, o.name, o.type, o.full_name;
-
- return l_result;
- end;
-
- function get_tmp_table_object_lines(a_owner varchar2, a_object_name varchar2) return ut_varchar2_list is
- l_result ut_varchar2_list;
- begin
- select /*+ no_parallel */ rtrim(s.text,chr(10)) as text
- bulk collect into l_result
- from ut_coverage_sources_tmp s
- where s.owner = a_owner
- and s.name = a_object_name
- order by s.line;
-
- return l_result;
- end;
-
- procedure set_coverage_run_ids( a_coverage_run_id raw, a_line_coverage_id integer, a_block_coverage_id integer ) is
- pragma autonomous_transaction;
- begin
- insert /*+ no_parallel */ into ut_coverage_runs
- ( coverage_run_id, line_coverage_id, block_coverage_id )
- values
- ( a_coverage_run_id, a_line_coverage_id, a_block_coverage_id );
- commit;
- end;
-
-end;
-/
diff --git a/source/core/coverage/ut_coverage_helper.pks b/source/core/coverage/ut_coverage_helper.pks
deleted file mode 100644
index cd6ed9ec7..000000000
--- a/source/core/coverage/ut_coverage_helper.pks
+++ /dev/null
@@ -1,67 +0,0 @@
-create or replace package ut_coverage_helper authid definer is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- --table of line calls indexed by line number
- --!!! this table is sparse!!!
- --type t_unit_line_calls is table of number(38,0) index by binary_integer;
-
- type t_unit_line_call is record(
- blocks binary_integer default 0
- ,covered_blocks binary_integer default 0
- ,partcovered binary_integer default 0
- ,calls binary_integer default 0);
-
- type t_unit_line_calls is table of t_unit_line_call index by binary_integer;
-
- type t_coverage_sources_tmp_row is record (
- full_name ut_coverage_sources_tmp.full_name%type,
- owner ut_coverage_sources_tmp.owner%type,
- name ut_coverage_sources_tmp.name%type,
- type ut_coverage_sources_tmp.type%type,
- line ut_coverage_sources_tmp.line%type,
- to_be_skipped ut_coverage_sources_tmp.to_be_skipped%type,
- text ut_coverage_sources_tmp.text%type
- );
-
- type t_coverage_sources_tmp_rows is table of t_coverage_sources_tmp_row;
-
- type t_tmp_table_object is record(
- owner ut_coverage_sources_tmp.owner%type,
- name ut_coverage_sources_tmp.name%type,
- type ut_coverage_sources_tmp.type%type,
- full_name ut_coverage_sources_tmp.full_name%type,
- lines_count integer,
- to_be_skipped_list ut_varchar2_list
- );
-
- type t_tmp_table_objects_crsr is ref cursor return t_tmp_table_object;
-
- procedure insert_into_tmp_table(a_data t_coverage_sources_tmp_rows);
-
- procedure cleanup_tmp_table;
-
- function is_tmp_table_populated return boolean;
-
- function get_tmp_table_objects_cursor return t_tmp_table_objects_crsr;
-
- function get_tmp_table_object_lines(a_owner varchar2, a_object_name varchar2) return ut_varchar2_list;
-
- procedure set_coverage_run_ids( a_coverage_run_id raw, a_line_coverage_id integer, a_block_coverage_id integer );
-
-end;
-/
diff --git a/source/core/coverage/ut_coverage_helper_block.pkb b/source/core/coverage/ut_coverage_helper_block.pkb
deleted file mode 100644
index fb4d4812e..000000000
--- a/source/core/coverage/ut_coverage_helper_block.pkb
+++ /dev/null
@@ -1,110 +0,0 @@
-create or replace package body ut_coverage_helper_block is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- type t_block_row is record(
- line binary_integer
- ,blocks binary_integer
- ,covered_blocks binary_integer);
-
- type t_block_rows is table of t_block_row;
-
- function coverage_start(a_run_comment varchar2) return integer is
- begin
- $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
- return dbms_plsql_code_coverage.start_coverage(run_comment => a_run_comment);
- $else
- return null;
- $end
- end;
-
- procedure coverage_stop is
- begin
- $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
- dbms_plsql_code_coverage.stop_coverage();
- $else
- null;
- $end
- exception
- when others then
- if sqlcode = -08402 then
- dbms_output.put_line('Unable to finish gathering coverage with DBMS_PLSQL_CODE_COVERAGE. ');
- dbms_output.put_line('Encountered exception `ORA-08402` when calling procedure `DBMS_PLSQL_CODE_COVERAGE.STOP_COVERAGE()`.');
- dbms_output.put_line('Coverage report will only include line-level code-coverage (without branches).');
- dbms_output.put_line('Please reference following issue for details on possible causes: https://github.com/utPLSQL/utPLSQL/issues/1097 ');
- end if;
- end;
-
- function block_results(a_object ut_coverage_helper.t_tmp_table_object, a_coverage_run_id raw) return t_block_rows is
- l_coverage_rows t_block_rows;
- l_ut_owner varchar2(250) := ut_utils.ut_owner;
- begin
- execute immediate q'[
- select /*+ no_parallel */
- line as line,
- count(block) as blocks,
- sum(covered) as covered_blocks
- from (select line,
- block,
- max(covered) as covered
- from dbmspcc_units ccu
- join ]'||l_ut_owner||q'[.ut_coverage_runs r
- on r.block_coverage_id = ccu.run_id
- left join dbmspcc_blocks ccb
- on ccu.run_id = ccb.run_id
- and ccu.object_id = ccb.object_id
- where r.coverage_run_id = :a_coverage_run_id
- and ccu.owner = :a_object_owner
- and ccu.name = :a_object_name
- and ccu.type = :a_object_type
- group by ccb.line, ccb.block
- )
- group by line
- having count(block) > 1
- order by line]'
- bulk collect into l_coverage_rows
- using
- a_coverage_run_id, a_object.owner,
- a_object.name, a_object.type;
-
- return l_coverage_rows;
- end;
-
- function get_raw_coverage_data(a_object ut_coverage_helper.t_tmp_table_object, a_coverage_run_id raw) return ut_coverage_helper.t_unit_line_calls is
- l_tmp_data t_block_rows;
- l_results ut_coverage_helper.t_unit_line_calls;
-
- begin
- $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
- l_tmp_data := block_results(a_object, a_coverage_run_id);
-
- for i in 1 .. l_tmp_data.count loop
- l_results(l_tmp_data(i).line).blocks := l_tmp_data(i).blocks;
- l_results(l_tmp_data(i).line).covered_blocks := l_tmp_data(i).covered_blocks;
- l_results(l_tmp_data(i).line).partcovered :=
- case
- when (l_tmp_data(i).covered_blocks > 0)
- and (l_tmp_data(i).blocks > l_tmp_data(i).covered_blocks)
- then 1
- else 0
- end;
- end loop;
- $end
- return l_results;
- end;
-end;
-/
diff --git a/source/core/coverage/ut_coverage_helper_block.pks b/source/core/coverage/ut_coverage_helper_block.pks
deleted file mode 100644
index a147d9f4f..000000000
--- a/source/core/coverage/ut_coverage_helper_block.pks
+++ /dev/null
@@ -1,26 +0,0 @@
-create or replace package ut_coverage_helper_block authid current_user is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- function coverage_start(a_run_comment in varchar2) return integer;
-
- procedure coverage_stop;
-
- function get_raw_coverage_data(a_object ut_coverage_helper.t_tmp_table_object, a_coverage_run_id raw) return ut_coverage_helper.t_unit_line_calls;
-
-end;
-/
diff --git a/source/core/coverage/ut_coverage_helper_profiler.pkb b/source/core/coverage/ut_coverage_helper_profiler.pkb
deleted file mode 100644
index f29291efb..000000000
--- a/source/core/coverage/ut_coverage_helper_profiler.pkb
+++ /dev/null
@@ -1,93 +0,0 @@
-create or replace package body ut_coverage_helper_profiler is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- type t_proftab_row is record (
- line binary_integer,
- calls number(38,0)
- );
-
- type t_proftab_rows is table of t_proftab_row;
-
- type t_block_row is record(
- line binary_integer
- ,blocks binary_integer
- ,covered_blocks binary_integer);
-
- type t_block_rows is table of t_block_row;
-
-
- function coverage_start(a_run_comment varchar2) return integer is
- l_coverage_id integer;
- begin
- dbms_profiler.start_profiler(run_comment => a_run_comment, run_number => l_coverage_id);
- return l_coverage_id;
- end;
-
- procedure coverage_pause is
- l_return_code binary_integer;
- begin
- l_return_code := dbms_profiler.pause_profiler();
- end;
-
- procedure coverage_resume is
- l_return_code binary_integer;
- begin
- l_return_code := dbms_profiler.resume_profiler();
- end;
-
- procedure coverage_stop is
- begin
- dbms_profiler.stop_profiler();
- end;
-
- function proftab_results(a_object ut_coverage_helper.t_tmp_table_object, a_coverage_run_id raw) return t_proftab_rows is
- l_coverage_rows t_proftab_rows;
- begin
- select /*+ no_parallel */
- d.line#,
- case when sum(d.total_occur) = 0 and sum(d.total_time) > 0 then 1 else sum(d.total_occur) end total_occur
- bulk collect into l_coverage_rows
- from plsql_profiler_units u
- join plsql_profiler_data d
- on u.runid = d.runid
- and u.unit_number = d.unit_number
- join ut_coverage_runs r
- on r.line_coverage_id = u.runid
- where r.coverage_run_id = a_coverage_run_id
- and u.unit_owner = a_object.owner
- and u.unit_name = a_object.name
- and u.unit_type = a_object.type
- group by d.line#;
-
- return l_coverage_rows;
- end;
-
- function get_raw_coverage_data(a_object ut_coverage_helper.t_tmp_table_object, a_coverage_run_id raw) return ut_coverage_helper.t_unit_line_calls is
- l_tmp_data t_proftab_rows;
- l_results ut_coverage_helper.t_unit_line_calls;
- begin
- l_tmp_data := proftab_results(a_object, a_coverage_run_id);
-
- for i in 1 .. l_tmp_data.count loop
- l_results(l_tmp_data(i).line).calls := l_tmp_data(i).calls;
- end loop;
- return l_results;
- end;
-
-end;
-/
diff --git a/source/core/coverage/ut_coverage_helper_profiler.pks b/source/core/coverage/ut_coverage_helper_profiler.pks
deleted file mode 100644
index 0c54a83bf..000000000
--- a/source/core/coverage/ut_coverage_helper_profiler.pks
+++ /dev/null
@@ -1,30 +0,0 @@
-create or replace package ut_coverage_helper_profiler authid definer is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- function coverage_start(a_run_comment in varchar2) return integer;
-
- procedure coverage_stop;
-
- procedure coverage_pause;
-
- procedure coverage_resume;
-
- function get_raw_coverage_data(a_object ut_coverage_helper.t_tmp_table_object, a_coverage_run_id raw) return ut_coverage_helper.t_unit_line_calls;
-
-end;
-/
diff --git a/source/core/coverage/ut_coverage_profiler.pkb b/source/core/coverage/ut_coverage_profiler.pkb
deleted file mode 100644
index 663ceab7f..000000000
--- a/source/core/coverage/ut_coverage_profiler.pkb
+++ /dev/null
@@ -1,96 +0,0 @@
-create or replace package body ut_coverage_profiler is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Public functions
- */
- function get_coverage_data(a_coverage_options ut_coverage_options) return ut_coverage.t_coverage is
- l_line_calls ut_coverage_helper.t_unit_line_calls;
- l_result ut_coverage.t_coverage;
- l_new_unit ut_coverage.t_unit_coverage;
- l_line_no binary_integer;
- l_source_objects_crsr ut_coverage_helper.t_tmp_table_objects_crsr;
- l_source_object ut_coverage_helper.t_tmp_table_object;
- begin
-
- l_source_objects_crsr := ut_coverage_helper.get_tmp_table_objects_cursor();
- loop
- fetch l_source_objects_crsr into l_source_object;
- exit when l_source_objects_crsr%notfound;
-
- --get coverage data
- l_line_calls := ut_coverage_helper_profiler.get_raw_coverage_data( l_source_object, a_coverage_options.coverage_run_id);
-
- --if there is coverage, we need to filter out the garbage (badly indicated data from dbms_profiler)
- if l_line_calls.count > 0 then
- --remove lines that should not be indicted as meaningful
- for i in 1 .. l_source_object.to_be_skipped_list.count loop
- if l_source_object.to_be_skipped_list(i) is not null then
- l_line_calls.delete(l_source_object.to_be_skipped_list(i));
- end if;
- end loop;
- end if;
-
- --if there are no file mappings or object was actually captured by profiler
- if a_coverage_options.file_mappings is null or l_line_calls.count > 0 then
-
- --populate total stats
- l_result.total_lines := nvl(l_result.total_lines,0) + l_source_object.lines_count;
- --populate object level coverage stats
- if not l_result.objects.exists(l_source_object.full_name) then
- l_result.objects(l_source_object.full_name) := l_new_unit;
- l_result.objects(l_source_object.full_name).owner := l_source_object.owner;
- l_result.objects(l_source_object.full_name).name := l_source_object.name;
- l_result.objects(l_source_object.full_name).total_lines := l_source_object.lines_count;
- end if;
- --map to results
- l_line_no := l_line_calls.first;
- if l_line_no is null then
- l_result.uncovered_lines := l_result.uncovered_lines + l_source_object.lines_count;
- l_result.objects(l_source_object.full_name).uncovered_lines := l_source_object.lines_count;
- else
- loop
- exit when l_line_no is null;
-
- if l_line_calls(l_line_no).calls > 0 then
- --total stats
- l_result.covered_lines := l_result.covered_lines + 1;
- l_result.executions := l_result.executions + l_line_calls(l_line_no).calls;
- --object level stats
- l_result.objects(l_source_object.full_name).covered_lines := l_result.objects(l_source_object.full_name).covered_lines + 1;
- l_result.objects(l_source_object.full_name).executions := l_result.objects(l_source_object.full_name).executions + l_line_calls(l_line_no).calls;
- elsif l_line_calls(l_line_no).calls = 0 then
- l_result.uncovered_lines := l_result.uncovered_lines + 1;
- l_result.objects(l_source_object.full_name).uncovered_lines := l_result.objects(l_source_object.full_name).uncovered_lines + 1;
- end if;
- l_result.objects(l_source_object.full_name).lines(l_line_no).executions := l_line_calls(l_line_no).calls;
-
- l_line_no := l_line_calls.next(l_line_no);
- end loop;
- end if;
- end if;
-
- end loop;
-
- close l_source_objects_crsr;
-
- return l_result;
- end get_coverage_data;
-
-end;
-/
diff --git a/source/core/coverage/ut_coverage_profiler.pks b/source/core/coverage/ut_coverage_profiler.pks
deleted file mode 100644
index 9ce9a27f0..000000000
--- a/source/core/coverage/ut_coverage_profiler.pks
+++ /dev/null
@@ -1,22 +0,0 @@
-create or replace package ut_coverage_profiler authid current_user is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- function get_coverage_data(a_coverage_options ut_coverage_options) return ut_coverage.t_coverage;
-
-end;
-/
diff --git a/source/core/coverage/ut_coverage_reporter_base.tpb b/source/core/coverage/ut_coverage_reporter_base.tpb
deleted file mode 100644
index da2bd27ad..000000000
--- a/source/core/coverage/ut_coverage_reporter_base.tpb
+++ /dev/null
@@ -1,113 +0,0 @@
-create or replace type body ut_coverage_reporter_base is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- overriding final member procedure before_calling_run(self in out nocopy ut_coverage_reporter_base, a_run ut_run) as
- begin
- (self as ut_output_reporter_base).before_calling_run(a_run);
- ut_coverage.coverage_start(a_coverage_run_id => a_run.coverage_options.coverage_run_id);
- ut_coverage.coverage_pause();
- end;
-
- overriding final member procedure before_calling_before_all(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_resume();
- end;
- overriding final member procedure after_calling_before_all (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_pause();
- end;
-
- overriding final member procedure before_calling_before_each(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_resume();
- end;
- overriding final member procedure after_calling_before_each (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_pause();
- end;
-
- overriding final member procedure before_calling_before_test(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_resume();
- end;
- overriding final member procedure after_calling_before_test (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_pause();
- end;
-
- overriding final member procedure before_calling_test_execute(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_resume();
- end;
- overriding final member procedure after_calling_test_execute (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_pause();
- end;
-
- overriding final member procedure before_calling_after_test(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_resume();
- end;
- overriding final member procedure after_calling_after_test (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_pause();
- end;
-
- overriding final member procedure before_calling_after_each(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_resume();
- end;
- overriding final member procedure after_calling_after_each (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_pause();
- end;
-
- overriding final member procedure before_calling_after_all(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_resume();
- end;
- overriding final member procedure after_calling_after_all (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable) is
- begin
- ut_coverage.coverage_pause();
- end;
-
- final member function get_report( a_coverage_options ut_coverage_options, a_client_character_set varchar2 := null ) return ut_varchar2_rows pipelined is
- l_reporter ut_coverage_reporter_base := self;
- begin
- ut_coverage_helper.cleanup_tmp_table();
- (l_reporter as ut_output_reporter_base).before_calling_run(null);
- l_reporter.after_calling_run( ut_run( a_coverage_options => a_coverage_options, a_client_character_set => a_client_character_set ) );
- for i in (select /*+ no_parallel */ x.text from table(l_reporter.get_lines(1, 1)) x ) loop
- pipe row (i.text);
- end loop;
- return;
- end;
-
- final member function get_report_cursor( a_coverage_options ut_coverage_options, a_client_character_set varchar2 := null ) return sys_refcursor is
- l_reporter ut_coverage_reporter_base := self;
- l_result sys_refcursor;
- begin
- ut_coverage_helper.cleanup_tmp_table();
- (l_reporter as ut_output_reporter_base).before_calling_run(null);
- l_reporter.after_calling_run( ut_run( a_coverage_options => a_coverage_options, a_client_character_set => a_client_character_set ) );
- open l_result for select /*+ no_parallel */ x.text from table(l_reporter.get_lines(1, 1)) x;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/core/coverage/ut_coverage_reporter_base.tps b/source/core/coverage/ut_coverage_reporter_base.tps
deleted file mode 100644
index 305c5d757..000000000
--- a/source/core/coverage/ut_coverage_reporter_base.tps
+++ /dev/null
@@ -1,44 +0,0 @@
-create or replace type ut_coverage_reporter_base under ut_output_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- overriding final member procedure before_calling_run(self in out nocopy ut_coverage_reporter_base, a_run ut_run),
- overriding final member procedure before_calling_before_all(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
- overriding final member procedure after_calling_before_all (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
-
- overriding final member procedure before_calling_before_each(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
- overriding final member procedure after_calling_before_each (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
-
- overriding final member procedure before_calling_before_test(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
- overriding final member procedure after_calling_before_test (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
-
- overriding final member procedure before_calling_test_execute(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
- overriding final member procedure after_calling_test_execute (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
-
- overriding final member procedure before_calling_after_test(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
- overriding final member procedure after_calling_after_test (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
-
- overriding final member procedure before_calling_after_each(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
- overriding final member procedure after_calling_after_each (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
-
- overriding final member procedure before_calling_after_all(self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
- overriding final member procedure after_calling_after_all (self in out nocopy ut_coverage_reporter_base, a_executable in ut_executable),
- final member function get_report( a_coverage_options ut_coverage_options, a_client_character_set varchar2 := null ) return ut_varchar2_rows pipelined,
- final member function get_report_cursor( a_coverage_options ut_coverage_options, a_client_character_set varchar2 := null ) return sys_refcursor
-)
-not final not instantiable
-/
diff --git a/source/core/coverage/ut_coverage_runs.sql b/source/core/coverage/ut_coverage_runs.sql
deleted file mode 100644
index 78230240d..000000000
--- a/source/core/coverage/ut_coverage_runs.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-declare
- l_tab_exist number;
-begin
- select count(*) into l_tab_exist
- from all_tables
- where table_name = 'UT_COVERAGE_RUNS' and owner = sys_context('USERENV','CURRENT_SCHEMA');
- if l_tab_exist = 0 then
- execute immediate q'[create table ut_coverage_runs
- (
- coverage_run_id raw(32) not null,
- line_coverage_id number(38,0) unique not null,
- block_coverage_id number(38,0) unique,
- constraint ut_coverage_runs primary key (coverage_run_id, line_coverage_id)
- ) organization index ]';
- execute immediate q'[comment on table ut_coverage_runs is
- 'Map of block and line coverage runs for a test-run']';
- dbms_output.put_line('UT_COVERAGE_RUNS table created');
- end if;
-end;
-/
diff --git a/source/core/coverage/ut_coverage_sources_tmp.sql b/source/core/coverage/ut_coverage_sources_tmp.sql
deleted file mode 100644
index c091d5955..000000000
--- a/source/core/coverage/ut_coverage_sources_tmp.sql
+++ /dev/null
@@ -1,26 +0,0 @@
-create global temporary table ut_coverage_sources_tmp(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- full_name varchar2(4000),
- owner varchar2(250),
- name varchar2(250),
- type varchar2(250),
- line number(38,0),
- to_be_skipped varchar2(1),
- text varchar2(4000),
- constraint ut_coverage_sources_tmp_pk primary key (owner,name,type,line)
-) on commit preserve rows;
-
---is this needed?
---create unique index ut_coverage_sources_tmp_uk on ut_coverage_sources_tmp$ (owner,name,to_be_skipped, line);
diff --git a/source/core/events/ut_event_item.tps b/source/core/events/ut_event_item.tps
deleted file mode 100644
index c0ea653ea..000000000
--- a/source/core/events/ut_event_item.tps
+++ /dev/null
@@ -1,25 +0,0 @@
-create or replace type ut_event_item authid current_user as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Object type is a pre-declaration to be referenced by ut_event_listener_base
- * The true abstract type is ut_suite_item
- */
- self_type varchar2(250 byte)
-) not final not instantiable
-/
diff --git a/source/core/events/ut_event_listener.tps b/source/core/events/ut_event_listener.tps
deleted file mode 100644
index bbcdbf218..000000000
--- a/source/core/events/ut_event_listener.tps
+++ /dev/null
@@ -1,35 +0,0 @@
-create or replace type ut_event_listener authid current_user as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Object type is a pre-declaration to be referenced by ut_event_listener_base
- * The true abstract type is ut_suite_item
- */
- self_type varchar2(250 byte),
-
- /**
- * Returns the list of events that are supported by particular implementation of the reporter
- */
- not instantiable member function get_supported_events return ut_varchar2_list,
-
- /**
- * Executes an action for a given event name
- */
- not instantiable member procedure on_event( self in out nocopy ut_event_listener, a_event_name varchar2, a_event_item ut_event_item)
-) not final not instantiable
-/
diff --git a/source/core/events/ut_event_manager.pkb b/source/core/events/ut_event_manager.pkb
deleted file mode 100644
index f51019421..000000000
--- a/source/core/events/ut_event_manager.pkb
+++ /dev/null
@@ -1,122 +0,0 @@
-create or replace package body ut_event_manager as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- type t_listeners is table of ut_event_listener;
- subtype t_listener_number is binary_integer;
- type t_listener_numbers is table of boolean index by t_listener_number;
- type t_events_listeners is table of t_listener_numbers index by t_event_name;
-
- type t_event_manager is record (
- event_listener_index t_events_listeners,
- listeners t_listeners
- );
- type t_event_managers is table of t_event_manager;
-
- g_event_listeners_index t_events_listeners;
- g_listeners t_listeners;
- g_suspended_event_managers t_event_managers;
-
- procedure initialize is
- begin
- if g_listeners is not null and g_listeners.count > 0 then
- if g_suspended_event_managers is null then
- g_suspended_event_managers := t_event_managers();
- end if;
- g_suspended_event_managers.extend;
- g_suspended_event_managers(g_suspended_event_managers.count).event_listener_index := g_event_listeners_index;
- g_suspended_event_managers(g_suspended_event_managers.count).listeners := g_listeners;
- end if;
- g_event_listeners_index.delete;
- g_listeners := t_listeners();
- end;
-
- procedure dispose_listeners is
- begin
- if g_suspended_event_managers is not null and g_suspended_event_managers.count > 0 then
- g_event_listeners_index := g_suspended_event_managers(g_suspended_event_managers.count).event_listener_index;
- g_listeners := g_suspended_event_managers(g_suspended_event_managers.count).listeners;
- g_suspended_event_managers.trim(1);
- else
- g_event_listeners_index.delete;
- g_listeners := t_listeners();
- end if;
- end;
-
- procedure trigger_event( a_event_name t_event_name, a_event_object ut_event_item := null ) is
-
- procedure trigger_listener_event(
- a_listener_numbers t_listener_numbers,
- a_event_name t_event_name,
- a_event_object ut_event_item
- ) is
- l_listener_number t_listener_number := a_listener_numbers.first;
- begin
- while l_listener_number is not null loop
- g_listeners(l_listener_number).on_event(a_event_name, a_event_object);
- l_listener_number := a_listener_numbers.next(l_listener_number);
- end loop;
- end;
- begin
- if a_event_name is not null then
- if g_event_listeners_index.exists(gc_all) then
- trigger_listener_event( g_event_listeners_index(gc_all), a_event_name, a_event_object );
- end if;
- if g_event_listeners_index.exists(a_event_name) then
- trigger_listener_event( g_event_listeners_index(a_event_name), a_event_name, a_event_object );
- end if;
- if a_event_name = ut_event_manager.gc_finalize then
- dispose_listeners();
- end if;
- end if;
- end;
-
- procedure add_event( a_event_name t_event_name, a_listener_pos binary_integer ) is
- begin
- g_event_listeners_index(a_event_name)(a_listener_pos) := true;
- end;
-
- procedure add_events( a_event_names ut_varchar2_list, a_listener_pos binary_integer ) is
- begin
- for i in 1 .. a_event_names.count loop
- add_event( a_event_names(i), a_listener_pos );
- end loop;
- end;
-
- function add_listener( a_listener ut_event_listener ) return t_listener_number is
- begin
- if g_listeners is null then
- g_listeners := t_listeners();
- end if;
- g_listeners.extend;
- g_listeners(g_listeners.last) := a_listener;
- return g_listeners.last;
- end;
-
- procedure add_listener( a_listener ut_event_listener ) is
- l_event_names ut_varchar2_list;
- begin
- if a_listener is not null then
- l_event_names := a_listener.get_supported_events();
- if l_event_names is not empty then
- add_events( l_event_names, add_listener( a_listener ) );
- end if;
- end if;
- end;
-
-end;
-/
diff --git a/source/core/events/ut_event_manager.pks b/source/core/events/ut_event_manager.pks
deleted file mode 100644
index 03b18b728..000000000
--- a/source/core/events/ut_event_manager.pks
+++ /dev/null
@@ -1,66 +0,0 @@
-create or replace package ut_event_manager authid current_user as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /* Constants: Event names */
- subtype t_event_name is varchar2(250);
-
- --capture all events
- gc_all constant t_event_name := 'all';
-
- gc_debug constant t_event_name := 'debug';
-
- gc_initialize constant t_event_name := 'initialize';
-
- gc_before_run constant t_event_name := 'before_run';
- gc_before_suite constant t_event_name := 'before_suite';
-
- gc_before_before_all constant t_event_name := 'before_beforeall';
- gc_after_before_all constant t_event_name := 'after_beforeall';
-
- gc_before_test constant t_event_name := 'beforetest';
-
- gc_before_before_each constant t_event_name := 'before_beforeeach';
- gc_after_before_each constant t_event_name := 'after_beforeeach';
- gc_before_before_test constant t_event_name := 'before_beforetest';
- gc_after_before_test constant t_event_name := 'after_beforetest';
-
- gc_before_test_execute constant t_event_name := 'before_test';
- gc_after_test_execute constant t_event_name := 'after_test';
-
- gc_before_after_test constant t_event_name := 'before_aftertest';
- gc_after_after_test constant t_event_name := 'after_aftertest';
- gc_before_after_each constant t_event_name := 'before_aftereach';
- gc_after_after_each constant t_event_name := 'after_aftereach';
-
- gc_after_test constant t_event_name := 'aftertest';
-
- gc_before_after_all constant t_event_name := 'before_afterall';
- gc_after_after_all constant t_event_name := 'after_afterall';
-
- gc_after_suite constant t_event_name := 'after_suite';
- gc_after_run constant t_event_name := 'after_run';
-
- gc_finalize constant t_event_name := 'finalize';
-
- procedure trigger_event( a_event_name t_event_name, a_event_object ut_event_item := null );
-
- procedure initialize;
-
- procedure add_listener( a_listener ut_event_listener );
-
-end;
-/
diff --git a/source/core/output_buffers/ut_output_buffer_base.tpb b/source/core/output_buffers/ut_output_buffer_base.tpb
deleted file mode 100644
index 20cec335e..000000000
--- a/source/core/output_buffers/ut_output_buffer_base.tpb
+++ /dev/null
@@ -1,155 +0,0 @@
-create or replace type body ut_output_buffer_base is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- member procedure init(self in out nocopy ut_output_buffer_base, a_output_id raw := null, a_self_type varchar2 := null) is
- pragma autonomous_transaction;
- l_exists int;
- begin
- cleanup_buffer();
- self.self_type := coalesce(a_self_type,self.self_type);
- self.output_id := coalesce(a_output_id, self.output_id, sys_guid());
- self.start_date := coalesce(self.start_date, sysdate);
- select /*+ no_parallel */ count(*) into l_exists from ut_output_buffer_info_tmp where output_id = self.output_id;
- if ( l_exists > 0 ) then
- update /*+ no_parallel */ ut_output_buffer_info_tmp set start_date = self.start_date where output_id = self.output_id;
- else
- insert /*+ no_parallel */ into ut_output_buffer_info_tmp(output_id, start_date) values (self.output_id, self.start_date);
- end if;
- commit;
- dbms_lock.allocate_unique( self.output_id, self.lock_handle);
- self.is_closed := 0;
- end;
-
- member procedure lock_buffer(a_timeout_sec number := null) is
- l_status integer;
- begin
- l_status := dbms_lock.request( self.lock_handle, dbms_lock.x_mode, 5, false );
- if l_status != 0 then
- raise_application_error(-20000, 'Cannot allocate lock for output buffer of reporter. lock request status = '||l_status||', lock handle = '||self.lock_handle||', self.output_id ='||self.output_id);
- end if;
- end;
-
- member procedure close(self in out nocopy ut_output_buffer_base) is
- l_status integer;
- begin
- l_status := dbms_lock.release( self.lock_handle );
- if l_status != 0 then
- raise_application_error(-20000, 'Cannot release lock for output buffer of reporter. Lock_handle = '||self.lock_handle||' status = '||l_status);
- end if;
- self.is_closed := 1;
- end;
-
-
- member procedure remove_buffer_info(self in ut_output_buffer_base) is
- pragma autonomous_transaction;
- begin
- delete from ut_output_buffer_info_tmp a
- where a.output_id = self.output_id;
- commit;
- end;
-
- member function timeout_producer_not_started( a_producer_started boolean, a_already_waited_sec number, a_init_wait_sec number ) return boolean
- is
- l_result boolean := false;
- begin
- if not a_producer_started and a_already_waited_sec >= a_init_wait_sec then
- if a_init_wait_sec > 0 then
- self.remove_buffer_info();
- raise_application_error(
- ut_utils.gc_out_buffer_timeout,
- 'Timeout occurred while waiting for report data producer to start. Waited for: '||ut_utils.to_string( a_already_waited_sec )||' seconds.'
- );
- else
- l_result := true;
- end if;
- end if;
- return l_result;
- end;
-
- member function timeout_producer_not_finished(a_producer_finished boolean, a_already_waited_sec number, a_timeout_sec number) return boolean
- is
- l_result boolean := false;
- begin
- if not a_producer_finished and a_timeout_sec is not null and a_already_waited_sec >= a_timeout_sec then
- if a_timeout_sec > 0 then
- self.remove_buffer_info();
- raise_application_error(
- ut_utils.gc_out_buffer_timeout,
- 'Timeout occurred while waiting for more data from producer. Waited for: '||ut_utils.to_string( a_already_waited_sec )||' seconds.'
- );
- else
- l_result := true;
- end if;
- end if;
- return l_result;
- end;
-
- member function get_lock_status return integer is
- l_result integer;
- l_release_status integer;
- begin
- l_result := dbms_lock.request( self.lock_handle, dbms_lock.s_mode, 0, false );
- if l_result = 0 then
- l_release_status := dbms_lock.release( self.lock_handle );
- end if;
- return l_result;
- end;
-
- member function get_lines_cursor(a_initial_timeout number := null, a_timeout_sec number := null) return sys_refcursor is
- l_lines sys_refcursor;
- begin
- open l_lines for
- select /*+ no_parallel */ text, item_type
- from table(self.get_lines(a_initial_timeout, a_timeout_sec));
- return l_lines;
- end;
-
- member procedure lines_to_dbms_output(self in ut_output_buffer_base, a_initial_timeout number := null, a_timeout_sec number := null) is
- l_data sys_refcursor;
- l_clob clob;
- l_item_type varchar2(32767);
- l_lines ut_varchar2_list;
- begin
- l_data := self.get_lines_cursor(a_initial_timeout, a_timeout_sec);
- loop
- fetch l_data into l_clob, l_item_type;
- exit when l_data%notfound;
- if dbms_lob.getlength(l_clob) > 32767 then
- l_lines := ut_utils.clob_to_table(l_clob);
- for i in 1 .. l_lines.count loop
- dbms_output.put_line(l_lines(i));
- end loop;
- else
- dbms_output.put_line(l_clob);
- end if;
- end loop;
- close l_data;
- end;
-
- member procedure cleanup_buffer(self in ut_output_buffer_base, a_retention_time_sec natural := null) is
- gc_buffer_retention_sec constant naturaln := coalesce(a_retention_time_sec, 60 * 60 * 24 * 5); -- 5 days
- l_retention_days number := gc_buffer_retention_sec / (60 * 60 * 24);
- l_max_retention_date date := sysdate - l_retention_days;
- pragma autonomous_transaction;
- begin
- delete from ut_output_buffer_info_tmp i where i.start_date <= l_max_retention_date;
- commit;
- end;
-
-end;
-/
\ No newline at end of file
diff --git a/source/core/output_buffers/ut_output_buffer_base.tps b/source/core/output_buffers/ut_output_buffer_base.tps
deleted file mode 100644
index f2d9ec686..000000000
--- a/source/core/output_buffers/ut_output_buffer_base.tps
+++ /dev/null
@@ -1,39 +0,0 @@
-create or replace type ut_output_buffer_base force authid definer as object(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- output_id raw(32),
- is_closed number(1,0),
- start_date date,
- lock_handle varchar2(30 byte),
- self_type varchar2(250 byte),
- member procedure init(self in out nocopy ut_output_buffer_base, a_output_id raw := null, a_self_type varchar2 := null),
- member procedure lock_buffer(a_timeout_sec number := null),
- member function timeout_producer_not_started( a_producer_started boolean, a_already_waited_sec number, a_init_wait_sec number ) return boolean,
- member function timeout_producer_not_finished(a_producer_finished boolean, a_already_waited_sec number, a_timeout_sec number) return boolean,
- member function get_lock_status return integer,
- member function get_lines_cursor(a_initial_timeout number := null, a_timeout_sec number := null) return sys_refcursor,
- member procedure lines_to_dbms_output(self in ut_output_buffer_base, a_initial_timeout number := null, a_timeout_sec number := null),
- member procedure cleanup_buffer(self in ut_output_buffer_base, a_retention_time_sec natural := null),
- member procedure remove_buffer_info(self in ut_output_buffer_base),
- member procedure close(self in out nocopy ut_output_buffer_base),
- not instantiable member procedure send_line(self in out nocopy ut_output_buffer_base, a_text varchar2, a_item_type varchar2 := null),
- not instantiable member procedure send_lines(self in out nocopy ut_output_buffer_base, a_text_list ut_varchar2_rows, a_item_type varchar2 := null),
- not instantiable member procedure send_clob(self in out nocopy ut_output_buffer_base, a_text clob, a_item_type varchar2 := null),
- not instantiable member function get_lines(a_initial_timeout number := null, a_timeout_sec number := null) return ut_output_data_rows pipelined
-) not final not instantiable
-/
diff --git a/source/core/output_buffers/ut_output_buffer_info_tmp.sql b/source/core/output_buffers/ut_output_buffer_info_tmp.sql
deleted file mode 100644
index af730d394..000000000
--- a/source/core/output_buffers/ut_output_buffer_info_tmp.sql
+++ /dev/null
@@ -1,25 +0,0 @@
-create table ut_output_buffer_info_tmp(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /*
- * This table is not a global temporary table as it needs to allow cross-session data exchange
- * It is used however as a temporary table with multiple writers.
- * This is why it has very high initrans and has nologging
- */
- output_id raw(32) not null,
- start_date date not null,
- constraint ut_output_buffer_info_tmp_pk primary key(output_id)
-) organization index nologging initrans 10
-;
-
diff --git a/source/core/output_buffers/ut_output_buffer_tmp.sql b/source/core/output_buffers/ut_output_buffer_tmp.sql
deleted file mode 100644
index 1ab19e534..000000000
--- a/source/core/output_buffers/ut_output_buffer_tmp.sql
+++ /dev/null
@@ -1,33 +0,0 @@
-create table ut_output_buffer_tmp(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /*
- * This table is not a global temporary table as it needs to allow cross-session data exchange
- * It is used however as a temporary table with multiple writers.
- * This is why it has very high initrans and has nologging
- */
- output_id raw(32) not null,
- message_id number(38,0) not null,
- text varchar2(4000),
- item_type varchar2(1000),
- is_finished number(1,0) default 0 not null,
- constraint ut_output_buffer_tmp_pk primary key(output_id, message_id),
- constraint ut_output_buffer_tmp_ck check(
- is_finished = 0 and (text is not null or item_type is not null )
- or is_finished = 1 and text is null and item_type is null ),
- constraint ut_output_buffer_fk foreign key (output_id) references ut_output_buffer_info_tmp(output_id) on delete cascade
-) organization index nologging initrans 100
- overflow nologging initrans 100;
-
-create sequence ut_output_buffer_tmp_seq cache 20;
diff --git a/source/core/output_buffers/ut_output_bulk_buffer.tpb b/source/core/output_buffers/ut_output_bulk_buffer.tpb
deleted file mode 100644
index cfc173e95..000000000
--- a/source/core/output_buffers/ut_output_bulk_buffer.tpb
+++ /dev/null
@@ -1,160 +0,0 @@
-create or replace type body ut_output_bulk_buffer is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2023 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_output_bulk_buffer(self in out nocopy ut_output_bulk_buffer, a_output_id raw := null) return self as result is
- begin
- self.init(a_output_id, $$plsql_unit);
- return;
- end;
-
- overriding member procedure send_line(self in out nocopy ut_output_bulk_buffer, a_text varchar2, a_item_type varchar2 := null) is
- pragma autonomous_transaction;
- begin
- if a_text is not null or a_item_type is not null then
- if length(a_text) > ut_utils.gc_max_storage_varchar2_len then
- self.send_lines(
- ut_utils.convert_collection(
- ut_utils.clob_to_table(a_text, ut_utils.gc_max_storage_varchar2_len)
- ),
- a_item_type
- );
- else
- insert /*+ no_parallel */ into ut_output_buffer_tmp(output_id, message_id, text, item_type)
- values (self.output_id, ut_output_buffer_tmp_seq.nextval, a_text, a_item_type);
- end if;
- commit;
- end if;
- end;
-
- overriding member procedure send_lines(self in out nocopy ut_output_bulk_buffer, a_text_list ut_varchar2_rows, a_item_type varchar2 := null) is
- pragma autonomous_transaction;
- begin
- insert /*+ no_parallel */ into ut_output_buffer_tmp(output_id, message_id, text, item_type)
- select /*+ no_parallel */ self.output_id, ut_output_buffer_tmp_seq.nextval, t.column_value, a_item_type
- from table(a_text_list) t
- where t.column_value is not null or a_item_type is not null;
- commit;
- end;
-
- overriding member procedure send_clob(self in out nocopy ut_output_bulk_buffer, a_text clob, a_item_type varchar2 := null) is
- pragma autonomous_transaction;
- begin
- if a_text is not null and a_text != empty_clob() or a_item_type is not null then
- if length(a_text) > ut_utils.gc_max_storage_varchar2_len then
- self.send_lines(
- ut_utils.convert_collection(
- ut_utils.clob_to_table(a_text, ut_utils.gc_max_storage_varchar2_len)
- ),
- a_item_type
- );
- else
- insert /*+ no_parallel */ into ut_output_buffer_tmp(output_id, message_id, text, item_type)
- values (self.output_id, ut_output_buffer_tmp_seq.nextval, a_text, a_item_type);
- end if;
- commit;
- end if;
- end;
-
- overriding member procedure lines_to_dbms_output(self in ut_output_bulk_buffer, a_initial_timeout number := null, a_timeout_sec number := null) is
- l_data sys_refcursor;
- l_text ut_varchar2_rows;
- l_item_type ut_varchar2_rows;
- begin
- l_data := self.get_lines_cursor(a_initial_timeout, a_timeout_sec);
- loop
- fetch l_data bulk collect into l_text, l_item_type limit 10000;
- for idx in 1 .. l_text.count loop
- dbms_output.put_line(l_text(idx));
- end loop;
- exit when l_data%notfound;
- end loop;
- close l_data;
- self.remove_buffer_info();
- end;
-
- overriding member function get_lines_cursor(a_initial_timeout number := null, a_timeout_sec number := null) return sys_refcursor is
- lc_init_wait_sec constant number := coalesce(a_initial_timeout, 10 );
- l_already_waited_sec number(10,2) := 0;
- l_sleep_time number(2,1);
- l_exists integer;
- l_finished boolean := false;
- l_data_produced boolean := false;
- l_producer_active boolean := false;
- l_producer_started boolean := false;
- l_producer_finished boolean := false;
- l_results sys_refcursor;
- begin
-
- while not l_finished loop
-
- if not l_data_produced then
- select /*+ no_parallel */ count(1) into l_exists
- from ut_output_buffer_tmp o
- where o.output_id = self.output_id and rownum = 1;
- l_data_produced := (l_exists = 1);
- end if;
-
- l_sleep_time := case when l_already_waited_sec >= 1 then 0.5 else 0.1 end;
- l_producer_active := (self.get_lock_status() <> 0);
- l_producer_started := (l_producer_active or l_data_produced ) or l_producer_started;
- l_producer_finished := (l_producer_started and not l_producer_active) or l_producer_finished;
- l_finished :=
- self.timeout_producer_not_finished(l_producer_finished, l_already_waited_sec, a_timeout_sec)
- or self.timeout_producer_not_started(l_producer_started, l_already_waited_sec, lc_init_wait_sec)
- or l_producer_finished;
-
- dbms_lock.sleep(l_sleep_time);
- l_already_waited_sec := l_already_waited_sec + l_sleep_time;
- end loop;
-
- open l_results for
- select /*+ no_parallel */ o.text, o.item_type
- from ut_output_buffer_tmp o
- where o.output_id = self.output_id
- and o.text is not null
- order by o.output_id, o.message_id;
-
- return l_results;
-
- end;
-
- /* Important note.
- This function code is almost duplicated between two types for performance reasons.
- The pipe row clause is much faster on VARCHAR2 then it is on clob.
- That is the key reason for two implementations.
- */
- overriding member function get_lines(a_initial_timeout number := null, a_timeout_sec number := null) return ut_output_data_rows pipelined is
- l_data sys_refcursor;
- l_text ut_varchar2_rows;
- l_item_type ut_varchar2_rows;
- begin
- l_data := self.get_lines_cursor(a_initial_timeout, a_timeout_sec);
- loop
- fetch l_data bulk collect into l_text, l_item_type limit 10000;
- for idx in 1 .. l_text.count loop
- pipe row( ut_output_data_row(l_text(idx), l_item_type(idx)) );
- end loop;
- exit when l_data%notfound;
- end loop;
- close l_data;
- self.remove_buffer_info();
- return;
- end;
-
-end;
-/
diff --git a/source/core/output_buffers/ut_output_bulk_buffer.tps b/source/core/output_buffers/ut_output_bulk_buffer.tps
deleted file mode 100644
index d74d4ee14..000000000
--- a/source/core/output_buffers/ut_output_bulk_buffer.tps
+++ /dev/null
@@ -1,27 +0,0 @@
-create or replace type ut_output_bulk_buffer under ut_output_buffer_base (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2023 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_output_bulk_buffer(self in out nocopy ut_output_bulk_buffer, a_output_id raw := null) return self as result,
- overriding member procedure send_line(self in out nocopy ut_output_bulk_buffer, a_text varchar2, a_item_type varchar2 := null),
- overriding member procedure send_lines(self in out nocopy ut_output_bulk_buffer, a_text_list ut_varchar2_rows, a_item_type varchar2 := null),
- overriding member procedure send_clob(self in out nocopy ut_output_bulk_buffer, a_text clob, a_item_type varchar2 := null),
- overriding member procedure lines_to_dbms_output(self in ut_output_bulk_buffer, a_initial_timeout number := null, a_timeout_sec number := null),
- overriding member function get_lines_cursor(a_initial_timeout number := null, a_timeout_sec number := null) return sys_refcursor,
- overriding member function get_lines(a_initial_timeout number := null, a_timeout_sec number := null) return ut_output_data_rows pipelined
-) not final
-/
diff --git a/source/core/output_buffers/ut_output_clob_buffer_tmp.sql b/source/core/output_buffers/ut_output_clob_buffer_tmp.sql
deleted file mode 100644
index 9ff9f7413..000000000
--- a/source/core/output_buffers/ut_output_clob_buffer_tmp.sql
+++ /dev/null
@@ -1,49 +0,0 @@
-declare
- v_table_sql varchar2(32767);
- e_non_assm exception;
- pragma exception_init(e_non_assm, -43853);
-begin
- v_table_sql := 'create table ut_output_clob_buffer_tmp(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /*
- * This table is not a global temporary table as it needs to allow cross-session data exchange
- * It is used however as a temporary table with multiple writers.
- * This is why it has very high initrans and has nologging
- */
- output_id raw(32) not null,
- message_id number(38,0) not null,
- text clob,
- item_type varchar2(1000),
- is_finished number(1,0) default 0 not null,
- constraint ut_output_clob_buffer_tmp_pk primary key(output_id, message_id),
- constraint ut_output_clob_buffer_tmp_ck check(
- is_finished = 0 and (text is not null or item_type is not null )
- or is_finished = 1 and text is null and item_type is null ),
- constraint ut_output_clob_buffer_tmp_fk foreign key (output_id) references ut_output_buffer_info_tmp(output_id) on delete cascade
-) nologging initrans 100
-';
- begin
- execute immediate
- v_table_sql || 'lob(text) store as securefile ut_output_text(retention none enable storage in row)';
- exception
- when e_non_assm then
- execute immediate
- v_table_sql || 'lob(text) store as basicfile ut_output_text(pctversion 0 enable storage in row)';
-
- end;
-end;
-/
-
-create sequence ut_output_clob_buffer_tmp_seq cache 20;
diff --git a/source/core/output_buffers/ut_output_clob_table_buffer.tpb b/source/core/output_buffers/ut_output_clob_table_buffer.tpb
deleted file mode 100644
index 3d49ab08d..000000000
--- a/source/core/output_buffers/ut_output_clob_table_buffer.tpb
+++ /dev/null
@@ -1,134 +0,0 @@
-create or replace type body ut_output_clob_table_buffer is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_output_clob_table_buffer(self in out nocopy ut_output_clob_table_buffer, a_output_id raw := null) return self as result is
- begin
- self.init(a_output_id, $$plsql_unit);
- return;
- end;
-
- overriding member procedure send_line(self in out nocopy ut_output_clob_table_buffer, a_text varchar2, a_item_type varchar2 := null) is
- pragma autonomous_transaction;
- begin
- if a_text is not null or a_item_type is not null then
- insert /*+ no_parallel */ into ut_output_clob_buffer_tmp(output_id, message_id, text, item_type)
- values (self.output_id, ut_output_clob_buffer_tmp_seq.nextval, a_text, a_item_type);
- end if;
- commit;
- end;
-
- overriding member procedure send_lines(self in out nocopy ut_output_clob_table_buffer, a_text_list ut_varchar2_rows, a_item_type varchar2 := null) is
- pragma autonomous_transaction;
- begin
- insert /*+ no_parallel */ into ut_output_clob_buffer_tmp(output_id, message_id, text, item_type)
- select /*+ no_parallel */ self.output_id, ut_output_clob_buffer_tmp_seq.nextval, t.column_value, a_item_type
- from table(a_text_list) t
- where t.column_value is not null or a_item_type is not null;
- commit;
- end;
-
- overriding member procedure send_clob(self in out nocopy ut_output_clob_table_buffer, a_text clob, a_item_type varchar2 := null) is
- pragma autonomous_transaction;
- begin
- if a_text is not null and a_text != empty_clob() or a_item_type is not null then
- insert /*+ no_parallel */ into ut_output_clob_buffer_tmp(output_id, message_id, text, item_type)
- values (self.output_id, ut_output_clob_buffer_tmp_seq.nextval, a_text, a_item_type);
- end if;
- commit;
- end;
-
- overriding member function get_lines(a_initial_timeout number := null, a_timeout_sec number := null) return ut_output_data_rows pipelined is
- lc_init_wait_sec constant number := coalesce(a_initial_timeout, 10 );
- l_buffer_rowids ut_varchar2_rows;
- l_buffer_data ut_output_data_rows;
- l_finished_flags ut_integer_list;
- l_already_waited_sec number(10,2) := 0;
- l_finished boolean := false;
- l_sleep_time number(2,1);
- l_lock_status integer;
- l_producer_started boolean := false;
- l_producer_finished boolean := false;
- procedure get_data_from_buffer_table(
- a_buffer_data out nocopy ut_output_data_rows,
- a_buffer_rowids out nocopy ut_varchar2_rows,
- a_finished_flags out nocopy ut_integer_list
- ) is
- lc_bulk_limit constant integer := 5000;
- begin
- with ordered_buffer as (
- select /*+ no_parallel index(a) */ ut_output_data_row(a.text, a.item_type), rowidtochar(a.rowid), is_finished
- from ut_output_clob_buffer_tmp a
- where a.output_id = self.output_id
- and a.message_id <= (select min(message_id) from ut_output_clob_buffer_tmp o where o.output_id = self.output_id) + lc_bulk_limit
- order by a.message_id
- )
- select /*+ no_parallel */ b.*
- bulk collect into a_buffer_data, a_buffer_rowids, a_finished_flags
- from ordered_buffer b;
- end;
-
- procedure remove_read_data(a_buffer_rowids ut_varchar2_rows) is
- pragma autonomous_transaction;
- begin
- forall i in 1 .. a_buffer_rowids.count
- delete from ut_output_clob_buffer_tmp a
- where rowid = chartorowid(a_buffer_rowids(i));
- commit;
- end;
-
- begin
- while not l_finished loop
-
- l_sleep_time := case when l_already_waited_sec >= 1 then 0.5 else 0.1 end;
- l_lock_status := self.get_lock_status();
- get_data_from_buffer_table( l_buffer_data, l_buffer_rowids, l_finished_flags );
-
- if l_buffer_data.count > 0 then
- l_already_waited_sec := 0;
- for i in 1 .. l_buffer_data.count loop
- if l_buffer_data(i).text is not null then
- pipe row( l_buffer_data(i) );
- elsif l_finished_flags(i) = 1 then
- l_finished := true;
- exit;
- end if;
- end loop;
- remove_read_data(l_buffer_rowids);
- else
- --nothing fetched from output, wait.
- dbms_lock.sleep(l_sleep_time);
- l_already_waited_sec := l_already_waited_sec + l_sleep_time;
- end if;
-
- l_producer_started := (l_lock_status <> 0 or l_buffer_data.count > 0) or l_producer_started;
- l_producer_finished := (l_producer_started and l_lock_status = 0 and l_buffer_data.count = 0) or l_producer_finished;
-
- l_finished :=
- self.timeout_producer_not_finished(l_producer_finished, l_already_waited_sec, a_timeout_sec)
- or self.timeout_producer_not_started(l_producer_started, l_already_waited_sec, lc_init_wait_sec)
- or l_producer_finished
- or l_finished;
-
- end loop;
-
- self.remove_buffer_info();
- return;
- end;
-
-end;
-/
diff --git a/source/core/output_buffers/ut_output_clob_table_buffer.tps b/source/core/output_buffers/ut_output_clob_table_buffer.tps
deleted file mode 100644
index 191e64c01..000000000
--- a/source/core/output_buffers/ut_output_clob_table_buffer.tps
+++ /dev/null
@@ -1,25 +0,0 @@
-create or replace type ut_output_clob_table_buffer under ut_output_buffer_base (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_output_clob_table_buffer(self in out nocopy ut_output_clob_table_buffer, a_output_id raw := null) return self as result,
- overriding member procedure send_line(self in out nocopy ut_output_clob_table_buffer, a_text varchar2, a_item_type varchar2 := null),
- overriding member procedure send_lines(self in out nocopy ut_output_clob_table_buffer, a_text_list ut_varchar2_rows, a_item_type varchar2 := null),
- overriding member procedure send_clob(self in out nocopy ut_output_clob_table_buffer, a_text clob, a_item_type varchar2 := null),
- overriding member function get_lines(a_initial_timeout number := null, a_timeout_sec number := null) return ut_output_data_rows pipelined
-) not final
-/
diff --git a/source/core/output_buffers/ut_output_data_row.tps b/source/core/output_buffers/ut_output_data_row.tps
deleted file mode 100644
index c5dd95e98..000000000
--- a/source/core/output_buffers/ut_output_data_row.tps
+++ /dev/null
@@ -1,21 +0,0 @@
-create or replace type ut_output_data_row as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- text clob,
- item_type varchar2(1000)
-)
-/
diff --git a/source/core/output_buffers/ut_output_data_rows.tps b/source/core/output_buffers/ut_output_data_rows.tps
deleted file mode 100644
index 097e9beff..000000000
--- a/source/core/output_buffers/ut_output_data_rows.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_output_data_rows as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of ut_output_data_row
-/
diff --git a/source/core/output_buffers/ut_output_table_buffer.tpb b/source/core/output_buffers/ut_output_table_buffer.tpb
deleted file mode 100644
index e8e2442a7..000000000
--- a/source/core/output_buffers/ut_output_table_buffer.tpb
+++ /dev/null
@@ -1,164 +0,0 @@
-create or replace type body ut_output_table_buffer is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_output_table_buffer(self in out nocopy ut_output_table_buffer, a_output_id raw := null) return self as result is
- begin
- self.init(a_output_id, $$plsql_unit);
- return;
- end;
-
- overriding member procedure send_line(self in out nocopy ut_output_table_buffer, a_text varchar2, a_item_type varchar2 := null) is
- pragma autonomous_transaction;
- begin
- if a_text is not null or a_item_type is not null then
- if lengthb(a_text) > ut_utils.gc_max_storage_varchar2_len then
- self.send_lines(
- ut_utils.convert_collection(
- ut_utils.clob_to_table(a_text, ut_utils.gc_max_storage_varchar2_len)
- ),
- a_item_type
- );
- else
- insert /*+ no_parallel */ into ut_output_buffer_tmp(output_id, message_id, text, item_type)
- values (self.output_id, ut_output_buffer_tmp_seq.nextval, a_text, a_item_type);
- end if;
- commit;
- end if;
- end;
-
- overriding member procedure send_lines(self in out nocopy ut_output_table_buffer, a_text_list ut_varchar2_rows, a_item_type varchar2 := null) is
- pragma autonomous_transaction;
- begin
- insert /*+ no_parallel */ into ut_output_buffer_tmp(output_id, message_id, text, item_type)
- select /*+ no_parallel */ self.output_id, ut_output_buffer_tmp_seq.nextval, t.column_value, a_item_type
- from table(a_text_list) t
- where t.column_value is not null or a_item_type is not null;
- commit;
- end;
-
- overriding member procedure send_clob(self in out nocopy ut_output_table_buffer, a_text clob, a_item_type varchar2 := null) is
- pragma autonomous_transaction;
- begin
- if a_text is not null and a_text != empty_clob() or a_item_type is not null then
- if ut_utils.lengthb_clob(a_text) > ut_utils.gc_max_storage_varchar2_len then
- self.send_lines(
- ut_utils.convert_collection(
- ut_utils.clob_to_table(a_text, ut_utils.gc_max_storage_varchar2_len)
- ),
- a_item_type
- );
- else
- insert /*+ no_parallel */ into ut_output_buffer_tmp(output_id, message_id, text, item_type)
- values (self.output_id, ut_output_buffer_tmp_seq.nextval, a_text, a_item_type);
- end if;
- commit;
- end if;
- end;
-
- overriding member procedure lines_to_dbms_output(self in ut_output_table_buffer, a_initial_timeout number := null, a_timeout_sec number := null) is
- l_data sys_refcursor;
- l_text ut_varchar2_rows;
- l_item_type ut_varchar2_rows;
- begin
- l_data := self.get_lines_cursor(a_initial_timeout, a_timeout_sec);
- loop
- fetch l_data bulk collect into l_text, l_item_type limit 10000;
- for idx in 1 .. l_text.count loop
- dbms_output.put_line(l_text(idx));
- end loop;
- exit when l_data%notfound;
- end loop;
- close l_data;
- end;
-
- /* Important note.
- This function code is almost duplicated between two types for performance reasons.
- The pipe row clause is much faster on VARCHAR2 then it is on clob.
- That is the key reason for two implementations.
- */
- overriding member function get_lines(a_initial_timeout number := null, a_timeout_sec number := null) return ut_output_data_rows pipelined is
- lc_init_wait_sec constant number := coalesce(a_initial_timeout, 10 );
- l_buffer_texts ut_varchar2_rows;
- l_buffer_item_types ut_varchar2_rows;
- l_finished_flags ut_integer_list;
- l_already_waited_sec number(10,2) := 0;
- l_finished boolean := false;
- l_sleep_time number(2,1);
- l_lock_status integer;
- l_producer_started boolean := false;
- l_producer_finished boolean := false;
-
- procedure get_data_from_buffer_table(
- a_buffer_texts out nocopy ut_varchar2_rows,
- a_buffer_item_types out nocopy ut_varchar2_rows,
- a_finished_flags out nocopy ut_integer_list
- ) is
- lc_bulk_limit constant integer := 20000;
- pragma autonomous_transaction;
- begin
- delete /*+ no_parallel */ from (
- select /*+ no_parallel */ *
- from ut_output_buffer_tmp a
- where a.output_id = self.output_id
- and a.message_id <= (select min(message_id) from ut_output_buffer_tmp o where o.output_id = self.output_id) + lc_bulk_limit
- order by a.message_id
- ) d
- returning d.text, d.item_type, d.is_finished
- bulk collect into a_buffer_texts, a_buffer_item_types, a_finished_flags;
- commit;
- end;
- begin
- while not l_finished loop
-
- l_sleep_time := case when l_already_waited_sec >= 1 then 0.5 else 0.1 end;
- l_lock_status := self.get_lock_status();
- get_data_from_buffer_table( l_buffer_texts, l_buffer_item_types, l_finished_flags );
-
- if l_buffer_texts.count > 0 then
- l_already_waited_sec := 0;
- for i in 1 .. l_buffer_texts.count loop
- if l_buffer_texts(i) is not null then
- pipe row( ut_output_data_row(l_buffer_texts(i), l_buffer_item_types(i)) );
- elsif l_finished_flags(i) = 1 then
- l_finished := true;
- exit;
- end if;
- end loop;
- else
- --nothing fetched from output, wait.
- dbms_lock.sleep(l_sleep_time);
- l_already_waited_sec := l_already_waited_sec + l_sleep_time;
- end if;
-
- l_producer_started := (l_lock_status <> 0 or l_buffer_texts.count > 0) or l_producer_started;
- l_producer_finished := (l_producer_started and l_lock_status = 0 and l_buffer_texts.count = 0) or l_producer_finished;
-
- l_finished :=
- self.timeout_producer_not_finished(l_producer_finished, l_already_waited_sec, a_timeout_sec)
- or self.timeout_producer_not_started(l_producer_started, l_already_waited_sec, lc_init_wait_sec)
- or l_producer_finished
- or l_finished;
-
- end loop;
-
- self.remove_buffer_info();
- return;
- end;
-
-end;
-/
diff --git a/source/core/output_buffers/ut_output_table_buffer.tps b/source/core/output_buffers/ut_output_table_buffer.tps
deleted file mode 100644
index 154ce4de6..000000000
--- a/source/core/output_buffers/ut_output_table_buffer.tps
+++ /dev/null
@@ -1,26 +0,0 @@
-create or replace type ut_output_table_buffer under ut_output_buffer_base (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_output_table_buffer(self in out nocopy ut_output_table_buffer, a_output_id raw := null) return self as result,
- overriding member procedure send_line(self in out nocopy ut_output_table_buffer, a_text varchar2, a_item_type varchar2 := null),
- overriding member procedure send_lines(self in out nocopy ut_output_table_buffer, a_text_list ut_varchar2_rows, a_item_type varchar2 := null),
- overriding member procedure send_clob(self in out nocopy ut_output_table_buffer, a_text clob, a_item_type varchar2 := null),
- overriding member procedure lines_to_dbms_output(self in ut_output_table_buffer, a_initial_timeout number := null, a_timeout_sec number := null),
- overriding member function get_lines(a_initial_timeout number := null, a_timeout_sec number := null) return ut_output_data_rows pipelined
-) not final
-/
diff --git a/source/core/session_context/ut_session_context.pkb b/source/core/session_context/ut_session_context.pkb
deleted file mode 100644
index a97505e9c..000000000
--- a/source/core/session_context/ut_session_context.pkb
+++ /dev/null
@@ -1,48 +0,0 @@
-create or replace package body ut_session_context as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- gc_context_name constant varchar2(30) := ut_utils.ut_owner()||'_INFO';
-
- procedure set_context(a_name varchar2, a_value varchar2) is
- begin
- dbms_session.set_context( gc_context_name, a_name, a_value );
- end;
-
- procedure clear_context(a_name varchar2) is
- begin
- dbms_session.clear_context( namespace => gc_context_name, attribute => a_name );
- end;
-
- procedure clear_all_context is
- begin
- dbms_session.clear_all_context( namespace => gc_context_name );
- end;
-
- function is_ut_run return boolean is
- l_paths varchar2(32767);
- begin
- l_paths := sys_context(gc_context_name, 'RUN_PATHS');
- return l_paths is not null;
- end;
-
- function get_namespace return varchar2 is
- begin
- return gc_context_name;
- end;
-
-end;
-/
\ No newline at end of file
diff --git a/source/core/session_context/ut_session_context.pks b/source/core/session_context/ut_session_context.pks
deleted file mode 100644
index 63da3399e..000000000
--- a/source/core/session_context/ut_session_context.pks
+++ /dev/null
@@ -1,45 +0,0 @@
-create or replace package ut_session_context as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /*
- * Sets value of a context
- */
- procedure set_context(a_name varchar2, a_value varchar2);
-
- /*
- * Clears value of a context
- */
- procedure clear_context(a_name varchar2);
-
- /*
- * Clears entire context for utPLSQL run
- */
- procedure clear_all_context;
-
- /*
- * Returns true, if session context UT3_INFO is not empty
- */
- function is_ut_run return boolean;
-
- /*
- * Returns utPLSQL session context namespace name
- */
- function get_namespace return varchar2;
-
-end;
-/
\ No newline at end of file
diff --git a/source/core/session_context/ut_session_info.tpb b/source/core/session_context/ut_session_info.tpb
deleted file mode 100644
index 7d469651a..000000000
--- a/source/core/session_context/ut_session_info.tpb
+++ /dev/null
@@ -1,183 +0,0 @@
-create or replace type body ut_session_info as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_session_info(self in out nocopy ut_session_info) return self as result is
- begin
- self.self_type := $$plsql_unit;
- dbms_application_info.read_client_info( client_info );
- dbms_application_info.read_module( module, action );
- return;
- end;
-
- -- run hooks
- member procedure before_calling_run(self in out nocopy ut_session_info, a_run in ut_run) is
- begin
- ut_session_context.set_context( 'run_paths', ut_utils.to_string( ut_utils.table_to_clob( a_run.run_paths,',' ), null ) );
- ut_session_context.set_context( 'coverage_run_id', rawtohex( a_run.coverage_options.coverage_run_id ) );
- dbms_application_info.set_module( 'utPLSQL', null );
- end;
-
- member procedure after_calling_run(self in out nocopy ut_session_info, a_run in ut_run) is
- begin
- ut_session_context.clear_context( 'run_paths' );
- ut_session_context.clear_context( 'coverage_run_id' );
- dbms_application_info.set_module( module, action );
- dbms_application_info.set_client_info( client_info );
- end;
-
- -- suite hooks
- member procedure before_calling_suite(self in out nocopy ut_session_info, a_suite in ut_logical_suite) is
- begin
- if a_suite is not of (ut_suite_context) then
- ut_session_context.set_context( 'suite_path', a_suite.path );
- ut_session_context.set_context( 'suite_package', a_suite.object_owner||'.'||a_suite.object_name );
- ut_session_context.set_context( 'suite_description', a_suite.description );
- ut_session_context.set_context( 'suite_start_time', ut_utils.to_string(a_suite.start_time) );
- dbms_application_info.set_module( 'utPLSQL', a_suite.object_name );
- else
- ut_session_context.set_context( 'context_name', a_suite.name );
- ut_session_context.set_context( 'context_path', a_suite.path);
- ut_session_context.set_context( 'context_description', a_suite.description );
- ut_session_context.set_context( 'context_start_time', ut_utils.to_string(a_suite.start_time) );
- end if;
- end;
-
- member procedure after_calling_suite(self in out nocopy ut_session_info, a_suite in ut_logical_suite) is
- begin
- if a_suite is not of (ut_suite_context) then
- ut_session_context.clear_context( 'suite_package' );
- ut_session_context.clear_context( 'suite_path' );
- ut_session_context.clear_context( 'suite_description' );
- ut_session_context.clear_context( 'suite_start_time' );
- else
- ut_session_context.clear_context( 'context_name' );
- ut_session_context.clear_context( 'context_path' );
- ut_session_context.clear_context( 'context_description' );
- ut_session_context.clear_context( 'context_start_time' );
- end if;
- end;
-
-
- member procedure before_calling_test(self in out nocopy ut_session_info, a_test in ut_test) is
- begin
- ut_session_context.set_context( 'test_name', a_test.object_owner||'.'||a_test.object_name||'.'||a_test.name );
- ut_session_context.set_context( 'test_description', a_test.description );
- ut_session_context.set_context( 'test_start_time', ut_utils.to_string(a_test.start_time) );
- end;
-
- member procedure after_calling_test (self in out nocopy ut_session_info, a_test in ut_test) is
- begin
- ut_session_context.clear_context( 'test_name' );
- ut_session_context.clear_context( 'test_description' );
- ut_session_context.clear_context( 'test_start_time' );
- end;
-
- member procedure before_calling_executable(self in out nocopy ut_session_info, a_executable in ut_executable) is
- begin
- ut_session_context.set_context( 'current_executable_type', a_executable.executable_type );
- ut_session_context.set_context(
- 'current_executable_name',
- a_executable.owner_name||'.'||a_executable.object_name||'.'||a_executable.procedure_name
- );
- dbms_application_info.set_client_info( a_executable.procedure_name );
- end;
-
- member procedure after_calling_executable(self in out nocopy ut_session_info, a_executable in ut_executable) is
- begin
- ut_session_context.clear_context( 'current_executable_type' );
- ut_session_context.clear_context( 'current_executable_name' );
- dbms_application_info.set_client_info( null );
- end;
-
- member procedure on_finalize(self in out nocopy ut_session_info, a_run in ut_run) is
- begin
- dbms_application_info.set_client_info( client_info );
- dbms_application_info.set_module( module, action );
- ut_session_context.clear_all_context();
- end;
-
- overriding member function get_supported_events return ut_varchar2_list is
- begin
- return ut_varchar2_list(
- ut_event_manager.gc_before_run,
- ut_event_manager.gc_before_suite,
- ut_event_manager.gc_before_test,
- ut_event_manager.gc_before_before_all,
- ut_event_manager.gc_before_before_each,
- ut_event_manager.gc_before_before_test,
- ut_event_manager.gc_before_test_execute,
- ut_event_manager.gc_before_after_test,
- ut_event_manager.gc_before_after_each,
- ut_event_manager.gc_before_after_all,
- ut_event_manager.gc_after_run,
- ut_event_manager.gc_after_suite,
- ut_event_manager.gc_after_test,
- ut_event_manager.gc_after_before_all,
- ut_event_manager.gc_after_before_each,
- ut_event_manager.gc_after_before_test,
- ut_event_manager.gc_after_test_execute,
- ut_event_manager.gc_after_after_test,
- ut_event_manager.gc_after_after_each,
- ut_event_manager.gc_after_after_all,
- ut_event_manager.gc_finalize
- );
- end;
-
- overriding member procedure on_event( self in out nocopy ut_session_info, a_event_name varchar2, a_event_item ut_event_item) is
- begin
- case
- when a_event_name in (
- ut_event_manager.gc_before_before_all,
- ut_event_manager.gc_before_before_each,
- ut_event_manager.gc_before_before_test,
- ut_event_manager.gc_before_test_execute,
- ut_event_manager.gc_before_after_test,
- ut_event_manager.gc_before_after_each,
- ut_event_manager.gc_before_after_all
- )
- then before_calling_executable(treat(a_event_item as ut_executable));
- when a_event_name in (
- ut_event_manager.gc_after_before_all,
- ut_event_manager.gc_after_before_each,
- ut_event_manager.gc_after_before_test,
- ut_event_manager.gc_after_test_execute,
- ut_event_manager.gc_after_after_test,
- ut_event_manager.gc_after_after_each,
- ut_event_manager.gc_after_after_all
- )
- then after_calling_executable(treat(a_event_item as ut_executable));
- when a_event_name = ut_event_manager.gc_before_test
- then self.before_calling_test(treat(a_event_item as ut_test));
- when a_event_name = ut_event_manager.gc_after_test
- then self.after_calling_test(treat(a_event_item as ut_test));
- when a_event_name = ut_event_manager.gc_after_suite
- then after_calling_suite(treat(a_event_item as ut_logical_suite));
- when a_event_name = ut_event_manager.gc_before_suite
- then before_calling_suite(treat(a_event_item as ut_logical_suite));
- when a_event_name = ut_event_manager.gc_before_run
- then before_calling_run(treat(a_event_item as ut_run));
- when a_event_name = ut_event_manager.gc_after_run
- then after_calling_run(treat(a_event_item as ut_run));
- when a_event_name = ut_event_manager.gc_finalize
- then on_finalize(treat(a_event_item as ut_run));
- else null;
- end case;
- end;
-
-end;
-/
\ No newline at end of file
diff --git a/source/core/session_context/ut_session_info.tps b/source/core/session_context/ut_session_info.tps
deleted file mode 100644
index 17e596d88..000000000
--- a/source/core/session_context/ut_session_info.tps
+++ /dev/null
@@ -1,49 +0,0 @@
-create or replace type ut_session_info under ut_event_listener (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- module varchar2(4000),
- action varchar2(4000),
- client_info varchar2(4000),
- constructor function ut_session_info(self in out nocopy ut_session_info) return self as result,
-
- member procedure before_calling_run(self in out nocopy ut_session_info, a_run in ut_run),
- member procedure after_calling_run (self in out nocopy ut_session_info, a_run in ut_run),
-
- member procedure before_calling_suite(self in out nocopy ut_session_info, a_suite in ut_logical_suite),
- member procedure after_calling_suite(self in out nocopy ut_session_info, a_suite in ut_logical_suite),
-
- member procedure before_calling_executable(self in out nocopy ut_session_info, a_executable in ut_executable),
- member procedure after_calling_executable (self in out nocopy ut_session_info, a_executable in ut_executable),
-
- member procedure before_calling_test(self in out nocopy ut_session_info, a_test in ut_test),
- member procedure after_calling_test (self in out nocopy ut_session_info, a_test in ut_test),
-
- member procedure on_finalize(self in out nocopy ut_session_info, a_run in ut_run),
-
- /**
- * Returns the list of events that are supported by particular implementation of the reporter
- */
- overriding member function get_supported_events return ut_varchar2_list,
-
- /**
- * Delegates execution of event into individual reporting procedures
- */
- overriding member procedure on_event( self in out nocopy ut_session_info, a_event_name varchar2, a_event_item ut_event_item)
-
-) final
-/
\ No newline at end of file
diff --git a/source/core/types/ut_console_reporter_base.tpb b/source/core/types/ut_console_reporter_base.tpb
deleted file mode 100644
index 909e9355a..000000000
--- a/source/core/types/ut_console_reporter_base.tpb
+++ /dev/null
@@ -1,45 +0,0 @@
-create or replace type body ut_console_reporter_base is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- static procedure set_color_enabled(a_flag boolean) is
- begin
- ut_ansiconsole_helper.color_enabled(a_flag);
- end;
-
- member procedure print_red_text(self in out nocopy ut_console_reporter_base, a_text varchar2) is
- begin
- self.print_text(ut_ansiconsole_helper.red(a_text));
- end;
-
- member procedure print_green_text(self in out nocopy ut_console_reporter_base, a_text varchar2) is
- begin
- self.print_text(ut_ansiconsole_helper.green(a_text));
- end;
-
- member procedure print_yellow_text(self in out nocopy ut_console_reporter_base, a_text varchar2) is
- begin
- self.print_text(ut_ansiconsole_helper.yellow(a_text));
- end;
-
- member procedure print_cyan_text(self in out nocopy ut_console_reporter_base, a_text varchar2) is
- begin
- self.print_text(ut_ansiconsole_helper.cyan(a_text));
- end;
-
-end;
-/
diff --git a/source/core/types/ut_console_reporter_base.tps b/source/core/types/ut_console_reporter_base.tps
deleted file mode 100644
index a2c4b6b8c..000000000
--- a/source/core/types/ut_console_reporter_base.tps
+++ /dev/null
@@ -1,29 +0,0 @@
-create or replace type ut_console_reporter_base under ut_output_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- static procedure set_color_enabled(a_flag boolean),
-
- member procedure print_red_text(self in out nocopy ut_console_reporter_base, a_text varchar2),
-
- member procedure print_green_text(self in out nocopy ut_console_reporter_base, a_text varchar2),
-
- member procedure print_yellow_text(self in out nocopy ut_console_reporter_base, a_text varchar2),
-
- member procedure print_cyan_text(self in out nocopy ut_console_reporter_base, a_text varchar2)
-
-) not final not instantiable
-/
diff --git a/source/core/types/ut_coverage_options.tpb b/source/core/types/ut_coverage_options.tpb
deleted file mode 100644
index a091802af..000000000
--- a/source/core/types/ut_coverage_options.tpb
+++ /dev/null
@@ -1,73 +0,0 @@
-create or replace type body ut_coverage_options as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_coverage_options(
- self in out nocopy ut_coverage_options,
- coverage_run_id raw,
- schema_names ut_varchar2_rows := null,
- exclude_objects ut_varchar2_rows := null,
- include_objects ut_varchar2_rows := null,
- file_mappings ut_file_mappings := null,
- include_schema_expr varchar2 := null,
- include_object_expr varchar2 := null,
- exclude_schema_expr varchar2 := null,
- exclude_object_expr varchar2 := null
- ) return self as result is
- function to_ut_object_list(a_names ut_varchar2_rows, a_schema_names ut_varchar2_rows) return ut_object_names is
- l_result ut_object_names;
- l_object_name ut_object_name;
- begin
- if a_names is not empty then
- l_result := ut_object_names();
- for i in 1 .. a_names.count loop
- l_object_name := ut_object_name(a_names(i));
- if l_object_name.owner is null then
- for i in 1 .. cardinality(a_schema_names) loop
- l_result.extend;
- l_result(l_result.last) := ut_object_name(a_schema_names(i)||'.'||l_object_name.name);
- end loop;
- else
- l_result.extend;
- l_result(l_result.last) := l_object_name;
- end if;
- end loop;
- end if;
- return l_result;
- end;
- begin
- self.coverage_run_id := coverage_run_id;
- self.file_mappings := file_mappings;
- self.schema_names := schema_names;
- self.exclude_objects := ut_object_names();
-
- if exclude_objects is not empty then
- self.exclude_objects := to_ut_object_list(exclude_objects, self.schema_names);
- end if;
-
- self.include_objects := to_ut_object_list(include_objects, self.schema_names);
-
- self.include_schema_expr := include_schema_expr;
- self.include_object_expr := include_object_expr;
- self.exclude_schema_expr := exclude_schema_expr;
- self.exclude_object_expr := exclude_object_expr;
-
-
- return;
- end;
-end;
-/
diff --git a/source/core/types/ut_coverage_options.tps b/source/core/types/ut_coverage_options.tps
deleted file mode 100644
index a8e3d5129..000000000
--- a/source/core/types/ut_coverage_options.tps
+++ /dev/null
@@ -1,41 +0,0 @@
-create or replace type ut_coverage_options force as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- coverage_run_id raw(32),
- schema_names ut_varchar2_rows,
- exclude_objects ut_object_names,
- include_objects ut_object_names,
- file_mappings ut_file_mappings,
- include_schema_expr varchar2(4000),
- include_object_expr varchar2(4000),
- exclude_schema_expr varchar2(4000),
- exclude_object_expr varchar2(4000),
- constructor function ut_coverage_options(
- self in out nocopy ut_coverage_options,
- coverage_run_id raw,
- schema_names ut_varchar2_rows := null,
- exclude_objects ut_varchar2_rows := null,
- include_objects ut_varchar2_rows := null,
- file_mappings ut_file_mappings := null,
- include_schema_expr varchar2 := null,
- include_object_expr varchar2 := null,
- exclude_schema_expr varchar2 := null,
- exclude_object_expr varchar2 := null
- ) return self as result
-)
-/
diff --git a/source/core/types/ut_executable.tpb b/source/core/types/ut_executable.tpb
deleted file mode 100644
index d2ce9b79d..000000000
--- a/source/core/types/ut_executable.tpb
+++ /dev/null
@@ -1,183 +0,0 @@
-create or replace type body ut_executable is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_executable(
- self in out nocopy ut_executable, a_owner varchar2, a_package varchar2,
- a_procedure_name varchar2, a_executable_type varchar2
- ) return self as result is
- begin
- self.self_type := $$plsql_unit;
- self.executable_type := a_executable_type;
- self.owner_name := a_owner;
- self.object_name := a_package;
- self.procedure_name := a_procedure_name;
- return;
- end;
-
- member function form_name(a_skip_current_user_schema boolean := false) return varchar2 is
- l_owner_name varchar2(250) := owner_name;
- begin
- if a_skip_current_user_schema and sys_context('userenv', 'current_schema') = owner_name then
- l_owner_name := null;
- end if;
- return ut_metadata.form_name(l_owner_name, object_name, procedure_name);
- end;
-
- member procedure do_execute(self in out nocopy ut_executable, a_item in out nocopy ut_suite_item) is
- l_completed_without_errors boolean;
- begin
- l_completed_without_errors := self.do_execute(a_item);
- end do_execute;
-
- member function do_execute(self in out nocopy ut_executable, a_item in out nocopy ut_suite_item) return boolean is
- l_statement varchar2(4000);
- l_status number;
- l_cursor_number number;
- l_completed_without_errors boolean := true;
- l_failed_with_invalid_pck boolean := true;
- l_start_transaction_id varchar2(250);
- l_end_transaction_id varchar2(250);
-
- function is_defined return boolean is
- l_result boolean := false;
- l_message_part varchar2(4000) := 'Call params for ' || self.executable_type || ' are not valid: ';
- begin
-
- if self.object_name is null then
- self.error_stack := l_message_part || 'package is not defined';
- elsif self.procedure_name is null then
- self.error_stack := l_message_part || 'procedure is not defined';
- else
- l_result := true;
- end if;
-
- return l_result;
- end is_defined;
-
- function is_invalid return boolean is
- l_result boolean := true;
- l_message_part varchar2(4000) := 'Call params for ' || self.executable_type || ' are not valid: ';
- begin
-
- if not ut_metadata.package_valid(self.owner_name, self.object_name) then
- self.error_stack := l_message_part || 'package '||upper(self.owner_name||'.'||self.object_name)||' does not exist or is invalid.';
- elsif not ut_metadata.procedure_exists(self.owner_name, self.object_name, self.procedure_name) then
- self.error_stack := l_message_part || 'procedure '||upper(self.owner_name || '.' || self.object_name || '.' ||self.procedure_name)||' does not exist.';
- else
- l_result := false;
- end if;
-
- return l_result;
- end is_invalid;
-
- procedure save_dbms_output is
- l_status number;
- l_line varchar2(32767);
- begin
-
- dbms_output.get_line(line => l_line, status => l_status);
- if l_status != 1 then
- dbms_lob.createtemporary(self.serveroutput, true, dur => dbms_lob.session);
- end if;
- while l_status != 1 loop
- if l_line is not null then
- ut_utils.append_to_clob(self.serveroutput, l_line||chr(10));
- end if;
- dbms_output.get_line(line => l_line, status => l_status);
- end loop;
- end save_dbms_output;
- begin
- l_start_transaction_id := dbms_transaction.local_transaction_id(true);
-
- --listener - before call to executable
- ut_event_manager.trigger_event('before_'||self.executable_type, self);
-
- l_completed_without_errors := is_defined();
- if l_completed_without_errors then
- l_statement :=
- 'declare' || chr(10) ||
- ' l_error_stack varchar2(32767);' || chr(10) ||
- ' l_error_backtrace varchar2(32767);' || chr(10) ||
- 'begin' || chr(10) ||
- ' begin' || chr(10) ||
- ' ' || self.form_name( a_skip_current_user_schema => true ) || ';' || chr(10) ||
- ' exception' || chr(10) ||
- ' when others then ' || chr(10) ||
- ' l_error_stack := dbms_utility.format_error_stack;' || chr(10) ||
- ' l_error_backtrace := dbms_utility.format_error_backtrace;' || chr(10) ||
- ' --raise on ORA-04068, ORA-04061: existing state of packages has been discarded to avoid unrecoverable session exception' || chr(10) ||
- ' end;' || chr(10) ||
- ' :a_error_stack := l_error_stack;' || chr(10) ||
- ' :a_error_backtrace := l_error_backtrace;' || chr(10) ||
- 'end;';
-
- ut_utils.debug_log('ut_executable.do_execute l_statement: ' || l_statement);
-
- l_cursor_number := dbms_sql.open_cursor;
-
- /**
- * The code will allow to execute once we check if packages are defined
- * If it fail with 6550 (usually invalid package) it will check if because of invalid state or missing
- * if for any other reason we will propagate it up as we didnt expected.
- **/
- begin
- dbms_sql.parse(l_cursor_number, statement => l_statement, language_flag => dbms_sql.native);
- dbms_sql.bind_variable(l_cursor_number, 'a_error_stack', to_char(null), 32767);
- dbms_sql.bind_variable(l_cursor_number, 'a_error_backtrace', to_char(null), 32767);
- l_status := dbms_sql.execute(l_cursor_number);
- dbms_sql.variable_value(l_cursor_number, 'a_error_stack', self.error_stack);
- dbms_sql.variable_value(l_cursor_number, 'a_error_backtrace', self.error_backtrace);
- dbms_sql.close_cursor(l_cursor_number);
- exception
- when ut_utils.ex_invalid_package then
- l_failed_with_invalid_pck := is_invalid();
- dbms_sql.close_cursor(l_cursor_number);
- if not l_failed_with_invalid_pck then
- raise;
- end if;
- when others then
- dbms_sql.close_cursor(l_cursor_number);
- raise;
- end;
-
- save_dbms_output;
-
- l_completed_without_errors := (self.error_stack||self.error_backtrace) is null;
- if self.error_stack like '%ORA-04068%' or self.error_stack like '%ORA-04061%' then
- ut_expectation_processor.set_invalidation_exception();
- end if;
- end if;
-
- --listener - after call to executable
- ut_event_manager.trigger_event('after_'||self.executable_type, self);
-
- l_end_transaction_id := dbms_transaction.local_transaction_id();
- if l_start_transaction_id != l_end_transaction_id or l_end_transaction_id is null then
- a_item.add_transaction_invalidator(self.form_name());
- end if;
-
- return l_completed_without_errors;
-
- end do_execute;
-
- member function get_error_stack_trace return varchar2 is
- begin
- return rtrim(self.error_stack||self.error_backtrace, chr(10));
- end;
-end;
-/
diff --git a/source/core/types/ut_executable.tps b/source/core/types/ut_executable.tps
deleted file mode 100644
index aaa5a3a72..000000000
--- a/source/core/types/ut_executable.tps
+++ /dev/null
@@ -1,43 +0,0 @@
-create or replace type ut_executable under ut_event_item(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /**
- * The name of the event to be executed before and after the executable is invoked
- */
- executable_type varchar2(250 char),
- owner_name varchar2(250 char),
- object_name varchar2(250 char),
- procedure_name varchar2(250 char),
- error_backtrace varchar2(4000),
- error_stack varchar2(4000),
- serveroutput clob,
- /**
- * Used for ordering of executables, as Oracle doesn not guarantee ordering of items in a nested table.
- */
- seq_no integer,
- constructor function ut_executable( self in out nocopy ut_executable, a_owner varchar2, a_package varchar2, a_procedure_name varchar2, a_executable_type varchar2) return self as result,
- member function form_name(a_skip_current_user_schema boolean := false) return varchar2,
- member procedure do_execute(self in out nocopy ut_executable, a_item in out nocopy ut_suite_item),
- /**
- * executes the defines executable
- * returns true if executed without exceptions
- * returns false if exceptions were raised
- */
- member function do_execute(self in out nocopy ut_executable, a_item in out nocopy ut_suite_item) return boolean,
- member function get_error_stack_trace return varchar2
-) not final
-/
diff --git a/source/core/types/ut_executable_test.tpb b/source/core/types/ut_executable_test.tpb
deleted file mode 100644
index fa5872e04..000000000
--- a/source/core/types/ut_executable_test.tpb
+++ /dev/null
@@ -1,195 +0,0 @@
-create or replace type body ut_executable_test as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_executable_test(
- self in out nocopy ut_executable_test, a_owner varchar2, a_package varchar2,
- a_procedure_name varchar2, a_executable_type varchar2
- ) return self as result is
- begin
- self.self_type := $$plsql_unit;
- self.executable_type := a_executable_type;
- self.owner_name := a_owner;
- self.object_name := a_package;
- self.procedure_name := a_procedure_name;
- return;
- end;
-
- member procedure do_execute(
- self in out nocopy ut_executable_test, a_item in out nocopy ut_suite_item,
- a_expected_error_codes in ut_varchar2_rows
- ) is
- l_completed_without_errors boolean;
- begin
- l_completed_without_errors := self.do_execute(a_item, a_expected_error_codes);
- end do_execute;
-
- member function do_execute(
- self in out nocopy ut_executable_test, a_item in out nocopy ut_suite_item,
- a_expected_error_codes in ut_varchar2_rows
- ) return boolean is
- l_expected_except_message varchar2(4000);
- l_expected_error_numbers ut_integer_list;
-
- function build_exception_numbers_list(
- a_item in out nocopy ut_suite_item,
- a_expected_error_codes in ut_varchar2_rows
- ) return ut_integer_list is
- l_exception_number integer;
- l_exception_number_list ut_integer_list := ut_integer_list();
- c_regexp_for_exception_no constant varchar2(30) := '^-?[[:digit:]]{1,5}$';
-
- c_integer_exception constant varchar2(1) := 'I';
- c_named_exception constant varchar2(1) := 'N';
-
- function is_valid_qualified_name (a_name varchar2) return boolean is
- l_name varchar2(500);
- begin
- l_name := dbms_assert.qualified_sql_name(a_name);
- return true;
- exception when others then
- return false;
- end;
-
- function check_exception_type(a_exception_name in varchar2) return varchar2 is
- l_exception_type varchar2(50);
- begin
- --check if it is a predefined exception
- begin
- execute immediate 'begin null; exception when '||a_exception_name||' then null; end;';
- l_exception_type := c_named_exception;
- exception
- when others then
- if dbms_utility.format_error_stack() like '%PLS-00485%' then
- declare
- e_invalid_number exception;
- pragma exception_init ( e_invalid_number, -6502 );
- begin
- execute immediate 'declare x integer := '||a_exception_name||'; begin null; end;';
- l_exception_type := c_integer_exception;
- exception
- when others then
- null;
- end;
- end if;
- end;
- return l_exception_type;
- end;
-
- function get_exception_number (a_exception_var in varchar2) return integer is
- l_exc_no integer;
- l_exc_type varchar2(50);
- function remap_no_data_found (a_number integer) return integer is
- begin
- return case a_number when 100 then -1403 else a_number end;
- end;
- begin
- l_exc_type := check_exception_type(a_exception_var);
-
- execute immediate
- case l_exc_type
- when c_integer_exception then
- 'declare l_exception number; begin :l_exception := '||a_exception_var||'; end;'
- when c_named_exception then
- 'begin raise '||a_exception_var||'; exception when others then :l_exception := sqlcode; end;'
- else
- 'begin :l_exception := null; end;'
- end
- using out l_exc_no;
-
- return remap_no_data_found(l_exc_no);
- end;
-
- begin
- if a_expected_error_codes is not empty then
- for i in 1 .. a_expected_error_codes.count loop
- /**
- * Check if its a valid qualified name and if so try to resolve name to an exception number
- */
- if is_valid_qualified_name(a_expected_error_codes(i)) then
- l_exception_number := get_exception_number(a_expected_error_codes(i));
- elsif regexp_like(a_expected_error_codes(i), c_regexp_for_exception_no) then
- l_exception_number := a_expected_error_codes(i);
- end if;
-
- if l_exception_number is null then
- a_item.put_warning(
- 'Invalid parameter value "'||a_expected_error_codes(i)||'" for "--%throws" annotation. Parameter ignored.',
- self.procedure_name,
- a_item.line_no
- );
- elsif l_exception_number >= 0 then
- a_item.put_warning(
- 'Invalid parameter value "'||a_expected_error_codes(i)||'" for "--%throws" annotation. Exception value must be a negative integer. Parameter ignored.',
- self.procedure_name,
- a_item.line_no
- );
- else
- l_exception_number_list.extend;
- l_exception_number_list(l_exception_number_list.last) := l_exception_number;
- end if;
- l_exception_number := null;
- end loop;
- end if;
-
- return l_exception_number_list;
- end;
- function failed_expec_errnum_message(a_expected_error_codes in ut_integer_list) return varchar is
- l_actual_error_no integer;
- l_expected_error_codes varchar2(4000);
- l_fail_message varchar2(4000);
- begin
- --Convert the ut_varchar2_list to string to can construct the message
- l_expected_error_codes := ut_utils.table_to_clob(a_expected_error_codes, ', ');
-
- if self.error_stack is null then
- l_fail_message := 'Expected one of exceptions ('||l_expected_error_codes||') but nothing was raised.';
- else
- l_actual_error_no := regexp_substr(self.error_stack, '^[[:alpha:]]{3}(-[0-9]+)', subexpression=>1);
- if not l_actual_error_no member of a_expected_error_codes or l_actual_error_no is null then
- l_fail_message := 'Actual: '||l_actual_error_no||' was expected to ';
- if cardinality(a_expected_error_codes) > 1 then
- l_fail_message := l_fail_message || 'be one of: ('||l_expected_error_codes||')';
- else
- l_fail_message := l_fail_message || 'equal: '||l_expected_error_codes;
- end if;
- l_fail_message := substr( l_fail_message||chr(10)||self.error_stack||chr(10)||self.error_backtrace, 1, 4000 );
- end if;
- end if;
-
- return l_fail_message;
- end;
- begin
- --Create a ut_executable object and call do_execute after that get the data to know the test's execution result
- self.do_execute(a_item);
- l_expected_error_numbers := build_exception_numbers_list(a_item, a_expected_error_codes);
- if l_expected_error_numbers is not null and l_expected_error_numbers is not empty then
- l_expected_except_message := failed_expec_errnum_message( l_expected_error_numbers );
-
- if l_expected_except_message is not null then
- ut_expectation_processor.add_expectation_result(
- ut_expectation_result(ut_utils.gc_failure, null, l_expected_except_message, false)
- );
- end if;
- self.error_stack := null;
- self.error_backtrace := null;
- end if;
-
- return (self.error_stack||self.error_backtrace) is null;
- end;
-end;
-/
diff --git a/source/core/types/ut_executable_test.tps b/source/core/types/ut_executable_test.tps
deleted file mode 100644
index 42b6080df..000000000
--- a/source/core/types/ut_executable_test.tps
+++ /dev/null
@@ -1,34 +0,0 @@
-create or replace type ut_executable_test authid current_user under ut_executable (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- constructor function ut_executable_test(
- self in out nocopy ut_executable_test, a_owner varchar2, a_package varchar2,
- a_procedure_name varchar2, a_executable_type varchar2
- ) return self as result,
-
- member procedure do_execute(
- self in out nocopy ut_executable_test, a_item in out nocopy ut_suite_item,
- a_expected_error_codes in ut_varchar2_rows
- ),
-
- member function do_execute(
- self in out nocopy ut_executable_test, a_item in out nocopy ut_suite_item,
- a_expected_error_codes in ut_varchar2_rows
- ) return boolean
-
-) final;
-/
diff --git a/source/core/types/ut_executables.tps b/source/core/types/ut_executables.tps
deleted file mode 100644
index d6d52b3d2..000000000
--- a/source/core/types/ut_executables.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_executables as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of ut_executable
-/
diff --git a/source/core/types/ut_expectation_result.tpb b/source/core/types/ut_expectation_result.tpb
deleted file mode 100644
index 0b3adf983..000000000
--- a/source/core/types/ut_expectation_result.tpb
+++ /dev/null
@@ -1,58 +0,0 @@
-create or replace type body ut_expectation_result is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_expectation_result(
- self in out nocopy ut_expectation_result, a_status integer,
- a_description varchar2, a_message clob, a_include_caller_info boolean := true
- ) return self as result is
- begin
- self.self_type := $$plsql_unit;
- self.status := a_status;
- self.description := a_description;
- self.message := a_message;
- if self.status = ut_utils.gc_failure and a_include_caller_info then
- self.caller_info := ut_expectation_processor.who_called_expectation(dbms_utility.format_call_stack());
- end if;
- return;
- end;
-
- member function get_result_clob(self in ut_expectation_result) return clob is
- l_result clob;
- begin
- if self.description is not null then
- ut_utils.append_to_clob(l_result, '"'||self.description||'"');
- if self.message is not null then
- ut_utils.append_to_clob(l_result, chr(10));
- end if;
- end if;
- ut_utils.append_to_clob(l_result, self.message);
- return l_result;
- end;
-
- member function get_result_lines(self in ut_expectation_result) return ut_varchar2_list is
- begin
- return ut_utils.clob_to_table(get_result_clob(), 4000 );
- end;
-
- member function result return integer is
- begin
- return self.status;
- end;
-
-end;
-/
diff --git a/source/core/types/ut_expectation_result.tps b/source/core/types/ut_expectation_result.tps
deleted file mode 100644
index d4b4c7548..000000000
--- a/source/core/types/ut_expectation_result.tps
+++ /dev/null
@@ -1,45 +0,0 @@
-create or replace type ut_expectation_result under ut_event_item(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /*
- * The expectation result status
- */
- status integer(1),
- /*
- * User description provided with the expectation
- */
- description varchar2(32767),
- /*
- * Additional information about the expression used by matcher
- * Used for complex matcher: like, between, ut_match etc.
- */
- message varchar2(32767),
- /*
- * The information about the line of code that invoked the expectation
- */
- caller_info varchar2(32767),
- constructor function ut_expectation_result(
- self in out nocopy ut_expectation_result, a_status integer,
- a_description varchar2, a_message clob, a_include_caller_info boolean := true
- ) return self as result,
- member function get_result_clob(self in ut_expectation_result) return clob,
- member function get_result_lines(self in ut_expectation_result) return ut_varchar2_list,
- member function result return integer
-)
-not final
-/
diff --git a/source/core/types/ut_expectation_results.tps b/source/core/types/ut_expectation_results.tps
deleted file mode 100644
index e5e4c6223..000000000
--- a/source/core/types/ut_expectation_results.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_expectation_results as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of ut_expectation_result
-/
diff --git a/source/core/types/ut_file_mapping.tpb b/source/core/types/ut_file_mapping.tpb
deleted file mode 100644
index dab1e35c5..000000000
--- a/source/core/types/ut_file_mapping.tpb
+++ /dev/null
@@ -1,23 +0,0 @@
-create or replace type body ut_file_mapping as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- map member function pk return varchar2 is
- begin
- return object_type||' '||object_owner||'.'||object_name;
- end;
-end;
-/
diff --git a/source/core/types/ut_file_mapping.tps b/source/core/types/ut_file_mapping.tps
deleted file mode 100644
index 941d95283..000000000
--- a/source/core/types/ut_file_mapping.tps
+++ /dev/null
@@ -1,24 +0,0 @@
-create or replace type ut_file_mapping as object(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- file_name varchar2(4000),
- object_owner varchar2(4000),
- object_name varchar2(4000),
- object_type varchar2(4000),
- map member function pk return varchar2
-)
-/
diff --git a/source/core/types/ut_file_mappings.tps b/source/core/types/ut_file_mappings.tps
deleted file mode 100644
index 240fb8dd7..000000000
--- a/source/core/types/ut_file_mappings.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_file_mappings as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of ut_file_mapping
-/
diff --git a/source/core/types/ut_integer_list.tps b/source/core/types/ut_integer_list.tps
deleted file mode 100644
index ec9a2a78f..000000000
--- a/source/core/types/ut_integer_list.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_integer_list as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of integer
-/
diff --git a/source/core/types/ut_key_value_pair.tps b/source/core/types/ut_key_value_pair.tps
deleted file mode 100644
index 5a337e608..000000000
--- a/source/core/types/ut_key_value_pair.tps
+++ /dev/null
@@ -1,21 +0,0 @@
-create or replace type ut_key_value_pair force as object(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- key varchar2(4000),
- value varchar2(4000)
-)
-/
diff --git a/source/core/types/ut_key_value_pairs.tps b/source/core/types/ut_key_value_pairs.tps
deleted file mode 100644
index 24bdded36..000000000
--- a/source/core/types/ut_key_value_pairs.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_key_value_pairs as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of ut_key_value_pair
-/
diff --git a/source/core/types/ut_logical_suite.tpb b/source/core/types/ut_logical_suite.tpb
deleted file mode 100644
index 036d40d51..000000000
--- a/source/core/types/ut_logical_suite.tpb
+++ /dev/null
@@ -1,119 +0,0 @@
-create or replace type body ut_logical_suite as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- overriding member procedure mark_as_skipped(self in out nocopy ut_logical_suite, a_skip_reason in varchar2) is
- begin
- ut_event_manager.trigger_event(ut_event_manager.gc_before_suite, self);
- self.start_time := current_timestamp;
- for i in 1 .. self.items.count loop
- self.items(i).mark_as_skipped(coalesce(a_skip_reason,self.disabled_reason));
- end loop;
- self.end_time := self.start_time;
- ut_event_manager.trigger_event(ut_event_manager.gc_after_suite, self);
- self.calc_execution_result();
- end;
-
- overriding member procedure set_rollback_type(self in out nocopy ut_logical_suite, a_rollback_type integer, a_force boolean := false) is
- begin
- self.rollback_type := case when a_force then a_rollback_type else coalesce(self.rollback_type, a_rollback_type) end;
- for i in 1 .. self.items.count loop
- self.items(i).set_rollback_type(self.rollback_type, a_force);
- end loop;
- end;
-
- overriding member function do_execute(self in out nocopy ut_logical_suite) return boolean is
- l_suite_savepoint varchar2(30);
- l_item_savepoint varchar2(30);
- l_completed_without_errors boolean;
- begin
- ut_utils.debug_log('ut_logical_suite.execute');
-
- ut_event_manager.trigger_event(ut_event_manager.gc_before_suite, self);
- self.start_time := current_timestamp;
-
- for i in 1 .. self.items.count loop
- -- execute the item (test or suite)
- self.items(i).do_execute();
- end loop;
-
- self.calc_execution_result();
- self.end_time := current_timestamp;
-
- ut_event_manager.trigger_event(ut_event_manager.gc_after_suite, self);
-
- return l_completed_without_errors;
- end;
-
- overriding member procedure calc_execution_result(self in out nocopy ut_logical_suite) is
- l_result integer(1);
- begin
- if self.items is not null and self.items.count > 0 then
- for i in 1 .. self.items.count loop
- self.results_count.sum_counter_values( self.items(i).results_count );
- end loop;
- l_result := self.results_count.result_status();
- else
- --if suite is empty then it's successful (no errors)
- l_result := ut_utils.gc_success;
- end if;
-
- self.result := l_result;
- end;
-
- overriding member procedure mark_as_errored(self in out nocopy ut_logical_suite, a_error_stack_trace varchar2) is
- begin
- ut_utils.debug_log('ut_logical_suite.fail');
- ut_event_manager.trigger_event(ut_event_manager.gc_before_suite, self);
- self.start_time := current_timestamp;
- for i in 1 .. self.items.count loop
- -- execute the item (test or suite)
- self.items(i).mark_as_errored(a_error_stack_trace);
- end loop;
- self.calc_execution_result();
- self.end_time := self.start_time;
- ut_event_manager.trigger_event(ut_event_manager.gc_after_suite, self);
- end;
-
- overriding member function get_error_stack_traces return ut_varchar2_list is
- begin
- return ut_varchar2_list();
- end;
-
- overriding member function get_serveroutputs return clob is
- begin
- return null;
- end;
-
- overriding member function get_transaction_invalidators return ut_varchar2_list is
- l_result ut_varchar2_list;
- l_child_results ut_varchar2_list;
- begin
- l_result := self.transaction_invalidators;
- for i in 1 .. self.items.count loop
- l_child_results := self.items(i).get_transaction_invalidators();
- for j in 1 .. l_child_results.count loop
- if l_child_results(j) not member of l_result then
- l_result.extend; l_result(l_result.last) := l_child_results(j);
- end if;
- end loop;
- end loop;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/core/types/ut_logical_suite.tps b/source/core/types/ut_logical_suite.tps
deleted file mode 100644
index c4f2f699b..000000000
--- a/source/core/types/ut_logical_suite.tps
+++ /dev/null
@@ -1,33 +0,0 @@
-create or replace type ut_logical_suite force under ut_suite_item (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * The list of items (suites/sub-suites/contexts/tests) to be invoked as part of this suite
- */
- items ut_suite_items,
-
- overriding member procedure mark_as_skipped(self in out nocopy ut_logical_suite, a_skip_reason in varchar2),
- overriding member procedure set_rollback_type(self in out nocopy ut_logical_suite, a_rollback_type integer, a_force boolean := false),
- overriding member function do_execute(self in out nocopy ut_logical_suite) return boolean,
- overriding member procedure calc_execution_result(self in out nocopy ut_logical_suite),
- overriding member procedure mark_as_errored(self in out nocopy ut_logical_suite, a_error_stack_trace varchar2),
- overriding member function get_error_stack_traces return ut_varchar2_list,
- overriding member function get_serveroutputs return clob,
- overriding member function get_transaction_invalidators return ut_varchar2_list
-) not final
-/
diff --git a/source/core/types/ut_object_name.tpb b/source/core/types/ut_object_name.tpb
deleted file mode 100644
index 76acc15bf..000000000
--- a/source/core/types/ut_object_name.tpb
+++ /dev/null
@@ -1,42 +0,0 @@
-create or replace type body ut_object_name as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- constructor function ut_object_name(self in out nocopy ut_object_name, owner varchar2, name varchar2) return self as result is
- begin
- self.owner := upper(owner);
- self.name := upper(name);
- return;
- end;
-
- constructor function ut_object_name(self in out nocopy ut_object_name, a_unit_name varchar2) return self as result is
- begin
- if instr(a_unit_name,'.') > 0 then
- self.owner := upper(regexp_substr(a_unit_name,'[^\.]+', 1, 1));
- self.name := upper(regexp_substr(a_unit_name,'[^\.]+', 1, 2));
- else
- self.name := upper(a_unit_name);
- end if;
- return;
- end;
-
-
- map member function identity return varchar2 is
- begin
- return owner||'.'||name;
- end;
-end;
-/
diff --git a/source/core/types/ut_object_name.tps b/source/core/types/ut_object_name.tps
deleted file mode 100644
index 5f8f724c4..000000000
--- a/source/core/types/ut_object_name.tps
+++ /dev/null
@@ -1,24 +0,0 @@
-create or replace type ut_object_name as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- owner varchar2(128),
- name varchar2(128),
- constructor function ut_object_name(self in out nocopy ut_object_name, owner varchar2, name varchar2) return self as result ,
- constructor function ut_object_name(self in out nocopy ut_object_name, a_unit_name varchar2) return self as result ,
- map member function identity return varchar2
-) final
-/
diff --git a/source/core/types/ut_object_names.tps b/source/core/types/ut_object_names.tps
deleted file mode 100644
index 03830be17..000000000
--- a/source/core/types/ut_object_names.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_object_names as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of ut_object_name
-/
diff --git a/source/core/types/ut_output_reporter_base.tpb b/source/core/types/ut_output_reporter_base.tpb
deleted file mode 100644
index 48970be5a..000000000
--- a/source/core/types/ut_output_reporter_base.tpb
+++ /dev/null
@@ -1,88 +0,0 @@
-create or replace type body ut_output_reporter_base is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_output_reporter_base(self in out nocopy ut_output_reporter_base) return self as result is
- begin
- return;
- end;
-
- member procedure init(self in out nocopy ut_output_reporter_base, a_self_type varchar2, a_output_buffer ut_output_buffer_base := null) is
- begin
- (self as ut_reporter_base).init(a_self_type);
- self.output_buffer := coalesce(a_output_buffer, ut_output_table_buffer());
- self.set_reporter_id(self.output_buffer.output_id);
- end;
-
- overriding member procedure set_reporter_id(self in out nocopy ut_output_reporter_base, a_reporter_id raw) is
- begin
- self.id := a_reporter_id;
- self.output_buffer.init(a_reporter_id);
- end;
-
- member function set_reporter_id(self in ut_output_reporter_base, a_reporter_id raw) return ut_output_reporter_base is
- l_result ut_output_reporter_base := self;
- begin
- l_result.set_reporter_id(a_reporter_id);
- return l_result;
- end;
-
- member procedure print_text(self in out nocopy ut_output_reporter_base, a_text varchar2, a_item_type varchar2 := null) is
- begin
- self.output_buffer.send_line(a_text, a_item_type);
- end;
-
- member procedure print_text_lines(self in out nocopy ut_output_reporter_base, a_text_lines ut_varchar2_rows, a_item_type varchar2 := null) is
- begin
- self.output_buffer.send_lines(a_text_lines, a_item_type);
- end;
-
- member procedure print_clob(self in out nocopy ut_output_reporter_base, a_clob clob, a_item_type varchar2 := null) is
- begin
- self.output_buffer.send_clob( a_clob, a_item_type );
- end;
-
- final member function get_lines(a_initial_timeout natural := null, a_timeout_sec natural) return ut_output_data_rows pipelined is
- begin
- for i in (select /*+ no_parallel */ value(x) val from table(self.output_buffer.get_lines(a_initial_timeout, a_timeout_sec)) x ) loop
- pipe row (i.val);
- end loop;
- end;
-
- final member function get_lines_cursor(a_initial_timeout natural := null, a_timeout_sec natural) return sys_refcursor is
- begin
- return self.output_buffer.get_lines_cursor(a_initial_timeout, a_timeout_sec);
- end;
-
- final member procedure lines_to_dbms_output(self in ut_output_reporter_base, a_initial_timeout natural := null, a_timeout_sec natural) is
- begin
- self.output_buffer.lines_to_dbms_output(a_initial_timeout, a_timeout_sec);
- end;
-
- overriding final member procedure on_finalize(self in out nocopy ut_output_reporter_base, a_run in ut_run) is
- begin
- self.output_buffer.close();
- end;
-
- overriding member procedure on_initialize(self in out nocopy ut_output_reporter_base, a_run in ut_run) is
- begin
- self.output_buffer.lock_buffer();
- self.output_buffer.send_line(null, 'initialize');
- end;
-
-end;
-/
diff --git a/source/core/types/ut_output_reporter_base.tps b/source/core/types/ut_output_reporter_base.tps
deleted file mode 100644
index 21eed9957..000000000
--- a/source/core/types/ut_output_reporter_base.tps
+++ /dev/null
@@ -1,35 +0,0 @@
-create or replace type ut_output_reporter_base under ut_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- output_buffer ut_output_buffer_base,
- constructor function ut_output_reporter_base(self in out nocopy ut_output_reporter_base) return self as result,
- member procedure init(self in out nocopy ut_output_reporter_base, a_self_type varchar2, a_output_buffer ut_output_buffer_base := null),
- overriding member procedure set_reporter_id(self in out nocopy ut_output_reporter_base, a_reporter_id raw),
- member function set_reporter_id(self in ut_output_reporter_base, a_reporter_id raw) return ut_output_reporter_base,
-
- member procedure print_text(self in out nocopy ut_output_reporter_base, a_text varchar2, a_item_type varchar2 := null),
- member procedure print_text_lines(self in out nocopy ut_output_reporter_base, a_text_lines ut_varchar2_rows, a_item_type varchar2 := null),
- member procedure print_clob(self in out nocopy ut_output_reporter_base, a_clob clob, a_item_type varchar2 := null),
-
- final member function get_lines(a_initial_timeout natural := null, a_timeout_sec natural := null) return ut_output_data_rows pipelined,
- final member function get_lines_cursor(a_initial_timeout natural := null, a_timeout_sec natural := null) return sys_refcursor,
- final member procedure lines_to_dbms_output(self in ut_output_reporter_base, a_initial_timeout natural := null, a_timeout_sec natural := null),
- overriding final member procedure on_finalize(self in out nocopy ut_output_reporter_base, a_run in ut_run),
- overriding member procedure on_initialize(self in out nocopy ut_output_reporter_base, a_run in ut_run)
-)
-not final not instantiable
-/
diff --git a/source/core/types/ut_path_item.tpb b/source/core/types/ut_path_item.tpb
deleted file mode 100644
index 6cdb2b8ad..000000000
--- a/source/core/types/ut_path_item.tpb
+++ /dev/null
@@ -1,42 +0,0 @@
-create or replace type body ut_path_item as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- constructor function ut_path_item(self in out nocopy ut_path_item, schema_name varchar2, object_name varchar2,procedure_name varchar2) return self as result is
- begin
- self.schema_name := schema_name;
- self.object_name := object_name;
- self.procedure_name := procedure_name;
- return;
- end;
-
- constructor function ut_path_item(self in out nocopy ut_path_item, schema_name varchar2,suite_path varchar2) return self as result is
- begin
- self.schema_name := schema_name;
- self.suite_path := suite_path;
- return;
- end;
-
- constructor function ut_path_item(self in out nocopy ut_path_item, schema_name varchar2, object_name varchar2,procedure_name varchar2,suite_path varchar2) return self as result is
- begin
- self.schema_name := schema_name;
- self.object_name := object_name;
- self.procedure_name := procedure_name;
- self.suite_path := suite_path;
- return;
- end;
-end;
-/
diff --git a/source/core/types/ut_path_item.tps b/source/core/types/ut_path_item.tps
deleted file mode 100644
index c8ec81be5..000000000
--- a/source/core/types/ut_path_item.tps
+++ /dev/null
@@ -1,26 +0,0 @@
-create or replace type ut_path_item as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- schema_name varchar2(4000),
- object_name varchar2(250),
- procedure_name varchar2(250),
- suite_path varchar2(4000),
- constructor function ut_path_item(self in out nocopy ut_path_item, schema_name varchar2, object_name varchar2,procedure_name varchar2) return self as result,
- constructor function ut_path_item(self in out nocopy ut_path_item, schema_name varchar2, suite_path varchar2) return self as result,
- constructor function ut_path_item(self in out nocopy ut_path_item, schema_name varchar2, object_name varchar2,procedure_name varchar2,suite_path varchar2) return self as result
-)
-/
diff --git a/source/core/types/ut_path_items.tps b/source/core/types/ut_path_items.tps
deleted file mode 100644
index 0c87cf28c..000000000
--- a/source/core/types/ut_path_items.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_path_items as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of ut_path_item
-/
diff --git a/source/core/types/ut_reporter_base.tpb b/source/core/types/ut_reporter_base.tpb
deleted file mode 100644
index 017dc8971..000000000
--- a/source/core/types/ut_reporter_base.tpb
+++ /dev/null
@@ -1,221 +0,0 @@
-create or replace type body ut_reporter_base is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- final member procedure init(self in out nocopy ut_reporter_base, a_self_type varchar2) is
- begin
- self.self_type := a_self_type;
- self.id := sys_guid();
- return;
- end;
-
- member procedure set_reporter_id(self in out nocopy ut_reporter_base, a_reporter_id raw) is
- begin
- self.id := a_reporter_id;
- end;
-
- member function get_reporter_id return raw is
- begin
- return self.id;
- end;
-
- member function get_description return varchar2 is
- begin
- return 'No description available';
- end;
-
- -- run hooks
- member procedure before_calling_run(self in out nocopy ut_reporter_base, a_run in ut_run) is
- begin
- null;
- end;
-
- -- suite hooks
- member procedure before_calling_suite(self in out nocopy ut_reporter_base, a_suite in ut_logical_suite) is
- begin
- null;
- end;
-
- member procedure before_calling_before_all(self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
- member procedure after_calling_before_all (self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
-
- member procedure before_calling_before_each(self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
- member procedure after_calling_before_each (self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
-
- -- test hooks
- member procedure before_calling_test(self in out nocopy ut_reporter_base, a_test in ut_test) is
- begin
- null;
- end;
-
- member procedure before_calling_before_test(self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
- member procedure after_calling_before_test (self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
-
- member procedure before_calling_test_execute(self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
- member procedure after_calling_test_execute (self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
-
- member procedure before_calling_after_test(self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
- member procedure after_calling_after_test (self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
-
- member procedure after_calling_test(self in out nocopy ut_reporter_base, a_test in ut_test) is
- begin
- null;
- end;
-
- --suite hooks continued
- member procedure before_calling_after_each(self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
- member procedure after_calling_after_each (self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
-
- member procedure before_calling_after_all(self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
- member procedure after_calling_after_all (self in out nocopy ut_reporter_base, a_executable in ut_executable) is
- begin
- null;
- end;
-
- member procedure after_calling_suite(self in out nocopy ut_reporter_base, a_suite in ut_logical_suite) is
- begin
- null;
- end;
-
- -- run hooks continued
- member procedure after_calling_run (self in out nocopy ut_reporter_base, a_run in ut_run) is
- begin
- null;
- end;
-
- overriding member function get_supported_events return ut_varchar2_list is
- begin
- return ut_varchar2_list(
- ut_event_manager.gc_initialize,
- ut_event_manager.gc_before_run,
- ut_event_manager.gc_before_suite,
- ut_event_manager.gc_before_test,
- ut_event_manager.gc_before_before_all,
- ut_event_manager.gc_before_before_each,
- ut_event_manager.gc_before_before_test,
- ut_event_manager.gc_before_test_execute,
- ut_event_manager.gc_before_after_test,
- ut_event_manager.gc_before_after_each,
- ut_event_manager.gc_before_after_all,
- ut_event_manager.gc_after_run,
- ut_event_manager.gc_after_suite,
- ut_event_manager.gc_after_test,
- ut_event_manager.gc_after_before_all,
- ut_event_manager.gc_after_before_each,
- ut_event_manager.gc_after_before_test,
- ut_event_manager.gc_after_test_execute,
- ut_event_manager.gc_after_after_test,
- ut_event_manager.gc_after_after_each,
- ut_event_manager.gc_after_after_all,
- ut_event_manager.gc_finalize
- );
- end;
-
- overriding member procedure on_event( self in out nocopy ut_reporter_base, a_event_name varchar2, a_event_item ut_event_item) is
- /* Resolves issue with ORA-21779 being thrown see issue: 1309 -> ( https://github.com/utPLSQL/utPLSQL/issues/1309#issuecomment-4020289898 ) */
- l_event_item ut_event_item := a_event_item;
- begin
- case a_event_name
- when ut_event_manager.gc_initialize
- then self.on_initialize(treat(l_event_item as ut_run));
- when ut_event_manager.gc_before_run
- then self.before_calling_run(treat(l_event_item as ut_run));
- when ut_event_manager.gc_before_suite
- then self.before_calling_suite(treat(l_event_item as ut_logical_suite));
- when ut_event_manager.gc_before_before_all
- then self.before_calling_before_all(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_before_before_each
- then self.before_calling_before_each(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_before_test
- then self.before_calling_test(treat(l_event_item as ut_test));
- when ut_event_manager.gc_before_before_test
- then self.before_calling_before_test(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_before_test_execute
- then self.before_calling_test_execute(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_before_after_test
- then self.before_calling_after_test(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_before_after_each
- then self.before_calling_after_each(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_before_after_all
- then self.before_calling_after_all(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_after_run
- then self.after_calling_run(treat(l_event_item as ut_run));
- when ut_event_manager.gc_after_suite
- then self.after_calling_suite(treat(l_event_item as ut_logical_suite));
- when ut_event_manager.gc_after_before_all
- then self.after_calling_before_all(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_after_before_each
- then self.after_calling_before_each(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_after_test
- then self.after_calling_test(treat(l_event_item as ut_test));
- when ut_event_manager.gc_after_before_test
- then self.after_calling_before_test(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_after_test_execute
- then self.after_calling_test_execute(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_after_after_test
- then self.after_calling_after_test(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_after_after_each
- then self.after_calling_after_each(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_after_after_all
- then self.after_calling_after_all(treat(l_event_item as ut_executable));
- when ut_event_manager.gc_finalize
- then self.on_finalize(treat(l_event_item as ut_run));
- else null;
- end case;
- end;
-
-end;
-/
diff --git a/source/core/types/ut_reporter_base.tps b/source/core/types/ut_reporter_base.tps
deleted file mode 100644
index de157136e..000000000
--- a/source/core/types/ut_reporter_base.tps
+++ /dev/null
@@ -1,82 +0,0 @@
-create or replace type ut_reporter_base under ut_event_listener (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- id raw(32),
- final member procedure init(self in out nocopy ut_reporter_base, a_self_type varchar2),
- member procedure set_reporter_id(self in out nocopy ut_reporter_base, a_reporter_id raw),
- member function get_reporter_id return raw,
- member function get_description return varchar2,
-
- -- run hooks
- member procedure before_calling_run(self in out nocopy ut_reporter_base, a_run in ut_run),
-
- -- suite hooks
- member procedure before_calling_suite(self in out nocopy ut_reporter_base, a_suite in ut_logical_suite),
-
- member procedure before_calling_before_all(self in out nocopy ut_reporter_base, a_executable in ut_executable),
- member procedure after_calling_before_all (self in out nocopy ut_reporter_base, a_executable in ut_executable),
-
- member procedure before_calling_before_each(self in out nocopy ut_reporter_base, a_executable in ut_executable),
- member procedure after_calling_before_each (self in out nocopy ut_reporter_base, a_executable in ut_executable),
-
- -- test hooks
- member procedure before_calling_test(self in out nocopy ut_reporter_base, a_test in ut_test),
-
- member procedure before_calling_before_test(self in out nocopy ut_reporter_base, a_executable in ut_executable),
- member procedure after_calling_before_test (self in out nocopy ut_reporter_base, a_executable in ut_executable),
-
- member procedure before_calling_test_execute(self in out nocopy ut_reporter_base, a_executable in ut_executable),
- member procedure after_calling_test_execute (self in out nocopy ut_reporter_base, a_executable in ut_executable),
-
- member procedure before_calling_after_test(self in out nocopy ut_reporter_base, a_executable in ut_executable),
- member procedure after_calling_after_test (self in out nocopy ut_reporter_base, a_executable in ut_executable),
-
- member procedure after_calling_test(self in out nocopy ut_reporter_base, a_test in ut_test),
-
- --suite hooks continued
- member procedure before_calling_after_each(self in out nocopy ut_reporter_base, a_executable in ut_executable),
- member procedure after_calling_after_each (self in out nocopy ut_reporter_base, a_executable in ut_executable),
-
- member procedure before_calling_after_all(self in out nocopy ut_reporter_base, a_executable in ut_executable),
- member procedure after_calling_after_all (self in out nocopy ut_reporter_base, a_executable in ut_executable),
-
- member procedure after_calling_suite(self in out nocopy ut_reporter_base, a_suite in ut_logical_suite),
-
- -- run hooks continued
- member procedure after_calling_run (self in out nocopy ut_reporter_base, a_run in ut_run),
-
- -- This method is executed when reporter is getting finalized
- -- it differs from after_calling_run, as it is getting called, even when the run fails
- -- This way, you may close all open outputs, files, connections etc. that need closing before the run finishes
- not instantiable member procedure on_finalize(self in out nocopy ut_reporter_base, a_run in ut_run),
-
- -- This method is executed when run is getting initialized
- not instantiable member procedure on_initialize(self in out nocopy ut_reporter_base, a_run in ut_run),
-
- /**
- * Returns the list of events that are supported by particular implementation of the reporter
- */
- overriding member function get_supported_events return ut_varchar2_list,
-
- /**
- * Delegates execution of event into individual reporting procedures
- */
- overriding member procedure on_event( self in out nocopy ut_reporter_base, a_event_name varchar2, a_event_item ut_event_item)
-
-)
-not final not instantiable
-/
diff --git a/source/core/types/ut_reporter_info.tps b/source/core/types/ut_reporter_info.tps
deleted file mode 100644
index f09c42e07..000000000
--- a/source/core/types/ut_reporter_info.tps
+++ /dev/null
@@ -1,23 +0,0 @@
-create or replace type ut_reporter_info as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- object_name varchar2(250),
- is_output_reporter varchar2(1),
- is_instantiable varchar2(1),
- is_final varchar2(1)
-)
-/
diff --git a/source/core/types/ut_reporters.tps b/source/core/types/ut_reporters.tps
deleted file mode 100644
index a2802bb26..000000000
--- a/source/core/types/ut_reporters.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_reporters as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of ut_reporter_base;
-/
diff --git a/source/core/types/ut_reporters_info.tps b/source/core/types/ut_reporters_info.tps
deleted file mode 100644
index 82c264f36..000000000
--- a/source/core/types/ut_reporters_info.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_reporters_info as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-table of ut_reporter_info;
-/
\ No newline at end of file
diff --git a/source/core/types/ut_results_counter.tpb b/source/core/types/ut_results_counter.tpb
deleted file mode 100644
index 811389e0e..000000000
--- a/source/core/types/ut_results_counter.tpb
+++ /dev/null
@@ -1,74 +0,0 @@
-create or replace type body ut_results_counter as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- constructor function ut_results_counter(self in out nocopy ut_results_counter) return self as result is
- begin
- self.disabled_count := 0;
- self.success_count := 0;
- self.failure_count := 0;
- self.errored_count := 0;
- self.warnings_count := 0;
- return;
- end;
-
- member procedure set_counter_values(self in out nocopy ut_results_counter, a_status integer) is
- begin
- self.disabled_count := case when a_status = ut_utils.gc_disabled then 1 else 0 end;
- self.success_count := case when a_status = ut_utils.gc_success then 1 else 0 end;
- self.failure_count := case when a_status = ut_utils.gc_failure then 1 else 0 end;
- self.errored_count := case when a_status = ut_utils.gc_error then 1 else 0 end;
- end;
-
- member procedure sum_counter_values(self in out nocopy ut_results_counter, a_item ut_results_counter) is
- begin
- self.disabled_count := self.disabled_count + a_item.disabled_count;
- self.success_count := self.success_count + a_item.success_count;
- self.failure_count := self.failure_count + a_item.failure_count;
- self.errored_count := self.errored_count + a_item.errored_count;
- self.warnings_count := self.warnings_count + a_item.warnings_count;
- end;
-
- member procedure increase_warning_count(self in out nocopy ut_results_counter, a_count integer := 1) is
- begin
- self.warnings_count := self.warnings_count + nvl(a_count,0);
- end;
-
- member function total_count return integer is
- begin
- --skip warnings here
- return self.disabled_count + self.success_count + self.failure_count + self.errored_count;
- end;
-
- member function result_status return integer is
- l_result integer;
- begin
- if self.errored_count > 0 then
- l_result := ut_utils.gc_error;
- elsif self.failure_count > 0 then
- l_result := ut_utils.gc_failure;
- elsif self.success_count > 0 then
- l_result := ut_utils.gc_success;
- elsif self.disabled_count > 0 then
- l_result := ut_utils.gc_disabled;
- else
- l_result := ut_utils.gc_error;
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/core/types/ut_results_counter.tps b/source/core/types/ut_results_counter.tps
deleted file mode 100644
index 913ae0967..000000000
--- a/source/core/types/ut_results_counter.tps
+++ /dev/null
@@ -1,30 +0,0 @@
-create or replace type ut_results_counter as object(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- disabled_count integer,
- success_count integer,
- failure_count integer,
- errored_count integer,
- warnings_count integer,
- constructor function ut_results_counter(self in out nocopy ut_results_counter) return self as result,
- member procedure set_counter_values(self in out nocopy ut_results_counter, a_status integer),
- member procedure sum_counter_values(self in out nocopy ut_results_counter, a_item ut_results_counter),
- member procedure increase_warning_count(self in out nocopy ut_results_counter, a_count integer := 1),
- member function total_count return integer,
- member function result_status return integer
-)
-/
diff --git a/source/core/types/ut_run.tpb b/source/core/types/ut_run.tpb
deleted file mode 100644
index 660c88791..000000000
--- a/source/core/types/ut_run.tpb
+++ /dev/null
@@ -1,112 +0,0 @@
-create or replace type body ut_run as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_run(
- self in out nocopy ut_run,
- a_items ut_suite_items := null,
- a_run_paths ut_varchar2_list := null,
- a_coverage_options ut_coverage_options := null,
- a_test_file_mappings ut_file_mappings := null,
- a_client_character_set varchar2 := null,
- a_random_test_order_seed positive := null,
- a_run_tags varchar2 := null
- ) return self as result is
- begin
- self.run_paths := a_run_paths;
- self.run_tags := a_run_tags;
- self.self_type := $$plsql_unit;
- self.items := a_items;
- self.client_character_set := lower(a_client_character_set);
- self.random_test_order_seed := a_random_test_order_seed;
- self.results_count := ut_results_counter();
- self.test_file_mappings := coalesce(a_test_file_mappings, ut_file_mappings());
- self.coverage_options := a_coverage_options;
- return;
- end;
-
- overriding member procedure mark_as_skipped(self in out nocopy ut_run,a_skip_reason in varchar2) is
- begin
- null;
- end;
-
- overriding member function do_execute(self in out nocopy ut_run) return boolean is
- l_completed_without_errors boolean;
- begin
- ut_utils.debug_log('ut_run.execute');
-
- ut_event_manager.trigger_event(ut_event_manager.gc_before_run, self);
- self.start_time := current_timestamp;
-
- -- clear anything that might stay in the session's cache
- ut_expectation_processor.clear_expectations;
-
- for i in 1 .. self.items.count loop
- l_completed_without_errors := self.items(i).do_execute();
- end loop;
-
- self.calc_execution_result();
-
- self.end_time := current_timestamp;
-
- ut_event_manager.trigger_event(ut_event_manager.gc_after_run, self);
-
- return l_completed_without_errors;
- end;
-
- overriding member procedure set_rollback_type(self in out nocopy ut_run, a_rollback_type integer, a_force boolean := false) is
- begin
- self.rollback_type := case when a_force then a_rollback_type else coalesce(self.rollback_type, a_rollback_type) end;
- for i in 1 .. self.items.count loop
- self.items(i).set_rollback_type(self.rollback_type, a_force);
- end loop;
- end;
-
- overriding member procedure calc_execution_result(self in out nocopy ut_run) is
- l_result integer(1);
- begin
- if self.items is not null and self.items.count > 0 then
- for i in 1 .. self.items.count loop
- self.results_count.sum_counter_values( self.items(i).results_count );
- end loop;
- l_result := self.results_count.result_status();
- else
- --if suite is empty then it's successful (no errors)
- l_result := ut_utils.gc_success;
- end if;
-
- self.result := l_result;
- end;
-
- overriding member procedure mark_as_errored(self in out nocopy ut_run, a_error_stack_trace varchar2) is
- begin
- null;
- end;
-
- overriding member function get_error_stack_traces return ut_varchar2_list is
- begin
- return ut_varchar2_list();
- end;
-
- overriding member function get_serveroutputs return clob is
- begin
- return null;
- end;
-
-
-end;
-/
diff --git a/source/core/types/ut_run.tps b/source/core/types/ut_run.tps
deleted file mode 100644
index 1878a2d46..000000000
--- a/source/core/types/ut_run.tps
+++ /dev/null
@@ -1,47 +0,0 @@
-create or replace type ut_run under ut_suite_item (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /**
- * The list of items (suites) to be invoked as part of this run
- */
- project_name varchar2(4000),
- items ut_suite_items,
- run_paths ut_varchar2_list,
- run_tags varchar2(4000),
- coverage_options ut_coverage_options,
- test_file_mappings ut_file_mappings,
- client_character_set varchar2(100),
- random_test_order_seed number(38,0),
- constructor function ut_run(
- self in out nocopy ut_run,
- a_items ut_suite_items := null,
- a_run_paths ut_varchar2_list := null,
- a_coverage_options ut_coverage_options := null,
- a_test_file_mappings ut_file_mappings := null,
- a_client_character_set varchar2 := null,
- a_random_test_order_seed positive := null,
- a_run_tags varchar2 := null
- ) return self as result,
- overriding member procedure mark_as_skipped(self in out nocopy ut_run,a_skip_reason in varchar2),
- overriding member function do_execute(self in out nocopy ut_run) return boolean,
- overriding member procedure set_rollback_type(self in out nocopy ut_run, a_rollback_type integer, a_force boolean := false),
- overriding member procedure calc_execution_result(self in out nocopy ut_run),
- overriding member procedure mark_as_errored(self in out nocopy ut_run, a_error_stack_trace varchar2),
- overriding member function get_error_stack_traces return ut_varchar2_list,
- overriding member function get_serveroutputs return clob
-)
-/
diff --git a/source/core/types/ut_run_info.tpb b/source/core/types/ut_run_info.tpb
deleted file mode 100644
index 6edc0f109..000000000
--- a/source/core/types/ut_run_info.tpb
+++ /dev/null
@@ -1,48 +0,0 @@
-create or replace type body ut_run_info as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions andTEST_GET_REPORTERS_LIST
- limitations under the License.
- */
- constructor function ut_run_info(self in out nocopy ut_run_info) return self as result is
- l_ut_owner varchar2(250) := ut_utils.ut_owner;
- begin
- self.self_type := $$plsql_unit;
- execute immediate
- 'select /*+ no_parallel */ '||l_ut_owner||'.ut.version() from dual'
- into self.ut_version;
-
- dbms_utility.db_version( self.db_version, self.db_compatibility );
- db_os_type := dbms_utility.port_string();
-
- execute immediate
- 'select /*+ no_parallel */ '||l_ut_owner||'.ut_key_value_pair(x.product, x.version) from product_component_version x'
- bulk collect into self.db_component_version;
-
- execute immediate
- 'select /*+ no_parallel */ '||l_ut_owner||'.ut_key_value_pair(x.parameter, x.value)
- from nls_session_parameters x'
- bulk collect into self.nls_session_params;
-
- execute immediate
- 'select /*+ no_parallel */ '||l_ut_owner||'.ut_key_value_pair(x.parameter, x.value) from nls_instance_parameters x'
- bulk collect into self.nls_instance_params;
-
- execute immediate
- 'select /*+ no_parallel */ '||l_ut_owner||'.ut_key_value_pair(x.parameter, x.value) from nls_database_parameters x'
- bulk collect into self.nls_db_params;
- return;
- end;
-end;
-/
diff --git a/source/core/types/ut_run_info.tps b/source/core/types/ut_run_info.tps
deleted file mode 100644
index 4a3da691f..000000000
--- a/source/core/types/ut_run_info.tps
+++ /dev/null
@@ -1,28 +0,0 @@
-create or replace type ut_run_info under ut_event_item (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- ut_version varchar2(4000),
- db_version varchar2(4000),
- db_compatibility varchar2(4000),
- db_os_type varchar2(4000),
- db_component_version ut_key_value_pairs,
- nls_session_params ut_key_value_pairs,
- nls_instance_params ut_key_value_pairs,
- nls_db_params ut_key_value_pairs,
- constructor function ut_run_info(self in out nocopy ut_run_info) return self as result
-);
-/
diff --git a/source/core/types/ut_stack.tpb b/source/core/types/ut_stack.tpb
deleted file mode 100644
index b5f4e8747..000000000
--- a/source/core/types/ut_stack.tpb
+++ /dev/null
@@ -1,58 +0,0 @@
-create or replace type body ut_stack as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2023 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_stack( self in out nocopy ut_stack) return self as result is
- begin
- self.tokens := ut_varchar2_list();
- self.top := 0;
- return;
- end ut_stack;
-
- member function peek(self in out nocopy ut_stack) return varchar2 is
- l_token varchar2(32767);
- begin
- if self.tokens.count =0 or self.tokens is null then
- l_token := null;
- else
- l_token := self.tokens(self.tokens.last);
- end if;
- return l_token;
- end;
-
- member procedure push(self in out nocopy ut_stack, a_token varchar2) is
- begin
- self.tokens.extend;
- self.tokens(self.tokens.last) := a_token;
- self.top := self.tokens.count;
- end push;
-
- member procedure pop(self in out nocopy ut_stack,a_cnt in integer default 1) is
- begin
- self.tokens.trim(a_cnt);
- self.top := self.tokens.count;
- end pop;
-
- member function pop(self in out nocopy ut_stack) return varchar2 is
- l_token varchar2(32767) := self.tokens(self.tokens.last);
- begin
- self.pop();
- return l_token;
- end;
-end;
-/
-
diff --git a/source/core/types/ut_stack.tps b/source/core/types/ut_stack.tps
deleted file mode 100644
index 23112fdde..000000000
--- a/source/core/types/ut_stack.tps
+++ /dev/null
@@ -1,26 +0,0 @@
-create or replace type ut_stack as object (
- top integer,
- tokens ut_varchar2_list,
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2023 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- constructor function ut_stack( self in out nocopy ut_stack) return self as result,
- member function peek(self in out nocopy ut_stack) return varchar2,
- member procedure push(self in out nocopy ut_stack, a_token varchar2),
- member procedure pop(self in out nocopy ut_stack,a_cnt in integer default 1),
- member function pop(self in out nocopy ut_stack) return varchar2
-)
-/
\ No newline at end of file
diff --git a/source/core/types/ut_suite.tpb b/source/core/types/ut_suite.tpb
deleted file mode 100644
index e3a4687d8..000000000
--- a/source/core/types/ut_suite.tpb
+++ /dev/null
@@ -1,112 +0,0 @@
-create or replace type body ut_suite as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_suite (
- self in out nocopy ut_suite, a_object_owner varchar2, a_object_name varchar2, a_line_no integer,
- a_tags ut_varchar2_rows := null
- ) return self as result is
- begin
- self.self_type := $$plsql_unit;
- self.init(a_object_owner, a_object_name, a_object_name, a_line_no);
- self.items := ut_suite_items();
- before_all_list := ut_executables();
- after_all_list := ut_executables();
- self.tags := coalesce(a_tags,ut_varchar2_rows());
- return;
- end;
-
- overriding member function do_execute(self in out nocopy ut_suite) return boolean is
- l_suite_savepoint varchar2(30);
- l_no_errors boolean;
-
- procedure propagate_error(a_error_stack_trace varchar2) is
- begin
- for i in 1..self.items.count loop
- self.items(i).mark_as_errored(a_error_stack_trace);
- end loop;
- end;
- begin
- ut_utils.debug_log('ut_suite.execute');
-
- if self.get_disabled_flag() then
- self.mark_as_skipped(a_skip_reason => self.disabled_reason);
- else
- self.start_time := current_timestamp;
- ut_event_manager.trigger_event(ut_event_manager.gc_before_suite, self);
-
- l_suite_savepoint := self.create_savepoint_if_needed();
-
- --includes listener calls for before and after actions
- l_no_errors := true;
- for i in 1 .. self.before_all_list.count loop
- l_no_errors := self.before_all_list(i).do_execute(self);
- if not l_no_errors then
- propagate_error(self.before_all_list(i).get_error_stack_trace());
- exit;
- end if;
- end loop;
-
- if l_no_errors then
- for i in 1 .. self.items.count loop
- self.items(i).do_execute();
- end loop;
- end if;
-
- for i in 1 .. after_all_list.count loop
- l_no_errors := self.after_all_list(i).do_execute(self);
- if not l_no_errors then
- self.put_warning(self.after_all_list(i).get_error_stack_trace());
- end if;
- end loop;
-
- self.rollback_to_savepoint(l_suite_savepoint);
-
- self.calc_execution_result();
- self.end_time := current_timestamp;
- ut_event_manager.trigger_event(ut_event_manager.gc_after_suite, self);
- end if;
-
- return l_no_errors;
- end;
-
- overriding member function get_error_stack_traces(self ut_suite) return ut_varchar2_list is
- l_stack_traces ut_varchar2_list := ut_varchar2_list();
- begin
- for i in 1 .. before_all_list.count loop
- ut_utils.append_to_list(l_stack_traces, self.before_all_list(i).get_error_stack_trace());
- end loop;
- for i in 1 .. after_all_list.count loop
- ut_utils.append_to_list(l_stack_traces, self.after_all_list(i).get_error_stack_trace());
- end loop;
- return l_stack_traces;
- end;
-
- overriding member function get_serveroutputs return clob is
- l_outputs clob;
- begin
- for i in 1 .. before_all_list.count loop
- ut_utils.append_to_clob(l_outputs, self.before_all_list(i).serveroutput);
- end loop;
- for i in 1 .. after_all_list.count loop
- ut_utils.append_to_clob(l_outputs, self.after_all_list(i).serveroutput);
- end loop;
- return l_outputs;
- end;
-
-end;
-/
diff --git a/source/core/types/ut_suite.tps b/source/core/types/ut_suite.tps
deleted file mode 100644
index ff7f3e171..000000000
--- a/source/core/types/ut_suite.tps
+++ /dev/null
@@ -1,37 +0,0 @@
-create or replace type ut_suite under ut_logical_suite (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /**
- * The procedure to be invoked before all of the items of the suite (executed once)
- * Procedure exists within the package of the suite
- */
- before_all_list ut_executables,
-
- /**
- * The procedure to be invoked after all of the items of the suite (executed once)
- * Procedure exists within the package of the suite
- */
- after_all_list ut_executables,
- constructor function ut_suite (
- self in out nocopy ut_suite, a_object_owner varchar2, a_object_name varchar2, a_line_no integer,
- a_tags ut_varchar2_rows := null
- ) return self as result,
- overriding member function do_execute(self in out nocopy ut_suite) return boolean,
- overriding member function get_error_stack_traces(self ut_suite) return ut_varchar2_list,
- overriding member function get_serveroutputs return clob
-) not final
-/
diff --git a/source/core/types/ut_suite_cache_row.tps b/source/core/types/ut_suite_cache_row.tps
deleted file mode 100644
index c147a8757..000000000
--- a/source/core/types/ut_suite_cache_row.tps
+++ /dev/null
@@ -1,41 +0,0 @@
-create or replace type ut_suite_cache_row as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- id number(22,0),
- self_type varchar2(250 byte),
- path varchar2(1000 byte),
- object_owner varchar2(250 byte),
- object_name varchar2(250 byte),
- name varchar2(250 byte),
- line_no number,
- parse_time timestamp (6),
- description varchar2(4000 byte),
- rollback_type number,
- disabled_flag number,
- disabled_reason varchar2(4000 byte),
- warnings ut_varchar2_rows,
- before_all_list ut_executables,
- after_all_list ut_executables,
- before_each_list ut_executables,
- before_test_list ut_executables,
- after_each_list ut_executables,
- after_test_list ut_executables,
- expected_error_codes ut_varchar2_rows,
- tags ut_varchar2_rows,
- item ut_executable_test
-)
-/
\ No newline at end of file
diff --git a/source/core/types/ut_suite_cache_rows.tps b/source/core/types/ut_suite_cache_rows.tps
deleted file mode 100644
index 9b6919df5..000000000
--- a/source/core/types/ut_suite_cache_rows.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create type ut_suite_cache_rows as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of ut_suite_cache_row
-/
\ No newline at end of file
diff --git a/source/core/types/ut_suite_context.tpb b/source/core/types/ut_suite_context.tpb
deleted file mode 100644
index be92e6fc9..000000000
--- a/source/core/types/ut_suite_context.tpb
+++ /dev/null
@@ -1,32 +0,0 @@
-create or replace type body ut_suite_context as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_suite_context (
- self in out nocopy ut_suite_context, a_object_owner varchar2, a_object_name varchar2, a_context_name varchar2 := null, a_line_no integer
- ) return self as result is
- begin
- self.self_type := $$plsql_unit;
- self.init(a_object_owner, a_object_name, a_context_name, a_line_no);
- self.items := ut_suite_items();
- before_all_list := ut_executables();
- after_all_list := ut_executables();
- return;
- end;
-
-end;
-/
diff --git a/source/core/types/ut_suite_context.tps b/source/core/types/ut_suite_context.tps
deleted file mode 100644
index 5e3d20f87..000000000
--- a/source/core/types/ut_suite_context.tps
+++ /dev/null
@@ -1,22 +0,0 @@
-create or replace type ut_suite_context under ut_suite (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- constructor function ut_suite_context (
- self in out nocopy ut_suite_context, a_object_owner varchar2, a_object_name varchar2, a_context_name varchar2 := null, a_line_no integer
- ) return self as result
-)
-/
diff --git a/source/core/types/ut_suite_item.tpb b/source/core/types/ut_suite_item.tpb
deleted file mode 100644
index 648f10dd1..000000000
--- a/source/core/types/ut_suite_item.tpb
+++ /dev/null
@@ -1,125 +0,0 @@
-create or replace type body ut_suite_item as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- member procedure init(self in out nocopy ut_suite_item, a_object_owner varchar2, a_object_name varchar2, a_name varchar2, a_line_no integer) is
- begin
- self.object_owner := a_object_owner;
- self.object_name := lower(trim(a_object_name));
- self.name := lower(trim(a_name));
- self.results_count := ut_results_counter();
- self.warnings := ut_varchar2_rows();
- self.line_no := a_line_no;
- self.transaction_invalidators := ut_varchar2_list();
- self.disabled_flag := ut_utils.boolean_to_int(false);
- self.disabled_reason := null;
- end;
-
- member function get_disabled_flag return boolean is
- begin
- return ut_utils.int_to_boolean(self.disabled_flag);
- end;
-
- member procedure set_rollback_type(self in out nocopy ut_suite_item, a_rollback_type integer, a_force boolean := false) is
- begin
- self.rollback_type := case when a_force then a_rollback_type else coalesce(self.rollback_type, a_rollback_type) end;
- end;
-
- member function get_rollback_type return integer is
- begin
- return nvl(self.rollback_type, ut_utils.gc_rollback_default);
- end;
-
- final member procedure do_execute(self in out nocopy ut_suite_item) is
- l_completed_without_errors boolean;
- begin
- l_completed_without_errors := self.do_execute();
- end;
-
- member function create_savepoint_if_needed return varchar2 is
- l_savepoint varchar2(30);
- begin
- if get_rollback_type() = ut_utils.gc_rollback_auto then
- l_savepoint := ut_utils.gen_savepoint_name();
- execute immediate 'savepoint ' || l_savepoint;
- end if;
- return l_savepoint;
- end;
-
- member procedure rollback_to_savepoint(self in out nocopy ut_suite_item, a_savepoint varchar2) is
- ex_savepoint_not_exists exception;
- l_transaction_invalidators clob;
- pragma exception_init(ex_savepoint_not_exists, -1086);
- l_savepoint varchar2(250);
- begin
- if get_rollback_type() = ut_utils.gc_rollback_auto and a_savepoint is not null then
- l_savepoint := sys.dbms_assert.qualified_sql_name(a_savepoint);
- execute immediate 'rollback to ' || l_savepoint;
- end if;
- exception
- when ex_savepoint_not_exists then
- l_transaction_invalidators :=
- lower( ut_utils.indent_lines( ut_utils.table_to_clob( self.get_transaction_invalidators() ), 2, true ) );
- if length(l_transaction_invalidators) > 3000 then
- l_transaction_invalidators := substr(l_transaction_invalidators,1,3000)||'...';
- end if;
- put_warning(
- 'Unable to perform automatic rollback after test'
- || case when self_type like '%SUITE' then ' suite' when self_type like '%CONTEXT' then ' context' end || '. '
- ||'An implicit or explicit commit/rollback occurred in procedures:'||chr(10)
- ||l_transaction_invalidators||chr(10)
- ||'Use the "--%rollback(manual)" annotation or remove commit/rollback/ddl statements that are causing the issue.'
- );
- end;
-
- member function execution_time return number is
- begin
- return ut_utils.time_diff(start_time, end_time);
- end;
-
- member procedure put_warning(self in out nocopy ut_suite_item, a_message varchar2) is
- begin
- self.warnings.extend;
- self.warnings(self.warnings.last) := a_message;
- self.results_count.increase_warning_count;
- end;
-
- member procedure put_warning(self in out nocopy ut_suite_item, a_message varchar2, a_procedure_name varchar2, a_line_no integer) is
- l_result varchar2(1000);
- begin
- l_result := self.object_owner || '.' || self.object_name ;
- if a_procedure_name is not null then
- l_result := l_result || '.' || a_procedure_name ;
- end if;
- put_warning( a_message || chr( 10 ) || 'at package "' || upper(l_result) || '", line ' || a_line_no );
- end;
-
- member function get_transaction_invalidators return ut_varchar2_list is
- begin
- return transaction_invalidators;
- end;
-
- member procedure add_transaction_invalidator(self in out nocopy ut_suite_item, a_object_name varchar2) is
- begin
- if a_object_name not member of transaction_invalidators then
- transaction_invalidators.extend();
- transaction_invalidators(transaction_invalidators.last) := a_object_name;
- end if;
- end;
-
-end;
-/
diff --git a/source/core/types/ut_suite_item.tps b/source/core/types/ut_suite_item.tps
deleted file mode 100644
index 8184f2a63..000000000
--- a/source/core/types/ut_suite_item.tps
+++ /dev/null
@@ -1,95 +0,0 @@
-create or replace type ut_suite_item force under ut_event_item (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * owner of the database object (package)
- */
- object_owner varchar2(250 byte),
- /**
- * name of the database object (package)
- */
- object_name varchar2(250 byte),
- /**
- * Name of the object (suite, sub-suite, test)
- */
- name varchar2(250 byte),
- /**
- * Description fo the suite item (as given by the annotation)
- */
- description varchar2(4000 byte),
-
- /**
- * Full path of the invocation of the item (including the items name itself)
- */
- path varchar2(1000 byte),
- /**
- * The type of the rollback behavior
- */
- rollback_type integer(1),
- /**
- * Indicates if the test is to be disabled by execution
- */
- disabled_flag integer(1),
- /**
- * Indicates reason whysa test is to be disabled by execution
- */
- disabled_reason varchar2(4000),
- /**
- * Line no where annotation identifying this item is placed in package
- */
- line_no integer,
- /**
- * Time when the suite item was last parsed from package source
- */
- parse_time timestamp,
- --execution result fields
- start_time timestamp with time zone,
- end_time timestamp with time zone,
- result integer(1),
- warnings ut_varchar2_rows,
- results_count ut_results_counter,
- transaction_invalidators ut_varchar2_list,
- /**
- * Hold list of tags assign to test
- */
- tags ut_varchar2_rows,
- member procedure init(self in out nocopy ut_suite_item, a_object_owner varchar2, a_object_name varchar2, a_name varchar2, a_line_no integer),
- member function get_disabled_flag return boolean,
- not instantiable member procedure mark_as_skipped(self in out nocopy ut_suite_item, a_skip_reason in varchar2),
- member procedure set_rollback_type(self in out nocopy ut_suite_item, a_rollback_type integer, a_force boolean := false),
- member function get_rollback_type return integer,
- member function create_savepoint_if_needed return varchar2,
- member procedure rollback_to_savepoint(self in out nocopy ut_suite_item, a_savepoint varchar2),
- member function get_transaction_invalidators return ut_varchar2_list,
- member procedure add_transaction_invalidator(self in out nocopy ut_suite_item, a_object_name varchar2),
- /*
- Returns execution time in seconds (with miliseconds)
- */
- member function execution_time return number,
-
- not instantiable member function do_execute(self in out nocopy ut_suite_item) return boolean,
- final member procedure do_execute(self in out nocopy ut_suite_item),
- not instantiable member procedure calc_execution_result(self in out nocopy ut_suite_item),
- not instantiable member procedure mark_as_errored(self in out nocopy ut_suite_item, a_error_stack_trace varchar2),
- not instantiable member function get_error_stack_traces return ut_varchar2_list,
- not instantiable member function get_serveroutputs return clob,
- member procedure put_warning(self in out nocopy ut_suite_item, a_message varchar2),
- member procedure put_warning(self in out nocopy ut_suite_item, a_message varchar2, a_procedure_name varchar2, a_line_no integer)
-)
-not final not instantiable
-/
diff --git a/source/core/types/ut_suite_items.tps b/source/core/types/ut_suite_items.tps
deleted file mode 100644
index 615283446..000000000
--- a/source/core/types/ut_suite_items.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_suite_items as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of ut_suite_item
-/
diff --git a/source/core/types/ut_test.tpb b/source/core/types/ut_test.tpb
deleted file mode 100644
index 946f8990d..000000000
--- a/source/core/types/ut_test.tpb
+++ /dev/null
@@ -1,178 +0,0 @@
-create or replace type body ut_test as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_test(
- self in out nocopy ut_test, a_object_owner varchar2 := null, a_object_name varchar2, a_name varchar2,
- a_line_no integer, a_expected_error_codes ut_varchar2_rows := null, a_tags ut_varchar2_rows := null
- ) return self as result is
- begin
- self.self_type := $$plsql_unit;
- self.init(a_object_owner, a_object_name, a_name, a_line_no);
- self.item := ut_executable_test(a_object_owner, a_object_name, a_name, ut_utils.gc_test_execute);
- self.before_each_list := ut_executables();
- self.before_test_list := ut_executables();
- self.after_test_list := ut_executables();
- self.after_each_list := ut_executables();
- self.all_expectations := ut_expectation_results();
- self.failed_expectations := ut_expectation_results();
- self.expected_error_codes := a_expected_error_codes;
- self.tags := coalesce(a_tags,ut_varchar2_rows());
- return;
- end;
-
- overriding member procedure mark_as_skipped(self in out nocopy ut_test, a_skip_reason in varchar2) is
- begin
- ut_event_manager.trigger_event(ut_event_manager.gc_before_test, self);
- self.start_time := current_timestamp;
- self.result := ut_utils.gc_disabled;
- self.disabled_reason := coalesce(a_skip_reason,self.disabled_reason);
- ut_utils.debug_log('ut_test.execute - disabled');
- self.results_count.set_counter_values(self.result);
- self.end_time := self.start_time;
- ut_event_manager.trigger_event(ut_event_manager.gc_after_test, self);
- end;
-
- overriding member function do_execute(self in out nocopy ut_test) return boolean is
- l_no_errors boolean;
- l_savepoint varchar2(30);
- begin
-
- ut_utils.debug_log('ut_test.execute');
-
- if self.get_disabled_flag() then
- mark_as_skipped(self.disabled_reason);
- else
- self.start_time := current_timestamp;
- ut_event_manager.trigger_event(ut_event_manager.gc_before_test, self);
-
- l_savepoint := self.create_savepoint_if_needed();
-
- --includes listener calls for before and after actions
- l_no_errors := true;
- for i in 1 .. self.before_each_list.count loop
- l_no_errors := self.before_each_list(i).do_execute(self);
- exit when not l_no_errors;
- end loop;
-
- if l_no_errors then
- for i in 1 .. self.before_test_list.count loop
- l_no_errors := self.before_test_list(i).do_execute(self);
- exit when not l_no_errors;
- end loop;
-
- if l_no_errors then
- -- execute the test
- self.item.do_execute(self, self.expected_error_codes);
-
- end if;
- -- perform cleanup regardless of the test or setup failure
- for i in 1 .. self.after_test_list.count loop
- self.after_test_list(i).do_execute(self);
- end loop;
- end if;
-
- for i in 1 .. self.after_each_list.count loop
- self.after_each_list(i).do_execute(self);
- end loop;
- self.rollback_to_savepoint(l_savepoint);
-
- self.calc_execution_result();
- self.end_time := current_timestamp;
- ut_event_manager.trigger_event(ut_event_manager.gc_after_test, self);
- end if;
- return l_no_errors;
- end;
-
- overriding member procedure calc_execution_result(self in out nocopy ut_test) is
- l_warnings ut_varchar2_rows;
- begin
- if self.get_error_stack_traces().count = 0 then
- self.result := ut_expectation_processor.get_status();
- else
- self.result := ut_utils.gc_error;
- end if;
- --expectation results need to be part of test results
- self.all_expectations := ut_expectation_processor.get_all_expectations();
- self.failed_expectations := ut_expectation_processor.get_failed_expectations();
- l_warnings := coalesce( ut_expectation_processor.get_warnings(), ut_varchar2_rows() );
- self.warnings := self.warnings multiset union all l_warnings;
- self.results_count.increase_warning_count( cardinality(l_warnings) );
- self.results_count.set_counter_values(self.result);
- ut_expectation_processor.clear_expectations();
- end;
-
- overriding member procedure mark_as_errored(self in out nocopy ut_test, a_error_stack_trace varchar2) is
- begin
- ut_utils.debug_log('ut_test.fail');
- ut_event_manager.trigger_event(ut_event_manager.gc_before_test, self);
- self.start_time := current_timestamp;
- self.parent_error_stack_trace := a_error_stack_trace;
- self.calc_execution_result();
- self.end_time := self.start_time;
- ut_event_manager.trigger_event(ut_event_manager.gc_after_test, self);
- end;
-
- overriding member function get_error_stack_traces(self ut_test) return ut_varchar2_list is
- l_stack_traces ut_varchar2_list := ut_varchar2_list();
- begin
- ut_utils.append_to_list(l_stack_traces, self.parent_error_stack_trace);
- for i in 1 .. before_each_list.count loop
- ut_utils.append_to_list(l_stack_traces, self.before_each_list(i).get_error_stack_trace());
- end loop;
- for i in 1 .. before_test_list.count loop
- ut_utils.append_to_list(l_stack_traces, self.before_test_list(i).get_error_stack_trace());
- end loop;
- ut_utils.append_to_list(l_stack_traces, self.item.get_error_stack_trace());
- for i in 1 .. after_test_list.count loop
- ut_utils.append_to_list(l_stack_traces, self.after_test_list(i).get_error_stack_trace());
- end loop;
- for i in 1 .. after_each_list.count loop
- ut_utils.append_to_list(l_stack_traces, self.after_each_list(i).get_error_stack_trace());
- end loop;
- return l_stack_traces;
- end;
- overriding member function get_serveroutputs return clob is
- l_outputs clob;
- begin
- for i in 1 .. before_each_list.count loop
- ut_utils.append_to_clob(l_outputs, self.before_each_list(i).serveroutput);
- end loop;
- for i in 1 .. before_test_list.count loop
- ut_utils.append_to_clob(l_outputs, self.before_test_list(i).serveroutput);
- end loop;
- ut_utils.append_to_clob(l_outputs, self.item.serveroutput );
- for i in 1 .. after_test_list.count loop
- ut_utils.append_to_clob(l_outputs, self.after_test_list(i).serveroutput);
- end loop;
- for i in 1 .. after_each_list.count loop
- ut_utils.append_to_clob(l_outputs, self.after_each_list(i).serveroutput);
- end loop;
- return l_outputs;
- end;
-
- member function get_failed_expectation_lines return ut_varchar2_rows is
- l_results ut_varchar2_rows;
- begin
- for i in 1 .. failed_expectations.count loop
- ut_utils.append_to_list( l_results, ut_utils.convert_collection( failed_expectations(i).get_result_lines() ) );
- ut_utils.append_to_list( l_results, failed_expectations(i).caller_info );
- end loop;
- return l_results;
- end;
-end;
-/
diff --git a/source/core/types/ut_test.tps b/source/core/types/ut_test.tps
deleted file mode 100644
index dbba64961..000000000
--- a/source/core/types/ut_test.tps
+++ /dev/null
@@ -1,70 +0,0 @@
-create or replace type ut_test force under ut_suite_item (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /*
- * Procedures to be invoked before invoking the test and before_test_list procedures.
- */
- before_each_list ut_executables,
- /**
- * Procedures to be invoked before invoking the test
- */
- before_test_list ut_executables,
- /**
- * The Test procedure to be executed
- */
- item ut_executable_test,
- /**
- * Procedures to be invoked after invoking the test
- */
- after_test_list ut_executables,
- /*
- * Procedures to be invoked after invoking the test and after_test_list procedures.
- */
- after_each_list ut_executables,
- /**
- * The list of all expectations results as well as database errors encountered while invoking
- * the test procedure and the before_test/after_test blocks
- */
- all_expectations ut_expectation_results,
-
- /**
- * The list of failed expectations results as well as database errors encountered while invoking
- * the test procedure and the before_test/after_test blocks
- */
- failed_expectations ut_expectation_results,
- /**
- * Holds information about error stacktrace from parent execution (suite)
- * Will get populated on exceptions in before-all calls
- */
- parent_error_stack_trace varchar2(4000),
- /**
- *Holds the expected error codes list when the user use the annotation throws
- */
- expected_error_codes ut_varchar2_rows,
- constructor function ut_test(
- self in out nocopy ut_test, a_object_owner varchar2 := null, a_object_name varchar2, a_name varchar2,
- a_line_no integer, a_expected_error_codes ut_varchar2_rows := null, a_tags ut_varchar2_rows := null
- ) return self as result,
- overriding member procedure mark_as_skipped(self in out nocopy ut_test, a_skip_reason in varchar2),
- overriding member function do_execute(self in out nocopy ut_test) return boolean,
- overriding member procedure calc_execution_result(self in out nocopy ut_test),
- overriding member procedure mark_as_errored(self in out nocopy ut_test, a_error_stack_trace varchar2),
- overriding member function get_error_stack_traces(self ut_test) return ut_varchar2_list,
- overriding member function get_serveroutputs return clob,
- member function get_failed_expectation_lines return ut_varchar2_rows
-)
-/
diff --git a/source/core/types/ut_varchar2_list.tps b/source/core/types/ut_varchar2_list.tps
deleted file mode 100644
index f0b5df509..000000000
--- a/source/core/types/ut_varchar2_list.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_varchar2_list as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of varchar2(32767)
-/
diff --git a/source/core/types/ut_varchar2_rows.tps b/source/core/types/ut_varchar2_rows.tps
deleted file mode 100644
index e7fa29c29..000000000
--- a/source/core/types/ut_varchar2_rows.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_varchar2_rows as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of varchar2(4000 byte)
-/
diff --git a/source/core/ut_dbms_output_cache.sql b/source/core/ut_dbms_output_cache.sql
deleted file mode 100644
index e61b403c8..000000000
--- a/source/core/ut_dbms_output_cache.sql
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-utPLSQL - Version 3
-Copyright 2016 - 2021 utPLSQL Project
-Licensed under the Apache License, Version 2.0 (the "License"):
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-/*
-* This table is not a global temporary table as it needs to allow cross-session data exchange
-* It is used however as a temporary table with multiple writers.
-* This is why it has very high initrans and has nologging
-*/
-declare
- l_tab_exist number;
-begin
- select /*+ no_parallel */ count(*) into l_tab_exist from
- (select table_name from all_tables where table_name = 'UT_DBMS_OUTPUT_CACHE' and owner = sys_context('USERENV','CURRENT_SCHEMA')
- union all
- select synonym_name from all_synonyms where synonym_name = 'UT_DBMS_OUTPUT_CACHE' and owner = sys_context('USERENV','CURRENT_SCHEMA'));
- if l_tab_exist = 0 then
-
- execute immediate q'[create global temporary table ut_dbms_output_cache
- (
- seq_no number(20,0) not null,
- text varchar2(4000),
- constraint ut_dbms_output_cache_pk primary key(seq_no)
- ) on commit preserve rows
- ]';
-
- end if;
-end;
-/
diff --git a/source/core/ut_expectation_processor.pkb b/source/core/ut_expectation_processor.pkb
deleted file mode 100644
index c165a9ee5..000000000
--- a/source/core/ut_expectation_processor.pkb
+++ /dev/null
@@ -1,239 +0,0 @@
-create or replace package body ut_expectation_processor as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- type tt_nls_params is table of nls_session_parameters%rowtype;
-
- g_session_params tt_nls_params;
-
- g_expectations_called ut_expectation_results := ut_expectation_results();
-
- g_warnings ut_varchar2_rows := ut_varchar2_rows();
-
- g_nulls_are_equal boolean_not_null := gc_default_nulls_are_equal;
-
- g_package_invalidated boolean := false;
-
- function nulls_are_equal return boolean is
- begin
- return g_nulls_are_equal;
- end;
-
- procedure nulls_are_equal(a_setting boolean_not_null) is
- begin
- g_nulls_are_equal := a_setting;
- end;
-
- function get_status return integer is
- l_result integer := ut_utils.gc_success;
- begin
- ut_utils.debug_log('ut_expectation_processor.get_status');
-
- for i in 1 .. g_expectations_called.count loop
- l_result := greatest(l_result, g_expectations_called(i).status);
- exit when l_result = ut_utils.gc_error;
- end loop;
- return l_result;
- end get_status;
-
- procedure clear_expectations is
- begin
- ut_utils.debug_log('ut_expectation_processor.clear_expectations');
- g_expectations_called.delete;
- g_warnings.delete;
- end;
-
- function get_all_expectations return ut_expectation_results is
- begin
- ut_utils.debug_log('ut_expectation_processor.get_all_expectations: g_expectations_called.count='||g_expectations_called.count);
- return g_expectations_called;
- end get_all_expectations;
-
- function get_failed_expectations return ut_expectation_results is
- l_expectations_results ut_expectation_results := ut_expectation_results();
- begin
- ut_utils.debug_log('ut_expectation_processor.get_failed_expectations: g_expectations_called.count='||g_expectations_called.count);
- for i in 1 .. g_expectations_called.count loop
- if g_expectations_called(i).status > ut_utils.gc_success then
- l_expectations_results.extend;
- l_expectations_results(l_expectations_results.last) := g_expectations_called(i);
- end if;
- end loop;
- ut_utils.debug_log('ut_expectation_processor.get_failed_expectations: l_expectations_results.count='||l_expectations_results.count);
- return l_expectations_results;
- end get_failed_expectations;
-
- procedure add_expectation_result(a_expectation_result ut_expectation_result) is
- l_results ut_varchar2_list;
- begin
- if ut_session_context.is_ut_run then
- ut_event_manager.trigger_event(ut_event_manager.gc_debug, a_expectation_result);
- g_expectations_called.extend;
- g_expectations_called(g_expectations_called.last) := a_expectation_result;
- else
- l_results := a_expectation_result.get_result_lines();
- dbms_output.put_line( upper( ut_utils.test_result_to_char( a_expectation_result.status ) ) || '');
- for i in 1 .. l_results.count loop
- dbms_output.put_line( ' ' || l_results(i) );
- end loop;
- if a_expectation_result.caller_info is not null then
- dbms_output.put_line( ut_utils.indent_lines( a_expectation_result.caller_info, 2, true) );
- end if;
- end if;
- end;
-
- procedure report_failure(a_message in varchar2) is
- begin
- add_expectation_result(ut_expectation_result(ut_utils.gc_failure, null, a_message));
- end;
-
- function get_session_parameters return tt_nls_params is
- l_session_params tt_nls_params;
- begin
- select /*+ no_parallel */ nsp.parameter, nsp.value
- bulk collect into l_session_params
- from nls_session_parameters nsp
- where parameter
- in ( 'NLS_DATE_FORMAT', 'NLS_TIMESTAMP_FORMAT', 'NLS_TIMESTAMP_TZ_FORMAT')
- order by 1;
-
- return l_session_params;
- end;
-
- procedure set_xml_nls_params is
- insuf_privs exception;
- pragma exception_init(insuf_privs, -1031);
- begin
- g_session_params := get_session_parameters();
-
- begin
- execute immediate q'[alter session set events '19119 trace name context forever, level 0x8']';
- exception
- when insuf_privs then NULL;
- end;
-
- execute immediate 'alter session set nls_timestamp_format = '''||ut_utils.gc_timestamp_format||'''';
- execute immediate 'alter session set nls_timestamp_tz_format = '''||ut_utils.gc_timestamp_tz_format||'''';
- end;
-
- procedure reset_nls_params is
- insuf_privs exception;
- pragma exception_init(insuf_privs, -1031);
- begin
- begin
- execute immediate q'[alter session set events '19119 trace name context off']';
- exception
- when insuf_privs then NULL;
- end;
-
- if g_session_params is not null then
- for i in 1 .. g_session_params.count loop
- execute immediate 'alter session set '||g_session_params(i).parameter||' = '''||g_session_params(i).value||'''';
- end loop;
- end if;
-
- end;
-
- function who_called_expectation(a_call_stack varchar2) return varchar2 is
- l_caller_stack_line varchar2(4000);
- l_call_stack varchar2(4000);
- l_line_no integer;
- l_owner varchar2(1000);
- l_object_name varchar2(1000);
- l_result varchar2(4000);
- -- in 12.2 format_call_stack reportes not only package name, but also the procedure name
- -- when 11g and 12c reports only package name
- function cut_header_and_expectations( a_stack varchar2 ) return varchar2 is
- begin
- return regexp_substr( a_stack, '(.*\.(UT_EQUAL|UT_BE_WITHIN[[:alnum:]$#_]*|UT_EXPECTATION[[:alnum:]$#_]*|UT|UTASSERT2?)(\.[[:alnum:]$#_]+)?\s+)+((.|\s)*)', 1, 1, 'm', 4);
- end;
- function cut_address_columns( a_stack varchar2 ) return varchar2 is
- begin
- return regexp_replace( a_stack, '^(0x)?[[:digit:]abcdef]+\s+', '', 1, 0, 'mi' );
- end;
- function cut_framework_stack( a_stack varchar2 ) return varchar2 is
- begin
- return regexp_replace(
- a_stack,
- '[0-9]+\s+anonymous\s+block\s+[0-9]+\s+package\s+body\s+sys\.dbms_sql(\.execute)?\s+[0-9]+\s+[[:alnum:]_$# ]+\.ut_executable.*',
- '',
- 1, 1, 'mni'
- );
- end;
- function format_stack( a_stack varchar2 ) return varchar2 is
- begin
- return regexp_replace(
- a_stack,
- '([0-9]+)\s+(.* )?((anonymous block)|(([[:alnum:]$#_]+\.[[:alnum:]$#_]+(\.([[:alnum:]$#_])+)?)))',
- 'at "\3", line \1', 1, 0, 'i'
- );
- end;
- begin
- l_call_stack := cut_header_and_expectations( a_call_stack );
- l_call_stack := cut_address_columns( l_call_stack );
- l_call_stack := cut_framework_stack( l_call_stack );
- l_call_stack := format_stack( l_call_stack );
- l_caller_stack_line := regexp_substr(l_call_stack,'^(.*)');
- if l_caller_stack_line like '%.%' then
- l_line_no := to_number( regexp_substr( l_caller_stack_line, ', line (\d+)', subexpression => 1 ) );
- l_owner := regexp_substr( l_caller_stack_line, 'at "([[:alnum:]$#_]+)\.(([[:alnum:]$#_]+)(\.([[:alnum:]$#_]+))?)", line (\d+)', subexpression => 1 );
- l_object_name := regexp_substr( l_caller_stack_line, 'at "([[:alnum:]$#_]+)\.(([[:alnum:]$#_]+)(\.([[:alnum:]$#_]+))?)", line (\d+)', subexpression => 3 );
- l_result :=
- l_caller_stack_line || ' ' || rtrim(ut_metadata.get_source_definition_line(l_owner, l_object_name, l_line_no),chr(10))
- || replace( l_call_stack, l_caller_stack_line );
- else
- l_result := l_call_stack;
- end if;
- return rtrim(l_result,chr(10));
- end;
-
- procedure add_warning(a_messsage varchar2) is
- begin
- g_warnings.extend;
- g_warnings(g_warnings.last) := a_messsage;
- end;
-
- procedure add_depreciation_warning(a_deprecated_syntax varchar2, a_new_syntax varchar2) is
- begin
- add_warning(
- ut_utils.build_depreciation_warning( a_deprecated_syntax, a_new_syntax ) || chr(10)
- || ut_expectation_processor.who_called_expectation(dbms_utility.format_call_stack())
- );
- end;
-
- function get_warnings return ut_varchar2_rows is
- begin
- return g_warnings;
- end;
-
- function invalidation_exception_found return boolean is
- begin
- return g_package_invalidated;
- end;
-
- procedure set_invalidation_exception is
- begin
- g_package_invalidated := true;
- end;
-
- procedure reset_invalidation_exception is
- begin
- g_package_invalidated := false;
- end;
-
-end;
-/
diff --git a/source/core/ut_expectation_processor.pks b/source/core/ut_expectation_processor.pks
deleted file mode 100644
index dd9187526..000000000
--- a/source/core/ut_expectation_processor.pks
+++ /dev/null
@@ -1,62 +0,0 @@
-create or replace package ut_expectation_processor authid current_user as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- gc_default_nulls_are_equal constant boolean := true;
-
- subtype boolean_not_null is boolean not null;
-
- function nulls_are_equal return boolean;
-
- procedure nulls_are_equal(a_setting boolean_not_null);
-
- function get_status return integer;
-
- procedure clear_expectations;
-
- function get_all_expectations return ut_expectation_results;
-
- function get_failed_expectations return ut_expectation_results;
-
- procedure add_expectation_result(a_expectation_result ut_expectation_result);
-
- procedure report_failure(a_message in varchar2);
-
- procedure set_xml_nls_params;
-
- procedure reset_nls_params;
-
- -- function is looking at call stack
- -- and tries to figure out at which line of code
- -- in a unit test, the expectation was called
- -- if found, it returns a text:
- -- at: owner.name:line "source code line text"
- -- The text is to be consumed by expectation result
- function who_called_expectation(a_call_stack varchar2) return varchar2;
-
- procedure add_warning(a_messsage varchar2);
-
- procedure add_depreciation_warning(a_deprecated_syntax varchar2, a_new_syntax varchar2);
-
- function get_warnings return ut_varchar2_rows;
-
- function invalidation_exception_found return boolean;
- procedure set_invalidation_exception;
- procedure reset_invalidation_exception;
-
-end;
-/
diff --git a/source/core/ut_file_mapper.pkb b/source/core/ut_file_mapper.pkb
deleted file mode 100644
index 425360533..000000000
--- a/source/core/ut_file_mapper.pkb
+++ /dev/null
@@ -1,122 +0,0 @@
-create or replace package body ut_file_mapper is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- type tt_key_values is table of varchar2(4000) index by varchar2(4000);
-
- /**
- * Private functions
- */
-
- function to_hash_table(a_key_value_tab ut_key_value_pairs) return tt_key_values is
- l_result tt_key_values;
- begin
- if a_key_value_tab is not null then
- for i in 1 .. a_key_value_tab.count loop
- l_result(upper(a_key_value_tab(i).key)) := a_key_value_tab(i).value;
- end loop;
- end if;
- return l_result;
- end;
-
- /**
- * Public functions
- */
- function default_file_to_obj_type_map return ut_key_value_pairs is
- begin
- return ut_key_value_pairs(
- ut_key_value_pair('fnc', 'FUNCTION'),
- ut_key_value_pair('prc', 'PROCEDURE'),
- ut_key_value_pair('tpb', 'TYPE BODY'),
- ut_key_value_pair('pkb', 'PACKAGE BODY'),
- ut_key_value_pair('bdy', 'PACKAGE BODY'),
- ut_key_value_pair('trg', 'TRIGGER')
- );
- end;
-
- function build_file_mappings(
- a_file_paths ut_varchar2_list,
- a_file_to_object_type_mapping ut_key_value_pairs := null,
- a_regex_pattern varchar2 := null,
- a_object_owner_subexpression positive := null,
- a_object_name_subexpression positive := null,
- a_object_type_subexpression positive := null
- ) return ut_file_mappings is
- begin
- return build_file_mappings(
- null, a_file_paths, a_file_to_object_type_mapping, a_regex_pattern,
- a_object_owner_subexpression, a_object_name_subexpression, a_object_type_subexpression
- );
- end;
-
- function build_file_mappings(
- a_object_owner varchar2,
- a_file_paths ut_varchar2_list,
- a_file_to_object_type_mapping ut_key_value_pairs := null,
- a_regex_pattern varchar2 := null,
- a_object_owner_subexpression positive := null,
- a_object_name_subexpression positive := null,
- a_object_type_subexpression positive := null
- ) return ut_file_mappings is
- l_file_to_object_type_mapping ut_key_value_pairs := coalesce(a_file_to_object_type_mapping, default_file_to_obj_type_map());
- l_regex_pattern varchar2(4000) := coalesce(a_regex_pattern, gc_file_mapping_regex);
- l_object_owner_subexpression positive := coalesce(a_object_owner_subexpression, gc_regex_owner_subexpression);
- l_object_name_subexpression positive := coalesce(a_object_name_subexpression, gc_regex_name_subexpression);
- l_object_type_subexpression positive := coalesce(a_object_type_subexpression, gc_regex_type_subexpression);
-
- l_key_values tt_key_values;
- l_mappings ut_file_mappings;
- l_mapping ut_file_mapping;
- l_object_type_key varchar2(4000);
- l_object_type varchar2(4000);
- l_object_owner varchar2(4000);
- l_file_path varchar2(32767);
- begin
- if a_file_paths is not null then
- l_key_values := to_hash_table(l_file_to_object_type_mapping);
- l_mappings := ut_file_mappings();
-
- for i in 1 .. a_file_paths.count loop
- l_file_path := replace(a_file_paths(i),'\','/');
- l_object_type_key := upper(regexp_substr(l_file_path, l_regex_pattern, 1, 1, 'i', l_object_type_subexpression));
- if l_key_values.exists(l_object_type_key) then
- l_object_type := upper(l_key_values(l_object_type_key));
- else
- l_object_type := null;
- end if;
-
- l_object_owner := coalesce(
- upper(a_object_owner),
- upper(regexp_substr(l_file_path, l_regex_pattern, 1, 1, 'i', l_object_owner_subexpression)),
- sys_context('USERENV', 'CURRENT_SCHEMA'));
-
- l_mapping := ut_file_mapping(
- file_name => a_file_paths(i),
- object_owner => l_object_owner,
- object_name => upper(regexp_substr(l_file_path, l_regex_pattern, 1, 1, 'i', l_object_name_subexpression)),
- object_type => l_object_type
- );
- l_mappings.extend();
- l_mappings(l_mappings.last) := l_mapping;
- end loop;
- end if;
-
- return l_mappings;
- end;
-
-end;
-/
diff --git a/source/core/ut_file_mapper.pks b/source/core/ut_file_mapper.pks
deleted file mode 100644
index adc4c983f..000000000
--- a/source/core/ut_file_mapper.pks
+++ /dev/null
@@ -1,47 +0,0 @@
-create or replace package ut_file_mapper authid current_user is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- gc_file_mapping_regex constant varchar2(100) := '/(((\w|[$#])+)\.)?((\w|[$#])+)\.(\w{3})$';
- gc_regex_owner_subexpression constant positive := 2;
- gc_regex_name_subexpression constant positive := 4;
- gc_regex_type_subexpression constant positive := 6;
-
- function default_file_to_obj_type_map return ut_key_value_pairs;
-
- function build_file_mappings(
- a_file_paths ut_varchar2_list,
- a_file_to_object_type_mapping ut_key_value_pairs := null,
- a_regex_pattern varchar2 := null,
- a_object_owner_subexpression positive := null,
- a_object_name_subexpression positive := null,
- a_object_type_subexpression positive := null
- ) return ut_file_mappings;
-
- function build_file_mappings(
- a_object_owner varchar2,
- a_file_paths ut_varchar2_list,
- a_file_to_object_type_mapping ut_key_value_pairs := null,
- a_regex_pattern varchar2 := null,
- a_object_owner_subexpression positive := null,
- a_object_name_subexpression positive := null,
- a_object_type_subexpression positive := null
- ) return ut_file_mappings;
-
-
-end;
-/
diff --git a/source/core/ut_metadata.pkb b/source/core/ut_metadata.pkb
deleted file mode 100644
index 360b7b97d..000000000
--- a/source/core/ut_metadata.pkb
+++ /dev/null
@@ -1,335 +0,0 @@
-create or replace package body ut_metadata as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- type t_cache is table of all_source.text%type;
- g_source_cache t_cache;
- g_cached_object varchar2(500);
- ------------------------------
- --public definitions
- function form_name(a_owner_name varchar2, a_object varchar2, a_subprogram varchar2 default null) return varchar2 is
- l_name varchar2(200);
- begin
- l_name := trim(a_object);
- if trim(a_owner_name) is not null then
- l_name := trim(a_owner_name) || '.' || l_name;
- end if;
- if trim(a_subprogram) is not null then
- l_name := l_name || '.' || trim(a_subprogram);
- end if;
- return l_name;
- end form_name;
-
- function package_valid(a_owner_name varchar2, a_package_name in varchar2) return boolean as
- l_cnt number;
- l_view_name varchar2(200) := get_objects_view_name;
- begin
-
- execute immediate q'[select /*+ no_parallel */ count(*)
- from ]'||l_view_name||q'[
- where owner = :a_owner_name
- and object_name = :a_package_name
- and object_type = 'PACKAGE'
- and status = 'VALID']'
- into l_cnt using upper(a_owner_name), upper(a_package_name);
- return l_cnt = 1;
- exception
- when others then
- return false;
- end;
-
- function procedure_exists(a_owner_name varchar2, a_package_name in varchar2, a_procedure_name in varchar2)
- return boolean as
- l_cnt number;
- l_view_name varchar2(200) := get_dba_view('dba_procedures');
- begin
- execute immediate
- 'select /*+ no_parallel */ count(*) from '||l_view_name
- ||' where owner = :l_schema and object_name = :l_package_name and procedure_name = :l_procedure_name and rownum = 1'
- into l_cnt using a_owner_name, a_package_name, a_procedure_name;
-
- --expect one method only for the package with that name.
- return l_cnt = 1;
- exception
- when others then
- return false;
- end;
-
- function get_source_definition_line(a_owner varchar2, a_object_name varchar2, a_line_no integer) return varchar2 is
- l_view_name varchar2(128) := get_source_view_name();
- l_line all_source.text%type;
- c_key constant varchar2(500) := a_owner || '.' || a_object_name;
- begin
- if not nvl(c_key = g_cached_object, false) then
- g_cached_object := c_key;
- execute immediate
- 'select /*+ no_parallel */ trim(text) text
- from '||l_view_name||q'[ s
- where s.owner = :a_owner
- and s.name = :a_object_name
- /*skip the declarations, consider only definitions*/
- and s.type not in ('PACKAGE', 'TYPE')
- order by line]'
- bulk collect into g_source_cache
- using a_owner, a_object_name;
- end if;
-
- if g_source_cache.exists(a_line_no) then
- l_line := g_source_cache(a_line_no);
- end if;
- return l_line;
- end;
-
- procedure reset_source_definition_cache is
- begin
- g_source_cache := null;
- g_cached_object := null;
- end;
-
- function get_dba_view(a_dba_view_name varchar2) return varchar2 is
- l_result varchar2(128) := lower(a_dba_view_name);
- begin
- if not is_object_visible(a_dba_view_name) then
- l_result := replace(l_result,'dba_','all_');
- end if;
- return l_result;
- end;
-
- function get_source_view_name return varchar2 is
- begin
- return get_dba_view('dba_source');
- end;
-
-
- function get_objects_view_name return varchar2 is
- begin
- return get_dba_view('dba_objects');
- end;
-
- function user_has_execute_any_proc return boolean is
- l_has_execute_any varchar2(1);
- begin
- select /*+ no_parallel */ decode( count( 1 ), 0, 'N', 'Y' )
- into l_has_execute_any
- from dual
- where
- exists(
- select 1
- from
- role_sys_privs
- join session_roles
- using ( role )
- where privilege = 'EXECUTE ANY PROCEDURE'
- ) or
- exists(
- select 1
- from user_sys_privs
- where privilege = 'EXECUTE ANY PROCEDURE'
- );
- return l_has_execute_any = 'Y';
- end;
-
- function is_object_visible(a_object_name varchar2) return boolean is
- l_invalid_object_name exception;
- pragma exception_init(l_invalid_object_name,-44002);
- begin
- return dbms_assert.sql_object_name(a_object_name) is not null;
- exception
- when l_invalid_object_name then
- return false;
- end;
-
- function package_exists_in_cur_schema(a_object_name varchar2) return boolean is
- l_cnt number;
- c_current_schema constant all_tables.owner%type := sys_context('USERENV','CURRENT_SCHEMA');
- begin
- select /*+ no_parallel */ count(*)
- into l_cnt
- from all_objects t
- where t.object_name = a_object_name
- and t.object_type = 'PACKAGE'
- and t.owner = c_current_schema;
- return l_cnt > 0;
- end;
-
- function is_collection (a_anytype_code in integer) return boolean is
- begin
- return coalesce(a_anytype_code in (dbms_types.typecode_varray,dbms_types.typecode_table,dbms_types.typecode_namedcollection),false);
- end;
-
- function is_collection (a_owner varchar2, a_type_name varchar2) return boolean is
- begin
- return is_collection(
- get_anytype_members_info(
- get_user_defined_type(a_owner, a_type_name)
- ).type_code
- );
- end;
-
- function get_attr_elem_info( a_anytype anytype, a_pos pls_integer := null )
- return t_anytype_elem_info_rec is
- l_result t_anytype_elem_info_rec;
- begin
- if a_anytype is not null then
- l_result.type_code := a_anytype.getattreleminfo(
- pos => a_pos,
- prec => l_result.precision,
- scale => l_result.scale,
- len => l_result.length,
- csid => l_result.char_set_id,
- csfrm => l_result.char_set_frm,
- attr_elt_type => l_result.attr_elt_type,
- aname => l_result.attribute_name
- );
- end if;
- return l_result;
- end;
-
- function get_anytype_members_info( a_anytype anytype )
- return t_anytype_members_rec is
- l_result t_anytype_members_rec;
- begin
- if a_anytype is not null then
- l_result.type_code := a_anytype.getinfo(
- prec => l_result.precision,
- scale => l_result.scale,
- len => l_result.length,
- csid => l_result.char_set_id,
- csfrm => l_result.char_set_frm,
- schema_name => l_result.schema_name,
- type_name => l_result.type_name,
- version => l_result.version,
- numelems => l_result.elements_count
- );
- end if;
- return l_result;
- end;
-
- function get_user_defined_type(a_owner varchar2, a_type_name varchar2) return anytype is
- l_anytype anytype;
- not_found exception;
- pragma exception_init(not_found,-22303);
- begin
- if a_type_name is not null then
- begin
- if ut_metadata.is_object_visible('GETANYTYPEFROMPERSISTENT') then
- execute immediate 'begin :l_anytype := getanytypefrompersistent( :a_owner, :a_type_name ); end;'
- using out l_anytype, in nvl(a_owner,sys_context('userenv','current_schema')), in a_type_name;
- else
- execute immediate 'begin :l_anytype := anytype.getpersistent( :a_owner, :a_type_name ); end;'
- using out l_anytype, in nvl(a_owner,sys_context('userenv','current_schema')), in a_type_name;
- end if;
- exception
- when not_found then
- null;
- end;
- end if;
- return l_anytype;
- end;
-
- function get_collection_element(a_anydata in anydata) return varchar2
- is
- l_anytype anytype;
- l_nested_type t_anytype_members_rec;
- l_elements_rec t_anytype_elem_info_rec;
- l_type_code integer;
- begin
- l_type_code := a_anydata.gettype(l_anytype);
- if is_collection(l_type_code) then
- l_elements_rec := get_attr_elem_info(l_anytype);
- if l_elements_rec.attr_elt_type is null then
- l_nested_type := get_anytype_members_info(l_anytype);
- else
- l_nested_type := get_anytype_members_info(l_elements_rec.attr_elt_type);
- end if;
- end if;
- return l_nested_type.schema_name || '.' ||l_nested_type.type_name;
- end;
-
- function has_collection_members (a_anydata in anydata) return boolean is
- l_anytype anytype;
- l_elements_rec t_anytype_elem_info_rec;
- l_type_code integer;
- begin
- l_type_code := a_anydata.gettype(l_anytype);
- l_elements_rec := get_attr_elem_info(l_anytype);
- return l_elements_rec.attr_elt_type is not null;
- end;
-
- function get_anydata_typename(a_data_value anydata) return varchar2
- is
- begin
- return case when a_data_value is not null then lower(a_data_value.gettypename()) else 'undefined' end;
- end;
-
- function is_anytype_null(a_value in anydata, a_compound_type in varchar2) return number is
- l_result integer := 0;
- l_anydata_sql varchar2(4000);
- l_compound_type varchar2(250);
- begin
- if a_value is not null then
- l_compound_type := sys.dbms_assert.qualified_sql_name(a_compound_type);
- l_anydata_sql := '
- declare
- l_data '||get_anydata_typename(a_value)||';
- l_value anydata := :a_value;
- l_status integer;
- begin
- l_status := l_value.get'||l_compound_type||'(l_data);
- :l_data_is_null := case when l_data is null then 1 else 0 end;
- end;';
- execute immediate l_anydata_sql using in a_value, out l_result;
- else
- l_result := 1;
- end if;
- return l_result;
- end;
-
- function get_object_name(a_full_object_name in varchar2) return varchar2 is
- l_result varchar2(250);
- begin
- l_result := regexp_substr(
- a_full_object_name,
- '^([[:alnum:]$#_]+|".*?")\.([[:alnum:]$#_]+|".*?")', subexpression => 2
- );
- if not l_result like '"%"' then
- l_result := upper(l_result);
- end if;
- return ut_utils.qualified_sql_name(l_result);
- end;
-
- function get_anydata_compound_type(a_data_value anydata) return varchar2 is
- l_result varchar2(30);
- l_type anytype;
- l_type_code integer;
- begin
- if a_data_value is not null then
- l_type_code := a_data_value.gettype(l_type);
- if l_type_code in (dbms_types.typecode_table, dbms_types.typecode_varray, dbms_types.typecode_namedcollection,
- dbms_types.typecode_object) then
- if l_type_code = dbms_types.typecode_object then
- l_result := 'object';
- else
- l_result := 'collection';
- end if;
- end if;
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/core/ut_metadata.pks b/source/core/ut_metadata.pks
deleted file mode 100644
index 27bfa5d30..000000000
--- a/source/core/ut_metadata.pks
+++ /dev/null
@@ -1,169 +0,0 @@
-create or replace package ut_metadata authid current_user as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Common package for all code that reads from the system tables.
- */
-
- type t_anytype_members_rec is record (
- type_code pls_integer,
- schema_name varchar2(128),
- type_name varchar2(128),
- length pls_integer,
- elements_count pls_integer,
- version varchar2(32767),
- precision pls_integer,
- scale pls_integer,
- char_set_id pls_integer,
- char_set_frm pls_integer
- );
-
- type t_anytype_elem_info_rec is record (
- type_code pls_integer,
- attribute_name varchar2(260),
- length pls_integer,
- version varchar2(32767),
- precision pls_integer,
- scale pls_integer,
- char_set_id pls_integer,
- char_set_frm pls_integer,
- attr_elt_type anytype
- );
-
- /**
- * Forms correct object/subprogram name to call as owner.object[.subprogram]
- *
- */
- function form_name(a_owner_name varchar2, a_object varchar2, a_subprogram varchar2 default null) return varchar2;
-
- /**
- * Check if package exists and is in a VALID state
- *
- */
- function package_valid(a_owner_name varchar2, a_package_name in varchar2) return boolean;
-
- /**
- * Check if package exists and is VALID and contains the given procedure.
- *
- */
- function procedure_exists(a_owner_name varchar2, a_package_name in varchar2, a_procedure_name in varchar2)
- return boolean;
-
- /**
- * Return the text of the source line for a given object (body). It excludes package spec and type spec
- */
- function get_source_definition_line(a_owner varchar2, a_object_name varchar2, a_line_no integer) return varchar2;
-
-
- /**
- * Invalidates package-level cache for source.
- * Caching is used to improve performance of function get_source_definition_line
- */
- procedure reset_source_definition_cache;
-
- /**
- * Returns dba_... view name if it is accessible, otherwise it returns all_... view
- * @param a_dba_view_name the name of dba view requested
- */
- function get_dba_view(a_dba_view_name varchar2) return varchar2;
-
- /**
- * Returns dba_source if accessible otherwise returns all_source
- */
- function get_source_view_name return varchar2;
-
- /**
- * Returns dba_objects if accessible otherwise returns all_objects
- */
- function get_objects_view_name return varchar2;
-
- /**
- * Returns true if object is accessible to current user
- * @param a_object_name fully qualified object name (with schema name)
- */
- function is_object_visible(a_object_name varchar2) return boolean;
-
- /**
- * Returns true if current user has execute any procedure privilege
- * The check is performed by checking if user can execute ut_utils package
- */
- function user_has_execute_any_proc return boolean;
-
- /**
- * Returns true if given object is a package and it exists in current schema
- * @param a_object_name the name of the object to be checked
- */
- function package_exists_in_cur_schema(a_object_name varchar2) return boolean;
-
- /**
- * Returns true if given typecode is a collection typecode
- */
- function is_collection(a_anytype_code in integer) return boolean;
-
- /**
- * Returns true if given object is a collection
- */
- function is_collection(a_owner varchar2, a_type_name varchar2) return boolean;
-
- /**
- * Returns a descriptor of anytype
- */
- function get_anytype_members_info( a_anytype anytype ) return t_anytype_members_rec;
-
- /**
- * Returns a descriptor of anytype attribute
- */
- function get_attr_elem_info( a_anytype anytype, a_pos pls_integer := null ) return t_anytype_elem_info_rec;
-
- /**
- * Returns ANYTYPE descriptor of an object type
- */
- function get_user_defined_type(a_owner varchar2, a_type_name varchar2) return anytype;
-
- /**
- * Return fully qualified name of the object from collection, if not collection returns null
- */
- function get_collection_element(a_anydata in anydata) return varchar2;
-
- /**
- * Check if collection got elements
- */
- function has_collection_members (a_anydata in anydata) return boolean;
-
- /**
- * Get typename from anydata
- */
- function get_anydata_typename(a_data_value anydata) return varchar2;
-
- /**
- * Is anydata object/collection is null
- */
- function is_anytype_null(a_value in anydata, a_compound_type in varchar2) return number;
-
- /**
- * Get object name from fully qualified name e.g ut3.test -> test
- */
- function get_object_name(a_full_object_name in varchar2) return varchar2;
-
- /**
- * Based on anydata decide if its a object or collection
- */
- function get_anydata_compound_type(a_data_value anydata) return varchar2;
-
-end ut_metadata;
-/
diff --git a/source/core/ut_savepoint_seq.sql b/source/core/ut_savepoint_seq.sql
deleted file mode 100644
index 5b0cda35e..000000000
--- a/source/core/ut_savepoint_seq.sql
+++ /dev/null
@@ -1,15 +0,0 @@
-create sequence ut_savepoint_seq
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- start with 1 cache 20 minvalue 1 maxvalue 99999999999999999 cycle;
\ No newline at end of file
diff --git a/source/core/ut_suite_builder.pkb b/source/core/ut_suite_builder.pkb
deleted file mode 100644
index ebb113370..000000000
--- a/source/core/ut_suite_builder.pkb
+++ /dev/null
@@ -1,894 +0,0 @@
-create or replace package body ut_suite_builder is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- subtype t_annotation_text is varchar2(4000);
- subtype t_annotation_name is varchar2(4000);
- subtype t_object_name is varchar2(500);
- subtype t_annotation_position is binary_integer;
-
- gc_suite constant t_annotation_name := 'suite';
- gc_suitepath constant t_annotation_name := 'suitepath';
- gc_tags constant t_annotation_name := 'tags';
- gc_test constant t_annotation_name := ut_utils.gc_test_execute;
- gc_disabled constant t_annotation_name := 'disabled';
- gc_displayname constant t_annotation_name := 'displayname';
- gc_beforeall constant t_annotation_name := ut_utils.gc_before_all;
- gc_beforeeach constant t_annotation_name := ut_utils.gc_before_each;
- gc_beforetest constant t_annotation_name := ut_utils.gc_before_test;
- gc_afterall constant t_annotation_name := ut_utils.gc_after_all;
- gc_aftereach constant t_annotation_name := ut_utils.gc_after_each;
- gc_aftertest constant t_annotation_name := ut_utils.gc_after_test;
- gc_throws constant t_annotation_name := 'throws';
- gc_rollback constant t_annotation_name := 'rollback';
- gc_context constant t_annotation_name := 'context';
- gc_name constant t_annotation_name := 'name';
- gc_endcontext constant t_annotation_name := 'endcontext';
-
- type tt_annotations is table of t_annotation_name;
-
- gc_supported_annotations constant tt_annotations
- := tt_annotations(
- gc_suite,
- gc_suitepath,
- gc_tags,
- gc_test,
- gc_disabled,
- gc_displayname,
- gc_beforeall,
- gc_beforeeach,
- gc_beforetest,
- gc_afterall,
- gc_aftereach,
- gc_aftertest,
- gc_throws,
- gc_rollback,
- gc_context,
- gc_name,
- gc_endcontext
- );
-
- type tt_executables is table of ut_executables index by t_annotation_position;
-
- type t_annotation is record(
- name t_annotation_name,
- text t_annotation_text,
- procedure_name t_object_name
- );
-
- type tt_annotations_by_line is table of t_annotation index by t_annotation_position;
-
- --list of annotation texts for a given annotation indexed by annotation position:
- --This would hold: ('some', 'other') for a single annotation name recurring in a single procedure example
- -- --%beforetest(some)
- -- --%beforetest(other)
- -- --%test(some test with two before test procedures)
- -- procedure some_test ...
- -- when you'd like to have two beforetest procedures executed in a single test
- type tt_annotation_texts is table of t_annotation_text index by t_annotation_position;
-
- type tt_annotations_by_name is table of tt_annotation_texts index by t_annotation_name;
-
- type tt_annotations_by_proc is table of tt_annotations_by_name index by t_object_name;
-
- type t_annotations_info is record (
- owner t_object_name,
- name t_object_name,
- parse_time timestamp,
- by_line tt_annotations_by_line,
- by_proc tt_annotations_by_proc,
- by_name tt_annotations_by_name
- );
-
- procedure delete_annotations_range(
- a_annotations in out nocopy t_annotations_info,
- a_start_pos t_annotation_position,
- a_end_pos t_annotation_position
- ) is
- l_pos t_annotation_position := a_start_pos;
- l_annotation t_annotation;
- begin
- while l_pos is not null and l_pos <= a_end_pos loop
- l_annotation := a_annotations.by_line(l_pos);
- if l_annotation.procedure_name is not null and a_annotations.by_proc.exists(l_annotation.procedure_name) then
- a_annotations.by_proc.delete(l_annotation.procedure_name);
- elsif a_annotations.by_name.exists(l_annotation.name) then
- a_annotations.by_name(l_annotation.name).delete(l_pos);
- if a_annotations.by_name(l_annotation.name).count = 0 then
- a_annotations.by_name.delete(l_annotation.name);
- end if;
- end if;
- l_pos := a_annotations.by_line.next( l_pos );
- end loop;
- a_annotations.by_line.delete(a_start_pos, a_end_pos);
- end;
-
-
- procedure add_items_to_list(a_list in out nocopy ut_suite_items, a_items ut_suite_items) is
- begin
- for i in 1 .. a_items.count loop
- a_list.extend();
- a_list(a_list.last) := a_items(i);
- end loop;
- end;
-
- -----------------------------------------------
- -- Processing annotations
- -----------------------------------------------
-
- procedure add_annotation_ignored_warning(
- a_suite in out nocopy ut_suite_item,
- a_annotation t_annotation_name,
- a_message varchar2,
- a_line_no binary_integer,
- a_procedure_name t_object_name := null
- ) is
- begin
- a_suite.put_warning(
- replace(a_message,'%%%','"--%'||a_annotation||'"')|| ' Annotation ignored.',
- a_procedure_name,
- a_line_no
- );
- end;
-
- function get_rollback_type(a_rollback_type_name varchar2) return ut_utils.t_rollback_type is
- l_rollback_type ut_utils.t_rollback_type;
- begin
- l_rollback_type :=
- case lower(a_rollback_type_name)
- when 'manual' then ut_utils.gc_rollback_manual
- when 'auto' then ut_utils.gc_rollback_auto
- end;
- return l_rollback_type;
- end;
-
- procedure add_to_throws_numbers_list(
- a_suite in out nocopy ut_suite,
- a_list in out nocopy ut_varchar2_rows,
- a_procedure_name t_object_name,
- a_throws_ann_text tt_annotation_texts
- ) is
- l_annotation_pos binary_integer;
-
- begin
- l_annotation_pos := a_throws_ann_text.first;
- while l_annotation_pos is not null loop
- if a_throws_ann_text(l_annotation_pos) is null then
- a_suite.put_warning(
- '"--%throws" annotation requires a parameter. Annotation ignored.',
- a_procedure_name,
- l_annotation_pos
- );
- else
- ut_utils.append_to_list(
- a_list,
- ut_utils.convert_collection( ut_utils.trim_list_elements ( ut_utils.string_to_table( a_throws_ann_text(l_annotation_pos), ',' ) ) )
- );
- end if;
- l_annotation_pos := a_throws_ann_text.next(l_annotation_pos);
- end loop;
- end;
-
- procedure add_tags_to_suite_item(
- a_suite in out nocopy ut_suite,
- a_tags_ann_text tt_annotation_texts,
- a_list in out nocopy ut_varchar2_rows,
- a_procedure_name t_object_name := null
- ) is
- l_annotation_pos binary_integer;
- l_tags_list ut_varchar2_list := ut_varchar2_list();
- l_tag_items ut_varchar2_list;
- begin
- l_annotation_pos := a_tags_ann_text.first;
- while l_annotation_pos is not null loop
- if a_tags_ann_text(l_annotation_pos) is null then
- a_suite.put_warning(
- '"--%tags" annotation requires a tag value populated. Annotation ignored.',
- a_procedure_name,
- l_annotation_pos
- );
- else
- l_tag_items := ut_utils.trim_list_elements(ut_utils.string_to_table(a_tags_ann_text(l_annotation_pos),','));
- if l_tag_items is not empty then
- for i in 1 .. l_tag_items.count loop
- if regexp_like(l_tag_items(i),'^[^-](\S)+$') then
- l_tags_list.extend();
- l_tags_list(l_tags_list.last) := l_tag_items(i);
- else
- a_suite.put_warning(
- 'Invalid value "'||l_tag_items(i)||'" for "--%tags" annotation. See documentation for details on valid tag values. Annotation value ignored.',
- a_procedure_name,
- l_annotation_pos
- );
- end if;
- end loop;
- end if;
- end if;
- l_annotation_pos := a_tags_ann_text.next(l_annotation_pos);
- end loop;
- --remove empty strings from table list e.g. tag1,,tag2 and convert to rows
- a_list := ut_utils.convert_collection( ut_utils.filter_list(set(l_tags_list),ut_utils.gc_word_no_space) );
- end;
-
- procedure set_seq_no(
- a_list in out nocopy ut_executables
- ) is
- begin
- if a_list is not null then
- for i in 1 .. a_list.count loop
- a_list(i).seq_no := i;
- end loop;
- end if;
- end;
-
- function convert_list(
- a_list tt_executables
- ) return ut_executables is
- l_result ut_executables := ut_executables();
- l_pos t_annotation_position := a_list.first;
- begin
- while l_pos is not null loop
- for i in 1 .. a_list(l_pos).count loop
- l_result.extend;
- l_result(l_result.last) := a_list(l_pos)(i);
- end loop;
- l_pos := a_list.next(l_pos);
- end loop;
- return l_result;
- end;
-
- function add_executables(
- a_owner t_object_name,
- a_package_name t_object_name,
- a_annotation_texts tt_annotation_texts,
- a_event_name ut_event_manager.t_event_name
- ) return tt_executables is
- l_executables ut_executables;
- l_result tt_executables;
- l_annotation_pos binary_integer;
- l_procedures_list ut_varchar2_list;
- l_procedures_pos binary_integer;
- l_components_list ut_varchar2_list;
- begin
- l_annotation_pos := a_annotation_texts.first;
- while l_annotation_pos is not null loop
- l_procedures_list :=
- ut_utils.filter_list(
- ut_utils.trim_list_elements(
- ut_utils.string_to_table(a_annotation_texts(l_annotation_pos), ',')
- )
- , '[[:alpha:]]+'
- );
-
- l_procedures_pos := l_procedures_list.first;
- l_executables := ut_executables();
- while l_procedures_pos is not null loop
- l_components_list := ut_utils.string_to_table(l_procedures_list(l_procedures_pos), '.');
-
- l_executables.extend;
- l_executables(l_executables.last) :=
- case(l_components_list.count())
- when 1 then
- ut_executable(a_owner, a_package_name, l_components_list(1), a_event_name)
- when 2 then
- ut_executable(a_owner,l_components_list(1), l_components_list(2), a_event_name)
- when 3 then
- ut_executable(l_components_list(1), l_components_list(2), l_components_list(3), a_event_name)
- else
- null
- end;
- l_procedures_pos := l_procedures_list.next(l_procedures_pos);
- end loop;
- l_result(l_annotation_pos) := l_executables;
- l_annotation_pos := a_annotation_texts.next(l_annotation_pos);
- end loop;
- return l_result;
- end;
-
- procedure warning_on_duplicate_annot(
- a_suite in out nocopy ut_suite_item,
- a_annotations tt_annotations_by_name,
- a_for_annotation varchar2,
- a_procedure_name t_object_name := null
- ) is
- l_line_no binary_integer;
- begin
- if a_annotations.exists(a_for_annotation) and a_annotations(a_for_annotation).count > 1 then
- --start from second occurrence of annotation
- l_line_no := a_annotations(a_for_annotation).next( a_annotations(a_for_annotation).first );
- while l_line_no is not null loop
- add_annotation_ignored_warning( a_suite, a_for_annotation, 'Duplicate annotation %%%.', l_line_no, a_procedure_name );
- l_line_no := a_annotations(a_for_annotation).next( l_line_no );
- end loop;
- end if;
- end;
-
- procedure warning_bad_annot_combination(
- a_suite in out nocopy ut_suite_item,
- a_procedure_name t_object_name,
- a_proc_annotations tt_annotations_by_name,
- a_for_annotation varchar2,
- a_invalid_annotations ut_varchar2_list
- ) is
- l_annotation_name t_annotation_name;
- l_line_no binary_integer;
- begin
- if a_proc_annotations.exists(a_for_annotation) then
- l_annotation_name := a_proc_annotations.first;
- while l_annotation_name is not null loop
- if l_annotation_name member of a_invalid_annotations then
- l_line_no := a_proc_annotations(l_annotation_name).first;
- while l_line_no is not null loop
- add_annotation_ignored_warning(
- a_suite, l_annotation_name, 'Annotation %%% cannot be used with "--%'|| a_for_annotation || '".',
- l_line_no, a_procedure_name
- );
- l_line_no := a_proc_annotations(l_annotation_name).next(l_line_no);
- end loop;
- end if;
- l_annotation_name := a_proc_annotations.next(l_annotation_name);
- end loop;
- end if;
- end;
-
- procedure add_test(
- a_suite in out nocopy ut_suite,
- a_suite_items in out nocopy ut_suite_items,
- a_procedure_name t_object_name,
- a_annotations t_annotations_info
- ) is
- l_test ut_test;
- l_annotation_texts tt_annotation_texts;
- l_proc_annotations tt_annotations_by_name := a_annotations.by_proc(a_procedure_name);
- begin
-
- if not l_proc_annotations.exists(gc_test) then
- return;
- end if;
- warning_on_duplicate_annot( a_suite, l_proc_annotations, gc_test, a_procedure_name);
- warning_on_duplicate_annot( a_suite, l_proc_annotations, gc_displayname, a_procedure_name);
- warning_on_duplicate_annot( a_suite, l_proc_annotations, gc_rollback, a_procedure_name);
- warning_bad_annot_combination(
- a_suite, a_procedure_name, l_proc_annotations, gc_test,
- ut_varchar2_list(gc_beforeeach, gc_aftereach, gc_beforeall, gc_afterall)
- );
-
- l_test := ut_test(a_suite.object_owner, a_suite.object_name, a_procedure_name, l_proc_annotations( gc_test).first);
- l_test.parse_time := a_annotations.parse_time;
-
- if l_proc_annotations.exists( gc_displayname) then
- l_annotation_texts := l_proc_annotations( gc_displayname);
- --take the last definition if more than one was provided
- l_test.description := l_annotation_texts(l_annotation_texts.first);
- --TODO if more than one - warning
- else
- l_test.description := l_proc_annotations(gc_test)(l_proc_annotations(gc_test).first);
- end if;
- l_test.path := a_suite.path ||'.'||a_procedure_name;
-
- if l_proc_annotations.exists(gc_rollback) then
- l_annotation_texts := l_proc_annotations(gc_rollback);
- l_test.rollback_type := get_rollback_type(l_annotation_texts(l_annotation_texts.first));
- if l_test.rollback_type is null then
- add_annotation_ignored_warning(
- a_suite, gc_rollback, 'Annotation %%% must be provided with one of values: "auto" or "manual".',
- l_annotation_texts.first, a_procedure_name
- );
- end if;
- end if;
-
- if l_proc_annotations.exists( gc_beforetest) then
- l_test.before_test_list := convert_list(
- add_executables( l_test.object_owner, l_test.object_name, l_proc_annotations( gc_beforetest ), gc_beforetest )
- );
- set_seq_no(l_test.before_test_list);
- end if;
- if l_proc_annotations.exists( gc_aftertest) then
- l_test.after_test_list := convert_list(
- add_executables( l_test.object_owner, l_test.object_name, l_proc_annotations( gc_aftertest ), gc_aftertest )
- );
- set_seq_no(l_test.after_test_list);
- end if;
-
- if l_proc_annotations.exists( gc_tags) then
- add_tags_to_suite_item(a_suite, l_proc_annotations( gc_tags), l_test.tags, a_procedure_name);
- end if;
-
- if l_proc_annotations.exists( gc_throws) then
- add_to_throws_numbers_list(a_suite, l_test.expected_error_codes, a_procedure_name, l_proc_annotations( gc_throws));
- end if;
- l_test.disabled_flag := ut_utils.boolean_to_int( l_proc_annotations.exists( gc_disabled));
-
- if l_proc_annotations.exists(gc_disabled) then
- l_annotation_texts := l_proc_annotations( gc_disabled);
- --take the last definition if more than one was provided
- l_test.disabled_reason := l_annotation_texts(l_annotation_texts.first);
- end if;
-
- a_suite_items.extend;
- a_suite_items( a_suite_items.last ) := l_test;
-
- end;
-
- procedure propagate_before_after_each(
- a_suite_items in out nocopy ut_suite_items,
- a_before_each_list tt_executables,
- a_after_each_list tt_executables
- ) is
- l_test ut_test;
- l_context ut_logical_suite;
- begin
- if a_suite_items is not null then
- for i in 1 .. a_suite_items.count loop
- if a_suite_items(i) is of (ut_test) then
- l_test := treat( a_suite_items(i) as ut_test);
- l_test.before_each_list := convert_list(a_before_each_list) multiset union all l_test.before_each_list;
- set_seq_no(l_test.before_each_list);
- l_test.after_each_list := l_test.after_each_list multiset union all convert_list(a_after_each_list);
- set_seq_no(l_test.after_each_list);
- a_suite_items(i) := l_test;
- elsif a_suite_items(i) is of (ut_logical_suite) then
- l_context := treat(a_suite_items(i) as ut_logical_suite);
- propagate_before_after_each( l_context.items, a_before_each_list, a_after_each_list);
- a_suite_items(i) := l_context;
- end if;
- end loop;
- end if;
- end;
-
- procedure process_before_after_annot(
- a_list in out nocopy tt_executables,
- a_annotation_name t_annotation_name,
- a_procedure_name t_object_name,
- a_proc_annotations tt_annotations_by_name,
- a_suite in out nocopy ut_suite
- ) is
- begin
- if a_proc_annotations.exists(a_annotation_name) and not a_proc_annotations.exists(gc_test) then
- a_list( a_proc_annotations(a_annotation_name).first ) := ut_executables(ut_executable(a_suite.object_owner, a_suite.object_name, a_procedure_name, a_annotation_name));
- warning_on_duplicate_annot(a_suite, a_proc_annotations, a_annotation_name, a_procedure_name);
- --TODO add warning if annotation has text - text ignored
- end if;
- end;
-
- procedure get_annotated_procedures(
- a_proc_annotations t_annotations_info,
- a_suite in out nocopy ut_suite,
- a_suite_items in out nocopy ut_suite_items,
- a_before_each_list in out nocopy tt_executables,
- a_after_each_list in out nocopy tt_executables,
- a_before_all_list in out nocopy tt_executables,
- a_after_all_list in out nocopy tt_executables
- ) is
- l_procedure_name t_object_name;
- begin
- l_procedure_name := a_proc_annotations.by_proc.first;
- while l_procedure_name is not null loop
- add_test( a_suite, a_suite_items, l_procedure_name, a_proc_annotations );
- process_before_after_annot(a_before_each_list, gc_beforeeach, l_procedure_name, a_proc_annotations.by_proc(l_procedure_name), a_suite);
- process_before_after_annot(a_after_each_list, gc_aftereach, l_procedure_name, a_proc_annotations.by_proc(l_procedure_name), a_suite);
- process_before_after_annot(a_before_all_list, gc_beforeall, l_procedure_name, a_proc_annotations.by_proc(l_procedure_name), a_suite);
- process_before_after_annot(a_after_all_list, gc_afterall, l_procedure_name, a_proc_annotations.by_proc(l_procedure_name), a_suite);
- l_procedure_name := a_proc_annotations.by_proc.next( l_procedure_name );
- end loop;
- end;
-
- procedure build_suitepath(
- a_suite in out nocopy ut_suite,
- a_annotations t_annotations_info
- ) is
- l_annotation_text t_annotation_text;
- begin
- if a_annotations.by_name.exists(gc_suitepath) then
- l_annotation_text := trim(a_annotations.by_name(gc_suitepath)(a_annotations.by_name(gc_suitepath).first));
- if l_annotation_text is not null then
- if regexp_like(l_annotation_text,'^((\w|[$#])+\.)*(\w|[$#])+$') then
- a_suite.path := l_annotation_text||'.'||a_suite.object_name;
- else
- add_annotation_ignored_warning(
- a_suite, gc_suitepath||'('||l_annotation_text||')',
- 'Invalid path value in annotation %%%.', a_annotations.by_name(gc_suitepath).first
- );
- end if;
- else
- add_annotation_ignored_warning(
- a_suite, gc_suitepath, '%%% annotation requires a non-empty parameter value.',
- a_annotations.by_name(gc_suitepath).first
- );
- end if;
- warning_on_duplicate_annot(a_suite, a_annotations.by_name, gc_suitepath);
- end if;
- a_suite.path := lower(coalesce(a_suite.path, a_suite.object_name));
- end;
-
- procedure add_tests_to_items(
- a_suite in out nocopy ut_suite,
- a_annotations t_annotations_info,
- a_suite_items in out nocopy ut_suite_items
- ) is
- l_before_each_list tt_executables;
- l_after_each_list tt_executables;
- l_before_all_list tt_executables;
- l_after_all_list tt_executables;
- l_rollback_type ut_utils.t_rollback_type;
- l_annotation_text t_annotation_text;
- begin
- if a_annotations.by_name.exists(gc_displayname) then
- l_annotation_text := trim(a_annotations.by_name(gc_displayname)(a_annotations.by_name(gc_displayname).first));
- if l_annotation_text is not null then
- a_suite.description := l_annotation_text;
- else
- add_annotation_ignored_warning(
- a_suite, gc_displayname, '%%% annotation requires a non-empty parameter value.',
- a_annotations.by_name(gc_displayname).first
- );
- end if;
- warning_on_duplicate_annot(a_suite, a_annotations.by_name, gc_displayname);
- end if;
-
- if a_annotations.by_name.exists(gc_rollback) then
- l_rollback_type := get_rollback_type(a_annotations.by_name(gc_rollback)(a_annotations.by_name(gc_rollback).first));
- if l_rollback_type is null then
- add_annotation_ignored_warning(
- a_suite, gc_rollback, '%%% annotation requires one of values as parameter: "auto" or "manual".',
- a_annotations.by_name(gc_rollback).first
- );
- end if;
- warning_on_duplicate_annot(a_suite, a_annotations.by_name, gc_rollback);
- end if;
- if a_annotations.by_name.exists(gc_beforeall) then
- l_before_all_list := add_executables( a_suite.object_owner, a_suite.object_name, a_annotations.by_name(gc_beforeall), gc_beforeall );
- end if;
- if a_annotations.by_name.exists(gc_afterall) then
- l_after_all_list := add_executables( a_suite.object_owner, a_suite.object_name, a_annotations.by_name(gc_afterall), gc_afterall );
- end if;
-
- if a_annotations.by_name.exists(gc_beforeeach) then
- l_before_each_list := add_executables( a_suite.object_owner, a_suite.object_name, a_annotations.by_name(gc_beforeeach), gc_beforeeach );
- end if;
- if a_annotations.by_name.exists(gc_aftereach) then
- l_after_each_list := add_executables( a_suite.object_owner, a_suite.object_name, a_annotations.by_name(gc_aftereach), gc_aftereach );
- end if;
-
- if a_annotations.by_name.exists(gc_tags) then
- add_tags_to_suite_item(a_suite, a_annotations.by_name(gc_tags),a_suite.tags);
- end if;
-
- a_suite.disabled_flag := ut_utils.boolean_to_int(a_annotations.by_name.exists(gc_disabled));
- if a_annotations.by_name.exists(gc_disabled) then
- a_suite.disabled_reason := a_annotations.by_name(gc_disabled)(a_annotations.by_name(gc_disabled).first);
- end if;
-
- --process procedure annotations for suite
- get_annotated_procedures(a_annotations, a_suite, a_suite_items, l_before_each_list, l_after_each_list, l_before_all_list, l_after_all_list);
-
- a_suite.set_rollback_type(l_rollback_type);
- propagate_before_after_each( a_suite_items, l_before_each_list, l_after_each_list);
- a_suite.before_all_list := convert_list(l_before_all_list);
- set_seq_no(a_suite.before_all_list);
- a_suite.after_all_list := convert_list(l_after_all_list);
- set_seq_no(a_suite.after_all_list);
- end;
-
- function get_next_annotation_of_type(
- a_start_position t_annotation_position,
- a_annotation_type varchar2,
- a_package_annotations in tt_annotations_by_name
- ) return t_annotation_position is
- l_result t_annotation_position;
- begin
- if a_package_annotations.exists(a_annotation_type) then
- l_result := a_package_annotations(a_annotation_type).first;
- while l_result <= a_start_position loop
- l_result := a_package_annotations(a_annotation_type).next(l_result);
- end loop;
- end if;
- return l_result;
- end;
-
- function get_endcontext_position(
- a_context_ann_pos t_annotation_position,
- a_package_annotations in tt_annotations_by_line
- ) return t_annotation_position is
- l_result t_annotation_position;
- l_open_count integer := 1;
- l_idx t_annotation_position := a_package_annotations.next(a_context_ann_pos);
- begin
- while l_open_count > 0 and l_idx is not null loop
- if ( a_package_annotations(l_idx).name = gc_context ) then
- l_open_count := l_open_count+1;
- elsif ( a_package_annotations(l_idx).name = gc_endcontext ) then
- l_open_count := l_open_count-1;
- l_result := l_idx;
- end if;
- l_idx := a_package_annotations.next(l_idx);
- end loop;
- if ( l_open_count > 0 ) then
- l_result := null;
- end if;
- return l_result;
- end;
-
- function has_nested_context(
- a_context_ann_pos t_annotation_position,
- a_package_annotations in tt_annotations_by_name
- ) return boolean is
- l_next_endcontext_pos t_annotation_position := 0;
- l_next_context_pos t_annotation_position := 0;
- begin
- if ( a_package_annotations.exists(gc_endcontext) and a_package_annotations.exists(gc_context)) then
- l_next_endcontext_pos := get_next_annotation_of_type(a_context_ann_pos, gc_endcontext, a_package_annotations);
- l_next_context_pos := a_package_annotations(gc_context).next(a_context_ann_pos);
- end if;
- return ( l_next_context_pos < l_next_endcontext_pos );
- end;
-
- function get_annotations_in_context(
- a_annotations t_annotations_info,
- a_context_pos t_annotation_position,
- a_end_context_pos t_annotation_position
- ) return t_annotations_info is
- l_result t_annotations_info;
- l_position t_annotation_position;
- l_procedure_name t_object_name;
- l_annotation_name t_annotation_name;
- l_annotation_text t_annotation_text;
- begin
- l_position := a_context_pos;
- l_result.owner := a_annotations.owner;
- l_result.name := a_annotations.name;
- l_result.parse_time := a_annotations.parse_time;
- while l_position is not null and l_position <= a_end_context_pos loop
- l_result.by_line(l_position) := a_annotations.by_line(l_position);
- l_procedure_name := l_result.by_line(l_position).procedure_name;
- l_annotation_name := l_result.by_line(l_position).name;
- l_annotation_text := l_result.by_line(l_position).text;
- if l_procedure_name is not null then
- l_result.by_proc(l_procedure_name)(l_annotation_name)(l_position) := l_annotation_text;
- else
- l_result.by_name(l_annotation_name)(l_position) := l_annotation_text;
- end if;
- l_position := a_annotations.by_line.next(l_position);
- end loop;
- return l_result;
- end;
-
- procedure get_context_items(
- a_parent in out nocopy ut_suite,
- a_annotations in out nocopy t_annotations_info,
- a_suite_items out nocopy ut_suite_items,
- a_parent_context_pos in integer := 0,
- a_parent_end_context_pos in integer default null
- ) is
- l_context_pos t_annotation_position;
- l_next_context_pos t_annotation_position;
- l_end_context_pos t_annotation_position;
- l_ctx_annotations t_annotations_info;
- l_context ut_suite_context;
- l_context_no binary_integer := 1;
- l_context_items ut_suite_items;
- type tt_context_names is table of boolean index by t_object_name;
- l_used_context_names tt_context_names;
- l_context_name t_object_name;
- l_default_context_name t_object_name;
- function get_context_name(
- a_parent in out nocopy ut_suite,
- a_start_position binary_integer
- ) return varchar2 is
- l_result t_annotation_name;
- l_found boolean;
- l_end_position binary_integer;
- l_annotation_pos binary_integer;
- l_context_names tt_annotation_texts;
- begin
- if a_annotations.by_name.exists(gc_name) then
- l_context_names := a_annotations.by_name( gc_name );
- -- Maximum end-position to look for %name annotation is either the next %context or the next %endcontext annotation
- l_end_position :=
- least(
- coalesce( get_next_annotation_of_type(a_start_position, gc_endcontext, a_annotations.by_name), a_annotations.by_line.last ),
- coalesce( get_next_annotation_of_type(a_start_position, gc_context, a_annotations.by_name), a_annotations.by_line.last )
- );
- l_annotation_pos := l_context_names.first;
-
- while l_annotation_pos is not null loop
- if l_annotation_pos > a_start_position and l_annotation_pos < l_end_position then
- if l_found then
- add_annotation_ignored_warning(a_parent, gc_name,'Duplicate annotation %%%.', l_annotation_pos);
- else
- l_result := l_context_names(l_annotation_pos);
- end if;
- l_found := true;
- end if;
- l_annotation_pos := l_context_names.next(l_annotation_pos);
- end loop;
- end if;
- return l_result;
- end;
- begin
- a_suite_items := ut_suite_items();
- if not a_annotations.by_name.exists(gc_context) then
- return;
- end if;
-
- l_context_pos := a_annotations.by_name( gc_context).next(a_parent_context_pos);
-
- while l_context_pos is not null loop
- l_default_context_name := 'nested_context_#'||l_context_no;
- l_context_name := null;
- l_end_context_pos := get_endcontext_position(l_context_pos, a_annotations.by_line );
- l_next_context_pos := a_annotations.by_name(gc_context).next(l_context_pos);
- l_context_name := get_context_name(a_parent, l_context_pos);
- if not regexp_like( l_context_name, '^(\w|[$#])+$' ) or l_context_name is null then
- if not regexp_like( l_context_name, '^(\w|[$#])+$' ) then
- a_parent.put_warning(
- 'Invalid value "'||l_context_name||'" for context name.' ||
- ' Context name ignored and fallback to auto-name "'||l_default_context_name||'" ',
- null,
- l_context_pos
- );
- end if;
- l_context_name := l_default_context_name;
- end if;
- if l_used_context_names.exists(l_context_name) then
- add_annotation_ignored_warning(
- a_parent, gc_name,
- 'Context name "'||l_context_name||'" already used in this scope. Name must be unique.' ||
- ' Using fallback name '||l_default_context_name||'.', l_context_pos );
- l_context_name := l_default_context_name;
- end if;
- l_used_context_names(l_context_name) := true;
-
- l_context := ut_suite_context(a_parent.object_owner, a_parent.object_name, l_context_name, l_context_pos );
- l_context.path := a_parent.path||'.'||l_context_name;
- l_context.description := coalesce( a_annotations.by_line( l_context_pos ).text, l_context_name );
- l_context.parse_time := a_annotations.parse_time;
-
- --if nested context found
- if has_nested_context(l_context_pos, a_annotations.by_name) then
- get_context_items( l_context, a_annotations, l_context_items, l_context_pos, l_end_context_pos );
- else
- l_context_items := ut_suite_items();
- end if;
-
- if l_end_context_pos is null then
- a_parent.put_warning(
- 'Missing "--%endcontext" annotation for a "--%context" annotation. The end of package is considered end of context.',
- null,
- l_context_pos
- );
- l_end_context_pos := a_annotations.by_line.last;
- end if;
-
- --create a sub-set of annotations to process as sub-suite (context)
- l_ctx_annotations := get_annotations_in_context( a_annotations, l_context_pos, l_end_context_pos);
-
- warning_on_duplicate_annot( l_context, l_ctx_annotations.by_name, gc_context );
-
- add_tests_to_items( l_context, l_ctx_annotations, l_context_items );
- add_items_to_list(a_suite_items, l_context_items);
- a_suite_items.extend;
- a_suite_items(a_suite_items.last) := l_context;
- -- remove annotations within context after processing them
- delete_annotations_range(a_annotations, l_context_pos, l_end_context_pos);
-
- exit when not a_annotations.by_name.exists( gc_context);
-
- l_context_pos := a_annotations.by_name( gc_context).next( l_context_pos);
- -- don't go on when the next context is outside the parent's context boundaries
- if (a_parent_end_context_pos <= l_context_pos ) then
- l_context_pos := null;
- end if;
- l_context_no := l_context_no + 1;
- end loop;
- end;
-
- procedure warning_on_extra_endcontext(
- a_suite in out nocopy ut_suite,
- a_package_ann_index tt_annotations_by_name
- ) is
- l_annotation_pos t_annotation_position;
- begin
- if a_package_ann_index.exists(gc_endcontext) then
- l_annotation_pos := a_package_ann_index(gc_endcontext).first;
- while l_annotation_pos is not null loop
- add_annotation_ignored_warning(
- a_suite, gc_endcontext, 'Extra %%% annotation found. Cannot find corresponding "--%context".',
- l_annotation_pos
- );
- l_annotation_pos := a_package_ann_index(gc_endcontext).next(l_annotation_pos);
- end loop;
- end if;
- end;
-
- procedure warning_on_unknown_annotations(
- a_suite in out nocopy ut_suite_item,
- a_annotations tt_annotations_by_line
- ) is
- l_line_no t_annotation_position := a_annotations.first;
- begin
- while l_line_no is not null loop
- if a_annotations(l_line_no).name not member of (gc_supported_annotations) then
- add_annotation_ignored_warning(
- a_suite,
- a_annotations(l_line_no).name,
- 'Unsupported annotation %%%.',
- l_line_no,
- a_annotations(l_line_no).procedure_name
- );
- end if;
- l_line_no := a_annotations.next(l_line_no);
- end loop;
- end;
-
- function convert_package_annotations(a_object ut_annotated_object) return t_annotations_info is
- l_result t_annotations_info;
- l_annotation t_annotation;
- l_annotation_no binary_integer;
- l_annotation_pos binary_integer;
- begin
- l_result.owner := a_object.object_owner;
- l_result.name := lower(trim(a_object.object_name));
- l_result.parse_time := a_object.parse_time;
- l_annotation_no := a_object.annotations.first;
- while l_annotation_no is not null loop
- l_annotation_pos := a_object.annotations(l_annotation_no).position;
- l_annotation.name := a_object.annotations(l_annotation_no).name;
- l_annotation.text := a_object.annotations(l_annotation_no).text;
- l_annotation.procedure_name := lower(trim(a_object.annotations(l_annotation_no).subobject_name));
- l_result.by_line( l_annotation_pos) := l_annotation;
- if l_annotation.procedure_name is null then
- l_result.by_name( l_annotation.name)( l_annotation_pos) := l_annotation.text;
- else
- l_result.by_proc(l_annotation.procedure_name)(l_annotation.name)(l_annotation_pos) := l_annotation.text;
- end if;
- l_annotation_no := a_object.annotations.next(l_annotation_no);
- end loop;
- return l_result;
- end;
-
- procedure create_suite_item_list( a_annotated_object ut_annotated_object, a_suite_items out nocopy ut_suite_items ) is
- l_annotations t_annotations_info;
- l_annotation_pos t_annotation_position;
- l_suite ut_suite;
- begin
- l_annotations := convert_package_annotations( a_annotated_object );
-
- if l_annotations.by_name.exists(gc_suite) then
- l_annotation_pos := l_annotations.by_name(gc_suite).first;
- l_suite := ut_suite(l_annotations.owner, l_annotations.name, l_annotation_pos);
- l_suite.description := l_annotations.by_name( gc_suite)( l_annotation_pos);
- l_suite.parse_time := l_annotations.parse_time;
- warning_on_unknown_annotations(l_suite, l_annotations.by_line);
-
- warning_on_duplicate_annot( l_suite, l_annotations.by_name, gc_suite );
-
- build_suitepath( l_suite, l_annotations );
- get_context_items( l_suite, l_annotations, a_suite_items );
- --create suite tests and add
- add_tests_to_items( l_suite, l_annotations, a_suite_items );
-
- --by this time all contexts were consumed and l_annotations should not have any context/endcontext annotation in it.
- warning_on_extra_endcontext( l_suite, l_annotations.by_name );
-
- a_suite_items.extend;
- a_suite_items( a_suite_items.last) := l_suite;
- end if;
- end;
-
-end ut_suite_builder;
-/
diff --git a/source/core/ut_suite_builder.pks b/source/core/ut_suite_builder.pks
deleted file mode 100644
index 352601a6d..000000000
--- a/source/core/ut_suite_builder.pks
+++ /dev/null
@@ -1,32 +0,0 @@
-create or replace package ut_suite_builder authid current_user is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Responsible for converting annotations into unit test suites
- */
-
- /**
- * Creates a list of suite items for an annotated object
- */
- procedure create_suite_item_list(
- a_annotated_object ut_annotated_object,
- a_suite_items out nocopy ut_suite_items
- );
-
-end ut_suite_builder;
-/
diff --git a/source/core/ut_suite_cache.sql b/source/core/ut_suite_cache.sql
deleted file mode 100644
index 182caabd0..000000000
--- a/source/core/ut_suite_cache.sql
+++ /dev/null
@@ -1,38 +0,0 @@
-create table ut_suite_cache
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- of ut_suite_cache_row
- nested table warnings store as ut_suite_cache_warnings
- nested table before_all_list store as ut_suite_cache_before_all
- nested table after_all_list store as ut_suite_cache_after_all
- nested table before_each_list store as ut_suite_cache_before_each
- nested table after_each_list store as ut_suite_cache_after_each
- nested table before_test_list store as ut_suite_cache_before_test
- nested table after_test_list store as ut_suite_cache_after_test
- nested table expected_error_codes store as ut_suite_cache_throws
- nested table tags store as ut_suite_cache_tags return as locator
-/
-
-alter table ut_suite_cache modify (object_owner not null, path not null, self_type not null, object_name not null, name not null, parse_time not null)
-/
-alter table ut_suite_cache add constraint ut_suite_cache_pk primary key (id)
-/
-alter table ut_suite_cache add constraint ut_suite_cache_uk1 unique (object_owner, path)
-/
-alter table ut_suite_cache add constraint ut_suite_cache_uk2 unique (object_owner, object_name, line_no)
-/
-
-alter table ut_suite_cache add constraint ut_suite_cache_schema_fk foreign key (object_owner, object_name)
-references ut_suite_cache_package(object_owner, object_name) on delete cascade
-/
diff --git a/source/core/ut_suite_cache_manager.pkb b/source/core/ut_suite_cache_manager.pkb
deleted file mode 100644
index e5fdae7ac..000000000
--- a/source/core/ut_suite_cache_manager.pkb
+++ /dev/null
@@ -1,502 +0,0 @@
-create or replace package body ut_suite_cache_manager is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /*
- * Private code
- */
- cursor c_get_bulk_cache_suite(cp_suite_items in ut_suite_cache_rows) is
- with
- suite_items as (
- select /*+ cardinality(c 500) */ value(c) as obj
- from table(cp_suite_items) c),
- suitepaths as (
- select distinct substr(c.obj.path,1,instr(c.obj.path,'.',-1)-1) as suitepath,
- c.obj.path as path,
- c.obj.object_owner as object_owner
- from suite_items c
- where c.obj.self_type = 'UT_SUITE'
- ),
- gen as (
- select rownum as pos
- from xmltable('1 to 20')
- ),
- suitepath_part AS (
- select distinct
- substr(b.suitepath, 1, instr(b.suitepath || '.', '.', 1, g.pos) -1) as path,
- object_owner
- from suitepaths b
- join gen g
- on g.pos <= regexp_count(b.suitepath, '\w+')
- ),
- logical_suite_data as (
- select 'UT_LOGICAL_SUITE' as self_type, p.path, p.object_owner,
- upper( substr(p.path, instr( p.path, '.', -1 ) + 1 ) ) as object_name,
- cast(null as ut_executables) as x,
- cast(null as ut_varchar2_rows) as y,
- cast(null as ut_executable_test) as z
- from suitepath_part p
- where p.path
- not in (select s.path from suitepaths s)
- ),
- logical_suites as (
- select ut_suite_cache_row(
- null,
- s.self_type, s.path, s.object_owner, s.object_name,
- s.object_name, null, null, null, null, 0,null,
- ut_varchar2_rows(),
- s.x, s.x, s.x, s.x, s.x, s.x,
- s.y, null, s.z
- ) as obj
- from logical_suite_data s
- )
- select /*+ no_parallel */ obj from suite_items
- union all
- select /*+ no_parallel */ obj from logical_suites;
-
- function get_missing_cache_objects(a_object_owner varchar2) return ut_varchar2_rows is
- l_result ut_varchar2_rows;
- l_data ut_annotation_objs_cache_info;
- begin
- l_data := ut_annotation_cache_manager.get_cached_objects_list(a_object_owner, 'PACKAGE');
-
- select /*+ no_parallel */ i.object_name
- bulk collect into l_result
- from ut_suite_cache_package i
- where not exists (
- select 1 from table(l_data) o
- where o.object_owner = i.object_owner
- and o.object_name = i.object_name
- and o.object_type = 'PACKAGE'
- )
- and i.object_owner = a_object_owner;
- return l_result;
- end;
-
- function group_paths_by_schema(a_paths ut_varchar2_list) return ut_path_items is
- c_package_path_regex constant varchar2(100) := '^([[:alnum:]$#_]+)(\.([[:alnum:]$#_\*]+))?(\.([[:alnum:]$#_\*]+))?$';
- l_results ut_path_items := ut_path_items();
- l_path_item ut_path_item;
- i pls_integer;
- begin
- i := a_paths.first;
- while (i is not null) loop
- l_results.extend;
- if a_paths(i) like '%:%' then
- l_path_item := ut_path_item(schema_name => upper(regexp_substr(a_paths(i),'^[^.:]+')),
- suite_path => ltrim(regexp_substr(a_paths(i),'[.:].*$'),':'));
- l_results(l_results.last) := l_path_item;
- else
- l_path_item := ut_path_item(schema_name => regexp_substr(a_paths(i), c_package_path_regex, subexpression => 1),
- object_name => regexp_substr(a_paths(i), c_package_path_regex, subexpression => 3),
- procedure_name => regexp_substr(a_paths(i), c_package_path_regex, subexpression => 5));
- l_results(l_results.last) := l_path_item;
- end if;
- i := a_paths.next(i);
- end loop;
-
- return l_results;
- end;
-
- /*
- First SQL queries for objects where procedure is null or its only wildcard.
- We split that due to fact that we can use func min to combine rows.
-
- Second union is responsible expanding paths where the procedure filter is given
- We cannot select min here as filter can cover only half of tests within
- package. Even if the filter doesnt return anything we still capture a proc filter
- name for error reporting later on.
-
- Third SQL cover scenario where a suitapath only is populated and wildcard is given
-
- Fourth SQL cover scenario where suitepath is populated with no filters
- */
- function expand_paths(a_schema_paths ut_path_items) return ut_path_items is
- l_schema_paths ut_path_items:= ut_path_items();
- begin
- with
- schema_paths as (
- select * from table(a_schema_paths)
- ),
- paths_for_object as (
- select /*+ no_parallel */ min(path) as suite_path,sp.schema_name as schema_name,nvl(c.object_name,sp.object_name) as object_name,
- null as procedure_name
- from schema_paths sp left outer join ut_suite_cache c
- on ( c.object_owner = upper(sp.schema_name)
- and c.object_name like replace(upper(sp.object_name),'*','%'))
- where sp.suite_path is null and sp.object_name is not null
- and ( sp.procedure_name is null or sp.procedure_name = '*')
- group by sp.schema_name,nvl(c.object_name,sp.object_name)
- ),
- paths_for_procedures as (
- select /*+ no_parallel */ path as suite_path,sp.schema_name as schema_name,nvl(c.object_name,sp.object_name) as object_name,
- nvl(c.name,sp.procedure_name) as procedure_name
- from schema_paths sp left outer join ut_suite_cache c
- on ( c.object_owner = upper(sp.schema_name)
- and c.object_name like replace(upper(sp.object_name),'*','%')
- and c.name like nvl(replace(upper(sp.procedure_name),'*','%'), c.name))
- where sp.suite_path is null and sp.object_name is not null
- and (sp.procedure_name is not null and sp.procedure_name != '*')
- ),
- paths_for_suite_path_with_ast as (
- select /*+ no_parallel */ nvl(c.path,sp.suite_path) as suite_path,sp.schema_name,sp.object_name,sp.procedure_name as procedure_name
- from schema_paths sp left outer join ut_suite_cache c on
- ( c.object_owner = upper(sp.schema_name)
- --and c.path like replace(sp.suite_path,'*','%'))
- and regexp_like(c.path,'^'||replace(sp.suite_path,'*','[[:alnum:]$#_]*')))
- where sp.suite_path is not null and instr(sp.suite_path,'*') > 0
- ),
- straigth_suite_paths as (
- select /*+ no_parallel */ sp.suite_path as suite_path,sp.schema_name,sp.object_name,sp.procedure_name as procedure_name
- from schema_paths sp
- where
- (sp.suite_path is not null and instr(sp.suite_path,'*') = 0)
- or
- (sp.suite_path is null and sp.object_name is null)
- ),
- all_suitepaths_together as (
- select * from paths_for_object
- union all
- select * from paths_for_procedures
- union all
- select * from paths_for_suite_path_with_ast
- union all
- select * from straigth_suite_paths
- )
- select ut_path_item(schema_name,object_name,procedure_name,suite_path)
- bulk collect into l_schema_paths
- from
- (select schema_name,object_name,procedure_name,suite_path,
- row_number() over ( partition by schema_name,object_name,procedure_name,suite_path order by 1) as r_num
- from all_suitepaths_together)
- where r_num = 1 ;
- return l_schema_paths;
- end;
-
- /*
- Get a suite items rows that matching our criteria like
- path,object_name etc.
- We need to consider also an wildcard character on our procedures and object
- names.
- Were the path is populated we need to make sure we dont return duplicates
- as the wildcard can produce multiple results from same path and
- parents and child for each can be same resulting in duplicates
- */
- function get_suite_items (
- a_schema_paths ut_path_items
- ) return ut_suite_cache_rows is
- l_suite_items ut_suite_cache_rows := ut_suite_cache_rows();
- begin
- select obj bulk collect into l_suite_items
- from (
- select /*+ cardinality(c 500) */ value(c) as obj,row_number() over ( partition by path,object_owner order by path,object_owner asc) as r_num
- from ut_suite_cache c,
- table(a_schema_paths) sp
- where c.object_owner = upper(sp.schema_name)
- and ((sp.suite_path is not null and sp.suite_path||'.' like c.path||'.%' /*all parents and self*/
- or
- (
- c.path||'.' like sp.suite_path||'.%' /*all children and self*/
- and c.object_name like nvl(upper(sp.object_name),c.object_name)
- and c.name like nvl(upper(sp.procedure_name),c.name)
- ))
- or
- ( sp.suite_path is null
- and c.object_name = nvl(upper(sp.object_name),c.object_name)
- and c.name = nvl(upper(sp.procedure_name),c.name)))) where r_num =1;
- return l_suite_items;
- end;
-
- /*
- We will sort a suites in hierarchical structure.
- Sorting from bottom to top so when we consolidate
- we will go in proper order.
- For random seed we will add an extra sort that can be null.
- The object owner is irrelevant on joing via path as we already
- resolved a list of test we want to use so as long they share a suitepath
- they are correct.
- */
- procedure sort_and_randomize_tests(
- a_suite_rows in out ut_suite_cache_rows,
- a_random_seed positive := null)
- is
- l_suite_rows ut_suite_cache_rows;
- begin
- with
- extract_parent_child as (
- select s.path, substr(s.path,1,instr(s.path,'.',-1,1)-1) as parent_path,s.object_owner,
- case when a_random_seed is null then s.line_no end line_no,
- case when a_random_seed is not null then ut_utils.hash_suite_path(s.path, a_random_seed) end random_seed
- from table(a_suite_rows) s),
- t1(path,parent_path,object_owner,line_no,random_seed) as (
- --Anchor member
- select s.path, parent_path,s.object_owner,s.line_no,random_seed
- from extract_parent_child s
- where parent_path is null
- union all
- --Recursive member
- select t2.path, t2.parent_path,t2.object_owner,t2.line_no,t2.random_seed
- from t1,extract_parent_child t2
- where t2.parent_path = t1.path
- and t2.object_owner = t1.object_owner)
- search depth first by line_no desc,random_seed desc nulls last set order1
- select value(i) as obj
- bulk collect into l_suite_rows
- from t1 c
- join table(a_suite_rows) i on i.object_owner = c.object_owner and i.path = c.path
- order by order1 desc;
-
- a_suite_rows := l_suite_rows;
- end;
-
- /*
- * Public code
- */
-
- function get_schema_paths(a_paths in ut_varchar2_list) return ut_path_items is
- begin
- return expand_paths(group_paths_by_schema(a_paths));
- end;
-
- function get_cached_suite_rows(
- a_suites_filtered ut_suite_cache_rows
- ) return ut_suite_cache_rows is
- l_results ut_suite_cache_rows := ut_suite_cache_rows();
- begin
-
- open c_get_bulk_cache_suite(a_suites_filtered);
- fetch c_get_bulk_cache_suite bulk collect into l_results;
- close c_get_bulk_cache_suite;
-
- return l_results;
- end;
-
- function get_schema_parse_time(a_schema_name varchar2) return timestamp result_cache is
- l_cache_parse_time timestamp;
- begin
- select /*+ no_parallel */ min(t.parse_time)
- into l_cache_parse_time
- from ut_suite_cache_schema t
- where object_owner = upper(a_schema_name);
- return l_cache_parse_time;
- end;
-
- procedure save_object_cache(
- a_object_owner varchar2,
- a_object_name varchar2,
- a_parse_time timestamp,
- a_suite_items ut_suite_items
- ) is
- pragma autonomous_transaction;
- l_cached_parse_time timestamp;
- l_object_owner varchar2(250) := upper(a_object_owner);
- l_object_name varchar2(250) := upper(a_object_name);
- begin
- if a_suite_items is null or a_suite_items.count = 0 then
-
- delete from ut_suite_cache t
- where t.object_owner = l_object_owner
- and t.object_name = l_object_name;
-
- delete from ut_suite_cache_package t
- where t.object_owner = l_object_owner
- and t.object_name = l_object_name;
-
- else
-
- select /*+ no_parallel */ min(parse_time)
- into l_cached_parse_time
- from ut_suite_cache_package t
- where t.object_name = l_object_name
- and t.object_owner = l_object_owner;
-
- if a_parse_time > l_cached_parse_time or l_cached_parse_time is null then
-
- update /*+ no_parallel */ ut_suite_cache_schema t
- set t.parse_time = greatest(t.parse_time,a_parse_time)
- where object_owner = l_object_owner;
-
- if sql%rowcount = 0 then
- insert /*+ no_parallel */ into ut_suite_cache_schema
- (object_owner, parse_time)
- values (l_object_owner, a_parse_time);
- end if;
-
- update /*+ no_parallel */ ut_suite_cache_package t
- set t.parse_time = a_parse_time
- where t.object_owner = l_object_owner
- and t.object_name = l_object_name;
-
- if sql%rowcount = 0 then
- insert /*+ no_parallel */ into ut_suite_cache_package
- (object_owner, object_name, parse_time)
- values (l_object_owner, l_object_name, a_parse_time );
- end if;
-
- delete from ut_suite_cache t
- where t.object_owner = l_object_owner
- and t.object_name = l_object_name;
-
- insert /*+ no_parallel */ into ut_suite_cache t
- (
- id, self_type, path, object_owner, object_name, name,
- line_no, parse_time, description,
- rollback_type, disabled_flag,disabled_reason, warnings,
- before_all_list, after_all_list,
- before_each_list, after_each_list,
- before_test_list, after_test_list,
- expected_error_codes, tags,
- item
- )
- with suites as (
- select treat(value(x) as ut_suite) i
- from table(a_suite_items) x
- where x.self_type in( 'UT_SUITE', 'UT_SUITE_CONTEXT' ) )
- select /*+ no_parallel */ ut_suite_cache_seq.nextval, s.i.self_type as self_type, s.i.path as path,
- upper(s.i.object_owner) as object_owner, upper(s.i.object_name) as object_name, upper(s.i.name) as name,
- s.i.line_no as line_no, s.i.parse_time as parse_time, s.i.description as description,
- s.i.rollback_type as rollback_type, s.i.disabled_flag as disabled_flag,s.i.disabled_reason as disabled_reason, s.i.warnings as warnings,
- s.i.before_all_list as before_all_list, s.i.after_all_list as after_all_list,
- null before_each_list, null after_each_list,
- null before_test_list, null after_test_list,
- null expected_error_codes, s.i.tags tags,
- null item
- from suites s;
-
- insert /*+ no_parallel */ into ut_suite_cache t
- (
- id, self_type, path, object_owner, object_name, name,
- line_no, parse_time, description,
- rollback_type, disabled_flag,disabled_reason, warnings,
- before_all_list, after_all_list,
- before_each_list, after_each_list,
- before_test_list, after_test_list,
- expected_error_codes, tags,
- item
- )
- with tests as (
- select treat(value(x) as ut_test) t
- from table ( a_suite_items ) x
- where x.self_type in ( 'UT_TEST' ) )
- select /*+ no_parallel */ ut_suite_cache_seq.nextval, s.t.self_type as self_type, s.t.path as path,
- upper(s.t.object_owner) as object_owner, upper(s.t.object_name) as object_name, upper(s.t.name) as name,
- s.t.line_no as line_no, s.t.parse_time as parse_time, s.t.description as description,
- s.t.rollback_type as rollback_type, s.t.disabled_flag as disabled_flag, s.t.disabled_reason as disabled_reason, s.t.warnings as warnings,
- null before_all_list, null after_all_list,
- s.t.before_each_list as before_each_list, s.t.after_each_list as after_each_list,
- s.t.before_test_list as before_test_list, s.t.after_test_list as after_test_list,
- s.t.expected_error_codes as expected_error_codes, s.t.tags as test_tags,
- s.t.item as item
- from tests s;
-
- end if;
- end if;
- commit;
- end;
-
- procedure remove_missing_objs_from_cache(a_schema_name varchar2) is
- l_objects ut_varchar2_rows;
- pragma autonomous_transaction;
- begin
- l_objects := get_missing_cache_objects(a_schema_name);
-
- if l_objects is not empty then
- delete /*+ no_parallel */ from ut_suite_cache i
- where i.object_owner = a_schema_name
- and i.object_name in ( select /*+ no_parallel */ column_value from table (l_objects) );
-
- delete /*+ no_parallel */ from ut_suite_cache_package i
- where i.object_owner = a_schema_name
- and i.object_name in ( select /*+ no_parallel */ column_value from table (l_objects) );
- end if;
-
- commit;
- end;
-
- function get_cached_suite_info(
- a_schema_paths ut_path_items
- ) return ut_suite_cache_rows is
- begin
- return get_cached_suite_rows(get_suite_items(a_schema_paths));
- end;
-
- function get_suite_items_info(
- a_suite_cache_items ut_suite_cache_rows
- ) return ut_suite_items_info is
- l_results ut_suite_items_info;
- begin
- select /*+ no_parallel */ ut_suite_item_info(
- c.object_owner, c.object_name, c.name,
- c.description, c.self_type, c.line_no,
- c.path, c.disabled_flag, c.disabled_reason, c.tags
- )
- bulk collect into l_results
- from table(a_suite_cache_items) c;
- return l_results;
- end;
-
- function get_cached_packages(
- a_schema_names ut_varchar2_rows
- ) return ut_object_names is
- l_results ut_object_names;
- begin
- select /*+ no_parallel */ ut_object_name( c.object_owner, c.object_name )
- bulk collect into l_results
- from ut_suite_cache_package c
- join table ( a_schema_names ) s
- on c.object_owner = upper(s.column_value);
- return l_results;
- end;
-
- function suite_item_exists(
- a_owner_name varchar2,
- a_package_name varchar2,
- a_procedure_name varchar2
- ) return boolean is
- l_count integer;
- begin
- if a_procedure_name is not null then
- select /*+ no_parallel */ count( 1 ) into l_count from dual
- where exists(
- select 1
- from ut_suite_cache c
- where c.object_owner = a_owner_name
- and c.object_name = a_package_name
- and c.name = a_procedure_name
- );
- elsif a_package_name is not null then
- select /*+ no_parallel */ count( 1 ) into l_count from dual
- where exists(
- select 1
- from ut_suite_cache c
- where c.object_owner = a_owner_name
- and c.object_name = a_package_name
- );
- else
- select /*+ no_parallel */ count( 1 ) into l_count from dual
- where exists(
- select 1
- from ut_suite_cache c
- where c.object_owner = a_owner_name
- );
- end if;
-
- return l_count > 0;
- end;
-
-end;
-/
diff --git a/source/core/ut_suite_cache_manager.pks b/source/core/ut_suite_cache_manager.pks
deleted file mode 100644
index 81b1e0136..000000000
--- a/source/core/ut_suite_cache_manager.pks
+++ /dev/null
@@ -1,101 +0,0 @@
-create or replace package ut_suite_cache_manager authid definer is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Responsible for storing and retrieving suite data from cache
- */
-
- /*
- * Saves suite items for individual package in suite cache
- */
- procedure save_object_cache(
- a_object_owner varchar2,
- a_object_name varchar2,
- a_parse_time timestamp,
- a_suite_items ut_suite_items
- );
-
- /*
- * Returns time when schema was last saved in cache
- */
- function get_schema_parse_time(a_schema_name varchar2) return timestamp result_cache;
-
- /*
- * Removes packages that are no longer annotated from cache
- */
- procedure remove_missing_objs_from_cache(a_schema_name varchar2);
-
- /*
- * We will sort a suites in hierarchical structure.
- * Sorting from bottom to top so when we consolidate
- * we will go in proper order.
- */
- procedure sort_and_randomize_tests(
- a_suite_rows in out ut_suite_cache_rows,
- a_random_seed positive := null);
-
- /*
- * Retrieves suite items data from cache.
- * Returned data is not filtered by user access rights.
- * Not to be used publicly. Used internally for building suites at runtime.
- */
- function get_cached_suite_rows(
- a_suites_filtered ut_suite_cache_rows
- ) return ut_suite_cache_rows;
-
- function get_schema_paths(a_paths in ut_varchar2_list) return ut_path_items;
-
- /*
- * Retrieves suite item info rows from cache.
- * Returned data is not filtered by user access rights.
- * Not to be used publicly. Used internally for building suites info.
- */
- function get_cached_suite_info(
- a_schema_paths ut_path_items
- ) return ut_suite_cache_rows;
-
- function get_suite_items_info(
- a_suite_cache_items ut_suite_cache_rows
- ) return ut_suite_items_info;
-
- function get_suite_items (
- a_schema_paths ut_path_items
- ) return ut_suite_cache_rows;
-
- /*
- * Retrieves list of cached suite packages.
- * Returned data is not filtered by user access rights.
- * Not to be used publicly. Used internally.
- */
- function get_cached_packages(
- a_schema_names ut_varchar2_rows
- ) return ut_object_names;
-
- /*
- * Returns true if given suite item exists in cache.
- * Returned data is not filtered by user access rights.
- * Not to be used publicly. Used internally.
- */
- function suite_item_exists(
- a_owner_name varchar2,
- a_package_name varchar2,
- a_procedure_name varchar2
- ) return boolean;
-
-end ut_suite_cache_manager;
-/
diff --git a/source/core/ut_suite_cache_package.sql b/source/core/ut_suite_cache_package.sql
deleted file mode 100644
index 7a146ff83..000000000
--- a/source/core/ut_suite_cache_package.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-create table ut_suite_cache_package (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- object_owner varchar2(250) not null,
- object_name varchar2(250) not null,
- parse_time timestamp not null,
- constraint ut_suite_cache_package_pk primary key(object_owner, object_name),
- constraint ut_suite_cache_package_fk foreign key (object_owner) references ut_suite_cache_schema(object_owner) on delete cascade
-) organization index
-/
-
-
diff --git a/source/core/ut_suite_cache_schema.sql b/source/core/ut_suite_cache_schema.sql
deleted file mode 100644
index 636816e65..000000000
--- a/source/core/ut_suite_cache_schema.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-create table ut_suite_cache_schema (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- object_owner varchar2(250) not null,
- parse_time timestamp not null,
- constraint ut_suite_cache_schema_pk primary key(object_owner)
-) organization index
-/
-
diff --git a/source/core/ut_suite_cache_seq.sql b/source/core/ut_suite_cache_seq.sql
deleted file mode 100644
index e1e560286..000000000
--- a/source/core/ut_suite_cache_seq.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-create sequence ut_suite_cache_seq
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-cache 100;
-
diff --git a/source/core/ut_suite_manager.pkb b/source/core/ut_suite_manager.pkb
deleted file mode 100644
index c418de638..000000000
--- a/source/core/ut_suite_manager.pkb
+++ /dev/null
@@ -1,629 +0,0 @@
-create or replace package body ut_suite_manager is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- gc_suitpath_error_message constant varchar2(100) := 'Suitepath exceeds 1000 CHAR on: ';
- cursor c_cached_suites_cursor is select * from table(ut_suite_cache_rows());
- type tt_cached_suites is table of c_cached_suites_cursor%rowtype;
- type t_cached_suites_cursor is ref cursor return c_cached_suites_cursor%rowtype;
- type t_item_levels is table of ut_suite_items index by binary_integer;
- ------------------
-
- procedure validate_paths(a_paths in ut_varchar2_list) is
- l_path varchar2(32767);
- begin
- if a_paths is null or a_paths.count = 0 then
- raise_application_error(ut_utils.gc_path_list_is_empty, 'Path list is empty');
- else
- for i in 1 .. a_paths.count loop
- l_path := a_paths(i);
- if l_path is null or not (
- regexp_like(l_path, '^[[:alnum:]$#_\*]+(\.[[:alnum:]$#_\*]+){0,2}$') or regexp_like(l_path, '^([[:alnum:]$#_]+)?:[[:alnum:]$#_\*]+(\.[[:alnum:]$#_\*]+)*$')) then
- raise_application_error(ut_utils.gc_invalid_path_format, 'Invalid path format: ' || nvl(l_path, 'NULL'));
- end if;
- end loop;
- end if;
- end;
-
- function trim_and_lower_paths( a_paths ut_varchar2_list) return ut_varchar2_list is
- l_paths_temp ut_varchar2_list := ut_varchar2_list();
- begin
- l_paths_temp.extend(a_paths.count);
- for i in 1 .. a_paths.count loop
- l_paths_temp(i) := trim(lower(a_paths(i)));
- end loop;
- return l_paths_temp;
- end;
-
- function resolve_schema_names(a_paths in out nocopy ut_varchar2_list) return ut_varchar2_rows is
- l_schema varchar2(4000);
- l_object varchar2(4000);
- l_schema_names ut_varchar2_rows := ut_varchar2_rows();
- c_current_schema constant all_tables.owner%type := sys_context('USERENV','CURRENT_SCHEMA');
- begin
- a_paths := set( trim_and_lower_paths( a_paths) );
-
- validate_paths(a_paths);
-
- for i in 1 .. a_paths.count loop
- --if path is suite-path
- if regexp_like(a_paths(i), '^([[:alnum:]$#_]+)?:') then
- --get schema name / path
- l_schema := regexp_substr(a_paths(i), '^([[:alnum:]$#_]+)?:',subexpression => 1);
- -- transform ":path1[.path2]" to "schema:path1[.path2]"
- if l_schema is not null then
- l_schema := sys.dbms_assert.schema_name(upper(l_schema));
- else
- a_paths(i) := c_current_schema || a_paths(i);
- l_schema := c_current_schema;
- end if;
- else
- -- get schema name / object.[procedure] name
- -- When path is one of: schema or schema.package[.object] or package[.object]
- -- transform it back to schema[.package[.object]]
- -- Object name or procedure is allowed to have filter char
- -- However this is not allowed on schema
- begin
- l_object := regexp_substr(a_paths(i), '^[[:alnum:]$#_\*]+');
- l_schema := sys.dbms_assert.schema_name(upper(l_object));
- exception
- when sys.dbms_assert.invalid_schema_name then
- if l_object like '%*%' or ut_metadata.package_exists_in_cur_schema(upper(l_object)) then
- a_paths(i) := c_current_schema || '.' || a_paths(i);
- l_schema := c_current_schema;
- else
- raise;
- end if;
- end;
- end if;
- l_schema_names.extend;
- l_schema_names(l_schema_names.last) := l_schema;
- end loop;
-
- return l_schema_names;
- end;
-
- procedure resolve_schema_names(a_paths in out nocopy ut_varchar2_list) is
- l_schema_names ut_varchar2_rows;
- begin
- l_schema_names := resolve_schema_names(a_paths);
- end;
-
- function sort_by_seq_no(
- a_list ut_executables
- ) return ut_executables is
- l_results ut_executables := ut_executables();
- begin
- if a_list is not null then
- l_results.extend(a_list.count);
- for i in 1 .. a_list.count loop
- l_results(a_list(i).seq_no) := a_list(i);
- end loop;
- end if;
- return l_results;
- end;
-
- procedure reverse_list_order(
- a_list in out nocopy ut_suite_items
- ) is
- l_start_idx pls_integer;
- l_end_idx pls_integer;
- l_item ut_suite_item;
- begin
- l_start_idx := a_list.first;
- l_end_idx := a_list.last;
- while l_start_idx < l_end_idx loop
- l_item := a_list(l_start_idx);
- a_list(l_start_idx) := a_list(l_end_idx);
- a_list(l_end_idx) := l_item;
- l_end_idx := a_list.prior(l_end_idx);
- l_start_idx := a_list.next(l_start_idx);
- end loop;
- end;
-
- function get_logical_suite(
- a_rows tt_cached_suites,
- a_idx pls_integer,
- a_level pls_integer,
- a_prev_level pls_integer,
- a_items_at_level t_item_levels
- ) return ut_suite_item is
- l_result ut_suite_item;
- begin
- case a_rows( a_idx ).self_type
- when 'UT_SUITE' then
- l_result :=
- case when a_prev_level > a_level then
- ut_suite(
- self_type => a_rows( a_idx ).self_type,
- object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
- name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
- rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag, disabled_reason => a_rows(a_idx).disabled_reason,
- line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
- start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
- results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
- items => a_items_at_level(a_prev_level),
- before_all_list => sort_by_seq_no( a_rows( a_idx ).before_all_list), after_all_list => sort_by_seq_no(
- a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags
- )
- else
- ut_suite(
- self_type => a_rows( a_idx ).self_type,
- object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
- name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
- rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag, disabled_reason => a_rows(a_idx).disabled_reason,
- line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
- start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
- results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
- items => ut_suite_items(),
- before_all_list => sort_by_seq_no( a_rows( a_idx ).before_all_list), after_all_list => sort_by_seq_no(
- a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags
- )
- end;
- when 'UT_SUITE_CONTEXT' then
- l_result :=
- case when a_prev_level > a_level then
- ut_suite_context(
- self_type => a_rows( a_idx ).self_type,
- object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
- name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
- rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag, disabled_reason => a_rows(a_idx).disabled_reason,
- line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
- start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
- results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
- items => a_items_at_level(a_prev_level),
- before_all_list => sort_by_seq_no( a_rows( a_idx ).before_all_list), after_all_list => sort_by_seq_no(
- a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags
- )
- else
- ut_suite_context(
- self_type => a_rows( a_idx ).self_type,
- object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
- name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
- rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag, disabled_reason => a_rows(a_idx).disabled_reason,
- line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
- start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
- results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
- items => ut_suite_items(),
- before_all_list => sort_by_seq_no( a_rows( a_idx ).before_all_list), after_all_list => sort_by_seq_no(
- a_rows( a_idx ).after_all_list), tags => a_rows(a_idx).tags
- )
- end;
- when 'UT_LOGICAL_SUITE' then
- l_result :=
- case when a_prev_level > a_level then
- ut_logical_suite(
- self_type => a_rows( a_idx ).self_type,
- object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
- name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
- rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag, disabled_reason => a_rows(a_idx).disabled_reason,
- line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
- start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
- results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
- items => a_items_at_level(a_prev_level), tags => null
- )
- else
- ut_logical_suite(
- self_type => a_rows( a_idx ).self_type,
- object_owner => a_rows( a_idx ).object_owner, object_name => lower( a_rows( a_idx ).object_name),
- name => lower( a_rows( a_idx ).name), description => a_rows( a_idx ).description, path => a_rows( a_idx ).path,
- rollback_type => a_rows( a_idx ).rollback_type, disabled_flag => a_rows( a_idx ).disabled_flag, disabled_reason => a_rows(a_idx).disabled_reason,
- line_no => a_rows( a_idx ).line_no, parse_time => a_rows( a_idx ).parse_time,
- start_time => null, end_time => null, result => null, warnings => a_rows( a_idx ).warnings,
- results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
- items => ut_suite_items(), tags => null
- )
- end;
- when 'UT_TEST' then
- l_result :=
- ut_test(
- self_type => a_rows(a_idx).self_type,
- object_owner => a_rows(a_idx).object_owner, object_name => lower(a_rows(a_idx).object_name),
- name => lower(a_rows(a_idx).name), description => a_rows(a_idx).description, path => a_rows(a_idx).path,
- rollback_type => a_rows(a_idx).rollback_type, disabled_flag => a_rows(a_idx).disabled_flag, disabled_reason => a_rows(a_idx).disabled_reason,
- line_no => a_rows(a_idx).line_no, parse_time => a_rows(a_idx).parse_time,
- start_time => null, end_time => null, result => null, warnings => a_rows(a_idx).warnings,
- results_count => ut_results_counter(), transaction_invalidators => ut_varchar2_list(),
- before_each_list => sort_by_seq_no(a_rows(a_idx).before_each_list), before_test_list => sort_by_seq_no(a_rows(a_idx).before_test_list),
- item => a_rows(a_idx).item,
- after_test_list => sort_by_seq_no(a_rows(a_idx).after_test_list), after_each_list => sort_by_seq_no(a_rows(a_idx).after_each_list),
- all_expectations => ut_expectation_results(), failed_expectations => ut_expectation_results(),
- parent_error_stack_trace => null, expected_error_codes => a_rows(a_idx).expected_error_codes,
- tags => a_rows(a_idx).tags
- );
- end case;
- l_result.results_count.warnings_count := l_result.warnings.count;
- return l_result;
- end;
-
- procedure reconstruct_from_cache(
- a_suites in out nocopy ut_suite_items,
- a_suite_data_cursor sys_refcursor
- ) is
- c_bulk_limit constant pls_integer := 1000;
- l_items_at_level t_item_levels;
- l_rows tt_cached_suites;
- l_level pls_integer;
- l_prev_level pls_integer;
- l_idx integer;
- begin
- loop
- fetch a_suite_data_cursor bulk collect into l_rows limit c_bulk_limit;
-
- l_idx := l_rows.first;
- while l_idx is not null loop
- l_level := length(l_rows(l_idx).path) - length( replace(l_rows(l_idx).path, '.') ) + 1;
- if l_level > 1 then
- if not l_items_at_level.exists(l_level) then
- l_items_at_level(l_level) := ut_suite_items();
- end if;
- l_items_at_level(l_level).extend;
- pragma inline(get_logical_suite, 'YES');
- l_items_at_level(l_level)(l_items_at_level(l_level).last) := get_logical_suite(l_rows, l_idx, l_level,l_prev_level, l_items_at_level );
- else
- a_suites.extend;
- pragma inline(get_logical_suite, 'YES');
- a_suites(a_suites.last) := get_logical_suite(l_rows, l_idx, l_level,l_prev_level, l_items_at_level );
- end if;
- if l_prev_level > l_level then
- l_items_at_level(l_prev_level).delete;
- end if;
- l_prev_level := l_level;
- l_idx := l_rows.next(l_idx);
- end loop;
- exit when a_suite_data_cursor%NOTFOUND;
- end loop;
-
- reverse_list_order( a_suites );
-
- for i in 1 .. a_suites.count loop
- a_suites( i ).set_rollback_type( a_suites( i ).get_rollback_type );
- end loop;
- close a_suite_data_cursor;
- end reconstruct_from_cache;
-
- function get_filtered_cursor(
- a_unfiltered_rows in ut_suite_cache_rows,
- a_skip_all_objects boolean := false
- )
- return ut_suite_cache_rows is
- l_result ut_suite_cache_rows := ut_suite_cache_rows();
- begin
- if ut_metadata.user_has_execute_any_proc() or a_skip_all_objects then
- l_result := a_unfiltered_rows;
- else
- select obj bulk collect into l_result
- from (
- select /*+ no_parallel */ value(c) as obj from table(a_unfiltered_rows) c
- where sys_context( 'userenv', 'current_user' ) = upper(c.object_owner)
- union all
- select /*+ no_parallel */ value(c) as obj from table(a_unfiltered_rows) c
- where sys_context( 'userenv', 'current_user' ) != upper(c.object_owner)
- and ( exists
- ( select 1
- from all_objects a
- where a.object_name = c.object_name
- and a.owner = c.object_owner
- and a.object_type = 'PACKAGE'
- )
- or c.self_type = 'UT_LOGICAL_SUITE'));
- end if;
- return l_result;
- end;
-
- procedure reconcile_paths_and_suites(
- a_schema_paths ut_path_items,
- a_filtered_rows ut_suite_cache_rows
- ) is
- begin
- for i in ( select /*+ no_parallel */ sp.schema_name,sp.object_name,sp.procedure_name,
- sp.suite_path,sc.path
- from table(a_schema_paths) sp left outer join
- table(a_filtered_rows) sc on
- (( upper(sp.schema_name) = upper(sc.object_owner) and upper(sp.object_name) = upper(sc.object_name)
- and nvl(upper(sp.procedure_name),sc.name) = sc.name )
- or (sc.path = sp.suite_path))
- where sc.path is null)
- loop
- if i.suite_path is not null then
- raise_application_error(ut_utils.gc_suite_package_not_found,'No suite packages found for path '||i.schema_name||':'||i.suite_path|| '.');
- elsif i.procedure_name is not null then
- raise_application_error(ut_utils.gc_suite_package_not_found,'Suite test '||i.schema_name||'.'||i.object_name|| '.'||i.procedure_name||' does not exist');
- elsif i.object_name is not null then
- raise_application_error(ut_utils.gc_suite_package_not_found,'Suite package '||i.schema_name||'.'||i.object_name|| ' does not exist');
- end if;
- end loop;
- end;
-
- function get_cached_suite_data(
- a_schema_paths ut_path_items,
- a_random_seed positive,
- a_tags varchar2 := null,
- a_skip_all_objects boolean := false
- ) return t_cached_suites_cursor is
- l_unfiltered_rows ut_suite_cache_rows;
- l_tag_filter_applied ut_suite_cache_rows;
- l_filtered_rows ut_suite_cache_rows;
- l_result t_cached_suites_cursor;
- begin
- l_unfiltered_rows := ut_suite_cache_manager.get_suite_items(a_schema_paths);
-
- l_tag_filter_applied := ut_suite_tag_filter.apply(l_unfiltered_rows,a_tags);
- l_filtered_rows := get_filtered_cursor(ut_suite_cache_manager.get_cached_suite_rows(l_tag_filter_applied),a_skip_all_objects);
- reconcile_paths_and_suites(a_schema_paths,l_filtered_rows);
-
- ut_suite_cache_manager.sort_and_randomize_tests(l_filtered_rows,a_random_seed);
-
- open l_result for
- select * from table(l_filtered_rows);
- return l_result;
- end;
-
- function can_skip_all_objects_scan(
- a_owner_name varchar2
- ) return boolean is
- begin
- return sys_context( 'userenv', 'current_user' ) = upper(a_owner_name) or ut_metadata.user_has_execute_any_proc();
- end;
-
- procedure build_and_cache_suites(
- a_owner_name varchar2,
- a_annotated_objects sys_refcursor
- ) is
- l_annotated_objects ut_annotated_objects;
- l_suite_items ut_suite_items;
-
- l_bad_suitepath_obj ut_varchar2_list := ut_varchar2_list();
- ex_string_too_small exception;
- pragma exception_init (ex_string_too_small,-06502);
- begin
- ut_event_manager.trigger_event('build_and_cache_suites - start');
- loop
- fetch a_annotated_objects bulk collect into l_annotated_objects limit 10;
-
- for i in 1 .. l_annotated_objects.count loop
- begin
- ut_suite_builder.create_suite_item_list( l_annotated_objects( i ), l_suite_items );
- exception
- when ex_string_too_small then
- ut_utils.append_to_list(l_bad_suitepath_obj,a_owner_name||'.'||l_annotated_objects( i ).object_name);
- end;
- ut_suite_cache_manager.save_object_cache(
- a_owner_name,
- l_annotated_objects( i ).object_name,
- l_annotated_objects( i ).parse_time,
- l_suite_items
- );
- end loop;
- exit when a_annotated_objects%notfound;
- end loop;
- close a_annotated_objects;
-
- --Check for any invalid suitepath objects
- if l_bad_suitepath_obj.count > 0 then
- raise_application_error(
- ut_utils.gc_value_too_large,
- ut_utils.to_string(gc_suitpath_error_message||ut_utils.table_to_clob(l_bad_suitepath_obj,','))
- );
- end if;
- ut_event_manager.trigger_event('build_and_cache_suites - end');
- end;
-
- procedure refresh_cache(
- a_owner_name varchar2
- ) is
- l_annotations_cursor sys_refcursor;
- l_suite_cache_time timestamp;
- l_owner_name varchar2(128) := upper(a_owner_name);
- begin
- ut_event_manager.trigger_event('refresh_cache - start');
- l_suite_cache_time := ut_suite_cache_manager.get_schema_parse_time(l_owner_name);
- l_annotations_cursor := ut_annotation_manager.get_annotated_objects(
- l_owner_name, 'PACKAGE', l_suite_cache_time
- );
-
- build_and_cache_suites(l_owner_name, l_annotations_cursor);
-
- if can_skip_all_objects_scan(l_owner_name) or ut_metadata.is_object_visible( 'dba_objects') then
- ut_suite_cache_manager.remove_missing_objs_from_cache( l_owner_name );
- end if;
-
- ut_event_manager.trigger_event('refresh_cache - end');
- end;
-
- procedure add_suites_for_paths(
- a_schema_paths ut_path_items,
- a_suites in out nocopy ut_suite_items,
- a_random_seed positive,
- a_tags varchar2 := null
- ) is
- begin
- reconstruct_from_cache(
- a_suites,
- get_cached_suite_data(
- a_schema_paths,
- a_random_seed,
- a_tags
- )
- );
- end;
-
- -----------------------------------------------
- -----------------------------------------------
- ------------- Public definitions -------------
-
- function build_suites_from_annotations(
- a_owner_name varchar2,
- a_annotated_objects sys_refcursor,
- a_path varchar2 := null,
- a_object_name varchar2 := null,
- a_procedure_name varchar2 := null,
- a_skip_all_objects boolean := false
- ) return ut_suite_items is
- l_suites ut_suite_items := ut_suite_items();
- l_schema_paths ut_path_items;
- begin
- build_and_cache_suites(a_owner_name, a_annotated_objects);
- l_schema_paths := ut_path_items(ut_path_item(a_owner_name,a_object_name,a_procedure_name,a_path));
- reconstruct_from_cache(
- l_suites,
- get_cached_suite_data(
- l_schema_paths,
- null,
- null,
- a_skip_all_objects
- )
- );
- return l_suites;
- end;
-
- function get_schema_ut_packages(a_schema_names ut_varchar2_rows, a_schema_name_expr varchar2) return ut_object_names is
- l_schema_names ut_varchar2_rows := a_schema_names;
- begin
- if a_schema_name_expr is not null then
- select username
- bulk collect into l_schema_names
- from all_users
- where regexp_like(username,a_schema_name_expr,'i');
- end if;
-
- for i in 1 .. l_schema_names.count loop
- refresh_cache(l_schema_names(i));
- end loop;
-
- return ut_suite_cache_manager.get_cached_packages( l_schema_names );
- end;
-
- function get_schema_names(a_paths ut_varchar2_list) return ut_varchar2_rows is
- l_paths ut_varchar2_list;
- begin
- l_paths := a_paths;
- return resolve_schema_names(l_paths);
- end;
-
- function configure_execution_by_path(a_paths ut_varchar2_list, a_random_seed positive := null) return ut_suite_items is
- l_suites ut_suite_items := ut_suite_items();
- begin
- configure_execution_by_path(a_paths, l_suites );
- return l_suites;
- end;
-
- procedure configure_execution_by_path(
- a_paths ut_varchar2_list,
- a_suites out nocopy ut_suite_items,
- a_random_seed positive := null,
- a_tags varchar2 := null
- ) is
- l_paths ut_varchar2_list := a_paths;
- l_schema_names ut_varchar2_rows;
- l_schema_paths ut_path_items;
- l_schema varchar2(4000);
- begin
- ut_event_manager.trigger_event('configure_execution_by_path - start');
- a_suites := ut_suite_items();
- --resolve schema names from paths and group paths by schema name
- l_schema_names := resolve_schema_names(l_paths);
-
- --refresh cache
- l_schema := l_schema_names.first;
- while l_schema is not null loop
- refresh_cache(upper(l_schema_names(l_schema)));
- l_schema := l_schema_names.next(l_schema);
- end loop;
-
- l_schema_paths := ut_suite_cache_manager.get_schema_paths(l_paths);
-
- --We will get a single list of paths rather than loop by loop.
- add_suites_for_paths(
- l_schema_paths,
- a_suites,
- a_random_seed,
- a_tags
- );
-
- --propagate rollback type to suite items after organizing suites into hierarchy
- for i in 1 .. a_suites.count loop
- a_suites(i).set_rollback_type( a_suites(i).get_rollback_type() );
- end loop;
-
- ut_event_manager.trigger_event('configure_execution_by_path - end');
- end configure_execution_by_path;
-
- function get_suites_info(
- a_paths ut_varchar2_list
- ) return sys_refcursor is
- l_result sys_refcursor;
- l_all_suite_info ut_suite_items_info;
- l_schema_names ut_varchar2_rows;
- l_schema_paths ut_path_items;
- l_paths ut_varchar2_list := a_paths;
- l_schema varchar2(4000);
- l_unfiltered_rows ut_suite_cache_rows;
- l_filtered_rows ut_suite_cache_rows;
-
- begin
- l_schema_names := resolve_schema_names(l_paths);
- --refresh cache
- l_schema := l_schema_names.first;
- while l_schema is not null loop
- refresh_cache(upper(l_schema_names(l_schema)));
- l_schema := l_schema_names.next(l_schema);
- end loop;
- l_schema_paths := ut_suite_cache_manager.get_schema_paths(l_paths);
- l_unfiltered_rows := ut_suite_cache_manager.get_cached_suite_info(l_schema_paths);
- l_filtered_rows := get_filtered_cursor(l_unfiltered_rows);
- l_all_suite_info := ut_suite_cache_manager.get_suite_items_info(l_filtered_rows);
- open l_result for
- select /*+ no_parallel */ value(c)
- from table(l_all_suite_info) c
- order by c.object_owner, c.object_name, c.item_line_no;
-
- return l_result;
- end;
-
- function suite_item_exists(
- a_owner_name varchar2,
- a_package_name varchar2 := null,
- a_procedure_name varchar2 := null
- ) return boolean is
- l_count integer := 1;
- l_item_exists boolean;
- l_owner_name varchar2(250) := upper(a_owner_name);
- l_package_name varchar2(250) := upper(a_package_name);
- l_procedure_name varchar2(250) := upper(a_procedure_name);
- begin
-
- refresh_cache(l_owner_name);
- l_item_exists := ut_suite_cache_manager.suite_item_exists( l_owner_name, l_package_name, l_procedure_name );
- if not can_skip_all_objects_scan( l_owner_name ) and l_package_name is not null then
- select /*+ no_parallel */ count(1)
- into l_count
- from dual c
- where exists
- ( select 1
- from all_objects a
- where a.object_name = l_package_name
- and a.owner = l_owner_name
- and a.object_type = 'PACKAGE'
- );
- end if;
-
- return l_count > 0 and l_item_exists;
- end;
-
-end ut_suite_manager;
-/
diff --git a/source/core/ut_suite_manager.pks b/source/core/ut_suite_manager.pks
deleted file mode 100644
index 07539139a..000000000
--- a/source/core/ut_suite_manager.pks
+++ /dev/null
@@ -1,106 +0,0 @@
-create or replace package ut_suite_manager authid current_user is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Resposible for building hierarhy of sutes from individual suites created by suite_builder
- */
-
- /**
- * @private
- *
- * Returns a list of Unit Test packages that exist in a given database schema
- * IMPORTANT! The returned list is not filtered by user privileges.
- * To be used internally only.
- *
- * @param a_schema_names list of schemas to return the information for
- * @return array containing unit test schema and object names
- */
- function get_schema_ut_packages(a_schema_names ut_varchar2_rows, a_schema_name_expr varchar2) return ut_object_names;
-
- /**
- * Builds a hierarchical suites based on given suite-paths
- *
- * @param a_paths list of suite-paths or procedure names or package names or schema names
- * @return array containing root suites-ready to be executed
- *
- */
- --TODO:Zerknij czy mozna wywalic
- function configure_execution_by_path(a_paths ut_varchar2_list, a_random_seed positive := null) return ut_suite_items;
-
- /**
- * Builds a hierarchical suites based on given suite-paths
- *
- * @param a_paths list of suite-paths or procedure names or package names or schema names
- * @param a_suites returned array containing root suites-ready to be executed
- *
- */
- procedure configure_execution_by_path(
- a_paths in ut_varchar2_list,
- a_suites out nocopy ut_suite_items,
- a_random_seed in positive := null,
- a_tags in varchar2 := null
- );
-
- /**
- * Cleanup paths by removing leading/trailing whitespace and making paths lowercase
- * Get list of schema names from execution paths.
- */
- function get_schema_names(a_paths ut_varchar2_list) return ut_varchar2_rows;
-
-
- /**
- * Constructs a list of suites based on the list of annotations passed
- * the suites are stored in cache
- */
- function build_suites_from_annotations(
- a_owner_name varchar2,
- a_annotated_objects sys_refcursor,
- a_path varchar2 := null,
- a_object_name varchar2 := null,
- a_procedure_name varchar2 := null,
- a_skip_all_objects boolean := false
- ) return ut_suite_items;
-
-
- /**
- * Returns a ref cursor containing information about unit test suites and the tests contained in them
- *
- * @param a_paths list of paths to be resolved and return a suites.
- */
- function get_suites_info(
- a_paths ut_varchar2_list
- ) return sys_refcursor;
-
- /**
- * Returns true if given suite item exists
- *
- * @param a_owner owner of items to retrieve
- * @param a_package_name name of suite package (optional)
- * @param a_procedure_name name of suite item (optional)
- * @param a_item_type suite_item type (optional)
- * @return ut_suite_items_info table of objects
- */
- function suite_item_exists(
- a_owner_name varchar2,
- a_package_name varchar2 := null,
- a_procedure_name varchar2 := null
- ) return boolean;
-
-
-end ut_suite_manager;
-/
diff --git a/source/core/ut_suite_tag_filter.pkb b/source/core/ut_suite_tag_filter.pkb
deleted file mode 100644
index 2d9436301..000000000
--- a/source/core/ut_suite_tag_filter.pkb
+++ /dev/null
@@ -1,295 +0,0 @@
-create or replace package body ut_suite_tag_filter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2023 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Constants use in postfix and infix transformations
- */
- gc_operators constant ut_varchar2_list := ut_varchar2_list('|','&','!');
- gc_unary_operators constant ut_varchar2_list := ut_varchar2_list('!'); -- right side associative operator
- gc_binary_operators constant ut_varchar2_list := ut_varchar2_list('|','&'); -- left side associative operator
- gc_reserved_tag_words constant ut_varchar2_list := ut_varchar2_list('none','any');
- gc_tags_column_name constant varchar2(250) := 'tags';
- gc_exception_msg constant varchar2(200) := 'Invalid tag expression';
-
- type t_precedence_table is table of number index by varchar2(1);
- g_precedence t_precedence_table;
-
- function tokenize_tags_string(a_tags in varchar2) return ut_varchar2_list is
- l_tags_tokens ut_varchar2_list := ut_varchar2_list();
- begin
- --Tokenize a string into operators and tags
- select regexp_substr(a_tags,'([^!()|&]+)|([!()|&])', 1, level) as string_parts
- bulk collect into l_tags_tokens
- from dual connect by regexp_substr (a_tags, '([^!()|&]+)|([!()|&])', 1, level) is not null;
-
- return l_tags_tokens;
- end;
-
- /*
- To support a legact tag notation
- , = OR
- - = NOT
- we will perform a replace of that characters into
- new notation.
- | = OR
- & = AND
- ! = NOT
- */
- function replace_legacy_tag_notation(a_tags varchar2
- ) return varchar2 is
- l_tags ut_varchar2_list := ut_utils.string_to_table(a_tags,',');
- l_tags_include varchar2(4000);
- l_tags_exclude varchar2(4000);
- l_return_tag varchar2(4000);
- begin
- if instr(a_tags,',') > 0 or instr(a_tags,'-') > 0 then
-
- select '('||listagg( t.column_value,'|')
- within group( order by column_value)||')'
- into l_tags_include
- from table(l_tags) t
- where t.column_value not like '-%';
-
- select '('||listagg( replace(t.column_value,'-','!'),' & ')
- within group( order by column_value)||')'
- into l_tags_exclude
- from table(l_tags) t
- where t.column_value like '-%';
-
-
- l_return_tag:=
- case
- when l_tags_include <> '()' and l_tags_exclude <> '()'
- then l_tags_include || ' & ' || l_tags_exclude
- when l_tags_include <> '()'
- then l_tags_include
- when l_tags_exclude <> '()'
- then l_tags_exclude
- end;
- else
- l_return_tag := a_tags;
- end if;
- return l_return_tag;
- end;
-
- /*
- https://stackoverflow.com/questions/29634992/shunting-yard-validate-expression
- */
- function shunt_logical_expression(a_tags in ut_varchar2_list) return ut_varchar2_list is
- l_operator_stack ut_stack := ut_stack();
- l_rnp_tokens ut_varchar2_list := ut_varchar2_list();
- l_token varchar2(32767);
- l_expect_operand boolean := true;
- l_expect_operator boolean := false;
- l_idx pls_integer;
- begin
- l_idx := a_tags.first;
- --Exuecute modified shunting algorithm
- WHILE (l_idx is not null) loop
- l_token := a_tags(l_idx);
- if (l_token member of gc_operators and l_token member of gc_binary_operators) then
- if not(l_expect_operator) then
- raise_application_error(ut_utils.gc_invalid_tag_expression, gc_exception_msg);
- end if;
- while l_operator_stack.top > 0 and (g_precedence(l_operator_stack.peek) > g_precedence(l_token)) loop
- l_rnp_tokens.extend;
- l_rnp_tokens(l_rnp_tokens.last) := l_operator_stack.pop;
- end loop;
- l_operator_stack.push(a_tags(l_idx));
- l_expect_operand := true;
- l_expect_operator:= false;
- elsif (l_token member of gc_operators and l_token member of gc_unary_operators) then
- if not(l_expect_operand) then
- raise_application_error(ut_utils.gc_invalid_tag_expression, gc_exception_msg);
- end if;
- l_operator_stack.push(a_tags(l_idx));
- l_expect_operand := true;
- l_expect_operator:= false;
- elsif l_token = '(' then
- if not(l_expect_operand) then
- raise_application_error(ut_utils.gc_invalid_tag_expression, gc_exception_msg);
- end if;
- l_operator_stack.push(a_tags(l_idx));
- l_expect_operand := true;
- l_expect_operator:= false;
- elsif l_token = ')' then
- if not(l_expect_operator) then
- raise_application_error(ut_utils.gc_invalid_tag_expression, gc_exception_msg);
- end if;
- while l_operator_stack.peek <> '(' loop
- l_rnp_tokens.extend;
- l_rnp_tokens(l_rnp_tokens.last) := l_operator_stack.pop;
- end loop;
- l_operator_stack.pop; --Pop the open bracket and discard it
- l_expect_operand := false;
- l_expect_operator:= true;
- else
- if not(l_expect_operand) then
- raise_application_error(ut_utils.gc_invalid_tag_expression, gc_exception_msg);
- end if;
- l_rnp_tokens.extend;
- l_rnp_tokens(l_rnp_tokens.last) :=l_token;
- l_expect_operator := true;
- l_expect_operand := false;
- end if;
-
- l_idx := a_tags.next(l_idx);
- end loop;
-
- while l_operator_stack.peek is not null loop
- if l_operator_stack.peek in ('(',')') then
- raise_application_error(ut_utils.gc_invalid_tag_expression, gc_exception_msg);
- end if;
- l_rnp_tokens.extend;
- l_rnp_tokens(l_rnp_tokens.last):=l_operator_stack.pop;
- end loop;
-
- return l_rnp_tokens;
- end shunt_logical_expression;
-
- function conv_postfix_to_infix_sql(a_postfix_exp in ut_varchar2_list,a_tags_column_name in varchar2)
- return varchar2 is
- l_infix_stack ut_stack := ut_stack();
- l_right_side varchar2(32767);
- l_left_side varchar2(32767);
- l_infix_exp varchar2(32767);
- l_member_token varchar2(20) := ' member of '||a_tags_column_name;
- l_idx pls_integer;
- begin
- l_idx := a_postfix_exp.first;
- while ( l_idx is not null) loop
- --If the token we got is a none or any keyword
- if a_postfix_exp(l_idx) member of gc_reserved_tag_words then
-
- l_infix_stack.push(
- case
- when a_postfix_exp(l_idx) = 'none' then '('||a_tags_column_name||' is empty or '||a_tags_column_name||' is null)'
- else a_tags_column_name||' is not empty'
- end
- );
- --If token is operand but also single tag
- elsif regexp_count(a_postfix_exp(l_idx),'[!()|&]') = 0 then
- l_infix_stack.push(q'[']'||a_postfix_exp(l_idx)||q'[']'||l_member_token);
- --If token is unary operator not
- elsif a_postfix_exp(l_idx) member of gc_unary_operators then
- l_right_side := l_infix_stack.pop;
- l_infix_exp := a_postfix_exp(l_idx)||'('||l_right_side||')';
- l_infix_stack.push(l_infix_exp);
- --If token is binary operator
- elsif a_postfix_exp(l_idx) member of gc_binary_operators then
- l_right_side := l_infix_stack.pop;
- l_left_side := l_infix_stack.pop;
- l_infix_exp := '('||l_left_side||a_postfix_exp(l_idx)||l_right_side||')';
- l_infix_stack.push(l_infix_exp);
- end if;
- l_idx := a_postfix_exp.next(l_idx);
- end loop;
-
- return l_infix_stack.pop;
- end conv_postfix_to_infix_sql;
-
- function create_where_filter(a_tags varchar2
- ) return varchar2 is
- l_tags varchar2(4000);
- begin
- l_tags := replace(replace_legacy_tag_notation(a_tags),' ');
- l_tags := conv_postfix_to_infix_sql(shunt_logical_expression(tokenize_tags_string(l_tags)),gc_tags_column_name);
- l_tags := replace(l_tags, '|',' or ');
- l_tags := replace(l_tags ,'&',' and ');
- l_tags := replace(l_tags ,'!','not');
- return l_tags;
- end;
-
-
- /*
- Having a base set of suites we will do a further filter down if there are
- any tags defined.
- */
- function get_tags_suites (
- a_suite_items ut_suite_cache_rows,
- a_tags varchar2
- ) return ut_suite_cache_rows is
- l_suite_tags ut_suite_cache_rows := ut_suite_cache_rows();
- l_sql varchar2(32000);
- l_tags varchar2(4000):= create_where_filter(a_tags);
- begin
- l_sql :=
- q'[
-with
- suites_mv as (
- select c.id,value(c) as obj,c.path as path,c.self_type,c.object_owner,c.tags as ]'||gc_tags_column_name||q'[
- from table(:suite_items) c
- ),
- suites_matching_expr as (
- select c.id,c.path as path,c.self_type,c.object_owner,c.tags
- from suites_mv c
- where c.self_type in ('UT_SUITE','UT_CONTEXT')
- and ]'||l_tags||q'[
- ),
- tests_matching_expr as (
- select c.id,c.path as path,c.self_type,c.object_owner,c.tags as ]'||gc_tags_column_name||q'[
- from suites_mv c where c.self_type in ('UT_TEST')
- and ]'||l_tags||q'[
- ),
- tests_with_tags_inh_from_suite as (
- select c.id,c.self_type,c.path,c.tags multiset union distinct t.tags as ]'||gc_tags_column_name||q'[ ,c.object_owner
- from suites_mv c join suites_matching_expr t
- on (c.path||'.' like t.path || '.%' /*all descendants and self*/ and c.object_owner = t.object_owner)
- ),
- tests_with_tags_prom_to_suite as (
- select c.id,c.self_type,c.path,c.tags multiset union distinct t.tags as ]'||gc_tags_column_name||q'[ ,c.object_owner
- from suites_mv c join tests_matching_expr t
- on (t.path||'.' like c.path || '.%' /*all ancestors and self*/ and c.object_owner = t.object_owner)
- )
- select obj from suites_mv c,
- (select id,row_number() over (partition by id order by id) r_num from
- (select id
- from tests_with_tags_prom_to_suite tst
- where ]'||l_tags||q'[
- union all
- select id from tests_with_tags_inh_from_suite tst
- where ]'||l_tags||q'[
- )
- ) t where c.id = t.id and r_num = 1 ]';
- execute immediate l_sql bulk collect into l_suite_tags using a_suite_items;
- return l_suite_tags;
- end;
-
- function apply(
- a_unfiltered_rows ut_suite_cache_rows,
- a_tags varchar2 := null
- ) return ut_suite_cache_rows is
- l_suite_items ut_suite_cache_rows := a_unfiltered_rows;
- begin
- if length(a_tags) > 0 then
- l_suite_items := get_tags_suites(l_suite_items,a_tags);
- end if;
-
- return l_suite_items;
- end;
-
-begin
- --Define operators precedence
- g_precedence('!'):=4;
- g_precedence('&'):=3;
- g_precedence('|'):=2;
- g_precedence(')'):=1;
- g_precedence('('):=1;
-
-end ut_suite_tag_filter;
-/
diff --git a/source/core/ut_suite_tag_filter.pks b/source/core/ut_suite_tag_filter.pks
deleted file mode 100644
index e824ae275..000000000
--- a/source/core/ut_suite_tag_filter.pks
+++ /dev/null
@@ -1,55 +0,0 @@
-create or replace package ut_suite_tag_filter authid definer is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2023 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Package that will filter suites by tags
- *
- */
-
- /*
- * Return table of tokens character by character
- */
- function tokenize_tags_string(a_tags in varchar2) return ut_varchar2_list;
-
- /*
- * Function that uses Dijkstra algorithm to parse mathematical and logical expression
- * and return a list of elements in Reverse Polish Notation ( postfix )
- * As part of execution it will validate expression.
- */
- function shunt_logical_expression(a_tags in ut_varchar2_list) return ut_varchar2_list;
-
- /*
- * Function that converts postfix notation into infix and creating a string of sql filter
- * that checking a tags collections for tags according to posted logic.
- */
- function conv_postfix_to_infix_sql(a_postfix_exp in ut_varchar2_list,a_tags_column_name in varchar2)
- return varchar2;
-
- /*
- * Generates a part where clause sql
- */
- function create_where_filter(a_tags varchar2)
- return varchar2;
-
- function apply(
- a_unfiltered_rows ut_suite_cache_rows,
- a_tags varchar2 := null
- ) return ut_suite_cache_rows;
-
-end ut_suite_tag_filter;
-/
diff --git a/source/core/ut_utils.pkb b/source/core/ut_utils.pkb
deleted file mode 100644
index 81d47221b..000000000
--- a/source/core/ut_utils.pkb
+++ /dev/null
@@ -1,1028 +0,0 @@
-create or replace package body ut_utils is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Constants regex used to validate XML name
- */
- gc_invalid_first_xml_char constant varchar2(50) := '[^_[:alpha:]]';
- gc_invalid_xml_char constant varchar2(50) := '[^_[:alnum:]\.-]';
- gc_full_valid_xml_name constant varchar2(50) := '^([[:alpha:]])([_[:alnum:]\.-])*$';
- gc_owner_hash constant integer(11) := dbms_utility.get_hash_value( ut_owner(), 0, power(2,31)-1);
-
-
- function surround_with(a_value varchar2, a_quote_char varchar2) return varchar2 is
- begin
- return case when a_quote_char is not null then a_quote_char||a_value||a_quote_char else a_value end;
- end;
-
- function test_result_to_char(a_test_result integer) return varchar2 as
- l_result varchar2(20);
- begin
- if a_test_result = gc_success then
- l_result := gc_success_char;
- elsif a_test_result = gc_failure then
- l_result := gc_failure_char;
- elsif a_test_result = gc_error then
- l_result := gc_error_char;
- elsif a_test_result = gc_disabled then
- l_result := gc_disabled_char;
- else
- l_result := 'Unknown(' || coalesce(to_char(a_test_result),'NULL') || ')';
- end if ;
- return l_result;
- end test_result_to_char;
-
-
- function to_test_result(a_test boolean) return integer is
- l_result integer;
- begin
- if a_test then
- l_result := gc_success;
- else
- l_result := gc_failure;
- end if;
- return l_result;
- end;
-
- function gen_savepoint_name return varchar2 is
- begin
- return 's'||gc_owner_hash||trim(to_char(ut_savepoint_seq.nextval,'00000000000000000'));
- end;
-
- procedure debug_log(a_message varchar2) is
- begin
- $if $$ut_trace $then
- dbms_output.put_line(a_message);
- $else
- null;
- $end
- end;
-
- procedure debug_log(a_message clob) is
- l_varchars ut_varchar2_list;
- begin
- $if $$ut_trace $then
- l_varchars := clob_to_table(a_message);
- for i in 1..l_varchars.count loop
- dbms_output.put_line(l_varchars(i));
- end loop;
- $else
- null;
- $end
- end;
-
- function to_string(
- a_value varchar2,
- a_quote_char varchar2 := '''',
- a_max_output_len in number := gc_max_output_string_length
- ) return varchar2 is
- l_result varchar2(32767);
- c_length constant integer := coalesce( lengthb( a_value ), 0 );
- c_max_input_string_length constant integer := a_max_output_len - coalesce( lengthb( a_quote_char ) * 2, 0 );
- c_overflow_substr_len constant integer := c_max_input_string_length - gc_more_data_string_len;
- begin
- if c_length = 0 then
- l_result := gc_null_string;
- elsif c_length <= c_max_input_string_length then
- l_result := surround_with(a_value, a_quote_char);
- else
- l_result := surround_with(substr(a_value, 1, c_overflow_substr_len ), a_quote_char) || gc_more_data_string;
- end if ;
- return l_result;
- end;
-
- function to_string(
- a_value clob,
- a_quote_char varchar2 := '''',
- a_max_output_len in number := gc_max_output_string_length
- ) return varchar2 is
- l_result varchar2(32767);
- c_length constant integer := coalesce(ut_utils.lengthb_clob(a_value), 0);
- c_max_input_string_length constant integer := a_max_output_len - coalesce( lengthb( a_quote_char ) * 2, 0 );
- c_overflow_substr_len constant integer := c_max_input_string_length - gc_more_data_string_len;
- begin
- if a_value is null then
- l_result := gc_null_string;
- elsif c_length = 0 then
- l_result := gc_empty_string;
- elsif c_length <= c_max_input_string_length then
- l_result := surround_with(a_value,a_quote_char);
- else
- l_result := surround_with(dbms_lob.substr(a_value, c_overflow_substr_len), a_quote_char) || gc_more_data_string;
- end if;
- return l_result;
- end;
-
- function to_string(
- a_value blob,
- a_quote_char varchar2 := '''',
- a_max_output_len in number := gc_max_output_string_length
- ) return varchar2 is
- l_result varchar2(32767);
- c_length constant integer := coalesce(dbms_lob.getlength(a_value), 0);
- c_max_input_string_length constant integer := a_max_output_len - coalesce( lengthb( a_quote_char ) * 2, 0 );
- c_overflow_substr_len constant integer := c_max_input_string_length - gc_more_data_string_len;
- begin
- if a_value is null then
- l_result := gc_null_string;
- elsif c_length = 0 then
- l_result := gc_empty_string;
- elsif c_length <= c_max_input_string_length then
- l_result := surround_with(rawtohex(a_value),a_quote_char);
- else
- l_result := to_string( rawtohex(dbms_lob.substr(a_value, c_overflow_substr_len)) );
- end if ;
- return l_result;
- end;
-
- function to_string(a_value boolean) return varchar2 is
- begin
- return case a_value when true then 'TRUE' when false then 'FALSE' else gc_null_string end;
- end;
-
- function to_string(a_value number) return varchar2 is
- begin
- return coalesce(to_char(a_value,gc_number_format), gc_null_string);
- end;
-
- function to_string(a_value date) return varchar2 is
- begin
- return coalesce(to_char(a_value,gc_date_format), gc_null_string);
- end;
-
- function to_string(a_value timestamp_unconstrained) return varchar2 is
- begin
- return coalesce(to_char(a_value,gc_timestamp_format), gc_null_string);
- end;
-
- function to_string(a_value timestamp_tz_unconstrained) return varchar2 is
- begin
- return coalesce(to_char(a_value,gc_timestamp_tz_format), gc_null_string);
- end;
-
- function to_string(a_value timestamp_ltz_unconstrained) return varchar2 is
- begin
- return coalesce(to_char(a_value,gc_timestamp_format), gc_null_string);
- end;
-
- function to_string(a_value yminterval_unconstrained) return varchar2 IS
- begin
- return coalesce(to_char(a_value), gc_null_string);
- end;
-
- function to_string(a_value dsinterval_unconstrained) return varchar2 IS
- begin
- return coalesce(to_char(a_value), gc_null_string);
- end;
-
-
- function boolean_to_int(a_value boolean) return integer is
- begin
- return case a_value when true then 1 when false then 0 end;
- end;
-
- function int_to_boolean(a_value integer) return boolean is
- begin
- return case a_value when 1 then true when 0 then false end;
- end;
-
- function string_to_table(a_string varchar2, a_delimiter varchar2:= chr(10), a_skip_leading_delimiter varchar2 := 'N') return ut_varchar2_list is
- l_offset integer := 1;
- l_delimiter_position integer;
- l_skip_leading_delimiter boolean := coalesce(a_skip_leading_delimiter = 'Y',false);
- l_result ut_varchar2_list := ut_varchar2_list();
- begin
- if a_string is null then
- return l_result;
- end if;
- if a_delimiter is null then
- return ut_varchar2_list(a_string);
- end if;
-
- loop
- l_delimiter_position := instr(a_string, a_delimiter, l_offset);
- if not (l_delimiter_position = 1 and l_skip_leading_delimiter) then
- l_result.extend;
- if l_delimiter_position > 0 then
- l_result(l_result.last) := substr(a_string, l_offset, l_delimiter_position - l_offset);
- else
- l_result(l_result.last) := substr(a_string, l_offset);
- end if;
- end if;
- exit when l_delimiter_position = 0;
- l_offset := l_delimiter_position + 1;
- end loop;
- return l_result;
- end;
-
- function string_table_to_table(a_list ut_varchar2_list, a_delimiter varchar2:= chr(10), a_skip_leading_delimiter varchar2 := 'N') return ut_varchar2_list is
- l_result ut_varchar2_list;
- begin
- if a_delimiter is null then
- l_result := a_list;
- elsif a_list is not empty then
- for i in 1 .. a_list.count loop
- ut_utils.append_to_list(l_result, ut_utils.string_to_table(a_list(i), a_delimiter, a_skip_leading_delimiter) );
- end loop;
- end if;
- return l_result;
- end;
-
- function clob_to_table(a_clob clob, a_max_amount integer := 8191, a_delimiter varchar2:= chr(10)) return ut_varchar2_list is
- l_offset integer := 1;
- l_length integer := dbms_lob.getlength(a_clob);
- l_amount integer;
- l_buffer varchar2(32767);
- l_last_line varchar2(32767);
- l_string_results ut_varchar2_list;
- l_results ut_varchar2_list := ut_varchar2_list();
- l_has_last_line boolean;
- l_skip_leading_delimiter varchar2(1) := 'N';
- begin
- while l_offset <= l_length loop
- l_amount := a_max_amount - coalesce( length(l_last_line), 0 );
--- dbms_lob.read(a_clob, l_amount, l_offset, l_buffer);
- l_buffer := substr(a_clob, l_offset, l_amount);
- l_amount := length(l_buffer);
- l_offset := l_offset + l_amount;
-
- l_string_results := string_to_table( l_last_line || l_buffer, a_delimiter, l_skip_leading_delimiter );
- for i in 1 .. l_string_results.count loop
- --if a split of lines was not done or not at the last line
- if l_string_results.count = 1 or i < l_string_results.count then
- l_results.extend;
- l_results(l_results.last) := l_string_results(i);
- end if;
- end loop;
-
- --check if we need to append the last line to the next element
- if l_string_results.count = 1 then
- l_has_last_line := false;
- l_last_line := null;
- elsif l_string_results.count > 1 then
- l_has_last_line := true;
- l_last_line := l_string_results(l_string_results.count);
- end if;
-
- l_skip_leading_delimiter := 'Y';
- end loop;
- if l_has_last_line then
- l_results.extend;
- l_results(l_results.last) := l_last_line;
- end if;
- return l_results;
- end;
-
- function table_to_clob(a_text_table ut_varchar2_list, a_delimiter varchar2:= chr(10)) return clob is
- l_result clob;
- l_table_rows integer := coalesce(cardinality(a_text_table),0);
- begin
- for i in 1 .. l_table_rows loop
- if i < l_table_rows then
- append_to_clob(l_result, a_text_table(i)||a_delimiter);
- else
- append_to_clob(l_result, a_text_table(i));
- end if;
- end loop;
- return l_result;
- end;
-
- function table_to_clob(a_text_table ut_varchar2_rows, a_delimiter varchar2:= chr(10)) return clob is
- l_result clob;
- l_table_rows integer := coalesce(cardinality(a_text_table),0);
- begin
- for i in 1 .. l_table_rows loop
- if i < l_table_rows then
- append_to_clob(l_result, a_text_table(i)||a_delimiter);
- else
- append_to_clob(l_result, a_text_table(i));
- end if;
- end loop;
- return l_result;
- end;
-
- function table_to_clob(a_integer_table ut_integer_list, a_delimiter varchar2:= chr(10)) return clob is
- l_result clob;
- l_table_rows integer := coalesce(cardinality(a_integer_table),0);
- begin
- for i in 1 .. l_table_rows loop
- if i < l_table_rows then
- append_to_clob(l_result, a_integer_table(i)||a_delimiter);
- else
- append_to_clob(l_result, a_integer_table(i));
- end if;
- end loop;
- return l_result;
- end;
-
- function time_diff(a_start_time timestamp with time zone, a_end_time timestamp with time zone) return number is
- begin
- return
- extract(day from(a_end_time - a_start_time)) * 24 * 60 * 60 +
- extract(hour from(a_end_time - a_start_time)) * 60 * 60 +
- extract(minute from(a_end_time - a_start_time)) * 60 +
- extract(second from(a_end_time - a_start_time));
- end;
-
- function indent_lines(a_text varchar2, a_indent_size integer := 4, a_include_first_line boolean := false) return varchar2 is
- begin
- if a_include_first_line then
- return rtrim(lpad( ' ', a_indent_size ) || replace( a_text, chr(10), chr(10) || lpad( ' ', a_indent_size ) ));
- else
- return rtrim(replace( a_text, chr(10), chr(10) || lpad( ' ', a_indent_size ) ));
- end if;
- end;
-
- function get_utplsql_objects_list return ut_object_names is
- l_result ut_object_names;
- begin
- select /*+ no_parallel */ distinct ut_object_name(sys_context('userenv','current_user'), o.object_name)
- bulk collect into l_result
- from user_objects o
- where o.object_name = 'UT' or object_name like 'UT\_%' escape '\'
- and o.object_type <> 'SYNONYM';
- return l_result;
- end;
-
- procedure append_to_list(a_list in out nocopy ut_varchar2_list, a_item varchar2) is
- begin
- if a_item is not null then
- if a_list is null then
- a_list := ut_varchar2_list();
- end if;
- a_list.extend;
- a_list(a_list.last) := a_item;
- end if;
- end append_to_list;
-
- procedure append_to_list(a_list in out nocopy ut_varchar2_rows, a_items ut_varchar2_rows) is
- begin
- if a_items is not null then
- if a_list is null then
- a_list := ut_varchar2_rows();
- end if;
- for i in 1 .. a_items.count loop
- a_list.extend;
- a_list(a_list.last) := a_items(i);
- end loop;
- end if;
- end;
-
- procedure append_to_list(a_list in out nocopy ut_varchar2_list, a_items ut_varchar2_list) is
- begin
- if a_items is not null then
- if a_list is null then
- a_list := ut_varchar2_list();
- end if;
- for i in 1 .. a_items.count loop
- a_list.extend;
- a_list(a_list.last) := a_items(i);
- end loop;
- end if;
- end;
-
- procedure append_to_list(a_list in out nocopy ut_varchar2_rows, a_item clob) is
- begin
- append_to_list(
- a_list,
- convert_collection(
- clob_to_table( a_item, ut_utils.gc_max_storage_varchar2_len )
- )
- );
- end;
-
- procedure append_to_list(a_list in out nocopy ut_varchar2_rows, a_item varchar2) is
- begin
- if a_item is not null then
- if a_list is null then
- a_list := ut_varchar2_rows();
- end if;
- if lengthb(a_item) > gc_max_storage_varchar2_len then
- append_to_list(
- a_list,
- ut_utils.convert_collection(
- ut_utils.clob_to_table( a_item, gc_max_storage_varchar2_len )
- )
- );
- else
- a_list.extend;
- a_list(a_list.last) := a_item;
- end if;
- end if;
- end append_to_list;
-
- procedure append_to_clob(a_src_clob in out nocopy clob, a_clob_table t_clob_tab, a_delimiter varchar2:= chr(10)) is
- begin
- if a_clob_table is not null and cardinality(a_clob_table) > 0 then
- if a_src_clob is null then
- dbms_lob.createtemporary(a_src_clob, true);
- end if;
- for i in 1 .. a_clob_table.count loop
- dbms_lob.append(a_src_clob,a_clob_table(i));
- if i < a_clob_table.count then
- append_to_clob(a_src_clob,a_delimiter);
- end if;
- end loop;
- end if;
- end;
-
- procedure append_to_clob(a_src_clob in out nocopy clob, a_new_data clob) is
- begin
- if a_new_data is not null and dbms_lob.getlength(a_new_data) > 0 then
- if a_src_clob is null then
- dbms_lob.createtemporary(a_src_clob, true);
- end if;
- dbms_lob.append(a_src_clob, a_new_data);
- end if;
- end;
-
- procedure append_to_clob(a_src_clob in out nocopy clob, a_new_data varchar2) is
- begin
- if a_new_data is not null then
- if a_src_clob is null then
- dbms_lob.createtemporary(a_src_clob, true);
- end if;
- dbms_lob.writeappend(a_src_clob, dbms_lob.getlength(a_new_data), a_new_data);
- end if;
- end;
-
- function convert_collection(a_collection ut_varchar2_list) return ut_varchar2_rows is
- l_result ut_varchar2_rows;
- begin
- if a_collection is not null then
- l_result := ut_varchar2_rows();
- for i in 1 .. a_collection.count loop
- l_result.extend();
- l_result(i) := substrb(a_collection(i),1,gc_max_storage_varchar2_len);
- end loop;
- end if;
- return l_result;
- end;
-
- function to_xpath(a_list varchar2, a_ancestors varchar2 := '/*/') return varchar2 is
- l_xpath varchar2(32767) := a_list;
- begin
- l_xpath := to_xpath( clob_to_table(a_clob=>a_list, a_delimiter=>','), a_ancestors);
- return l_xpath;
- end;
-
- function to_xpath(a_list ut_varchar2_list, a_ancestors varchar2 := '/*/') return varchar2 is
- l_xpath varchar2(32767);
- l_item varchar2(32767);
- l_iter integer;
- begin
- if a_list is not null then
- l_iter := a_list.first;
- while l_iter is not null loop
- l_item := trim(a_list(l_iter));
- if l_item is not null then
- if l_item like '%,%' then
- l_xpath := l_xpath || to_xpath( l_item, a_ancestors ) || '|';
- elsif l_item like '/%' then
- l_xpath := l_xpath || l_item || '|';
- else
- l_xpath := l_xpath || a_ancestors || l_item || '|';
- end if;
- end if;
- l_iter := a_list.next(l_iter);
- end loop;
- l_xpath := rtrim(l_xpath,',|');
- end if;
- return l_xpath;
- end;
-
- function to_version(a_version_no varchar2) return t_version is
- l_result t_version;
- c_version_part_regex constant varchar2(20) := '[0-9]+';
- begin
-
- if regexp_like(a_version_no,'v?([0-9]+(\.|$)){1,4}') then
- l_result.major := regexp_substr(a_version_no, c_version_part_regex, 1, 1);
- l_result.minor := regexp_substr(a_version_no, c_version_part_regex, 1, 2);
- l_result.bugfix := regexp_substr(a_version_no, c_version_part_regex, 1, 3);
- l_result.build := regexp_substr(a_version_no, c_version_part_regex, 1, 4);
- else
- raise_application_error(gc_invalid_version_no, 'Version string "'||a_version_no||'" is not a valid version');
- end if;
- return l_result;
- end;
-
- procedure save_dbms_output_to_cache is
- l_status number;
- l_line varchar2(32767);
- l_offset integer := 0;
- l_lines ut_varchar2_rows := ut_varchar2_rows();
- c_lines_limit constant integer := 100;
- pragma autonomous_transaction;
-
- procedure flush_lines(a_lines ut_varchar2_rows, a_offset integer) is
- begin
- if a_lines is not empty then
- insert /*+ no_parallel */ into ut_dbms_output_cache (seq_no,text)
- select /*+ no_parallel */ rownum+a_offset, column_value
- from table(a_lines);
- end if;
- end;
- begin
- loop
- dbms_output.get_line(line => l_line, status => l_status);
- exit when l_status = 1;
- l_lines := l_lines multiset union all ut_utils.convert_collection(ut_utils.clob_to_table(l_line||chr(7),4000));
- if l_lines.count > c_lines_limit then
- flush_lines(l_lines, l_offset);
- l_offset := l_offset + l_lines.count;
- l_lines.delete;
- end if;
- end loop;
- flush_lines(l_lines, l_offset);
- commit;
- end;
-
- procedure read_cache_to_dbms_output is
- l_lines_data sys_refcursor;
- l_lines ut_varchar2_rows;
- c_lines_limit constant integer := 10000;
- pragma autonomous_transaction;
- begin
- open l_lines_data for select /*+ no_parallel */ text from ut_dbms_output_cache order by seq_no;
- loop
- fetch l_lines_data bulk collect into l_lines limit c_lines_limit;
- for i in 1 .. l_lines.count loop
- if substr(l_lines(i),-1) = chr(7) then
- dbms_output.put_line(rtrim(l_lines(i),chr(7)));
- else
- dbms_output.put(l_lines(i));
- end if;
- end loop;
- exit when l_lines_data%notfound;
- end loop;
- close l_lines_data;
- execute immediate 'truncate table ut_dbms_output_cache';
- commit;
- end;
-
- function ut_owner return varchar2 is
- begin
- return qualified_sql_name( sys_context('userenv','current_schema') );
- end;
-
- function scale_cardinality(a_cardinality natural) return natural is
- begin
- return case when a_cardinality > 0 then trunc(power(10,(floor(log(10,a_cardinality))+1))/3) else 1 end;
- end;
-
- function build_depreciation_warning(a_old_syntax varchar2, a_new_syntax varchar2) return varchar2 is
- begin
- return 'The syntax: "'||a_old_syntax||'" is deprecated.' ||chr(10)||
- 'Please use the new syntax: "'||a_new_syntax||'".' ||chr(10)||
- 'The deprecated syntax will not be supported in future releases.';
- end;
-
- function to_xml_number_format(a_value number) return varchar2 is
- begin
- return to_char(a_value, gc_number_format, 'NLS_NUMERIC_CHARACTERS=''. ''');
- end;
-
- function get_xml_header(a_encoding varchar2) return varchar2 is
- begin
- return
- '';
- end;
-
- function trim_list_elements(a_list ut_varchar2_list, a_regexp_to_trim varchar2 default '[:space:]') return ut_varchar2_list is
- l_trimmed_list ut_varchar2_list;
- l_index integer;
- begin
- if a_list is not null then
- l_trimmed_list := ut_varchar2_list();
- l_index := a_list.first;
-
- while (l_index is not null) loop
- l_trimmed_list.extend;
- l_trimmed_list(l_trimmed_list.count) := regexp_replace(a_list(l_index), '(^['||a_regexp_to_trim||']*)|(['||a_regexp_to_trim||']*$)');
- l_index := a_list.next(l_index);
- end loop;
- end if;
-
- return l_trimmed_list;
- end;
-
- function filter_list(a_list in ut_varchar2_list, a_regexp_filter in varchar2) return ut_varchar2_list is
- l_filtered_list ut_varchar2_list;
- l_index integer;
- begin
- if a_list is not null then
- l_filtered_list := ut_varchar2_list();
- l_index := a_list.first;
- while (l_index is not null) loop
- if regexp_like(a_list(l_index), a_regexp_filter) then
- l_filtered_list.extend;
- l_filtered_list(l_filtered_list.count) := a_list(l_index);
- end if;
- l_index := a_list.next(l_index);
- end loop;
- end if;
-
- return l_filtered_list;
- end;
-
- function xmlgen_escaped_string(a_string in varchar2) return varchar2 is
- l_result varchar2(4000) := a_string;
- l_sql varchar2(32767) := q'!select /*+ no_parallel */ q'[!'||a_string||q'!]' as "!'||a_string||'" from dual';
- begin
- if a_string is not null then
- select /*+ no_parallel */ extract(dbms_xmlgen.getxmltype(l_sql),'/*/*/*').getRootElement()
- into l_result
- from dual;
- end if;
- return l_result;
- end;
-
- function replace_multiline_comments(a_source clob) return clob is
- l_result clob;
- l_ml_comment_start binary_integer := 1;
- l_comment_start binary_integer := 1;
- l_text_start binary_integer := 1;
- l_escaped_text_start binary_integer := 1;
- l_escaped_text_end_char varchar2(1 char);
- l_end binary_integer := 1;
- l_ml_comment clob;
- l_newlines_count binary_integer;
- l_offset binary_integer := 1;
- l_length binary_integer := coalesce(dbms_lob.getlength(a_source), 0);
- begin
- l_ml_comment_start := instr(a_source,'/*');
- l_comment_start := instr(a_source,'--');
- l_text_start := instr(a_source,'''');
- l_escaped_text_start := instr(a_source,q'[q']');
- while l_offset > 0 and l_ml_comment_start > 0 loop
-
- if l_ml_comment_start > 0 and (l_ml_comment_start < l_comment_start or l_comment_start = 0)
- and (l_ml_comment_start < l_text_start or l_text_start = 0)and (l_ml_comment_start < l_escaped_text_start or l_escaped_text_start = 0)
- then
- l_end := instr(a_source,'*/',l_ml_comment_start+2);
- append_to_clob(l_result, dbms_lob.substr(a_source, l_ml_comment_start-l_offset, l_offset));
- if l_end > 0 then
- l_ml_comment := substr(a_source, l_ml_comment_start, l_end-l_ml_comment_start);
- l_newlines_count := length( l_ml_comment ) - length( translate( l_ml_comment, 'a'||chr(10), 'a') );
- if l_newlines_count > 0 then
- append_to_clob(l_result, lpad( chr(10), l_newlines_count, chr(10) ) );
- end if;
- l_end := l_end + 2;
- end if;
- else
-
- if l_comment_start > 0 and (l_comment_start < l_ml_comment_start or l_ml_comment_start = 0)
- and (l_comment_start < l_text_start or l_text_start = 0) and (l_comment_start < l_escaped_text_start or l_escaped_text_start = 0)
- then
- l_end := instr(a_source,chr(10),l_comment_start+2);
- if l_end > 0 then
- l_end := l_end + 1;
- end if;
- elsif l_text_start > 0 and (l_text_start < l_ml_comment_start or l_ml_comment_start = 0)
- and (l_text_start < l_comment_start or l_comment_start = 0) and (l_text_start < l_escaped_text_start or l_escaped_text_start = 0)
- then
- l_end := instr(a_source,q'[']',l_text_start+1);
-
- --skip double quotes while searching for end of quoted text
- while l_end > 0 and l_end = instr(a_source,q'['']',l_text_start+1) loop
- l_end := instr(a_source,q'[']',l_end+1);
- end loop;
- if l_end > 0 then
- l_end := l_end + 1;
- end if;
-
- elsif l_escaped_text_start > 0 and (l_escaped_text_start < l_ml_comment_start or l_ml_comment_start = 0)
- and (l_escaped_text_start < l_comment_start or l_comment_start = 0) and (l_escaped_text_start < l_text_start or l_text_start = 0)
- then
- --translate char "[" from the start of quoted text "q'[someting]'" into "]"
- l_escaped_text_end_char := translate( substr(a_source, l_escaped_text_start + 2, 1), '[{(<', ']})>');
- l_end := instr(a_source,l_escaped_text_end_char||'''',l_escaped_text_start + 3 );
- if l_end > 0 then
- l_end := l_end + 2;
- end if;
- end if;
-
- if l_end = 0 then
- append_to_clob(l_result, substr(a_source, l_offset, l_length-l_offset));
- else
- append_to_clob(l_result, substr(a_source, l_offset, l_end-l_offset));
- end if;
- end if;
- l_offset := l_end;
- if l_offset >= l_ml_comment_start then
- l_ml_comment_start := instr(a_source,'/*',l_offset);
- end if;
- if l_offset >= l_comment_start then
- l_comment_start := instr(a_source,'--',l_offset);
- end if;
- if l_offset >= l_text_start then
- l_text_start := instr(a_source,'''',l_offset);
- end if;
- if l_offset >= l_escaped_text_start then
- l_escaped_text_start := instr(a_source,q'[q']',l_offset);
- end if;
- end loop;
- append_to_clob(l_result, substr(a_source, l_end));
- return l_result;
- end;
-
- function get_child_reporters(a_for_reporters ut_reporters_info := null) return ut_reporters_info is
- l_for_reporters ut_reporters_info := a_for_reporters;
- l_results ut_reporters_info;
- begin
- if l_for_reporters is null then
- l_for_reporters := ut_reporters_info(ut_reporter_info('UT_REPORTER_BASE','N','N','N'));
- end if;
-
- select /*+ no_parallel cardinality(f 10) */
- ut_reporter_info(
- object_name => t.type_name,
- is_output_reporter =>
- case
- when f.is_output_reporter = 'Y' or t.type_name = 'UT_OUTPUT_REPORTER_BASE'
- then 'Y' else 'N'
- end,
- is_instantiable => case when t.instantiable = 'YES' then 'Y' else 'N' end,
- is_final => case when t.final = 'YES' then 'Y' else 'N' end
- )
- bulk collect into l_results
- from user_types t
- join (select * from table(l_for_reporters) where is_final = 'N' ) f
- on f.object_name = supertype_name;
-
- return l_results;
- end;
-
- function remove_error_from_stack(a_error_stack varchar2, a_ora_code number) return varchar2 is
- l_caller_stack_line varchar2(4000);
- l_ora_search_pattern varchar2(500) := '^ORA'||a_ora_code||': (.*)$';
- begin
- l_caller_stack_line := regexp_replace(srcstr => a_error_stack
- ,pattern => l_ora_search_pattern
- ,replacestr => null
- ,position => 1
- ,occurrence => 1
- ,modifier => 'm');
- return l_caller_stack_line;
- end;
-
- /**
- * Change string into unicode to match xmlgen format _00_
- * See the section of Oracle documentation called: Escape of Characters in Generated XML Data
- * https://docs.oracle.com/en/database/oracle/oracle-database/12.2/adxdb/generation-of-XML-data-from-relational-data.html#GUID-5BE09A7D-80D8-4734-B9AF-4A61F27FA9B2
- */
- function char_to_xmlgen_unicode(a_character varchar2) return varchar2 is
- begin
- return '_x00'||rawtohex(utl_raw.cast_to_raw(a_character))||'_';
- end;
-
- /**
- * Build valid XML column name as element names can contain letters, digits, hyphens, underscores, and periods
- */
- function build_valid_xml_name(a_preprocessed_name varchar2) return varchar2 is
- l_post_processed varchar2(4000);
- begin
- for i in (select /*+ no_parallel */ regexp_substr( a_preprocessed_name ,'(.{1})', 1, level, null, 1 ) AS string_char,level level_no
- from dual connect by level <= regexp_count(a_preprocessed_name, '(.{1})'))
- loop
- if i.level_no = 1 and regexp_like(i.string_char,gc_invalid_first_xml_char) then
- l_post_processed := l_post_processed || char_to_xmlgen_unicode(i.string_char);
- elsif regexp_like(i.string_char,gc_invalid_xml_char) then
- l_post_processed := l_post_processed || char_to_xmlgen_unicode(i.string_char);
- else
- l_post_processed := l_post_processed || i.string_char;
- end if;
- end loop;
- return l_post_processed;
- end;
-
- function get_valid_xml_name(a_name varchar2) return varchar2 is
- l_valid_name varchar2(4000);
- begin
- if regexp_like(a_name,gc_full_valid_xml_name) then
- l_valid_name := a_name;
- else
- l_valid_name := build_valid_xml_name(a_name);
- end if;
- return l_valid_name;
- end;
-
- function to_cdata(a_lines ut_varchar2_rows) return ut_varchar2_rows is
- l_results ut_varchar2_rows;
- begin
- if a_lines is not empty then
- ut_utils.append_to_list( l_results, gc_cdata_start_tag);
- for i in 1 .. a_lines.count loop
- ut_utils.append_to_list( l_results, replace( a_lines(i), gc_cdata_end_tag, gc_cdata_end_tag_wrap ) );
- end loop;
- ut_utils.append_to_list( l_results, gc_cdata_end_tag);
- else
- l_results := a_lines;
- end if;
- return l_results;
- end;
-
- function to_cdata(a_clob clob) return clob is
- l_result clob;
- begin
- if a_clob is not null and a_clob != empty_clob() then
- l_result := replace( a_clob, gc_cdata_end_tag, gc_cdata_end_tag_wrap );
- l_result := to_clob(gc_cdata_start_tag)
- || replace( a_clob, gc_cdata_end_tag, gc_cdata_end_tag_wrap )
- || to_clob(gc_cdata_end_tag);
- else
- l_result := a_clob;
- end if;
- return l_result;
- end;
-
- function add_prefix(a_list ut_varchar2_list, a_prefix varchar2, a_connector varchar2 := '/') return ut_varchar2_list is
- l_result ut_varchar2_list := ut_varchar2_list();
- l_idx binary_integer;
- begin
- if a_prefix is not null then
- l_idx := a_list.first;
- while l_idx is not null loop
- l_result.extend;
- l_result(l_idx) := add_prefix(a_list(l_idx), a_prefix, a_connector);
- l_idx := a_list.next(l_idx);
- end loop;
- end if;
- return l_result;
- end;
-
- function add_prefix(a_item varchar2, a_prefix varchar2, a_connector varchar2 := '/') return varchar2 is
- begin
- return a_prefix||a_connector||trim(leading a_connector from a_item);
- end;
-
- function strip_prefix(a_item varchar2, a_prefix varchar2, a_connector varchar2 := '/') return varchar2 is
- begin
- return regexp_replace(a_item,a_prefix||a_connector);
- end;
-
- function get_hash(a_data raw, a_hash_type binary_integer := dbms_crypto.hash_sh1) return t_hash is
- begin
- --We cannot run hash on null
- return case when a_data is null then null else dbms_crypto.hash(a_data, a_hash_type) end;
- end;
-
- function get_hash(a_data clob, a_hash_type binary_integer := dbms_crypto.hash_sh1) return t_hash is
- begin
- --We cannot run hash on null
- return case when a_data is null then null else dbms_crypto.hash(a_data, a_hash_type) end;
- end;
-
- function hash_suite_path(a_path varchar2, a_random_seed positiven) return varchar2 is
- l_start_pos pls_integer := 1;
- l_end_pos pls_integer := 1;
- l_result varchar2(4000);
- l_item varchar2(4000);
- l_at_end boolean := false;
- begin
- if a_random_seed is null then
- l_result := a_path;
- end if;
- if a_path is not null then
- loop
- l_end_pos := instr(a_path,'.',l_start_pos);
- if l_end_pos = 0 then
- l_end_pos := length(a_path)+1;
- l_at_end := true;
- end if;
- l_item := substr(a_path,l_start_pos,l_end_pos-l_start_pos);
- if l_item is not null then
- l_result :=
- l_result ||
- ut_utils.get_hash( to_char( dbms_utility.get_hash_value( l_item, 1, a_random_seed ) ) );
- end if;
- exit when l_at_end;
- l_result := l_result || chr(0);
- l_start_pos := l_end_pos + 1;
- end loop;
- end if;
- return l_result;
- end;
-
- function qualified_sql_name(a_name varchar2) return varchar2 is
- begin
- return
- case
- when a_name is not null
- then sys.dbms_assert.qualified_sql_name(a_name)
- end;
- end;
-
- function interval_to_text(a_interval dsinterval_unconstrained) return varchar2 is
- l_day varchar2(100) := extract(day from a_interval);
- l_hour varchar2(100) := extract(hour from a_interval);
- l_minute varchar2(100) := extract(minute from a_interval);
- l_second varchar2(100) := extract(second from a_interval);
- l_result varchar2(32767);
- begin
- l_result := case
- when l_day = 1 then l_day ||' day'
- when l_day > 1 then l_day ||' days'
- end ||
- case
- when l_hour = 1 then ' '|| l_hour ||' hour'
- when l_hour > 1 then ' '|| l_hour ||' hours'
- end ||
- case
- when l_minute = 1 then ' '||l_minute ||' minute'
- when l_minute > 1 then ' '||l_minute ||' minutes'
- end ||
- case
- when l_second > 1 then ' '||l_second ||' seconds'
- when l_second = 1 then ' '||l_second ||' second'
- when l_second > 0 then ' '||l_second ||' seconds'
- end;
- l_result :=
- case
- when a_interval is null then 'NULL'
- when l_result is null then '0 seconds'
- else ltrim(l_result,' ')
- end;
-
- return l_result;
- end;
-
- function interval_to_text(a_interval yminterval_unconstrained) return varchar2 is
- l_year varchar2(4) := extract(year from a_interval);
- l_month varchar2(20) := extract(month from a_interval);
- l_result varchar2(32767);
- begin
- l_result := case
- when l_year = 1 then l_year ||' year'
- when l_year > 1 then l_year ||' years'
- end ||
- case
- when l_month > 1 then ' '||l_month ||' months'
- when l_month = 1 then ' '||l_month ||' month'
- end;
- l_result :=
- case
- when a_interval is null then 'NULL'
- when l_result is null then '0 months'
- else ltrim(l_result,' ')
- end;
-
- return l_result;
- end;
-
-
- /*
- * Inspired by
- * https://stackoverflow.com/a/48782891
- */
- function lengthb_clob( a_clob clob) return integer is
- l_blob blob;
- l_desc_offset PLS_INTEGER := 1;
- l_src_offset PLS_INTEGER := 1;
- l_lang PLS_INTEGER := 0;
- l_warning PLS_INTEGER := 0;
- l_result integer;
- begin
- if a_clob = empty_clob() then
- l_result := 0;
- elsif a_clob is not null then
- dbms_lob.createtemporary(l_blob,true);
- dbms_lob.converttoblob
- ( l_blob
- , a_clob
- , dbms_lob.getlength(a_clob)
- , l_desc_offset
- , l_src_offset
- , dbms_lob.default_csid
- , l_lang
- , l_warning
- );
- l_result := length(l_blob);
- dbms_lob.freetemporary(l_blob);
- end if;
- return l_result;
- end;
-
-end ut_utils;
-/
diff --git a/source/core/ut_utils.pks b/source/core/ut_utils.pks
deleted file mode 100644
index 9615c7b4d..000000000
--- a/source/core/ut_utils.pks
+++ /dev/null
@@ -1,486 +0,0 @@
-create or replace package ut_utils authid definer is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Common utilities and constants used throughout utPLSQL framework
- *
- */
-
- gc_version constant varchar2(50) := 'v3.1.14.4342-develop';
-
- subtype t_executable_type is varchar2(30);
- gc_before_all constant t_executable_type := 'beforeall';
- gc_before_each constant t_executable_type := 'beforeeach';
- gc_before_test constant t_executable_type := 'beforetest';
- gc_test_execute constant t_executable_type := 'test';
- gc_after_test constant t_executable_type := 'aftertest';
- gc_after_each constant t_executable_type := 'aftereach';
- gc_after_all constant t_executable_type := 'afterall';
-
- /* Constants: Test Results */
- subtype t_test_result is binary_integer range 0 .. 3;
- gc_disabled constant t_test_result := 0; -- test/suite was disabled
- gc_success constant t_test_result := 1; -- test passed
- gc_failure constant t_test_result := 2; -- one or more expectations failed
- gc_error constant t_test_result := 3; -- exception was raised
-
- gc_disabled_char constant varchar2(8) := 'Disabled'; -- test/suite was disabled
- gc_success_char constant varchar2(7) := 'Success'; -- test passed
- gc_failure_char constant varchar2(7) := 'Failure'; -- one or more expectations failed
- gc_error_char constant varchar2(5) := 'Error'; -- exception was raised
-
- gc_cdata_start_tag constant varchar2(10) := '';
- gc_cdata_end_tag_wrap constant varchar2(30) := ']]'||gc_cdata_end_tag||gc_cdata_start_tag||'>';
-
-
- /*
- Constants: Rollback type for ut_test_object
- */
- subtype t_rollback_type is binary_integer range 0 .. 1;
- gc_rollback_auto constant t_rollback_type := 0; -- rollback after each test and suite
- gc_rollback_manual constant t_rollback_type := 1; -- leave transaction control manual
- gc_rollback_default constant t_rollback_type := gc_rollback_auto;
-
- ex_unsupported_rollback_type exception;
- gc_unsupported_rollback_type constant pls_integer := -20200;
- pragma exception_init(ex_unsupported_rollback_type, -20200);
-
- ex_path_list_is_empty exception;
- gc_path_list_is_empty constant pls_integer := -20201;
- pragma exception_init(ex_path_list_is_empty, -20201);
-
- ex_invalid_path_format exception;
- gc_invalid_path_format constant pls_integer := -20202;
- pragma exception_init(ex_invalid_path_format, -20202);
-
- ex_suite_package_not_found exception;
- gc_suite_package_not_found constant pls_integer := -20204;
- pragma exception_init(ex_suite_package_not_found, -20204);
-
- -- Reporting event time not supported
- ex_invalid_rep_event_time exception;
- gc_invalid_rep_event_time constant pls_integer := -20210;
- pragma exception_init(ex_invalid_rep_event_time, -20210);
-
- -- Reporting event name not supported
- ex_invalid_rep_event_name exception;
- gc_invalid_rep_event_name constant pls_integer := -20211;
- pragma exception_init(ex_invalid_rep_event_name, -20211);
-
- -- Any of tests failed
- ex_some_tests_failed exception;
- gc_some_tests_failed constant pls_integer := -20213;
- pragma exception_init(ex_some_tests_failed, -20213);
-
- -- Version number provided is not in valid format
- ex_invalid_version_no exception;
- gc_invalid_version_no constant pls_integer := -20214;
- pragma exception_init(ex_invalid_version_no, -20214);
-
- -- Version number provided is not in valid format
- ex_out_buffer_timeout exception;
- gc_out_buffer_timeout constant pls_integer := -20215;
- pragma exception_init(ex_out_buffer_timeout, -20215);
-
- ex_invalid_package exception;
- gc_invalid_package constant pls_integer := -6550;
- pragma exception_init(ex_invalid_package, -6550);
-
- ex_failure_for_all exception;
- gc_failure_for_all constant pls_integer := -24381;
- pragma exception_init (ex_failure_for_all, -24381);
-
- ex_dml_for_all exception;
- gc_dml_for_all constant pls_integer := -20216;
- pragma exception_init (ex_dml_for_all, -20216);
-
- ex_value_too_large exception;
- gc_value_too_large constant pls_integer := -20217;
- pragma exception_init (ex_value_too_large, -20217);
-
- ex_xml_processing exception;
- gc_xml_processing constant pls_integer := -19202;
- pragma exception_init (ex_xml_processing, -19202);
-
- ex_failed_open_cur exception;
- gc_failed_open_cur constant pls_integer := -20218;
- pragma exception_init (ex_failed_open_cur, -20218);
-
- ex_invalid_tag_expression exception;
- gc_invalid_tag_expression constant pls_integer := -20219;
- pragma exception_init (ex_invalid_tag_expression, -20219);
-
- gc_max_storage_varchar2_len constant integer := 4000;
- gc_max_output_string_length constant integer := 4000;
- gc_more_data_string constant varchar2(5) := '[...]';
- gc_more_data_string_len constant integer := length( gc_more_data_string );
- gc_number_format constant varchar2(100) := 'TM9';
- gc_date_format constant varchar2(100) := 'syyyy-mm-dd"T"hh24:mi:ss';
- gc_timestamp_format constant varchar2(100) := 'syyyy-mm-dd"T"hh24:mi:ssxff';
- gc_timestamp_tz_format constant varchar2(100) := 'syyyy-mm-dd"T"hh24:mi:ssxff tzh:tzm';
- gc_null_string constant varchar2(4) := 'NULL';
- gc_empty_string constant varchar2(5) := 'EMPTY';
-
- gc_bc_fetch_limit constant integer := 1000;
- gc_diff_max_rows constant integer := 20;
-
- gc_max_objects_fetch_limit constant integer := 1000000;
-
- /**
- * Regexp to validate tag
- */
- gc_word_no_space constant varchar2(50) := '^(\w|\S)+$';
-
- type t_version is record(
- major natural,
- minor natural,
- bugfix natural,
- build natural
- );
-
- type t_clob_tab is table of clob;
-
- /**
- * Converts test results into strings
- *
- * @param a_test_result numeric representation of test result
- *
- * @return a string representation of a test_result.
- */
- function test_result_to_char(a_test_result integer) return varchar2;
-
- function to_test_result(a_test boolean) return integer;
-
- /**
- * Generates a unique name for a savepoint
- * Uses sys_guid, as timestamp gives only miliseconds on Windows and is not unique
- * Issue: #506 for details on the implementation approach
- */
- function gen_savepoint_name return varchar2;
-
- procedure debug_log(a_message varchar2);
-
- procedure debug_log(a_message clob);
-
- function to_string(
- a_value varchar2,
- a_quote_char varchar2 := '''',
- a_max_output_len in number := gc_max_output_string_length
- ) return varchar2;
-
- function to_string(
- a_value clob,
- a_quote_char varchar2 := '''',
- a_max_output_len in number := gc_max_output_string_length
- ) return varchar2;
-
- function to_string(
- a_value blob,
- a_quote_char varchar2 := '''',
- a_max_output_len in number := gc_max_output_string_length
- ) return varchar2;
-
- function to_string(a_value boolean) return varchar2;
-
- function to_string(a_value number) return varchar2;
-
- function to_string(a_value date) return varchar2;
-
- function to_string(a_value timestamp_unconstrained) return varchar2;
-
- function to_string(a_value timestamp_tz_unconstrained) return varchar2;
-
- function to_string(a_value timestamp_ltz_unconstrained) return varchar2;
-
- function to_string(a_value yminterval_unconstrained) return varchar2;
-
- function to_string(a_value dsinterval_unconstrained) return varchar2;
-
- function boolean_to_int(a_value boolean) return integer;
-
- function int_to_boolean(a_value integer) return boolean;
-
- /**
- *
- * Splits a given string into table of string by delimiter.
- * The delimiter gets removed.
- * If null a_string passed, empty table is returned.
- * If null a_delimiter passed, a_string is returned as element of result table.
- * If null a_skip_leading_delimiter, it defaults to 'N'
- * If no occurrence of a_delimiter found in a_text then text is returned as a single row of the table.
- * If no text between delimiters found then an empty row is returned, example:
- * string_to_table( 'a,,b', ',' ) gives table ut_varchar2_list( 'a', null, 'b' );
- *
- * @param a_string the text to be split.
- * @param a_delimiter the delimiter character or string
- * @param a_skip_leading_delimiter determines if the leading delimiter should be ignored, used by clob_to_table
- *
- * @return table of varchar2 values
- */
- function string_to_table(a_string varchar2, a_delimiter varchar2:= chr(10), a_skip_leading_delimiter varchar2 := 'N') return ut_varchar2_list;
-
- /**
- *
- * Splits each string in table of string into a table of string using specified delimiter.
- * The delimiter gets removed.
- * If null a_delimiter passed, a_list is returned as-is.
- * If null a_list passed, empty table is returned.
- * If null a_skip_leading_delimiter, it defaults to 'N'
- * If no occurrence of a_delimiter found in a_text then text is returned as a single row of the table.
- * If no text between delimiters found then an empty row is returned, example:
- * string_table_to_table( a_list => ut_varchar2_list('x','y',null,'a,,b'), a_delimiter=>',' ) gives table ut_varchar2_list( 'x', 'y', null, 'a', null, 'b' );
- *
- * @param a_list the table of texts to be split.
- * @param a_delimiter the delimiter character or string
- * @param a_skip_leading_delimiter determines if the leading delimiter should be ignored, used by clob_to_table
- *
- * @return table of varchar2 values
- */
- function string_table_to_table(a_list ut_varchar2_list, a_delimiter varchar2:= chr(10), a_skip_leading_delimiter varchar2 := 'N') return ut_varchar2_list;
-
- /**
- * Splits a given string into table of string by delimiter.
- * Default value of a_max_amount is 8191 because of code can contains multibyte character.
- * The delimiter gets removed.
- * If null a_clob passed, empty table is returned.
- * If null a_delimiter passed, a_string is returned as element of result table.
- * If null a_skip_leading_delimiter, it defaults to 'N'
- * If no occurrence of a_delimiter found in a_text then text is returned as a single row of the table.
- * If split text is longer than a_max_amount it gets split into pieces of a_max_amount.
- * If no text between delimiters found then an empty row is returned, example:
- * clob_to_table( 'a,,b', ',' ) gives table ut_varchar2_list( 'a', null, 'b' );
- *
- * @param a_clob the text to be split.
- * @param a_delimiter the delimiter character or string (default chr(10) )
- * @param a_max_amount the maximum length of returned string (default 8191)
- * @return table of varchar2 values
- */
- function clob_to_table(a_clob clob, a_max_amount integer := 8191, a_delimiter varchar2:= chr(10)) return ut_varchar2_list;
-
- function table_to_clob(a_text_table ut_varchar2_list, a_delimiter varchar2:= chr(10)) return clob;
-
- function table_to_clob(a_text_table ut_varchar2_rows, a_delimiter varchar2:= chr(10)) return clob;
-
- function table_to_clob(a_integer_table ut_integer_list, a_delimiter varchar2:= chr(10)) return clob;
-
- /**
- * Returns time difference in seconds (with miliseconds) between given timestamps
- */
- function time_diff(a_start_time timestamp with time zone, a_end_time timestamp with time zone) return number;
-
- /**
- * Returns a text indented with spaces except the first line.
- */
- function indent_lines(a_text varchar2, a_indent_size integer := 4, a_include_first_line boolean := false) return varchar2;
-
-
- /**
- * Returns a list of object that are part of utPLSQL framework
- */
- function get_utplsql_objects_list return ut_object_names;
-
- /**
- * Append a item to the end of ut_varchar2_list
- */
- procedure append_to_list(a_list in out nocopy ut_varchar2_list, a_item varchar2);
-
- /**
- * Append a item to the end of ut_varchar2_rows
- */
- procedure append_to_list(a_list in out nocopy ut_varchar2_rows, a_item varchar2);
-
- /**
- * Append a item to the end of ut_varchar2_rows
- */
- procedure append_to_list(a_list in out nocopy ut_varchar2_rows, a_item clob);
-
- /**
- * Append a list of items to the end of ut_varchar2_rows
- */
- procedure append_to_list(a_list in out nocopy ut_varchar2_rows, a_items ut_varchar2_rows);
-
- /**
- * Append a list of items to the end of ut_varchar2_list
- */
- procedure append_to_list(a_list in out nocopy ut_varchar2_list, a_items ut_varchar2_list);
-
- procedure append_to_clob(a_src_clob in out nocopy clob, a_clob_table t_clob_tab, a_delimiter varchar2 := chr(10));
-
- procedure append_to_clob(a_src_clob in out nocopy clob, a_new_data clob);
-
- procedure append_to_clob(a_src_clob in out nocopy clob, a_new_data varchar2);
-
- function convert_collection(a_collection ut_varchar2_list) return ut_varchar2_rows;
-
- function to_xpath(a_list varchar2, a_ancestors varchar2 := '/*/') return varchar2;
-
- function to_xpath(a_list ut_varchar2_list, a_ancestors varchar2 := '/*/') return varchar2;
-
- /**
- * Converts version string into version record
- *
- * @param a_version_no string representation of version in format vX.X.X.X where X is a positive integer
- * @return t_version record with up to four positive numbers containing version
- * @throws 20214 if passed version string is not matching version pattern
- */
- function to_version(a_version_no varchar2) return t_version;
-
-
- /**
- * Saves data from dbms_output buffer into a global temporary table (cache)
- * used to store dbms_output buffer captured before the run
- *
- */
- procedure save_dbms_output_to_cache;
-
- /**
- * Reads data from global temporary table (cache) abd puts it back into dbms_output
- * used to recover dbms_output buffer data after a run is complete
- *
- */
- procedure read_cache_to_dbms_output;
-
-
- /**
- * Function is used to reference to utPLSQL owned objects in dynamic sql statements executed from packages with invoker rights
- *
- * @return the name of the utPSQL schema owner
- */
- function ut_owner return varchar2;
-
-
- /**
- * Used in dynamic sql select statements to maintain balance between
- * number of hard-parses and optimiser accurancy for cardinality of collections
- *
- *
- * @return 3, for inputs of: 1-9; 33 for input of 10 - 99; 333 for (100 - 999)
- */
- function scale_cardinality(a_cardinality natural) return natural;
-
- function build_depreciation_warning(a_old_syntax varchar2, a_new_syntax varchar2) return varchar2;
-
- /**
- * Returns number as string. The value is represented as decimal according to XML standard:
- * https://www.w3.org/TR/xmlschema-2/#decimal
- */
- function to_xml_number_format(a_value number) return varchar2;
-
-
- /**
- * Returns xml header. If a_encoding is not null, header will include encoding attribute with provided value
- */
- function get_xml_header(a_encoding varchar2) return varchar2;
-
-
- /**
- * Takes a collection of type ut_varchar2_list and it trims the characters passed as arguments for every element
- */
- function trim_list_elements(a_list IN ut_varchar2_list, a_regexp_to_trim in varchar2 default '[:space:]') return ut_varchar2_list;
-
- /**
- * Takes a collection of type ut_varchar2_list and it only returns the elements which meets the regular expression
- */
- function filter_list(a_list IN ut_varchar2_list, a_regexp_filter in varchar2) return ut_varchar2_list;
-
- -- Generates XMLGEN escaped string
- function xmlgen_escaped_string(a_string in varchar2) return varchar2;
-
- /**
- * Replaces multi-line comments in given source-code with empty lines
- */
- function replace_multiline_comments(a_source clob) return clob;
-
- /**
- * Returns list of sub-type reporters for given list of super-type reporters
- */
- function get_child_reporters(a_for_reporters ut_reporters_info := null) return ut_reporters_info;
-
- /**
- * Remove given ORA error from stack
- */
- function remove_error_from_stack(a_error_stack varchar2, a_ora_code number) return varchar2;
-
- /**
- * Check if xml name is valid if not build a valid name
- */
- function get_valid_xml_name(a_name varchar2) return varchar2;
-
- /**
- * Converts input list into a list surrounded by CDATA tags
- * All CDATA end tags get escaped using recommended method from https://en.wikipedia.org/wiki/CDATA#Nesting
- */
- function to_cdata(a_lines ut_varchar2_rows) return ut_varchar2_rows;
-
- /**
- * Converts input CLOB into a CLOB surrounded by CDATA tags
- * All CDATA end tags get escaped using recommended method from https://en.wikipedia.org/wiki/CDATA#Nesting
- */
- function to_cdata(a_clob clob) return clob;
-
- /**
- * Add prefix word to elements of list
- */
- function add_prefix(a_list ut_varchar2_list, a_prefix varchar2, a_connector varchar2 := '/') return ut_varchar2_list;
-
- function add_prefix(a_item varchar2, a_prefix varchar2, a_connector varchar2 := '/') return varchar2;
-
- function strip_prefix(a_item varchar2, a_prefix varchar2, a_connector varchar2 := '/') return varchar2;
-
-
- subtype t_hash is raw(128);
-
- /*
- * Wrapper function for calling dbms_crypto.hash
- */
- function get_hash(a_data raw, a_hash_type binary_integer := dbms_crypto.hash_sh1) return t_hash;
-
- /*
- * Wrapper function for calling dbms_crypto.hash
- */
- function get_hash(a_data clob, a_hash_type binary_integer := dbms_crypto.hash_sh1) return t_hash;
-
- /*
- * Returns a hash value of suitepath based on input path and random seed
- */
- function hash_suite_path(a_path varchar2, a_random_seed positiven) return varchar2;
-
- /*
- * Verifies that the input string is a qualified SQL name using sys.dbms_assert.qualified_sql_name
- * If null value passed returns null
- */
- function qualified_sql_name(a_name varchar2) return varchar2;
-
- /*
- * Return value of interval in plain english
- */
- function interval_to_text(a_interval dsinterval_unconstrained) return varchar2;
-
- /*
- * Return value of interval in plain english
- */
- function interval_to_text(a_interval yminterval_unconstrained) return varchar2;
-
- /*
- * Return length of CLOB in bytes. Null for NULL
- */
- function lengthb_clob( a_clob clob) return integer;
-
-end ut_utils;
-/
diff --git a/source/create_grants.sql b/source/create_grants.sql
deleted file mode 100644
index 2cdea9970..000000000
--- a/source/create_grants.sql
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-Create all necessary grant for the user who owns test packages and want to execute utPLSQL framework
-*/
-
-@@define_ut3_owner_param.sql
-
-column 2 new_value 2 noprint
-select null as "2" from dual where 1=0;
-spool params.sql.tmp
-select
- case
- when '&&2' is null then q'[ACCEPT ut3_user CHAR DEFAULT 'PUBLIC' PROMPT 'Provide schema which should be granted access to the utPLSQL v3 framework (PUBLIC): ']'
- else 'define ut3_user=&&2'
- end
-from dual;
-
-spool off
-set termout on
-@params.sql.tmp
-set termout off
-/* cleanup temporary sql files */
---try running on windows
-$ del params.sql.tmp
---try running on linux/unix
-! rm params.sql.tmp
-set termout on
-
-set echo off
-set feedback on
-set heading off
-set verify off
-
-prompt Granting privileges on UTPLSQL objects in &&ut3_owner schema to user &&ut3_user
-
-whenever sqlerror exit failure rollback
-whenever oserror exit failure rollback
-
-alter session set current_schema = &&ut3_owner;
-
---public API
-grant execute on &&ut3_owner..ut to &ut3_user;
-grant execute on &&ut3_owner..ut_runner to &ut3_user;
-grant execute on &&ut3_owner..ut_file_mappings to &ut3_user;
-grant execute on &&ut3_owner..ut_file_mapping to &ut3_user;
-grant execute on &&ut3_owner..ut_file_mapper to &ut3_user;
-grant execute on &&ut3_owner..ut_suite_items_info to &ut3_user;
-grant execute on &&ut3_owner..ut_suite_item_info to &ut3_user;
-grant execute on &&ut3_owner..ut_suite_cache_rows to &ut3_user;
-grant execute on &&ut3_owner..ut_run_info to &ut3_user;
-grant execute on &&ut3_owner..ut_coverage_options to &ut3_user;
-
---generic types
-grant execute on &&ut3_owner..ut_varchar2_list to &ut3_user;
-grant execute on &&ut3_owner..ut_varchar2_rows to &ut3_user;
-grant execute on &&ut3_owner..ut_integer_list to &ut3_user;
-grant execute on &&ut3_owner..ut_key_value_pairs to &ut3_user;
-grant execute on &&ut3_owner..ut_key_value_pair to &ut3_user;
-
---expectations
-grant execute on &&ut3_owner..ut_expectation to &ut3_user;
-grant execute on &&ut3_owner..ut_expectation_compound to &ut3_user;
-grant execute on &&ut3_owner..ut_expectation_json to &ut3_user;
-
---matchers
-grant execute on &&ut3_owner..ut_matcher to &ut3_user;
-grant execute on &&ut3_owner..ut_be_between to &ut3_user;
-grant execute on &&ut3_owner..ut_be_empty to &ut3_user;
-grant execute on &&ut3_owner..ut_be_false to &ut3_user;
-grant execute on &&ut3_owner..ut_be_greater_or_equal to &ut3_user;
-grant execute on &&ut3_owner..ut_be_greater_than to &ut3_user;
-grant execute on &&ut3_owner..ut_be_less_or_equal to &ut3_user;
-grant execute on &&ut3_owner..ut_be_less_than to &ut3_user;
-grant execute on &&ut3_owner..ut_be_like to &ut3_user;
-grant execute on &&ut3_owner..ut_be_not_null to &ut3_user;
-grant execute on &&ut3_owner..ut_be_null to &ut3_user;
-grant execute on &&ut3_owner..ut_be_true to &ut3_user;
-grant execute on &&ut3_owner..ut_be_within to &ut3_user;
-grant execute on &&ut3_owner..ut_be_within_pct to &ut3_user;
-grant execute on &&ut3_owner..ut_contain to &ut3_user;
-grant execute on &&ut3_owner..ut_equal to &ut3_user;
-grant execute on &&ut3_owner..ut_have_count to &ut3_user;
-grant execute on &&ut3_owner..ut_match to &ut3_user;
-
---reporters - test results
-grant execute on &&ut3_owner..ut_teamcity_reporter to &ut3_user;
-grant execute on &&ut3_owner..ut_xunit_reporter to &ut3_user;
-grant execute on &&ut3_owner..ut_junit_reporter to &ut3_user;
-grant execute on &&ut3_owner..ut_tfs_junit_reporter to &ut3_user;
-grant execute on &&ut3_owner..ut_documentation_reporter to &ut3_user;
-grant execute on &&ut3_owner..ut_sonar_test_reporter to &ut3_user;
-grant execute on &&ut3_owner..ut_realtime_reporter to &ut3_user;
-grant execute on &&ut3_owner..ut_tap_reporter to &ut3_user;
---reporters - coverage
-grant execute on &&ut3_owner..ut_coverage_html_reporter to &ut3_user;
-grant execute on &&ut3_owner..ut_coverage_sonar_reporter to &ut3_user;
-grant execute on &&ut3_owner..ut_coveralls_reporter to &ut3_user;
-grant execute on &&ut3_owner..ut_coverage_cobertura_reporter to &ut3_user;
---reporters - debug
-grant execute on &&ut3_owner..ut_debug_reporter to &ut3_user;
-
---reporters - base types
-grant execute on &&ut3_owner..ut_reporters to &ut3_user;
-grant execute on &&ut3_owner..ut_reporter_base to &ut3_user;
-grant execute on &&ut3_owner..ut_output_reporter_base to &ut3_user;
-grant execute on &&ut3_owner..ut_coverage_reporter_base to &ut3_user;
-grant execute on &&ut3_owner..ut_console_reporter_base to &ut3_user;
-
---outputs
-grant execute on &&ut3_owner..ut_output_buffer_base to &ut3_user;
-grant execute on &&ut3_owner..ut_output_table_buffer to &ut3_user;
-grant execute on &&ut3_owner..ut_output_clob_table_buffer to &ut3_user;
-grant execute on &&ut3_owner..ut_output_bulk_buffer to &ut3_user;
-
---needed internally for selecting from annotation objects within packages that use invoker rights
-grant execute on &&ut3_owner..ut_annotation_objs_cache_info to &ut3_user;
-grant execute on &&ut3_owner..ut_annotation_obj_cache_info to &ut3_user;
-
---other grants
-grant execute on &&ut3_owner..ut_executables to &ut3_user;
-grant execute on &&ut3_owner..ut_executable_test to &ut3_user;
-grant execute on &&ut3_owner..ut_suite_cache_row to &ut3_user;
-grant execute on &&ut3_owner..ut_suite_cache_rows to &ut3_user;
-
-grant select, insert, delete, update on &&ut3_owner..dbmspcc_blocks to &ut3_user;
-grant select, insert, delete, update on &&ut3_owner..dbmspcc_runs to &ut3_user;
-grant select, insert, delete, update on &&ut3_owner..dbmspcc_units to &ut3_user;
-grant select on &&ut3_owner..ut_coverage_runs to &ut3_user;
-grant execute on &&ut3_owner..ut_matcher_options to &ut3_user;
-grant execute on &&ut3_owner..ut_matcher_options_items to &ut3_user;
-
diff --git a/source/create_synonyms.sql b/source/create_synonyms.sql
deleted file mode 100644
index d839e11b7..000000000
--- a/source/create_synonyms.sql
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-Create all necessary grant for the user who owns test packages and want to execute utPLSQL framework
-*/
-
-@@define_ut3_owner_param.sql
-
-column 2 new_value 2 noprint
-select null as "2" from dual where 1=0;
-spool params.sql.tmp
-select
- case
- when '&&2' is null then q'[ACCEPT ut3_user CHAR DEFAULT 'PUBLIC' PROMPT 'Provide schema which should own synonyms for the utPLSQL v3 framework (PUBLIC): ']'
- else 'define ut3_user=&&2.'
- end
-from dual;
-spool off
-set termout on
-@params.sql.tmp
-set termout off
-
-spool params.sql.tmp
-select
- case
- when upper('&&ut3_user') = 'PUBLIC' then q'[define action_type='or replace public'
- ]'||q'[define ut3_user=''
- ]'||q'[define grantee='PUBLIC']'
- else q'[define action_type='or replace'
- ]'||q'[define grantee='&&ut3_user']
- ]'||q'[define ut3_user='&&ut3_user..']'
- end
-from dual;
-
-spool off
-set termout on
-@params.sql.tmp
-set termout off
-/* cleanup temporary sql files */
---try running on windows
-$ del params.sql.tmp
---try running on linux/unix
-! rm params.sql.tmp
-set termout on
-
-set echo off
-set feedback on
-set heading off
-set verify off
-
-whenever sqlerror exit failure rollback
-whenever oserror exit failure rollback
-
-alter session set current_schema = &&ut3_owner;
-
-prompt Creating synonyms for UTPLSQL objects in &&ut3_owner schema to user &&grantee
-
---public API
-create &action_type. synonym &ut3_user.ut for &&ut3_owner..ut;
-create &action_type. synonym &ut3_user.ut_runner for &&ut3_owner..ut_runner;
-create &action_type. synonym &ut3_user.ut_file_mappings for &&ut3_owner..ut_file_mappings;
-create &action_type. synonym &ut3_user.ut_file_mapping for &&ut3_owner..ut_file_mapping;
-create &action_type. synonym &ut3_user.ut_file_mapper for &&ut3_owner..ut_file_mapper;
-create &action_type. synonym &ut3_user.ut_suite_items_info for &&ut3_owner..ut_suite_items_info;
-create &action_type. synonym &ut3_user.ut_suite_item_info for &&ut3_owner..ut_suite_item_info;
-create &action_type. synonym &ut3_user.ut_run_info for &&ut3_owner..ut_run_info;
-create &action_type. synonym &ut3_user.ut_coverage_options for &&ut3_owner..ut_coverage_options;
-
---generic types
-create &action_type. synonym &ut3_user.ut_varchar2_list for &&ut3_owner..ut_varchar2_list;
-create &action_type. synonym &ut3_user.ut_varchar2_rows for &&ut3_owner..ut_varchar2_rows;
-create &action_type. synonym &ut3_user.ut_integer_list for &&ut3_owner..ut_integer_list;
-create &action_type. synonym &ut3_user.ut_key_value_pairs for &&ut3_owner..ut_key_value_pairs;
-create &action_type. synonym &ut3_user.ut_key_value_pair for &&ut3_owner..ut_key_value_pair;
-
---expectations
-create &action_type. synonym &ut3_user.ut_expectation for &&ut3_owner..ut_expectation;
-create &action_type. synonym &ut3_user.ut_expectation_compound for &&ut3_owner..ut_expectation_compound;
-create &action_type. synonym &ut3_user.ut_expectation_json for &&ut3_owner..ut_expectation_json;
-
---matchers
-create &action_type. synonym &ut3_user.ut_matcher for &&ut3_owner..ut_matcher;
-create &action_type. synonym &ut3_user.be_between for &&ut3_owner..be_between;
-create &action_type. synonym &ut3_user.be_empty for &&ut3_owner..be_empty;
-create &action_type. synonym &ut3_user.be_false for &&ut3_owner..be_false;
-create &action_type. synonym &ut3_user.be_greater_or_equal for &&ut3_owner..be_greater_or_equal;
-create &action_type. synonym &ut3_user.be_greater_than for &&ut3_owner..be_greater_than;
-create &action_type. synonym &ut3_user.be_less_or_equal for &&ut3_owner..be_less_or_equal;
-create &action_type. synonym &ut3_user.be_less_than for &&ut3_owner..be_less_than;
-create &action_type. synonym &ut3_user.be_like for &&ut3_owner..be_like;
-create &action_type. synonym &ut3_user.be_not_null for &&ut3_owner..be_not_null;
-create &action_type. synonym &ut3_user.be_null for &&ut3_owner..be_null;
-create &action_type. synonym &ut3_user.be_true for &&ut3_owner..be_true;
-create &action_type. synonym &ut3_user.be_within for &&ut3_owner..be_within;
-create &action_type. synonym &ut3_user.be_within_pct for &&ut3_owner..be_within_pct;
-create &action_type. synonym &ut3_user.contain for &&ut3_owner..contain;
-create &action_type. synonym &ut3_user.equal for &&ut3_owner..equal;
-create &action_type. synonym &ut3_user.have_count for &&ut3_owner..have_count;
-create &action_type. synonym &ut3_user.match for &&ut3_owner..match;
-
---reporters - test results
-create &action_type. synonym &ut3_user.ut_teamcity_reporter for &&ut3_owner..ut_teamcity_reporter;
-create &action_type. synonym &ut3_user.ut_xunit_reporter for &&ut3_owner..ut_xunit_reporter;
-create &action_type. synonym &ut3_user.ut_junit_reporter for &&ut3_owner..ut_junit_reporter;
-create &action_type. synonym &ut3_user.ut_tfs_junit_reporter for &&ut3_owner..ut_tfs_junit_reporter;
-create &action_type. synonym &ut3_user.ut_documentation_reporter for &&ut3_owner..ut_documentation_reporter;
-create &action_type. synonym &ut3_user.ut_sonar_test_reporter for &&ut3_owner..ut_sonar_test_reporter;
-create &action_type. synonym &ut3_user.ut_realtime_reporter for &&ut3_owner..ut_realtime_reporter;
-create &action_type. synonym &ut3_user.ut_tap_reporter for &&ut3_owner..ut_tap_reporter;
---reporters - coverage
-create &action_type. synonym &ut3_user.ut_coverage_html_reporter for &&ut3_owner..ut_coverage_html_reporter;
-create &action_type. synonym &ut3_user.ut_coverage_sonar_reporter for &&ut3_owner..ut_coverage_sonar_reporter;
-create &action_type. synonym &ut3_user.ut_coveralls_reporter for &&ut3_owner..ut_coveralls_reporter;
-create &action_type. synonym &ut3_user.ut_coverage_cobertura_reporter for &&ut3_owner..ut_coverage_cobertura_reporter;
---reporters - debug
-create &action_type. synonym &ut3_user.ut_debug_reporter for &&ut3_owner..ut_debug_reporter;
---reporters - base types
-create &action_type. synonym &ut3_user.ut_reporters for &&ut3_owner..ut_reporters;
-create &action_type. synonym &ut3_user.ut_reporter_base for &&ut3_owner..ut_reporter_base;
-create &action_type. synonym &ut3_user.ut_output_reporter_base for &&ut3_owner..ut_output_reporter_base;
-
---other synonyms
-create &action_type. synonym &ut3_user.dbmspcc_blocks for &&ut3_owner..dbmspcc_blocks;
-create &action_type. synonym &ut3_user.dbmspcc_runs for &&ut3_owner..dbmspcc_runs;
-create &action_type. synonym &ut3_user.dbmspcc_units for &&ut3_owner..dbmspcc_units;
diff --git a/source/create_synonyms_and_grants_for_public.sql b/source/create_synonyms_and_grants_for_public.sql
deleted file mode 100644
index 050162d72..000000000
--- a/source/create_synonyms_and_grants_for_public.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-Create all necessary grant for the user who owns test packages and want to execute utPLSQL framework
-*/
-
-@@define_ut3_owner_param.sql
-
-@@create_grants.sql '&&ut3_owner' 'PUBLIC'
-@@create_synonyms.sql '&&ut3_owner' 'PUBLIC'
diff --git a/source/create_user_grants.sql b/source/create_user_grants.sql
deleted file mode 100644
index 83e594884..000000000
--- a/source/create_user_grants.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-Create all necessary grant for the user who owns test packages and want to execute utPLSQL framework
-*/
-
-@@create_grants.sql
diff --git a/source/create_user_synonyms.sql b/source/create_user_synonyms.sql
deleted file mode 100644
index a1e7a6acc..000000000
--- a/source/create_user_synonyms.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-Create all necessary grant for the user who owns test packages and want to execute utPLSQL framework
-*/
-
-@@create_synonyms.sql
diff --git a/source/create_utplsql_owner.sql b/source/create_utplsql_owner.sql
deleted file mode 100644
index d7e4f3040..000000000
--- a/source/create_utplsql_owner.sql
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-whenever sqlerror exit failure rollback
-whenever oserror exit failure rollback
-set echo off
-set feedback off
-set heading off
-set verify off
-
-define ut3_owner_schema = &1
-define ut3_password = &2
-define ut3_tablespace = &3
-
-prompt Creating utPLSQL user &&ut3_owner_schema
-
-create user &ut3_owner_schema identified by "&ut3_password" default tablespace &ut3_tablespace quota unlimited on &ut3_tablespace;
-
-grant create session, create sequence, create procedure, create type, create table, create view, create synonym to &ut3_owner_schema;
-
-grant execute on dbms_lock to &ut3_owner_schema;
-grant execute on dbms_crypto to &ut3_owner_schema;
-grant execute on dbms_lob to &ut3_owner_schema;
-grant execute on dbms_xmlgen to &ut3_owner_schema;
-grant execute on dbms_sql to &ut3_owner_schema;
-grant execute on dbms_random to &ut3_owner_schema;
-
-
-grant alter session to &ut3_owner_schema;
-
diff --git a/source/define_ut3_owner_param.sql b/source/define_ut3_owner_param.sql
deleted file mode 100644
index 259b49712..000000000
--- a/source/define_ut3_owner_param.sql
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-set serveroutput on size unlimited format truncated
-whenever oserror continue
-
-set heading off
-set linesize 1000
-set pagesize 0
-
-set verify off
-set define on
-
-set termout off
-set timing off
-set feedback off
-
-column line_separator new_value line_separator noprint
-select '--------------------------------------------------------------' as line_separator from dual;
-
-column 1 new_value 1 noprint
-select null as "1" from dual where 1=0;
-spool params.sql.tmp
-select
- case
- when '&&1' is null then q'[ACCEPT ut3_owner CHAR DEFAULT 'UT3' PROMPT 'Provide schema for the utPLSQL v3 (UT3)']'
- else 'define ut3_owner=&&1'
- end
-from dual;
-spool off
-set termout on
-@params.sql.tmp
-set termout off
-/* cleanup temporary sql files */
---try running on windows
-$ del params.sql.tmp
---try running on linux/unix
-! rm params.sql.tmp
-set termout on
diff --git a/source/dummy.sql b/source/dummy.sql
deleted file mode 100644
index 36d9f8778..000000000
--- a/source/dummy.sql
+++ /dev/null
@@ -1 +0,0 @@
-whenever sqlerror exit failure rollback
diff --git a/source/expectations/data_values/ut_compound_data_diff_tmp.sql b/source/expectations/data_values/ut_compound_data_diff_tmp.sql
deleted file mode 100644
index c10e8d2e8..000000000
--- a/source/expectations/data_values/ut_compound_data_diff_tmp.sql
+++ /dev/null
@@ -1,26 +0,0 @@
-create global temporary table ut_compound_data_diff_tmp(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- diff_id raw(128),
- act_data_id raw(32),
- exp_data_id raw(32),
- act_item_data xmltype,
- exp_item_data xmltype,
- item_no integer,
- duplicate_no integer,
- constraint ut_compound_data_diff_tmp_uk1 unique (diff_id,duplicate_no,item_no),
- constraint ut_compound_data_diff_tmp_chk check(
- item_no is not null
- )
-) on commit delete rows;
diff --git a/source/expectations/data_values/ut_compound_data_helper.pkb b/source/expectations/data_values/ut_compound_data_helper.pkb
deleted file mode 100644
index 875ec760a..000000000
--- a/source/expectations/data_values/ut_compound_data_helper.pkb
+++ /dev/null
@@ -1,853 +0,0 @@
-create or replace package body ut_compound_data_helper is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- g_diff_count integer;
- type t_type_name_map is table of varchar2(128) index by binary_integer;
- type t_types_no_length is table of varchar2(128) index by varchar2(128);
- g_type_name_map t_type_name_map;
- g_anytype_name_map t_type_name_map;
- g_type_no_length_map t_types_no_length;
-
- g_compare_sql_template varchar2(4000) :=
- q'[
- with exp as (
- select
- ucd.*,
- {:duplicate_number:} "UT3$_Dup#No"
- from (
- select
- ucd."UT3$_Item#Data"
- ,x.data_id "UT3$_Data#Id"
- ,ucd."UT3$_Position#" + x.item_no "UT3$_Item#No"
- {:columns:}
- from ut_compound_data_tmp x,
- xmltable('/ROWSET/ROW' passing x.item_data columns
- "UT3$_Item#Data" xmltype path '*'
- ,"UT3$_Position#" for ordinality
- {:xml_to_columns:} ) ucd
- where x.data_id = :exp_guid
- ) ucd
- )
- , act as (
- select
- ucd.*,
- {:duplicate_number:} "UT3$_Dup#No"
- from (
- select
- ucd."UT3$_Item#Data"
- ,x.data_id "UT3$_Data#Id"
- ,ucd."UT3$_Position#" + x.item_no "UT3$_Item#No"
- {:columns:}
- from ut_compound_data_tmp x,
- xmltable('/ROWSET/ROW' passing x.item_data columns
- "UT3$_Item#Data" xmltype path '*'
- ,"UT3$_Position#" for ordinality
- {:xml_to_columns:} ) ucd
- where x.data_id = :act_guid
- ) ucd
- )
- select /*+ no_parallel */
- a."UT3$_Item#Data" as act_item_data,
- a."UT3$_Data#Id" act_data_id,
- e."UT3$_Item#Data" as exp_item_data,
- e."UT3$_Data#Id" exp_data_id,
- {:item_no:} as item_no,
- nvl(e."UT3$_Dup#No",a."UT3$_Dup#No") dup_no
- from act a {:join_type:} exp e on ( {:join_condition:} )
- where {:where_condition:}]';
-
- function get_columns_diff(
- a_expected ut_cursor_column_tab,
- a_actual ut_cursor_column_tab,
- a_order_enforced boolean := false
- ) return tt_column_diffs is
- l_results tt_column_diffs;
- begin
- execute immediate q'[with
- expected_cols as (
- select display_path exp_column_name,column_position exp_col_pos,
- replace(column_type_name,'VARCHAR2','CHAR') exp_col_type_compare, column_type_name exp_col_type
- from table(:a_expected)
- where parent_name is null and hierarchy_level = 1 and column_name is not null
- ),
- actual_cols as (
- select display_path act_column_name,column_position act_col_pos,
- replace(column_type_name,'VARCHAR2','CHAR') act_col_type_compare, column_type_name act_col_type
- from table(:a_actual)
- where parent_name is null and hierarchy_level = 1 and column_name is not null
- ),
- joined_cols as (
- select e.*,a.*]'
- || case when a_order_enforced then ',
- row_number() over(partition by case when a.act_col_pos + e.exp_col_pos is not null then 1 end order by a.act_col_pos) a_pos_nn,
- row_number() over(partition by case when a.act_col_pos + e.exp_col_pos is not null then 1 end order by e.exp_col_pos) e_pos_nn'
- else
- null
- end ||q'[
- from expected_cols e
- full outer join actual_cols a
- on e.exp_column_name = a.act_column_name
- )
- select /*+ no_parallel */ case
- when exp_col_pos is null and act_col_pos is not null then '+'
- when exp_col_pos is not null and act_col_pos is null then '-'
- when exp_col_type_compare != act_col_type_compare then 't'
- else 'p'
- end as diff_type,
- exp_column_name, exp_col_type, exp_col_pos,
- act_column_name, act_col_type, act_col_pos
- from joined_cols
- --column is unexpected (extra) or missing
- where act_col_pos is null or exp_col_pos is null
- --column type is not matching (except CHAR/VARCHAR2)
- or act_col_type_compare != exp_col_type_compare]'
- || case when a_order_enforced then q'[
- --column position is not matching (both when excluded extra/missing columns as well as when they are included)
- or (a_pos_nn != e_pos_nn and exp_col_pos != act_col_pos)]'
- end ||q'[
- order by exp_col_pos, act_col_pos]'
- bulk collect into l_results using a_expected, a_actual;
- return l_results;
- end;
-
- function generate_not_equal_stmt(
- a_data_info ut_cursor_column, a_pk_table ut_varchar2_list
- ) return varchar2
- is
- l_pk_tab ut_varchar2_list := coalesce(a_pk_table,ut_varchar2_list());
- l_index integer;
- l_sql_stmt varchar2(32767);
- l_exists boolean := false;
- begin
- l_index := l_pk_tab.first;
- if l_pk_tab.count > 0 then
- loop
- if a_data_info.access_path = l_pk_tab(l_index) then
- l_exists := true;
- end if;
- exit when l_index = l_pk_tab.count or (a_data_info.access_path = l_pk_tab(l_index));
- l_index := a_pk_table.next(l_index);
- end loop;
- end if;
- if not(l_exists) then
- l_sql_stmt := ' (decode(a.'||a_data_info.transformed_name||','||' e.'||a_data_info.transformed_name||',1,0) = 0)';
- end if;
- return l_sql_stmt;
- end;
-
- function generate_join_by_stmt(
- a_data_info ut_cursor_column, a_pk_table ut_varchar2_list
- ) return varchar2
- is
- l_pk_tab ut_varchar2_list := coalesce(a_pk_table,ut_varchar2_list());
- l_index integer;
- l_sql_stmt varchar2(32767);
- begin
- if l_pk_tab.count <> 0 then
- l_index:= l_pk_tab.first;
- loop
- if l_pk_tab(l_index) in (a_data_info.access_path, a_data_info.parent_name) then
- --When then table is nested and join is on whole table
- l_sql_stmt := l_sql_stmt ||' a.'||a_data_info.transformed_name||q'[ = ]'||' e.'||a_data_info.transformed_name;
- end if;
- exit when (a_data_info.access_path = l_pk_tab(l_index)) or l_index = l_pk_tab.count;
- l_index := l_pk_tab.next(l_index);
- end loop;
- end if;
- return l_sql_stmt;
- end;
-
- function generate_equal_sql(a_col_name in varchar2) return varchar2 is
- begin
- return ' decode(a.'||a_col_name||','||' e.'||a_col_name||',1,0) = 1 ';
- end;
-
- function generate_partition_stmt(
- a_data_info ut_cursor_column, a_pk_table in ut_varchar2_list, a_alias varchar2 := 'ucd.'
- ) return varchar2
- is
- l_index integer;
- l_sql_stmt varchar2(32767);
- begin
- if a_pk_table is not empty then
- l_index:= a_pk_table.first;
- loop
- if a_pk_table(l_index) in (a_data_info.access_path, a_data_info.parent_name) then
- --When then table is nested and join is on whole table
- l_sql_stmt := l_sql_stmt ||a_alias||a_data_info.transformed_name;
- end if;
- exit when (a_data_info.access_path = a_pk_table(l_index)) or l_index = a_pk_table.count;
- l_index := a_pk_table.next(l_index);
- end loop;
- else
- l_sql_stmt := a_alias||a_data_info.transformed_name;
- end if;
- return l_sql_stmt;
- end;
-
- function generate_select_stmt(a_data_info ut_cursor_column, a_alias varchar2 := 'ucd.')
- return varchar2
- is
- l_alias varchar2(10) := a_alias;
- l_col_syntax varchar2(4000);
- begin
- if a_data_info.is_sql_diffable = 0 then
- l_col_syntax := 'ut_utils.get_hash('||l_alias||a_data_info.transformed_name||'.getClobVal()) as '||a_data_info.transformed_name ;
- elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type = 'DATE' then
- l_col_syntax := 'to_date('||l_alias||a_data_info.transformed_name||') as '|| a_data_info.transformed_name;
- elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type in ('TIMESTAMP') then
- l_col_syntax := 'to_timestamp('||l_alias||a_data_info.transformed_name||','''||ut_utils.gc_timestamp_format||''') as '|| a_data_info.transformed_name;
- elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type in ('TIMESTAMP WITH TIME ZONE') then
- l_col_syntax := 'to_timestamp_tz('||l_alias||a_data_info.transformed_name||','''||ut_utils.gc_timestamp_tz_format||''') as '|| a_data_info.transformed_name;
- elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type in ('TIMESTAMP WITH LOCAL TIME ZONE') then
- l_col_syntax := ' cast( to_timestamp_tz('||l_alias||a_data_info.transformed_name||','''||ut_utils.gc_timestamp_tz_format||''') AS TIMESTAMP WITH LOCAL TIME ZONE) as '|| a_data_info.transformed_name;
- else
- l_col_syntax := l_alias||a_data_info.transformed_name||' as '|| a_data_info.transformed_name;
- end if;
- return l_col_syntax;
- end;
-
- function generate_xmltab_stmt(a_data_info ut_cursor_column) return varchar2 is
- l_col_type varchar2(4000);
- begin
- if a_data_info.is_sql_diffable = 0 then
- l_col_type := 'XMLTYPE';
- elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type in ('DATE','TIMESTAMP','TIMESTAMP WITH TIME ZONE',
- 'TIMESTAMP WITH LOCAL TIME ZONE') then
- l_col_type := 'VARCHAR2(50)';
- elsif a_data_info.is_sql_diffable = 1 and type_no_length(a_data_info.column_type) then
- l_col_type := a_data_info.column_type;
- elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type in ('VARCHAR2','CHAR') then
- l_col_type := 'VARCHAR2('||greatest(a_data_info.column_len,4000)||')';
- elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type in ('NUMBER') then
- --We cannot use a precision and scale as dbms_sql.describe_columns3 return precision 0 for dual table
- -- there is also no need for that as we not process data but only read and compare as they are stored
- l_col_type := a_data_info.column_type;
- else
- l_col_type := a_data_info.column_type
- ||case when a_data_info.column_len is not null
- then '('||a_data_info.column_len||')'
- else null
- end;
- end if;
- return a_data_info.transformed_name||' '||l_col_type||q'[ PATH ']'||a_data_info.access_path||q'[']';
- end;
-
- procedure gen_sql_pieces_out_of_cursor(
- a_data_info ut_cursor_column_tab,
- a_pk_table ut_varchar2_list,
- a_unordered boolean,
- a_xml_stmt out nocopy clob,
- a_select_stmt out nocopy clob,
- a_partition_stmt out nocopy clob,
- a_join_by_stmt out nocopy clob,
- a_not_equal_stmt out nocopy clob
- ) is
- l_partition_tmp clob;
- l_xmltab_list ut_varchar2_list := ut_varchar2_list();
- l_select_list ut_varchar2_list := ut_varchar2_list();
- l_partition_list ut_varchar2_list := ut_varchar2_list();
- l_equal_list ut_varchar2_list := ut_varchar2_list();
- l_join_by_list ut_varchar2_list := ut_varchar2_list();
- l_not_equal_list ut_varchar2_list := ut_varchar2_list();
-
- procedure add_element_to_list(a_list in out ut_varchar2_list, a_list_element in varchar2)
- is
- begin
- if a_list_element is not null then
- a_list.extend;
- a_list(a_list.last) := a_list_element;
- end if;
- end;
-
- begin
- if a_data_info is not empty then
- for i in 1..a_data_info.count loop
- if a_data_info(i).has_nested_col = 0 and a_data_info(i).column_type <> 'OBJECT' then
- --Get XMLTABLE column list
- add_element_to_list(l_xmltab_list,generate_xmltab_stmt(a_data_info(i)));
- --Get Select statment list of columns
- add_element_to_list(l_select_list, generate_select_stmt(a_data_info(i)));
- --Get columns by which we partition
- add_element_to_list(l_partition_list,generate_partition_stmt(a_data_info(i), a_pk_table));
- --Get equal statement
- add_element_to_list(l_equal_list,generate_equal_sql(a_data_info(i).transformed_name));
- --Generate join by stmt
- add_element_to_list(l_join_by_list,generate_join_by_stmt(a_data_info(i), a_pk_table));
- --Generate not equal stmt
- add_element_to_list(l_not_equal_list,generate_not_equal_stmt(a_data_info(i), a_pk_table));
- end if;
- end loop;
-
- a_xml_stmt := nullif(','||ut_utils.table_to_clob(l_xmltab_list, ' , '),',');
- a_select_stmt := nullif(','||ut_utils.table_to_clob(l_select_list, ' , '),',');
- l_partition_tmp := ut_utils.table_to_clob(l_partition_list, ' , ');
- ut_utils.append_to_clob(a_partition_stmt,' row_number() over (partition by '||l_partition_tmp||' order by '||l_partition_tmp||' ) ');
-
- if a_pk_table.count > 0 then
- -- If key defined do the join or these and where on diffrences as well as on duplicate number when rows are same.
- a_join_by_stmt := ' e."UT3$_Dup#No" = a."UT3$_Dup#No" and '||ut_utils.table_to_clob(l_join_by_list, ' and ');
- elsif a_unordered then
- -- If no key defined do the join on all columns
- a_join_by_stmt := ' e."UT3$_Dup#No" = a."UT3$_Dup#No" and '||ut_utils.table_to_clob(l_equal_list, ' and ');
- else
- -- Else join on rownumber
- a_join_by_stmt := 'a."UT3$_Item#No" = e."UT3$_Item#No" ';
- end if;
- a_not_equal_stmt := ut_utils.table_to_clob(l_not_equal_list, ' or ');
- else
- --Partition by piece when no data
- ut_utils.append_to_clob(a_partition_stmt,' 1 ');
- a_join_by_stmt := 'a."UT3$_Item#No" = e."UT3$_Item#No" ';
- end if;
- end;
-
- function gen_compare_sql(
- a_other ut_data_value_refcursor,
- a_join_by_list ut_varchar2_list,
- a_unordered boolean,
- a_inclusion_type boolean,
- a_is_negated boolean
- ) return clob is
- l_compare_sql clob;
- l_xmltable_stmt clob;
- l_select_stmt clob;
- l_partition_stmt clob;
- l_join_on_stmt clob;
- l_not_equal_stmt clob;
- l_where_stmt clob;
- l_join_by_list ut_varchar2_list;
-
- function get_join_type(a_inclusion_compare in boolean,a_negated in boolean) return varchar2 is
- begin
- return
- case
- when a_inclusion_compare and not(a_negated) then ' right outer join '
- when a_inclusion_compare and a_negated then ' inner join '
- else ' full outer join '
- end;
- end;
-
- function get_item_no(a_unordered boolean) return varchar2 is
- begin
- return
- case
- when a_unordered then 'row_number() over ( order by nvl(e."UT3$_Item#No",a."UT3$_Item#No"))'
- else 'nvl(e."UT3$_Item#No",a."UT3$_Item#No") '
- end;
- end;
-
- begin
- /**
- * We already estabilished cursor equality so now we add anydata root if we compare anydata
- * to join by.
- */
- l_join_by_list :=
- case
- when a_other is of (ut_data_value_anydata) then ut_utils.add_prefix(a_join_by_list, a_other.cursor_details.get_root)
- else a_join_by_list
- end;
-
- dbms_lob.createtemporary(l_compare_sql, true);
- --Initiate a SQL template with placeholders
- ut_utils.append_to_clob(l_compare_sql, g_compare_sql_template);
- --Generate a pieceso of dynamic SQL that will substitute placeholders
- gen_sql_pieces_out_of_cursor(
- a_other.cursor_details.cursor_columns_info, l_join_by_list, a_unordered,
- l_xmltable_stmt, l_select_stmt, l_partition_stmt, l_join_on_stmt,
- l_not_equal_stmt
- );
-
- l_compare_sql := replace(l_compare_sql,'{:duplicate_number:}',l_partition_stmt);
- l_compare_sql := replace(l_compare_sql,'{:columns:}',l_select_stmt);
- l_compare_sql := replace(l_compare_sql,'{:xml_to_columns:}',l_xmltable_stmt);
- l_compare_sql := replace(l_compare_sql,'{:item_no:}',get_item_no(a_unordered));
- l_compare_sql := replace(l_compare_sql,'{:join_type:}',get_join_type(a_inclusion_type,a_is_negated));
- l_compare_sql := replace(l_compare_sql,'{:join_condition:}',l_join_on_stmt);
-
- if l_not_equal_stmt is not null and ((l_join_by_list.count > 0 and not a_is_negated) or (not a_unordered)) then
- ut_utils.append_to_clob(l_where_stmt,' ( '||l_not_equal_stmt||' ) or ');
- end if;
- --If its inclusion we expect a actual set to fully match and have no extra elements over expected
- if a_inclusion_type then
- ut_utils.append_to_clob(l_where_stmt,case when a_is_negated then ' 1 = 1 ' else ' ( a."UT3$_Data#Id" is null ) ' end);
- else
- ut_utils.append_to_clob(l_where_stmt,' (a."UT3$_Data#Id" is null or e."UT3$_Data#Id" is null) ');
- end if;
-
- l_compare_sql := replace(l_compare_sql,'{:where_condition:}',l_where_stmt);
- return l_compare_sql;
- end;
-
- function get_column_extract_path(a_cursor_info ut_cursor_column_tab) return ut_varchar2_list is
- l_column_list ut_varchar2_list := ut_varchar2_list();
- begin
- for i in 1..a_cursor_info.count loop
- --This avoids extracting single columns from nested objects.
- --as we can go down to any level but we will lose visibility of parent.
- if a_cursor_info(i).hierarchy_level = 1 then
- l_column_list.extend;
- l_column_list(l_column_list.last) := a_cursor_info(i).access_path;
- end if;
- end loop;
- return l_column_list;
- end;
-
- function get_rows_diff_by_sql(
- a_act_cursor_info ut_cursor_column_tab, a_exp_cursor_info ut_cursor_column_tab,
- a_expected_dataset_guid raw, a_actual_dataset_guid raw, a_diff_id raw,
- a_join_by_list ut_varchar2_list, a_unordered boolean, a_enforce_column_order boolean := false,
- a_extract_path varchar2
- ) return tt_row_diffs is
- l_act_extract_xpath varchar2(32767):= ut_utils.to_xpath(get_column_extract_path(a_act_cursor_info));
- l_exp_extract_xpath varchar2(32767):= ut_utils.to_xpath(get_column_extract_path(a_exp_cursor_info));
- l_join_xpath varchar2(32767) := ut_utils.to_xpath(a_join_by_list);
- l_results tt_row_diffs;
- l_sql varchar2(32767);
- l_column_order varchar2(100);
- begin
- if a_enforce_column_order then
- l_column_order := 'col_no';
- else
- l_column_order := 'col_name';
- end if;
- l_sql := q'[
- with
- exp_cols as (
- select
- i.exp_item_data, i.exp_data_id, i.item_no rn, rownum col_no, i.diff_id,
- s.column_value col, s.column_value.getRootElement() col_name,
- nvl( s.column_value.getclobval(), empty_clob() ) col_val
- from (
- select
- ucd.exp_data_id, extract( ucd.exp_item_data, :column_path ) exp_item_data,
- ucd.item_no, ucd.diff_id
- from ut_compound_data_diff_tmp ucd
- where ucd.diff_id = :diff_id
- and ucd.exp_data_id = :self_guid
- ) i,
- table( xmlsequence( extract( i.exp_item_data, :extract_path ) ) ) s
- ),
- act_cols as (
- select
- i.act_item_data, i.act_data_id, i.item_no rn, rownum col_no, i.diff_id,
- s.column_value col, s.column_value.getRootElement() col_name,
- nvl( s.column_value.getclobval(), empty_clob() ) col_val
- from (
- select
- ucd.act_data_id, extract( ucd.act_item_data, :column_path ) act_item_data,
- ucd.item_no, ucd.diff_id
- from ut_compound_data_diff_tmp ucd
- where ucd.diff_id = :diff_id
- and ucd.act_data_id = :other_guid
- ) i,
- table( xmlsequence( extract( i.act_item_data, :extract_path ) ) ) s
- ),
- data_diff as (
- select rn, diff_type, xmlserialize(content data_item no indent) diffed_row, null pk_value, col_name, diff_id
- from (
- select nvl(exp.rn, act.rn) rn,
- exp.diff_id diff_id,
- xmlagg(exp.col order by exp.col_no) exp_item,
- xmlagg(act.col order by nvl(exp.col_no, act.col_no)) act_item,
- max(nvl(exp.col_name,act.col_name)) col_name
- from exp_cols exp
- join act_cols act
- on exp.rn = act.rn and exp.col_name = act.col_name
- where dbms_lob.compare(exp.col_val, act.col_val) != 0
- group by nvl(exp.rn, act.rn), exp.diff_id
- )
- unpivot ( data_item for diff_type in (exp_item as 'Expected:', act_item as 'Actual:') )
- ),
- unordered_diff as (
- select rn, diff_type, xmlserialize(content data_item no indent) diffed_row, null pk_value, col_name, diff_id
- from (
- select nvl(exp.rn, act.rn) rn,
- exp.diff_id diff_id,
- xmlagg(exp.col order by exp.col_name) exp_item,
- xmlagg(act.col order by act.col_name) act_item,
- max(nvl(exp.col_name,act.col_name)) col_name
- from exp_cols exp
- join act_cols act
- on exp.rn = act.rn and exp.col_name = act.col_name
- where dbms_lob.compare(exp.col_val, act.col_val) != 0
- group by nvl(exp.rn, act.rn), exp.diff_id
- )
- unpivot ( data_item for diff_type in (exp_item as 'Expected:', act_item as 'Actual:') )
- )
- select /*+ no_parallel */ rn, diff_type, diffed_row, pk_value
- from (
- select rn, diff_type, diffed_row, pk_value,
- case when diff_type = 'Actual:' then 1 else 2 end rnk,
- 1 final_order,
- col_name
- from ( ]'
- || case when a_unordered then q'[
- select /*+ no_unnest */
- u.rn, u.diff_type, u.diffed_row,
- replace(
- extract( case when i.exp_data_id is null then i.act_item_data else i.exp_item_data end, :join_by ).getclobval(),
- chr(10)
- ) pk_value,
- u.col_name
- from data_diff u
- join ut_compound_data_diff_tmp i
- on i.diff_id = u.diff_id
- and i.item_no = u.rn]'
- else q'[
- select rn, diff_type, diffed_row, pk_value, col_name
- from data_diff
- where :join_by is null ]'
- end ||q'[
- )
- union all
- select
- item_no as rn,
- case when exp_data_id is null then 'Extra:' else 'Missing:' end as diff_type,
- xmlserialize(
- content (
- extract( (case when exp_data_id is null then act_item_data else exp_item_data end),'/*/*')
- ) no indent
- ) diffed_row,
- nvl2(
- :join_by,
- replace(
- extract( case when exp_data_id is null then act_item_data else exp_item_data end, :join_by ).getclobval(),
- chr(10)
- ),
- null
- ) pk_value,
- case when exp_data_id is null then 1 else 2 end rnk,
- 2 final_order,
- null col_name
- from ut_compound_data_diff_tmp i
- where diff_id = :diff_id
- and act_data_id is null or exp_data_id is null
- )
- order by final_order,]'
- ||case when a_enforce_column_order or (not(a_enforce_column_order) and not(a_unordered)) then
- q'[
- case when final_order = 1 then rn else rnk end,
- case when final_order = 1 then rnk else rn end
- ]'
- when a_unordered then
- q'[
- case when final_order = 1 then col_name else to_char(rnk) end,
- case when final_order = 1 then to_char(rn) else col_name end,
- case when final_order = 1 then to_char(rnk) else col_name end
- ]'
- end;
- execute immediate l_sql
- bulk collect into l_results
- using l_exp_extract_xpath, a_diff_id, a_expected_dataset_guid, a_extract_path,
- l_act_extract_xpath, a_diff_id, a_actual_dataset_guid, a_extract_path,
- l_join_xpath, l_join_xpath, l_join_xpath, a_diff_id;
- return l_results;
- end;
-
- function get_fixed_size_hash(a_string varchar2, a_base integer :=0,a_size integer := 9999999) return number is
- begin
- return dbms_utility.get_hash_value(a_string,a_base,a_size);
- end;
-
- procedure insert_diffs_result(a_diff_tab t_diff_tab, a_diff_id raw) is
- begin
- forall idx in 1..a_diff_tab.count save exceptions
- insert /*+ no_parallel */ into ut_compound_data_diff_tmp
- ( diff_id, act_item_data, act_data_id, exp_item_data, exp_data_id, item_no, duplicate_no )
- values
- (a_diff_id,
- xmlelement( name "ROW", a_diff_tab(idx).act_item_data), a_diff_tab(idx).act_data_id,
- xmlelement( name "ROW", a_diff_tab(idx).exp_item_data), a_diff_tab(idx).exp_data_id,
- a_diff_tab(idx).item_no, a_diff_tab(idx).dup_no);
- exception
- when ut_utils.ex_failure_for_all then
- raise_application_error(ut_utils.gc_dml_for_all,'Failure to insert a diff tmp data.');
- end;
-
- procedure set_rows_diff(a_rows_diff integer) is
- begin
- g_diff_count := a_rows_diff;
- end;
-
- procedure cleanup_diff is
- begin
- g_diff_count := 0;
- delete from ut_compound_data_diff_tmp;
- delete from ut_json_data_diff_tmp;
- end;
-
- function get_rows_diff_count return integer is
- begin
- return g_diff_count;
- end;
-
- function is_sql_compare_allowed(a_type_name varchar2)
- return boolean is
- l_assert boolean;
- begin
- --clob/blob/xmltype/object/nestedcursor/nestedtable
- if a_type_name IN (g_type_name_map(dbms_sql.blob_type),
- g_type_name_map(dbms_sql.clob_type),
- g_type_name_map(dbms_sql.long_type),
- g_type_name_map(dbms_sql.long_raw_type),
- g_type_name_map(dbms_sql.bfile_type),
- g_anytype_name_map(dbms_types.typecode_namedcollection))
- then
- l_assert := false;
- else
- l_assert := true;
- end if;
- return l_assert;
- end;
-
- function get_column_type_desc(a_type_code in integer, a_dbms_sql_desc in boolean)
- return varchar2 is
- begin
- return
- case
- when a_dbms_sql_desc then g_type_name_map(a_type_code)
- else g_anytype_name_map(a_type_code)
- end;
- end;
-
- function get_compare_cursor(a_diff_cursor_text in clob,a_self_id raw, a_other_id raw) return sys_refcursor is
- l_diff_cursor sys_refcursor;
- begin
- open l_diff_cursor for a_diff_cursor_text using a_self_id, a_other_id;
- return l_diff_cursor;
- end;
-
- function create_err_cursor_msg(a_error_stack varchar2) return varchar2 is
- begin
- return 'SQL exception thrown when fetching data from cursor:'||
- ut_utils.remove_error_from_stack(sqlerrm,ut_utils.gc_xml_processing)||chr(10)||
- ut_expectation_processor.who_called_expectation(a_error_stack)||chr(10)||
- 'Check the query and data for errors.';
- end;
-
- procedure save_cursor_data_for_diff(a_data_id raw, a_set_id integer, a_xml xmltype) is
- begin
- insert /*+ no_parallel */ into ut_compound_data_tmp (data_id, item_no, item_data) values (a_data_id, a_set_id, a_xml);
- end;
-
- function get_row_data_as_xml(a_data_id raw, a_max_rows integer) return ut_utils.t_clob_tab is
- l_results ut_utils.t_clob_tab;
- begin
- select /*+ no_parallel */ xmlserialize( content ucd.item_data no indent)
- bulk collect into l_results
- from ut_compound_data_tmp tmp
- ,xmltable ( '/ROWSET' passing tmp.item_data
- columns item_data xmltype PATH '*'
- ) ucd
- where tmp.data_id = a_data_id
- and rownum <= a_max_rows;
-
- return l_results;
- end;
-
- function type_no_length ( a_type_name varchar2) return boolean is
- begin
- return case
- when g_type_no_length_map.exists(a_type_name) then
- true
- else
- false
- end;
- end;
-
- function compare_json_data(a_act_json_data ut_json_leaf_tab,a_exp_json_data ut_json_leaf_tab) return tt_json_diff_tab is
- l_result_diff tt_json_diff_tab := tt_json_diff_tab();
- begin
-
- with
- differences as (
- select case
- when (a.element_name is null or e.element_name is null) then gc_json_missing
- when a.json_type != e.json_type then gc_json_type
- when (decode(a.element_value,e.element_value,1,0) = 0) then gc_json_notequal
- else gc_json_unknown
- end as difference_type,
- case
- when (a.element_name is null or e.element_name is null) then 1
- when a.json_type != e.json_type then 2
- when (decode(a.element_value,e.element_value,1,0) = 0) then 3
- else 4
- end as order_by_type,
- a.element_name as act_element_name,
- a.element_value as act_element_value,
- a.hierarchy_level as act_hierarchy_level,
- a.index_position as act_index_position,
- a.json_type as act_json_type,
- a.access_path as act_access_path,
- a.parent_name as act_par_name,
- a.parent_path as act_parent_path,
- e.element_name as exp_element_name,
- e.element_value as exp_element_value,
- e.hierarchy_level as exp_hierarchy_level,
- e.index_position as exp_index_position,
- e.json_type as exp_json_type,
- e.access_path as exp_access_path,
- e.parent_name as exp_par_name,
- e.parent_path as exp_parent_path
- from table(a_act_json_data) a
- full outer join table(a_exp_json_data) e
- on decode(a.parent_name,e.parent_name,1,0)= 1
- and decode(a.parent_path,e.parent_path,1,0)= 1
- and (
- case when a.parent_type = 'object' or e.parent_type = 'object' then
- decode(a.element_name,e.element_name,1,0)
- else 1 end = 1
- )
- and (
- case when a.parent_type = 'array' or e.parent_type = 'array' then
- decode(a.index_position,e.index_position,1,0)
- else 1 end = 1
- )
- and a.hierarchy_level = e.hierarchy_level
- where (a.element_name is null or e.element_name is null)
- or (a.json_type != e.json_type)
- or (decode(a.element_value,e.element_value,1,0) = 0)
- )
- select /*+ no_parallel */ difference_type,
- act_element_name, act_element_value, act_json_type, act_access_path, act_parent_path,
- exp_element_name, exp_element_value, exp_json_type, exp_access_path, exp_parent_path
- bulk collect into l_result_diff
- from differences a
- where not exists (
- select 1 from differences b
- where (a.act_par_name = b.act_element_name and a.act_hierarchy_level - 1 = b.act_hierarchy_level)
- or (a.exp_par_name = b.exp_element_name and a.exp_hierarchy_level - 1 = b.exp_hierarchy_level)
- and a.difference_type = gc_json_missing and b.difference_type = gc_json_missing
- )
- order by order_by_type,
- nvl(act_hierarchy_level,exp_hierarchy_level),
- nvl(act_index_position,exp_index_position) nulls first,
- nvl(act_element_name,exp_element_name) ;
- return l_result_diff;
- end;
-
- function insert_json_diffs(a_diff_id raw, a_act_json_data ut_json_leaf_tab, a_exp_json_data ut_json_leaf_tab) return integer is
- l_diffs tt_json_diff_tab := compare_json_data(a_act_json_data,a_exp_json_data);
- begin
- forall i in 1..l_diffs.count
- insert /*+ no_parallel */ into ut_json_data_diff_tmp (
- diff_id, difference_type,
- act_element_name, act_element_value, act_json_type, act_access_path, act_parent_path,
- exp_element_name, exp_element_value, exp_json_type, exp_access_path, exp_parent_path
- )
- values (
- a_diff_id,l_diffs(i).difference_type,
- l_diffs(i).act_element_name,l_diffs(i).act_element_value,l_diffs(i).act_json_type, l_diffs(i).act_access_path, l_diffs(i).act_parent_path,
- l_diffs(i).exp_element_name,l_diffs(i).exp_element_value,l_diffs(i).exp_json_type,l_diffs(i).exp_access_path, l_diffs(i).exp_parent_path
- );
-
- return l_diffs.count;
- end;
-
- function get_json_diffs_type(a_diff_id raw) return tt_json_diff_type_tab is
- l_diffs_summary tt_json_diff_type_tab := tt_json_diff_type_tab();
- begin
- select /*+ no_parallel */ d.difference_type,count(1)
- bulk collect into l_diffs_summary
- from ut_json_data_diff_tmp d
- where diff_id = a_diff_id
- group by d.difference_type;
-
- return l_diffs_summary;
- end;
-
- function get_json_diffs_tmp(a_diff_id raw) return tt_json_diff_tab is
- l_diffs tt_json_diff_tab;
- begin
- select /*+ no_parallel */ difference_type,
- act_element_name, act_element_value, act_json_type, act_access_path, act_parent_path,
- exp_element_name, exp_element_value, exp_json_type, exp_access_path, exp_parent_path
- bulk collect into l_diffs
- from ut_json_data_diff_tmp
- where diff_id = a_diff_id;
-
- return l_diffs;
- end;
-
- function get_json_object(a_json_t json) return json_element_t is
- l_obj json_element_t;
- begin
- $if dbms_db_version.version >= 21 $then
- l_obj := case when a_json_t is null then cast (null as json_element_t ) else json_element_t.parse(json_query(a_json_t, '$' returning clob)) end;
- $end
- return l_obj;
- end;
-
-begin
- g_anytype_name_map(dbms_types.typecode_date) := 'DATE';
- g_anytype_name_map(dbms_types.typecode_number) := 'NUMBER';
- g_anytype_name_map(3 /*INTEGER in object type*/) := 'NUMBER';
- g_anytype_name_map(dbms_types.typecode_raw) := 'RAW';
- g_anytype_name_map(dbms_types.typecode_char) := 'CHAR';
- g_anytype_name_map(dbms_types.typecode_varchar2) := 'VARCHAR2';
- g_anytype_name_map(dbms_types.typecode_varchar) := 'VARCHAR';
- g_anytype_name_map(dbms_types.typecode_blob) := 'BLOB';
- g_anytype_name_map(dbms_types.typecode_bfile) := 'BFILE';
- g_anytype_name_map(dbms_types.typecode_clob) := 'CLOB';
- g_anytype_name_map(dbms_types.typecode_timestamp) := 'TIMESTAMP';
- g_anytype_name_map(dbms_types.typecode_timestamp_tz) := 'TIMESTAMP WITH TIME ZONE';
- g_anytype_name_map(dbms_types.typecode_timestamp_ltz) := 'TIMESTAMP WITH LOCAL TIME ZONE';
- g_anytype_name_map(dbms_types.typecode_interval_ym) := 'INTERVAL YEAR TO MONTH';
- g_anytype_name_map(dbms_types.typecode_interval_ds) := 'INTERVAL DAY TO SECOND';
- g_anytype_name_map(dbms_types.typecode_bfloat) := 'BINARY_FLOAT';
- g_anytype_name_map(dbms_types.typecode_bdouble) := 'BINARY_DOUBLE';
- g_anytype_name_map(dbms_types.typecode_urowid) := 'UROWID';
- g_anytype_name_map(dbms_types.typecode_varray) := 'VARRRAY';
- g_anytype_name_map(dbms_types.typecode_table) := 'TABLE';
- g_anytype_name_map(dbms_types.typecode_namedcollection) := 'NAMEDCOLLECTION';
- g_anytype_name_map(dbms_types.typecode_object) := 'OBJECT';
-
- g_type_name_map( dbms_sql.binary_bouble_type ) := 'BINARY_DOUBLE';
- g_type_name_map( dbms_sql.bfile_type ) := 'BFILE';
- g_type_name_map( dbms_sql.binary_float_type ) := 'BINARY_FLOAT';
- g_type_name_map( dbms_sql.blob_type ) := 'BLOB';
- g_type_name_map( dbms_sql.long_raw_type ) := 'LONG RAW';
- g_type_name_map( dbms_sql.char_type ) := 'CHAR';
- g_type_name_map( dbms_sql.clob_type ) := 'CLOB';
- g_type_name_map( dbms_sql.long_type ) := 'LONG';
- g_type_name_map( dbms_sql.date_type ) := 'DATE';
- g_type_name_map( dbms_sql.interval_day_to_second_type ) := 'INTERVAL DAY TO SECOND';
- g_type_name_map( dbms_sql.interval_year_to_month_type ) := 'INTERVAL YEAR TO MONTH';
- g_type_name_map( dbms_sql.raw_type ) := 'RAW';
- g_type_name_map( dbms_sql.timestamp_type ) := 'TIMESTAMP';
- g_type_name_map( dbms_sql.timestamp_with_tz_type ) := 'TIMESTAMP WITH TIME ZONE';
- g_type_name_map( dbms_sql.timestamp_with_local_tz_type ) := 'TIMESTAMP WITH LOCAL TIME ZONE';
- g_type_name_map( dbms_sql.varchar2_type ) := 'VARCHAR2';
- g_type_name_map( dbms_sql.number_type ) := 'NUMBER';
- g_type_name_map( dbms_sql.rowid_type ) := 'ROWID';
- g_type_name_map( dbms_sql.urowid_type ) := 'UROWID';
- g_type_name_map( dbms_sql.user_defined_type ) := 'USER_DEFINED_TYPE';
- g_type_name_map( dbms_sql.ref_type ) := 'REF_TYPE';
-
-
- /**
- * List of types that have no length but can produce a max_len from desc_cursor function.
- */
- g_type_no_length_map('ROWID') := 'ROWID';
- g_type_no_length_map('INTERVAL DAY TO SECOND') := 'INTERVAL DAY TO SECOND';
- g_type_no_length_map('INTERVAL YEAR TO MONTH') := 'INTERVAL YEAR TO MONTH';
- g_type_no_length_map('BINARY_DOUBLE') := 'BINARY_DOUBLE';
- g_type_no_length_map('BINARY_FLOAT') := 'BINARY_FLOAT';
-end;
-/
diff --git a/source/expectations/data_values/ut_compound_data_helper.pks b/source/expectations/data_values/ut_compound_data_helper.pks
deleted file mode 100644
index 451cd9bac..000000000
--- a/source/expectations/data_values/ut_compound_data_helper.pks
+++ /dev/null
@@ -1,140 +0,0 @@
-create or replace package ut_compound_data_helper authid definer is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- gc_compare_unordered constant varchar2(10):='unordered';
- gc_compare_normal constant varchar2(10):='normal';
-
- gc_json_missing constant varchar2(30) := 'missing properties';
- gc_json_type constant varchar2(30) := 'incorrect types';
- gc_json_notequal constant varchar2(30) := 'unequal values';
- gc_json_unknown constant varchar2(30) := 'unknown';
-
- type t_column_diffs is record(
- diff_type varchar2(1),
- expected_name varchar2(250),
- expected_type varchar2(250),
- expected_pos integer,
- actual_name varchar2(250),
- actual_type varchar2(250),
- actual_pos integer
- );
-
- type tt_column_diffs is table of t_column_diffs;
-
- type t_row_diffs is record(
- rn integer,
- diff_type varchar2(250),
- diffed_row clob,
- pk_value varchar2(4000)
- );
-
- type tt_row_diffs is table of t_row_diffs;
-
- type t_diff_rec is record (
- act_item_data xmltype,
- act_data_id raw(32),
- exp_item_data xmltype,
- exp_data_id raw(32),
- item_no number,
- dup_no number
- );
-
- type t_diff_tab is table of t_diff_rec;
-
- type t_json_diff_rec is record (
- difference_type varchar2(50),
- act_element_name varchar2(4000),
- act_element_value varchar2(4000),
- act_json_type varchar2(4000),
- act_access_path varchar2(4000),
- act_parent_path varchar2(4000),
- exp_element_name varchar2(4000),
- exp_element_value varchar2(4000),
- exp_json_type varchar2(4000),
- exp_access_path varchar2(4000),
- exp_parent_path varchar2(4000)
- );
-
- type tt_json_diff_tab is table of t_json_diff_rec;
-
- type t_json_diff_type_rec is record (
- difference_type varchar2(50),
- no_of_occurence integer
- );
-
- type tt_json_diff_type_tab is table of t_json_diff_type_rec;
-
- function get_columns_diff(
- a_expected ut_cursor_column_tab, a_actual ut_cursor_column_tab,a_order_enforced boolean := false
- ) return tt_column_diffs;
-
- function get_rows_diff_by_sql(
- a_act_cursor_info ut_cursor_column_tab,a_exp_cursor_info ut_cursor_column_tab,
- a_expected_dataset_guid raw, a_actual_dataset_guid raw, a_diff_id raw,
- a_join_by_list ut_varchar2_list, a_unordered boolean, a_enforce_column_order boolean := false,
- a_extract_path varchar2
- ) return tt_row_diffs;
-
- function get_fixed_size_hash(a_string varchar2, a_base integer :=0,a_size integer :=9999999) return number;
-
- function gen_compare_sql(
- a_other ut_data_value_refcursor,
- a_join_by_list ut_varchar2_list,
- a_unordered boolean,
- a_inclusion_type boolean,
- a_is_negated boolean
- ) return clob;
-
- procedure insert_diffs_result(a_diff_tab t_diff_tab, a_diff_id raw);
-
- procedure set_rows_diff(a_rows_diff integer);
-
- procedure cleanup_diff;
-
- function get_rows_diff_count return integer;
-
- function is_sql_compare_allowed(a_type_name varchar2) return boolean;
-
- function get_column_type_desc(a_type_code in integer, a_dbms_sql_desc in boolean) return varchar2;
-
- function get_compare_cursor(a_diff_cursor_text in clob,a_self_id raw, a_other_id raw) return sys_refcursor;
-
- function create_err_cursor_msg(a_error_stack varchar2) return varchar2;
-
- procedure save_cursor_data_for_diff(a_data_id raw, a_set_id integer, a_xml xmltype);
-
- function get_row_data_as_xml(a_data_id raw, a_max_rows integer) return ut_utils.t_clob_tab;
-
- /*
- * Function to return true or false if the type dont have an length
- */
- function type_no_length ( a_type_name varchar2) return boolean;
-
- function compare_json_data(a_act_json_data ut_json_leaf_tab,a_exp_json_data ut_json_leaf_tab) return tt_json_diff_tab;
-
- function insert_json_diffs(a_diff_id raw, a_act_json_data ut_json_leaf_tab,a_exp_json_data ut_json_leaf_tab) return integer;
-
- function get_json_diffs_tmp(a_diff_id raw) return tt_json_diff_tab;
-
-
- function get_json_diffs_type(a_diff_id raw) return tt_json_diff_type_tab;
-
- function get_json_object(a_json_t json) return json_element_t;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_compound_data_tmp.sql b/source/expectations/data_values/ut_compound_data_tmp.sql
deleted file mode 100644
index 1bfa77fca..000000000
--- a/source/expectations/data_values/ut_compound_data_tmp.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-create global temporary table ut_compound_data_tmp(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_id raw(32),
- item_no integer,
- item_data xmltype,
- item_hash raw(128),
- pk_hash raw(128),
- duplicate_no integer,
- constraint ut_cmp_data_tmp_hash_pk unique (data_id, item_no, duplicate_no)
-) on commit delete rows;
---xmltype column item_data store as binary xml;
\ No newline at end of file
diff --git a/source/expectations/data_values/ut_compound_data_value.tpb b/source/expectations/data_values/ut_compound_data_value.tpb
deleted file mode 100644
index 2c52ff8fa..000000000
--- a/source/expectations/data_values/ut_compound_data_value.tpb
+++ /dev/null
@@ -1,63 +0,0 @@
-create or replace type body ut_compound_data_value as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- member function get_elements_count_info return varchar2 is
- begin
- return case when elements_count is null then ' [ null ]' else ' [ count = '||elements_count||' ]' end;
- end;
-
- overriding member function get_object_info return varchar2 is
- begin
- return self.data_type||get_elements_count_info();
- end;
-
- overriding member function is_null return boolean is
- begin
- return ut_utils.int_to_boolean(self.is_data_null);
- end;
-
- overriding member function is_diffable return boolean is
- begin
- return true;
- end;
-
- overriding member function is_multi_line return boolean is
- begin
- return not self.is_null();
- end;
-
- overriding member function to_string return varchar2 is
- l_result clob;
- l_result_string varchar2(32767);
- begin
- if not self.is_null() then
- dbms_lob.createtemporary(l_result, true);
- ut_utils.append_to_clob(l_result,'Data:'||chr(10));
- ut_utils.append_to_clob(
- l_result,
- ut_compound_data_helper.get_row_data_as_xml( self.data_id, ut_utils.gc_diff_max_rows )
- );
-
- l_result_string := ut_utils.to_string(l_result,null);
- dbms_lob.freetemporary(l_result);
- end if;
- return l_result_string;
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_compound_data_value.tps b/source/expectations/data_values/ut_compound_data_value.tps
deleted file mode 100644
index c14dadceb..000000000
--- a/source/expectations/data_values/ut_compound_data_value.tps
+++ /dev/null
@@ -1,50 +0,0 @@
-create or replace type ut_compound_data_value force under ut_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /**
- * Holds information about ref cursor to be processed by expectation
- */
-
-
- /**
- * Determines if the cursor is null
- */
- is_data_null integer,
-
- /**
- * Holds the number of elements in the compound data value (cursor/collection)
- */
- elements_count integer,
-
- /**
- * Holds unique id for retrieving the data from ut_compound_data_tmp temp table
- */
- data_id raw(16),
-
- /**
- * Holds name for the type of compound
- */
- compound_type varchar2(50),
-
- member function get_elements_count_info return varchar2,
- overriding member function get_object_info return varchar2,
- overriding member function is_null return boolean,
- overriding member function is_diffable return boolean,
- overriding member function to_string return varchar2,
- overriding member function is_multi_line return boolean
-) not final not instantiable
-/
diff --git a/source/expectations/data_values/ut_cursor_column.tpb b/source/expectations/data_values/ut_cursor_column.tpb
deleted file mode 100644
index a9fb6b0f4..000000000
--- a/source/expectations/data_values/ut_cursor_column.tpb
+++ /dev/null
@@ -1,74 +0,0 @@
-create or replace type body ut_cursor_column as
-
- member procedure init(
- self in out nocopy ut_cursor_column,
- a_col_name varchar2, a_col_schema_name varchar2,
- a_col_type_name varchar2, a_col_max_len integer, a_parent_name varchar2 := null, a_hierarchy_level integer := 1,
- a_col_position integer, a_col_type varchar2, a_collection integer,a_access_path in varchar2, a_col_precision in integer,
- a_col_scale integer
- ) is
- begin
- self.parent_name := a_parent_name; --Name of the parent if its nested
- self.hierarchy_level := a_hierarchy_level; --Hierarchy level
- self.column_position := a_col_position; --Position of the column in cursor/ type
- self.column_len := a_col_max_len; --length of column
- self.column_precision := a_col_precision;
- self.column_scale := a_col_scale;
- self.column_type_name := coalesce(a_col_type_name,a_col_type); --type name e.g. test_dummy_object or varchar2
- self.column_name := case when a_col_name is null and a_collection = 1 then
- self.column_type_name
- else TRIM( BOTH '''' FROM a_col_name)
- end; --name of the column, however in nested object for collection name is not defined in cursor.
- self.xml_valid_name := ut_utils.get_valid_xml_name(self.column_name);
- self.display_path := case when a_access_path is null then
- self.column_name
- else
- a_access_path||'/'||self.column_name
- end; --Access path used for incldue exclude eg/ TEST_DUMMY_OBJECT/VARCHAR2
- self.access_path := case when a_access_path is null then
- self.xml_valid_name
- else
- a_access_path||'/'||self.xml_valid_name
- end; --Access path used for XMLTABLE query
- self.filter_path := '/'||self.access_path; --Filter path will differ from access path in anydata type
- --Transformed name needs to be build on full access path to avoid ambiguity when there is 3 or more levels of nesting.
- self.transformed_name := case when length(self.xml_valid_name) > 30 then
- '"'||ut_compound_data_helper.get_fixed_size_hash(self.access_path)||'"'
- when self.parent_name is null then
- '"'||self.xml_valid_name||'"'
- else
- '"'||ut_compound_data_helper.get_fixed_size_hash(self.access_path)||'"'
- end; --when is nestd we need to hash name to make sure we dont exceed 30 char
- self.column_type := a_col_type; --column type e.g. user_defined , varchar2
- self.column_schema := a_col_schema_name; -- schema name
- self.is_sql_diffable := case
- when lower(self.column_type) = 'user_defined_type' then
- 0
- -- Due to bug in 11g/12.1 collection fails on varchar 4000+
- when (lower(self.column_type) in ('varchar2','char')) and (self.column_len > 4000) then
- 0
- else
- ut_utils.boolean_to_int(ut_compound_data_helper.is_sql_compare_allowed(self.column_type))
- end; --can we directly compare or do we need to hash value
- self.is_collection := a_collection;
- self.has_nested_col := case when lower(self.column_type) = 'user_defined_type' and self.is_collection = 0 then 1 else 0 end;
- end;
-
- constructor function ut_cursor_column( self in out nocopy ut_cursor_column,
- a_col_name varchar2, a_col_schema_name varchar2,
- a_col_type_name varchar2, a_col_max_len integer, a_parent_name varchar2 := null, a_hierarchy_level integer := 1,
- a_col_position integer, a_col_type in varchar2, a_collection integer,a_access_path in varchar2, a_col_precision in integer,
- a_col_scale integer
- ) return self as result is
- begin
- init(a_col_name, a_col_schema_name, a_col_type_name, a_col_max_len, a_parent_name,a_hierarchy_level, a_col_position,
- a_col_type, a_collection,a_access_path,a_col_precision,a_col_scale);
- return;
- end;
-
- constructor function ut_cursor_column( self in out nocopy ut_cursor_column) return self as result is
- begin
- return;
- end;
-end;
-/
diff --git a/source/expectations/data_values/ut_cursor_column.tps b/source/expectations/data_values/ut_cursor_column.tps
deleted file mode 100644
index 77bf78f01..000000000
--- a/source/expectations/data_values/ut_cursor_column.tps
+++ /dev/null
@@ -1,52 +0,0 @@
-create or replace type ut_cursor_column authid current_user as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- parent_name varchar2(4000),
- access_path varchar2(4000),
- filter_path varchar2(4000),
- display_path varchar2(4000),
- has_nested_col number(1,0),
- transformed_name varchar2(2000),
- hierarchy_level number,
- column_position number,
- xml_valid_name varchar2(2000),
- column_name varchar2(2000),
- column_type varchar2(128),
- column_type_name varchar2(128),
- column_schema varchar2(128),
- column_len integer,
- column_precision integer,
- column_scale integer,
- is_sql_diffable number(1, 0),
- is_collection number(1, 0),
-
- member procedure init(self in out nocopy ut_cursor_column,
- a_col_name varchar2, a_col_schema_name varchar2,
- a_col_type_name varchar2, a_col_max_len integer, a_parent_name varchar2 := null, a_hierarchy_level integer := 1,
- a_col_position integer, a_col_type in varchar2, a_collection integer,a_access_path in varchar2, a_col_precision in integer,
- a_col_scale integer),
-
- constructor function ut_cursor_column( self in out nocopy ut_cursor_column,
- a_col_name varchar2, a_col_schema_name varchar2,
- a_col_type_name varchar2, a_col_max_len integer, a_parent_name varchar2 := null, a_hierarchy_level integer := 1,
- a_col_position integer, a_col_type in varchar2, a_collection integer, a_access_path in varchar2, a_col_precision in integer,
- a_col_scale integer)
- return self as result,
-
- constructor function ut_cursor_column( self in out nocopy ut_cursor_column) return self as result
-)
-/
diff --git a/source/expectations/data_values/ut_cursor_column_tab.tps b/source/expectations/data_values/ut_cursor_column_tab.tps
deleted file mode 100644
index 106023d96..000000000
--- a/source/expectations/data_values/ut_cursor_column_tab.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_cursor_column_tab as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-table of ut_cursor_column
-/
\ No newline at end of file
diff --git a/source/expectations/data_values/ut_cursor_details.tpb b/source/expectations/data_values/ut_cursor_details.tpb
deleted file mode 100644
index b823ff944..000000000
--- a/source/expectations/data_values/ut_cursor_details.tpb
+++ /dev/null
@@ -1,260 +0,0 @@
-create or replace type body ut_cursor_details as
-
- member function equals( a_other ut_cursor_details, a_match_options ut_matcher_options ) return boolean is
- l_diffs integer;
- begin
- select /*+ no_parallel */ count(1) into l_diffs
- from table(self.cursor_columns_info) a
- full outer join table(a_other.cursor_columns_info) e
- on decode(a.parent_name,e.parent_name,1,0)= 1
- and a.column_name = e.column_name
- and replace(a.column_type,'VARCHAR2','CHAR') = replace(e.column_type,'VARCHAR2','CHAR')
- and ( a.column_position = e.column_position or a_match_options.columns_are_unordered_flag = 1 )
- where a.column_name is null or e.column_name is null;
- return l_diffs = 0;
- end;
-
- member procedure desc_compound_data(
- self in out nocopy ut_cursor_details, a_compound_data anytype,
- a_parent_name in varchar2, a_level in integer, a_access_path in varchar2
- ) is
- l_idx pls_integer := 1;
- l_elements_info ut_metadata.t_anytype_members_rec;
- l_element_info ut_metadata.t_anytype_elem_info_rec;
- l_is_collection boolean;
- begin
- l_elements_info := ut_metadata.get_anytype_members_info( a_compound_data );
- l_is_collection := ut_metadata.is_collection(l_elements_info.type_code);
- if l_elements_info.elements_count is null then
- l_element_info := ut_metadata.get_attr_elem_info( a_compound_data );
- self.cursor_columns_info.extend;
- self.cursor_columns_info(cursor_columns_info.last) :=
- ut_cursor_column(
- l_elements_info.type_name,
- l_elements_info.schema_name,
- null,
- l_elements_info.length,
- a_parent_name,
- a_level,
- l_idx,
- ut_compound_data_helper.get_column_type_desc(l_elements_info.type_code,false),
- ut_utils.boolean_to_int(l_is_collection),
- a_access_path,
- l_elements_info.precision,
- l_elements_info.scale
- );
- if l_element_info.attr_elt_type is not null then
- desc_compound_data(
- l_element_info.attr_elt_type, l_elements_info.type_name,
- a_level + 1, a_access_path || '/' || l_elements_info.type_name
- );
- end if;
- else
- while l_idx <= l_elements_info.elements_count loop
- l_element_info := ut_metadata.get_attr_elem_info( a_compound_data, l_idx );
-
- self.cursor_columns_info.extend;
- self.cursor_columns_info(cursor_columns_info.last) :=
- ut_cursor_column(
- l_element_info.attribute_name,
- l_elements_info.schema_name,
- null,
- l_element_info.length,
- a_parent_name,
- a_level,
- l_idx,
- ut_compound_data_helper.get_column_type_desc(l_element_info.type_code,false),
- ut_utils.boolean_to_int(l_is_collection),
- a_access_path,
- l_elements_info.precision,
- l_elements_info.scale
- );
- if l_element_info.attr_elt_type is not null then
- desc_compound_data(
- l_element_info.attr_elt_type, l_element_info.attribute_name,
- a_level + 1, a_access_path || '/' || l_element_info.attribute_name
- );
- end if;
- l_idx := l_idx + 1;
- end loop;
- end if;
- end;
-
- constructor function ut_cursor_details(self in out nocopy ut_cursor_details) return self as result is
- begin
- self.cursor_columns_info := ut_cursor_column_tab();
- return;
- end;
-
- constructor function ut_cursor_details(
- self in out nocopy ut_cursor_details,
- a_cursor_number in number
- ) return self as result is
- l_columns_count pls_integer;
- $if dbms_db_version.version = 12 and dbms_db_version.release = 1 or dbms_db_version.version < 12 $then
- l_columns_desc dbms_sql.desc_tab3;
- $else
- l_columns_desc dbms_sql.desc_tab4;
- $end
- l_is_collection boolean;
- l_hierarchy_level integer := 1;
- begin
- self.cursor_columns_info := ut_cursor_column_tab();
- self.is_anydata := 0;
- dbms_sql.describe_columns3(a_cursor_number, l_columns_count, l_columns_desc);
-
- /**
- * Due to a bug with object being part of cursor in ANYDATA scenario
- * oracle fails to revert number to cursor. We ar using dbms_sql.close cursor to close it
- * to avoid leaving open cursors behind.
- * a_cursor := dbms_sql.to_refcursor(l_cursor_number);
- **/
- for pos in 1 .. l_columns_count loop
- l_is_collection := ut_metadata.is_collection( l_columns_desc(pos).col_schema_name, l_columns_desc(pos).col_type_name );
- self.cursor_columns_info.extend;
- self.cursor_columns_info(self.cursor_columns_info.last) :=
- ut_cursor_column(
- l_columns_desc(pos).col_name,
- l_columns_desc(pos).col_schema_name,
- l_columns_desc(pos).col_type_name,
- l_columns_desc(pos).col_max_len,
- null,
- l_hierarchy_level,
- pos,
- ut_compound_data_helper.get_column_type_desc(l_columns_desc(pos).col_type,true),
- ut_utils.boolean_to_int(l_is_collection),
- null,
- l_columns_desc(pos).col_precision,
- l_columns_desc(pos).col_scale
- );
-
- if l_columns_desc(pos).col_type = dbms_sql.user_defined_type or l_is_collection then
- desc_compound_data(
- ut_metadata.get_user_defined_type( l_columns_desc(pos).col_schema_name, l_columns_desc(pos).col_type_name ),
- l_columns_desc(pos).col_name,
- l_hierarchy_level + 1,
- l_columns_desc(pos).col_name
- );
- end if;
- end loop;
- return;
- end;
-
- member function contains_collection return boolean is
- l_collection_elements number;
- begin
- select /*+ no_parallel */ count(1) into l_collection_elements
- from table(cursor_columns_info) c
- where c.is_collection = 1 and rownum = 1;
- return l_collection_elements > 0;
- end;
-
- member function get_missing_join_by_columns( a_expected_columns ut_varchar2_list ) return ut_varchar2_list is
- l_result ut_varchar2_list;
- begin
- --regexp_replace(c.access_path,'^\/?([^\/]+\/){1}')
- select /*+ no_parallel */ fl.column_value
- bulk collect into l_result
- from table(a_expected_columns) fl
- where not exists (
- select 1 from table(self.cursor_columns_info) c
- where regexp_like(c.filter_path,'^/?'||fl.column_value||'($|/.*)' )
- )
- order by fl.column_value;
- return l_result;
- end;
-
- member procedure filter_columns(self in out nocopy ut_cursor_details, a_match_options ut_matcher_options) is
- l_result ut_cursor_details := self;
- l_column_tab ut_cursor_column_tab := ut_cursor_column_tab();
- l_column ut_cursor_column;
- c_xpath_extract_reg constant varchar2(50) := '^((/ROW/)|^(//)|^(/\*/))?(.*)';
- begin
- if l_result.cursor_columns_info is not null then
-
- --limit columns to those on the include items minus exclude items
- if a_match_options.include.items.count > 0 then
- -- if include - exclude = 0 then keep all columns
- if a_match_options.include.items != a_match_options.exclude.items then
- with included_columns as (
- select regexp_replace( column_value, c_xpath_extract_reg, '\5' ) col_names
- from table(a_match_options.include.items)
- minus
- select regexp_replace( column_value, c_xpath_extract_reg, '\5' ) col_names
- from table(a_match_options.exclude.items)
- )
- select /*+ no_parallel */ value(x)
- bulk collect into l_result.cursor_columns_info
- from table(self.cursor_columns_info) x
- where exists(
- select 1 from included_columns f where regexp_like(x.filter_path,'^/?'||f.col_names||'($|/.*)' )
- )
- or x.hierarchy_level = case when self.is_anydata = 1 then 1 else 0 end ;
- end if;
- elsif a_match_options.exclude.items.count > 0 then
- with excluded_columns as (
- select regexp_replace( column_value, c_xpath_extract_reg, '\5' ) col_names
- from table(a_match_options.exclude.items)
- )
- select /*+ no_parallel */ value(x)
- bulk collect into l_result.cursor_columns_info
- from table(self.cursor_columns_info) x
- where not exists(
- select 1 from excluded_columns f where regexp_like(x.filter_path,'^/?'||f.col_names||'($|/.*)' )
- );
- end if;
-
- --Rewrite column order after columns been excluded
- for i in (
- select /*+ no_parallel */ parent_name, access_path, display_path, has_nested_col,
- transformed_name, hierarchy_level,
- rownum as new_position, xml_valid_name,
- column_name, column_type, column_type_name, column_schema,
- column_len, column_precision ,column_scale ,is_sql_diffable, is_collection,value(x) col_info
- from table(l_result.cursor_columns_info) x
- order by x.column_position asc
- ) loop
- l_column := i.col_info;
- l_column.column_position := i.new_position;
- l_column_tab.extend;
- l_column_tab(l_column_tab.last) := l_column;
- end loop;
-
- l_result.cursor_columns_info := l_column_tab;
- self := l_result;
- end if;
- end;
-
- member function get_xml_children(a_parent_name varchar2 := null) return xmltype is
- l_result xmltype;
- begin
- select /*+ no_parallel */ xmlagg(xmlelement(evalname t.column_name,t.column_type_name))
- into l_result
- from table(self.cursor_columns_info) t
- where (a_parent_name is null and parent_name is null and hierarchy_level = 1 and column_name is not null)
- having count(*) > 0;
- return l_result;
- end;
-
- member function get_root return varchar2 is
- l_root varchar2(250);
- begin
- if self.cursor_columns_info.count > 0 then
- select /*+ no_parallel */ x.access_path into l_root from table(self.cursor_columns_info) x
- where x.hierarchy_level = 1;
- else
- l_root := null;
- end if;
- return l_root;
- end;
-
- member procedure strip_root_from_anydata(self in out nocopy ut_cursor_details) is
- l_root varchar2(250) := get_root();
- begin
- self.is_anydata := 1;
- for i in 1..cursor_columns_info.count loop
- self.cursor_columns_info(i).filter_path := '/'||ut_utils.strip_prefix(self.cursor_columns_info(i).access_path,l_root);
- end loop;
- end;
-end;
-/
diff --git a/source/expectations/data_values/ut_cursor_details.tps b/source/expectations/data_values/ut_cursor_details.tps
deleted file mode 100644
index e7f9405eb..000000000
--- a/source/expectations/data_values/ut_cursor_details.tps
+++ /dev/null
@@ -1,41 +0,0 @@
-create or replace type ut_cursor_details authid current_user as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- cursor_columns_info ut_cursor_column_tab,
-
- /*if type is anydata we need to skip level 1 on joinby / inlude / exclude as its artificial cursor*/
- is_anydata number(1,0),
- constructor function ut_cursor_details(self in out nocopy ut_cursor_details) return self as result,
- constructor function ut_cursor_details(
- self in out nocopy ut_cursor_details,a_cursor_number in number
- ) return self as result,
- member function equals(a_other ut_cursor_details, a_match_options ut_matcher_options) return boolean,
- member procedure desc_compound_data(
- self in out nocopy ut_cursor_details,
- a_compound_data anytype,
- a_parent_name in varchar2,
- a_level in integer,
- a_access_path in varchar2
- ),
- member function contains_collection return boolean,
- member function get_missing_join_by_columns( a_expected_columns ut_varchar2_list ) return ut_varchar2_list,
- member procedure filter_columns(self in out nocopy ut_cursor_details, a_match_options ut_matcher_options),
- member function get_xml_children(a_parent_name varchar2 := null) return xmltype,
- member function get_root return varchar2,
- member procedure strip_root_from_anydata(self in out nocopy ut_cursor_details)
-)
-/
diff --git a/source/expectations/data_values/ut_data_value.tpb b/source/expectations/data_values/ut_data_value.tpb
deleted file mode 100644
index 6b1763dd0..000000000
--- a/source/expectations/data_values/ut_data_value.tpb
+++ /dev/null
@@ -1,67 +0,0 @@
-create or replace type body ut_data_value as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- order member function compare(a_other ut_data_value) return integer is
- begin
- return compare_implementation(a_other);
- end;
-
- member function is_diffable return boolean is
- begin
- return false;
- end;
-
- member function is_empty return boolean is
- begin
- raise value_error;
- end;
-
- member function diff( a_other ut_data_value, a_match_options ut_matcher_options ) return varchar2 is
- begin
- return null;
- end;
-
- member function is_multi_line return boolean is
- begin
- return false;
- end;
-
- member function get_object_info return varchar2 is
- begin
- return self.data_type;
- end;
-
- final member function to_string_report(a_add_new_line_for_multi_line boolean := false, a_with_object_info boolean := true) return varchar2 is
- l_result varchar2(32767);
- l_info varchar2(32767);
- begin
- if a_with_object_info then
- l_info := '('||get_object_info()||')';
- end if;
- if self.is_multi_line() then
- l_result :=
- l_info || chr(10) || ut_utils.indent_lines( rtrim(self.to_string(),chr(10)), a_include_first_line =>true );
- if a_add_new_line_for_multi_line then
- l_result := l_result || chr(10);
- end if;
- else
- l_result := self.to_string() || ' ' || l_info;
- end if;
- return l_result;
- end;
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value.tps b/source/expectations/data_values/ut_data_value.tps
deleted file mode 100644
index beda3d911..000000000
--- a/source/expectations/data_values/ut_data_value.tps
+++ /dev/null
@@ -1,32 +0,0 @@
-create or replace type ut_data_value force authid current_user as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_type varchar2(250 char),
- data_type_plsql varchar2(250 char),
- self_type varchar2(250 char),
- not instantiable member function is_null return boolean,
- not instantiable member function to_string return varchar2,
- member function get_object_info return varchar2,
- member function is_multi_line return boolean,
- final member function to_string_report(a_add_new_line_for_multi_line boolean := false, a_with_object_info boolean := true) return varchar2,
- order member function compare( a_other ut_data_value ) return integer,
- member function is_diffable return boolean,
- member function is_empty return boolean,
- member function diff( a_other ut_data_value, a_match_options ut_matcher_options ) return varchar2,
- not instantiable member function compare_implementation( a_other ut_data_value ) return integer
-) not final not instantiable
-/
diff --git a/source/expectations/data_values/ut_data_value_anydata.tpb b/source/expectations/data_values/ut_data_value_anydata.tpb
deleted file mode 100644
index f6fbdc840..000000000
--- a/source/expectations/data_values/ut_data_value_anydata.tpb
+++ /dev/null
@@ -1,142 +0,0 @@
-create or replace type body ut_data_value_anydata as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- overriding member function get_object_info return varchar2 is
- begin
- return self.data_type || case when self.compound_type = 'collection' then self.get_elements_count_info() end;
- end;
-
- member function get_extract_path(a_data_value anydata) return varchar2 is
- l_path varchar2(10);
- begin
- if self.compound_type = 'object' then
- l_path := '/*/*';
- else
- case when ut_metadata.has_collection_members(a_data_value) then
- l_path := '/*/*';
- else
- l_path := '/*';
- end case;
- end if;
- return l_path;
- end;
-
- member function get_cursor_sql_from_anydata(a_data_value anydata) return varchar2 is
- l_cursor_sql varchar2(32767);
- begin
- l_cursor_sql := '
- declare
- l_data '||self.data_type||';
- l_value anydata := :a_value;
- l_status integer;
- l_tmp_refcursor sys_refcursor;
- begin
- l_status := l_value.get'||self.compound_type||'(l_data); '||
- case when self.compound_type = 'collection' then
- q'[ open :l_tmp_refcursor for select /*+ no_parallel */ value(x) as "]'||
- ut_metadata.get_object_name(ut_metadata.get_collection_element(a_data_value))||
- q'[" from table(l_data) x;]'
- else
- q'[ open :l_tmp_refcursor for select /*+ no_parallel */ l_data as "]'||ut_metadata.get_object_name(self.data_type)||
- q'[" from dual;]'
- end ||
- 'end;';
- return l_cursor_sql;
- end;
-
- member procedure init(self in out nocopy ut_data_value_anydata, a_value anydata) is
- l_refcursor sys_refcursor;
- cursor_not_open exception;
- l_cursor_number number;
- l_anydata_sql varchar2(32767);
- begin
- self.data_type := ut_metadata.get_anydata_typename(a_value);
- self.compound_type := get_instance(a_value);
- self.is_data_null := ut_metadata.is_anytype_null(a_value,self.compound_type);
- self.data_id := sys_guid();
- self.self_type := $$plsql_unit;
- self.cursor_details := ut_cursor_details();
-
- ut_compound_data_helper.cleanup_diff;
-
- if not self.is_null() then
- self.extract_path := get_extract_path(a_value);
- l_anydata_sql := get_cursor_sql_from_anydata(a_value);
- execute immediate l_anydata_sql using in a_value, in out l_refcursor;
- if l_refcursor%isopen then
- self.extract_cursor(l_refcursor);
- l_cursor_number := dbms_sql.to_cursor_number(l_refcursor);
- self.cursor_details := ut_cursor_details(l_cursor_number);
- self.cursor_details.strip_root_from_anydata;
- dbms_sql.close_cursor(l_cursor_number);
- elsif not l_refcursor%isopen then
- raise cursor_not_open;
- end if;
- end if;
- exception
- when cursor_not_open then
- raise_application_error(-20155, 'Cursor is not open');
- when others then
- if l_refcursor%isopen then
- close l_refcursor;
- end if;
- raise;
- end;
-
- member function get_instance(a_data_value anydata) return varchar2 is
- l_result varchar2(30);
- begin
- l_result := ut_metadata.get_anydata_compound_type(a_data_value);
- if l_result not in ('object','collection') then
- raise_application_error(-20000, 'Data type '||a_data_value.gettypename||' in ANYDATA is not supported by utPLSQL');
- end if;
- return l_result;
- end;
-
- constructor function ut_data_value_anydata(self in out nocopy ut_data_value_anydata, a_value anydata) return self as result
- is
- begin
- init(a_value);
- return;
- end;
-
- overriding member function compare_implementation(
- a_other ut_data_value,
- a_match_options ut_matcher_options,
- a_inclusion_compare boolean := false,
- a_is_negated boolean := false
- ) return integer is
- l_result integer := 0;
- begin
- if not a_other is of (ut_data_value_anydata) then
- raise value_error;
- end if;
- l_result := l_result + (self as ut_data_value_refcursor).compare_implementation(a_other,a_match_options,a_inclusion_compare,a_is_negated);
- return l_result;
- end;
-
- overriding member function is_empty return boolean is
- begin
- if self.compound_type = 'collection' then
- return self.elements_count = 0;
- else
- raise value_error;
- end if;
- end;
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_anydata.tps b/source/expectations/data_values/ut_data_value_anydata.tps
deleted file mode 100644
index 60dba5515..000000000
--- a/source/expectations/data_values/ut_data_value_anydata.tps
+++ /dev/null
@@ -1,33 +0,0 @@
-create or replace type ut_data_value_anydata under ut_data_value_refcursor(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- overriding member function get_object_info return varchar2,
- member function get_extract_path(a_data_value anydata) return varchar2,
- member function get_cursor_sql_from_anydata(a_data_value anydata) return varchar2,
- member procedure init(self in out nocopy ut_data_value_anydata, a_value anydata),
- member function get_instance(a_data_value anydata) return varchar2,
- constructor function ut_data_value_anydata(self in out nocopy ut_data_value_anydata, a_value anydata) return self as result,
- overriding member function compare_implementation(
- a_other ut_data_value,
- a_match_options ut_matcher_options,
- a_inclusion_compare boolean := false,
- a_is_negated boolean := false
- ) return integer,
- overriding member function is_empty return boolean
-)
-/
diff --git a/source/expectations/data_values/ut_data_value_blob.tpb b/source/expectations/data_values/ut_data_value_blob.tpb
deleted file mode 100644
index e145a8d4f..000000000
--- a/source/expectations/data_values/ut_data_value_blob.tpb
+++ /dev/null
@@ -1,63 +0,0 @@
-create or replace type body ut_data_value_blob as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_data_value_blob(self in out nocopy ut_data_value_blob, a_value blob) return self as result is
- begin
- self.data_value := a_value;
- self.self_type := $$plsql_unit;
- self.data_type := 'blob';
- self.data_type_plsql := 'blob';
- return;
- end;
-
- overriding member function is_null return boolean is
- begin
- return (self.data_value is null);
- end;
-
- overriding member function is_empty return boolean is
- l_result boolean := false;
- begin
- if self.data_value is not null and dbms_lob.compare( self.data_value, empty_blob()) = 0 then
- l_result := true;
- end if;
- return l_result;
- end;
-
- overriding member function to_string return varchar2 is
- begin
- return ut_utils.to_string(self.data_value);
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- l_result integer;
- l_other ut_data_value_blob;
- begin
- if a_other is of (ut_data_value_blob) then
- l_other := treat(a_other as ut_data_value_blob);
- l_result := dbms_lob.compare( self.data_value, l_other.data_value);
- end if;
- return l_result;
- end;
-
- overriding member function is_multi_line return boolean is
- begin
- return not self.is_null() and dbms_lob.getlength(self.data_value) > 100;
- end;
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_blob.tps b/source/expectations/data_values/ut_data_value_blob.tps
deleted file mode 100644
index 6df3f3273..000000000
--- a/source/expectations/data_values/ut_data_value_blob.tps
+++ /dev/null
@@ -1,26 +0,0 @@
-create or replace type ut_data_value_blob under ut_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_value blob,
- constructor function ut_data_value_blob(self in out nocopy ut_data_value_blob, a_value blob) return self as result,
- overriding member function is_null return boolean,
- overriding member function is_empty return boolean,
- overriding member function to_string return varchar2,
- overriding member function is_multi_line return boolean,
- overriding member function compare_implementation(a_other ut_data_value) return integer
-)
-/
diff --git a/source/expectations/data_values/ut_data_value_boolean.tpb b/source/expectations/data_values/ut_data_value_boolean.tpb
deleted file mode 100644
index 867c3c19c..000000000
--- a/source/expectations/data_values/ut_data_value_boolean.tpb
+++ /dev/null
@@ -1,58 +0,0 @@
-create or replace type body ut_data_value_boolean as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_data_value_boolean(self in out nocopy ut_data_value_boolean, a_value boolean) return self as result is
- begin
- self.data_value := ut_utils.boolean_to_int(a_value);
- self.self_type := $$plsql_unit;
- self.data_type := 'boolean';
- self.data_type_plsql := 'boolean';
- return;
- end;
-
- overriding member function is_null return boolean is
- begin
- return (self.data_value is null);
- end;
-
- overriding member function to_string return varchar2 is
- begin
- return ut_utils.to_string(ut_utils.int_to_boolean(self.data_value));
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- l_other ut_data_value_boolean;
- l_result integer;
- begin
- if a_other is of (ut_data_value_boolean) then
- l_other := treat(a_other as ut_data_value_boolean);
- if self.data_value = l_other.data_value then
- l_result := 0;
- elsif self.data_value > l_other.data_value then
- l_result := 1;
- elsif self.data_value < l_other.data_value then
- l_result := -1;
- end if;
- else
- raise value_error;
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_boolean.tps b/source/expectations/data_values/ut_data_value_boolean.tps
deleted file mode 100644
index e25b6e0fd..000000000
--- a/source/expectations/data_values/ut_data_value_boolean.tps
+++ /dev/null
@@ -1,24 +0,0 @@
-create or replace type ut_data_value_boolean under ut_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_value number(1,0), --holds int representation of boolean
- constructor function ut_data_value_boolean(self in out nocopy ut_data_value_boolean, a_value boolean) return self as result,
- overriding member function is_null return boolean,
- overriding member function to_string return varchar2,
- overriding member function compare_implementation(a_other ut_data_value) return integer
-)
-/
diff --git a/source/expectations/data_values/ut_data_value_clob.tpb b/source/expectations/data_values/ut_data_value_clob.tpb
deleted file mode 100644
index f8a53a035..000000000
--- a/source/expectations/data_values/ut_data_value_clob.tpb
+++ /dev/null
@@ -1,64 +0,0 @@
-create or replace type body ut_data_value_clob as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_data_value_clob(self in out nocopy ut_data_value_clob, a_value clob) return self as result is
- begin
- self.data_value := a_value;
- self.self_type := $$plsql_unit;
- self.data_type := 'clob';
- self.data_type_plsql := 'clob';
- return;
- end;
-
- overriding member function is_null return boolean is
- begin
- return (self.data_value is null);
- end;
-
- overriding member function is_empty return boolean is
- l_result boolean := false;
- begin
- if self.data_value is not null and dbms_lob.compare( self.data_value, empty_clob()) = 0 then
- l_result := true;
- end if;
- return l_result;
- end;
-
- overriding member function to_string return varchar2 is
- begin
- return ut_utils.to_string(self.data_value);
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- l_result integer;
- l_other ut_data_value_clob;
- begin
- if a_other is of (ut_data_value_clob) then
- l_other := treat(a_other as ut_data_value_clob);
- l_result := dbms_lob.compare( self.data_value, l_other.data_value);
- end if;
- return l_result;
- end;
-
- overriding member function is_multi_line return boolean is
- begin
- return not self.is_null() and (dbms_lob.getlength(self.data_value) > 100 or dbms_lob.instr(self.data_value,chr(10)) > 0);
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_clob.tps b/source/expectations/data_values/ut_data_value_clob.tps
deleted file mode 100644
index 6869798d1..000000000
--- a/source/expectations/data_values/ut_data_value_clob.tps
+++ /dev/null
@@ -1,26 +0,0 @@
-create or replace type ut_data_value_clob under ut_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_value clob,
- constructor function ut_data_value_clob(self in out nocopy ut_data_value_clob, a_value clob) return self as result,
- overriding member function is_null return boolean,
- overriding member function is_empty return boolean,
- overriding member function to_string return varchar2,
- overriding member function is_multi_line return boolean,
- overriding member function compare_implementation(a_other ut_data_value) return integer
-)
-/
diff --git a/source/expectations/data_values/ut_data_value_date.tpb b/source/expectations/data_values/ut_data_value_date.tpb
deleted file mode 100644
index 20424d193..000000000
--- a/source/expectations/data_values/ut_data_value_date.tpb
+++ /dev/null
@@ -1,58 +0,0 @@
-create or replace type body ut_data_value_date as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_data_value_date(self in out nocopy ut_data_value_date, a_value date) return self as result is
- begin
- self.data_value := a_value;
- self.self_type := $$plsql_unit;
- self.data_type := 'date';
- self.data_type_plsql := 'date';
- return;
- end;
-
- overriding member function is_null return boolean is
- begin
- return (self.data_value is null);
- end;
-
- overriding member function to_string return varchar2 is
- begin
- return ut_utils.to_string(self.data_value);
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- l_result integer;
- l_other ut_data_value_date;
- begin
- if a_other is of (ut_data_value_date) then
- l_other := treat(a_other as ut_data_value_date);
- if self.data_value = l_other.data_value then
- l_result := 0;
- elsif self.data_value > l_other.data_value then
- l_result := 1;
- elsif self.data_value < l_other.data_value then
- l_result := -1;
- end if;
- else
- raise value_error;
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_date.tps b/source/expectations/data_values/ut_data_value_date.tps
deleted file mode 100644
index f64a577e0..000000000
--- a/source/expectations/data_values/ut_data_value_date.tps
+++ /dev/null
@@ -1,24 +0,0 @@
-create or replace type ut_data_value_date under ut_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_value date,
- constructor function ut_data_value_date(self in out nocopy ut_data_value_date, a_value date) return self as result,
- overriding member function is_null return boolean,
- overriding member function to_string return varchar2,
- overriding member function compare_implementation(a_other ut_data_value) return integer
-)
-/
diff --git a/source/expectations/data_values/ut_data_value_dsinterval.tpb b/source/expectations/data_values/ut_data_value_dsinterval.tpb
deleted file mode 100644
index 026d4970f..000000000
--- a/source/expectations/data_values/ut_data_value_dsinterval.tpb
+++ /dev/null
@@ -1,56 +0,0 @@
-create or replace type body ut_data_value_dsinterval as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_data_value_dsinterval(self in out nocopy ut_data_value_dsinterval, a_value dsinterval_unconstrained) return self as result is
- begin
- self.data_value := a_value;
- self.self_type := $$plsql_unit;
- self.data_type := 'interval day to second';
- self.data_type_plsql := 'dsinterval_unconstrained';
- return;
- end;
-
- overriding member function is_null return boolean is
- begin
- return (self.data_value is null);
- end;
-
- overriding member function to_string return varchar2 is
- begin
- return ut_utils.interval_to_text(self.data_value);
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- l_result integer;
- l_other ut_data_value_dsinterval;
- begin
- if a_other is of (ut_data_value_dsinterval) then
- l_other := treat(a_other as ut_data_value_dsinterval);
- if self.data_value = l_other.data_value then
- l_result := 0;
- elsif self.data_value > l_other.data_value then
- l_result := 1;
- elsif self.data_value < l_other.data_value then
- l_result := -1;
- end if;
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_dsinterval.tps b/source/expectations/data_values/ut_data_value_dsinterval.tps
deleted file mode 100644
index 6f5cb708c..000000000
--- a/source/expectations/data_values/ut_data_value_dsinterval.tps
+++ /dev/null
@@ -1,24 +0,0 @@
-create or replace type ut_data_value_dsinterval under ut_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_value interval day(9) to second(9),
- constructor function ut_data_value_dsinterval(self in out nocopy ut_data_value_dsinterval, a_value dsinterval_unconstrained) return self as result,
- overriding member function is_null return boolean,
- overriding member function to_string return varchar2,
- overriding member function compare_implementation(a_other ut_data_value) return integer
-)
-/
diff --git a/source/expectations/data_values/ut_data_value_json.tpb b/source/expectations/data_values/ut_data_value_json.tpb
deleted file mode 100644
index b703af181..000000000
--- a/source/expectations/data_values/ut_data_value_json.tpb
+++ /dev/null
@@ -1,174 +0,0 @@
-create or replace type body ut_data_value_json as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- member procedure init (self in out nocopy ut_data_value_json, a_value json_element_t) is
- begin
- self.is_data_null := case when a_value is null then 1 else 0 end;
- self.data_value := case when a_value is null then null else a_value.to_clob end;
- self.self_type := $$plsql_unit;
- self.data_type := 'json';
- self.json_tree := ut_json_tree_details(a_value);
- self.data_id := sys_guid();
- end;
-
- constructor function ut_data_value_json(self in out nocopy ut_data_value_json, a_value json_element_t) return self as result is
- begin
- init(a_value);
- return;
- end;
-
- constructor function ut_data_value_json(self in out nocopy ut_data_value_json, a_value json) return self as result is
- l_value json_element_t := ut_compound_data_helper.get_json_object(a_value);
- begin
- init(l_value);
- return;
- end;
-
- overriding member function is_null return boolean is
- begin
- return (ut_utils.int_to_boolean(self.is_data_null));
- end;
-
- overriding member function is_empty return boolean is
- begin
- return self.data_value = '{}';
- end;
-
- overriding member function to_string return varchar2 is
- begin
- return ut_utils.to_string(self.data_value);
- end;
-
- overriding member function diff( a_other ut_data_value, a_match_options ut_matcher_options ) return varchar2 is
- l_result clob;
- l_results ut_utils.t_clob_tab := ut_utils.t_clob_tab();
- l_result_string varchar2(32767);
- l_other ut_data_value_json;
- l_self ut_data_value_json := self;
- l_diff_id ut_utils.t_hash;
- c_max_rows integer := ut_utils.gc_diff_max_rows;
- l_diffs ut_compound_data_helper.tt_json_diff_tab;
- l_message varchar2(32767);
-
- function get_diff_by_type(a_diff_id raw) return clob is
- l_diff_summary ut_compound_data_helper.tt_json_diff_type_tab := ut_compound_data_helper.get_json_diffs_type(a_diff_id);
- l_message_list ut_varchar2_list := ut_varchar2_list();
- begin
- for i in 1..l_diff_summary.count loop
- l_message_list.extend;
- l_message_list(l_message_list.last) := l_diff_summary(i).no_of_occurence||' '||l_diff_summary(i).difference_type;
- end loop;
- return ut_utils.table_to_clob(l_message_list,', ');
- end;
-
- function get_json_diff_text (a_json_diff ut_compound_data_helper.t_json_diff_rec) return clob is
- begin
- return
- case
- when a_json_diff.difference_type = ut_compound_data_helper.gc_json_missing
- then
- case
- when a_json_diff.act_element_name is not null then q'[ Missing property: ]'||a_json_diff.act_element_name
- when a_json_diff.exp_element_name is not null then q'[ Extra property: ]'||a_json_diff.exp_element_name
- end || ' on path: '||nvl(a_json_diff.act_parent_path,a_json_diff.exp_parent_path)
- else
- case
- when a_json_diff.difference_type = ut_compound_data_helper.gc_json_type
- then q'[ Actual type: ']'||a_json_diff.act_json_type||q'[' was expected to be: ']'||a_json_diff.exp_json_type||q'[']'
- when a_json_diff.difference_type = ut_compound_data_helper.gc_json_notequal
- then q'[ Actual value: ]'||a_json_diff.act_element_value||q'[ was expected to be: ]'||a_json_diff.exp_element_value
- end || ' on path: '||nvl(a_json_diff.act_access_path,a_json_diff.exp_access_path)
- end;
- end;
-
- begin
- if not a_other is of (ut_data_value_json) then
- raise value_error;
- end if;
- dbms_lob.createtemporary(l_result, true);
- l_other := treat(a_other as ut_data_value_json);
- l_diff_id := ut_utils.get_hash(self.data_id||l_other.data_id);
-
- if not l_self.is_null and not l_other.is_null then
- l_diffs := ut_compound_data_helper.get_json_diffs_tmp(l_diff_id);
-
- l_message := ' '||l_diffs.count|| ' differences found' ||
- case when l_diffs.count > c_max_rows then ', showing first '|| c_max_rows else null end||chr(10);
- ut_utils.append_to_clob( l_result, l_message );
- l_message := get_diff_by_type(l_diff_id)||chr(10);
- ut_utils.append_to_clob( l_result, l_message );
-
- for i in 1 .. least( c_max_rows, l_diffs.count ) loop
- l_results.extend;
- l_results(l_results.last) := get_json_diff_text(l_diffs(i));
- end loop;
- ut_utils.append_to_clob(l_result, l_results);
-
- end if;
-
- if l_result != empty_clob() then
- l_result_string := chr(10) || 'Diff:' || ut_utils.to_string(l_result,null);
- end if;
- dbms_lob.freetemporary(l_result);
- return l_result_string;
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- l_self ut_data_value_json := self;
- l_other ut_data_value := a_other;
- begin
- return l_self.compare_implementation( l_other, null );
- end;
-
- member function compare_implementation(a_other in ut_data_value,a_match_options ut_matcher_options) return
- integer is
- l_result integer;
- l_other ut_data_value_json;
- l_diff_id ut_utils.t_hash;
- begin
- if a_other is of (ut_data_value_json) then
- l_other := treat(a_other as ut_data_value_json);
- l_diff_id := ut_utils.get_hash(self.data_id||l_other.data_id);
- l_result :=
- case
- when ut_compound_data_helper.insert_json_diffs(
- l_diff_id, l_other.json_tree.json_tree_info, self.json_tree.json_tree_info
- ) > 0 then 1
- else 0
- end;
- end if;
- return l_result;
- end;
-
- member function get_elements_count return integer is
- begin
- return json_element_t.parse(self.data_value).get_size;
- end;
-
- member function get_json_count_info return varchar2 is
- begin
- return self.data_type||' [ count = '||self.get_elements_count||' ]';
- end;
-
- overriding member function get_object_info return varchar2 is
- begin
- return self.data_type;
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_json.tps b/source/expectations/data_values/ut_data_value_json.tps
deleted file mode 100644
index 3b77e54eb..000000000
--- a/source/expectations/data_values/ut_data_value_json.tps
+++ /dev/null
@@ -1,33 +0,0 @@
-create or replace type ut_data_value_json under ut_compound_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_value clob,
- json_tree ut_json_tree_details,
- member procedure init (self in out nocopy ut_data_value_json, a_value json_element_t),
- constructor function ut_data_value_json(self in out nocopy ut_data_value_json, a_value json_element_t) return self as result,
- constructor function ut_data_value_json(self in out nocopy ut_data_value_json, a_value json) return self as result,
- overriding member function is_null return boolean,
- overriding member function is_empty return boolean,
- overriding member function to_string return varchar2,
- overriding member function diff( a_other ut_data_value, a_match_options ut_matcher_options ) return varchar2,
- overriding member function compare_implementation(a_other ut_data_value) return integer,
- member function compare_implementation(a_other ut_data_value,a_match_options ut_matcher_options) return integer,
- member function get_elements_count return integer,
- member function get_json_count_info return varchar2,
- overriding member function get_object_info return varchar2
-)
-/
diff --git a/source/expectations/data_values/ut_data_value_number.tpb b/source/expectations/data_values/ut_data_value_number.tpb
deleted file mode 100644
index 382e6e9aa..000000000
--- a/source/expectations/data_values/ut_data_value_number.tpb
+++ /dev/null
@@ -1,58 +0,0 @@
-create or replace type body ut_data_value_number as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_data_value_number(self in out nocopy ut_data_value_number, a_value number) return self as result is
- begin
- self.data_value := a_value;
- self.self_type := $$plsql_unit;
- self.data_type := 'number';
- self.data_type_plsql := 'number';
- return;
- end;
-
- overriding member function is_null return boolean is
- begin
- return (self.data_value is null);
- end;
-
- overriding member function to_string return varchar2 is
- begin
- return ut_utils.to_string(self.data_value);
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- l_result integer;
- l_other ut_data_value_number;
- begin
- if a_other is of (ut_data_value_number) then
- l_other := treat(a_other as ut_data_value_number);
- if self.data_value = l_other.data_value then
- l_result := 0;
- elsif self.data_value > l_other.data_value then
- l_result := 1;
- elsif self.data_value < l_other.data_value then
- l_result := -1;
- end if;
- else
- raise value_error;
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_number.tps b/source/expectations/data_values/ut_data_value_number.tps
deleted file mode 100644
index 86d68f356..000000000
--- a/source/expectations/data_values/ut_data_value_number.tps
+++ /dev/null
@@ -1,24 +0,0 @@
-create or replace type ut_data_value_number under ut_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_value number,
- constructor function ut_data_value_number(self in out nocopy ut_data_value_number, a_value number) return self as result,
- overriding member function is_null return boolean,
- overriding member function to_string return varchar2,
- overriding member function compare_implementation(a_other ut_data_value) return integer
-)
-/
diff --git a/source/expectations/data_values/ut_data_value_refcursor.tpb b/source/expectations/data_values/ut_data_value_refcursor.tpb
deleted file mode 100644
index a4f0cf7a0..000000000
--- a/source/expectations/data_values/ut_data_value_refcursor.tpb
+++ /dev/null
@@ -1,396 +0,0 @@
-create or replace type body ut_data_value_refcursor as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_data_value_refcursor(self in out nocopy ut_data_value_refcursor, a_value sys_refcursor)
- return self as result is
- begin
- init(a_value);
- return;
- end;
-
- member procedure extract_cursor(self in out nocopy ut_data_value_refcursor, a_value sys_refcursor)
- is
- c_bulk_rows constant integer := 10000;
- l_cursor sys_refcursor := a_value;
- l_ctx number;
- l_xml xmltype;
- l_ut_owner varchar2(250) := ut_utils.ut_owner;
- l_set_id integer := 0;
- l_elements_count number := 0;
- begin
- -- We use DBMS_XMLGEN in order to:
- -- 1) be able to process data in bulks (set of rows)
- -- 2) be able to influence the ROWSET/ROW tags
- -- 3) be able to influence the way NULL values are handled (empty TAG)
- -- 4) be able to influence the way TIMESTAMP is formatted.
- -- Due to Oracle feature/bug, it is not possible to change the DATE formatting of cursor data
- -- AFTER the cursor was opened.
- -- The only solution for this is to change NLS settings before opening the cursor.
- --
- -- This would work fine if we could use DBMS_XMLGEN.restartQuery.
- -- The restartQuery fails however if PLSQL variables of TIMESTAMP/INTERVAL or CLOB/BLOB are used.
- ut_expectation_processor.set_xml_nls_params();
- l_ctx := dbms_xmlgen.newContext(l_cursor);
- dbms_xmlgen.setNullHandling(l_ctx, dbms_xmlgen.empty_tag);
- dbms_xmlgen.setMaxRows(l_ctx, c_bulk_rows);
- loop
- l_xml := dbms_xmlgen.getxmltype(l_ctx);
- exit when dbms_xmlgen.getNumRowsProcessed(l_ctx) = 0;
- --Bug in oracle 12.2+ where XML binary storage trimming insignificant whitespaces.
- $if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
- l_xml := xmltype( replace(l_xml.getClobVal(),' 0 then
- ut_utils.append_to_clob( l_result, self.cursor_details.get_xml_children().getclobval() );
- end if;
- ut_utils.append_to_clob(l_result,chr(10)||(self as ut_compound_data_value).to_string());
- l_result_string := ut_utils.to_string(l_result,null);
- dbms_lob.freetemporary(l_result);
- end if;
- return l_result_string;
- end;
-
- overriding member function diff( a_other ut_data_value, a_match_options ut_matcher_options ) return varchar2 is
- l_result clob;
- l_results ut_utils.t_clob_tab := ut_utils.t_clob_tab();
- l_result_string varchar2(32767);
- l_other ut_data_value_refcursor;
- l_self ut_data_value_refcursor := self;
- l_column_diffs ut_compound_data_helper.tt_column_diffs;
-
- l_other_cols ut_cursor_column_tab;
- l_self_cols ut_cursor_column_tab;
-
- l_act_missing_pk ut_varchar2_list := ut_varchar2_list();
- l_exp_missing_pk ut_varchar2_list := ut_varchar2_list();
-
- c_max_rows integer := ut_utils.gc_diff_max_rows;
- l_diff_id ut_utils.t_hash;
- l_diff_row_count integer;
- l_row_diffs ut_compound_data_helper.tt_row_diffs;
- l_message varchar2(32767);
-
- function get_col_diff_text(a_col ut_compound_data_helper.t_column_diffs) return varchar2 is
- begin
- return
- case a_col.diff_type
- when '-' then
- ' Column <'||a_col.expected_name||'> [data-type: '||a_col.expected_type||'] is missing. Expected column position: '||a_col.expected_pos||'.'
- when '+' then
- ' Column <'||a_col.actual_name||'> [position: '||a_col.actual_pos||', data-type: '||a_col.actual_type||'] is not expected in results.'
- when 't' then
- ' Column <'||a_col.actual_name||'> data-type is invalid. Expected: '||a_col.expected_type||',' ||' actual: '||a_col.actual_type||'.'
- when 'p' then
- ' Column <'||a_col.actual_name||'> is misplaced. Expected position: '||a_col.expected_pos||',' ||' actual position: '||a_col.actual_pos||'.'
- end;
- end;
-
- function remove_incomparable_cols(
- a_cursor_details ut_cursor_column_tab, a_column_diffs ut_compound_data_helper.tt_column_diffs
- ) return ut_cursor_column_tab is
- l_missing_cols ut_varchar2_list := ut_varchar2_list();
- l_result ut_cursor_column_tab;
- begin
- for i in 1 .. a_column_diffs.count loop
- if a_column_diffs(i).diff_type in ('-','+') then
- l_missing_cols.extend;
- l_missing_cols(l_missing_cols.last) := coalesce(a_column_diffs(i).expected_name, a_column_diffs(i).actual_name);
- end if;
- end loop;
- select /*+ no_parallel */ value(i) bulk collect into l_result
- from table(a_cursor_details) i
- where i.access_path not in (
- select c.column_value
- from table(l_missing_cols) c
- );
- return l_result;
- end;
-
- function get_diff_message (a_row_diff ut_compound_data_helper.t_row_diffs, a_is_unordered boolean) return varchar2 is
- begin
- if a_is_unordered then
- if a_row_diff.pk_value is not null then
- return ' PK '||a_row_diff.pk_value||' - '||rpad(a_row_diff.diff_type,10)||a_row_diff.diffed_row;
- else
- return rpad(a_row_diff.diff_type,10)||a_row_diff.diffed_row;
- end if;
- else
- return ' Row No. '||a_row_diff.rn||' - '||rpad(a_row_diff.diff_type,10)||a_row_diff.diffed_row;
- end if;
- end;
-
- begin
- if not a_other is of (ut_data_value_refcursor) then
- raise value_error;
- end if;
- l_other := treat(a_other as ut_data_value_refcursor);
- l_other.cursor_details.filter_columns(a_match_options);
- l_self.cursor_details.filter_columns(a_match_options);
-
- l_other_cols := l_other.cursor_details.cursor_columns_info;
- l_self_cols := l_self.cursor_details.cursor_columns_info;
-
- dbms_lob.createtemporary(l_result,true);
- --diff columns
- if not l_self.is_null and not l_other.is_null then
- l_column_diffs := ut_compound_data_helper.get_columns_diff(
- l_self.cursor_details.cursor_columns_info,
- l_other.cursor_details.cursor_columns_info,
- a_match_options.ordered_columns()
- );
-
- if l_column_diffs is not empty then
- ut_utils.append_to_clob(l_result,chr(10) || 'Columns:' || chr(10));
- l_other_cols := remove_incomparable_cols( l_other_cols, l_column_diffs );
- l_self_cols := remove_incomparable_cols( l_self_cols, l_column_diffs );
- for i in 1 .. l_column_diffs.count loop
- l_results.extend;
- l_results(l_results.last) := get_col_diff_text(l_column_diffs(i));
- end loop;
- ut_utils.append_to_clob(l_result, l_results);
- end if;
- end if;
-
- --check for missing pk
- if a_match_options.join_by.items.count > 0 then
- l_act_missing_pk := l_other.cursor_details.get_missing_join_by_columns( a_match_options.join_by.items );
- l_exp_missing_pk := l_self.cursor_details.get_missing_join_by_columns( a_match_options.join_by.items );
- end if;
-
- --diff rows and row elements if the pk is not missing
- if l_act_missing_pk.count + l_exp_missing_pk.count = 0 then
- l_diff_id := ut_utils.get_hash( l_self.data_id || l_other.data_id );
-
- -- First tell how many rows are different
- l_diff_row_count := ut_compound_data_helper.get_rows_diff_count;
- if l_diff_row_count > 0 then
- l_row_diffs := ut_compound_data_helper.get_rows_diff_by_sql(
- l_self_cols, l_other_cols, l_self.data_id, l_other.data_id,
- l_diff_id,
- case
- when
- l_self.cursor_details.is_anydata = 1 then ut_utils.add_prefix(a_match_options.join_by.items, l_self.cursor_details.get_root)
- else
- a_match_options.join_by.items
- end,
- a_match_options.unordered,a_match_options.ordered_columns(), self.extract_path
- );
- l_message := chr(10)
- ||'Rows: [ ' || l_diff_row_count ||' differences'
- || case when l_diff_row_count > c_max_rows and l_row_diffs.count > 0 then ', showing first '||c_max_rows end
- ||' ]'||chr(10)|| case when l_row_diffs.count = 0 then ' All rows are different as the columns are not matching.' else null end;
- ut_utils.append_to_clob( l_result, l_message );
- l_results := ut_utils.t_clob_tab();
- for i in 1 .. l_row_diffs.count loop
- l_results.extend;
- l_results(l_results.last) := get_diff_message(l_row_diffs(i),a_match_options.unordered);
- end loop;
- ut_utils.append_to_clob(l_result,l_results);
- elsif l_column_diffs is not empty then
- l_message:= chr(10)||'Rows: [ all different ]'||chr(10)||' All rows are different as the columns position is not matching.';
- ut_utils.append_to_clob( l_result, l_message );
- end if;
- else
- ut_utils.append_to_clob(l_result,chr(10) || 'Unable to join sets:' || chr(10));
-
- for i in 1 .. l_exp_missing_pk.count loop
- ut_utils.append_to_clob(l_result, ' Join key '||l_exp_missing_pk(i)||' does not exists in expected'||chr(10));
- end loop;
-
- for i in 1 .. l_act_missing_pk.count loop
- ut_utils.append_to_clob(l_result, ' Join key '||l_act_missing_pk(i)||' does not exists in actual'||chr(10));
- end loop;
-
- if l_self.cursor_details.contains_collection() or l_other.cursor_details.contains_collection() then
- ut_utils.append_to_clob(l_result,' Please make sure that your join clause is not refferring to collection element'|| chr(10));
- end if;
-
- end if;
- if l_result != empty_clob() then
- l_result_string := chr(10) || 'Diff:' || ut_utils.to_string(l_result,null);
- end if;
- dbms_lob.freetemporary(l_result);
- return l_result_string;
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- begin
- return compare_implementation( a_other, null );
- end;
-
- member function compare_implementation(
- a_other ut_data_value,
- a_match_options ut_matcher_options,
- a_inclusion_compare boolean := false,
- a_is_negated boolean := false
- ) return integer is
- l_result integer := 0;
- l_self ut_data_value_refcursor := self;
- l_other ut_data_value_refcursor;
- l_diff_cursor_text clob;
-
- function compare_data(
- a_self ut_data_value_refcursor,
- a_other ut_data_value_refcursor,
- a_diff_cursor_text clob
- ) return integer is
- l_diff_id ut_utils.t_hash;
- l_result integer;
- --We will start with number od differences being displayed.
- l_cursor sys_refcursor;
- l_diff_tab ut_compound_data_helper.t_diff_tab;
- l_diif_rowcount integer :=0;
- begin
- l_diff_id := ut_utils.get_hash(a_self.data_id||a_other.data_id);
-
- begin
- l_cursor := ut_compound_data_helper.get_compare_cursor(a_diff_cursor_text,
- a_self.data_id, a_other.data_id);
- --fetch and save rows for display of diff
- fetch l_cursor bulk collect into l_diff_tab limit ut_utils.gc_diff_max_rows;
- exception when others then
- if l_cursor%isopen then
- close l_cursor;
- end if;
- raise;
- end;
-
- ut_compound_data_helper.insert_diffs_result( l_diff_tab, l_diff_id );
- --fetch rows for count only
- loop
- exit when l_diff_tab.count = 0;
- l_diif_rowcount := l_diif_rowcount + l_diff_tab.count;
- fetch l_cursor bulk collect into l_diff_tab limit ut_utils.gc_bc_fetch_limit;
- end loop;
-
- ut_compound_data_helper.set_rows_diff(l_diif_rowcount);
-
- --result is OK only if both are same
- if l_diif_rowcount = 0 and a_self.is_null = a_other.is_null then
- l_result := 0;
- else
- l_result := 1;
- end if;
- close l_cursor;
- return l_result;
- end;
- begin
- if not a_other is of (ut_data_value_refcursor) then
- raise value_error;
- end if;
-
- l_other := treat(a_other as ut_data_value_refcursor);
- l_other.cursor_details.filter_columns( a_match_options );
- l_self.cursor_details.filter_columns( a_match_options );
-
- if a_match_options.join_by.items.count > 0 then
- l_result :=
- l_self.cursor_details.get_missing_join_by_columns( a_match_options.join_by.items ).count
- + l_other.cursor_details.get_missing_join_by_columns( a_match_options.join_by.items ).count;
- end if;
-
- if l_result = 0 then
- if not l_self.is_null() and not l_other.is_null() and not l_self.cursor_details.equals( l_other.cursor_details, a_match_options ) then
- l_result := 1;
- end if;
- l_diff_cursor_text := ut_compound_data_helper.gen_compare_sql(
- l_other,
- a_match_options.join_by.items,
- a_match_options.unordered(),
- a_inclusion_compare,
- a_is_negated
- );
- l_result := l_result + compare_data( l_self, l_other, l_diff_cursor_text );
- end if;
- return l_result;
- end;
-
- overriding member function is_empty return boolean is
- begin
- return self.elements_count = 0;
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_refcursor.tps b/source/expectations/data_values/ut_data_value_refcursor.tps
deleted file mode 100644
index 594695e32..000000000
--- a/source/expectations/data_values/ut_data_value_refcursor.tps
+++ /dev/null
@@ -1,52 +0,0 @@
-create or replace type ut_data_value_refcursor under ut_compound_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /**
- * Holds information about ref cursor to be processed by expectation
- */
-
-
- /**
- * Determines if the cursor is null
- */
- is_cursor_null integer,
-
- /*
- *columns info
- */
- cursor_details ut_cursor_details,
-
- /*
- * extract path of elements, important for collectiosn and objects
- */
- extract_path varchar2(10),
-
- constructor function ut_data_value_refcursor(self in out nocopy ut_data_value_refcursor, a_value sys_refcursor) return self as result,
- member procedure extract_cursor(self in out nocopy ut_data_value_refcursor, a_value sys_refcursor),
- member procedure init(self in out nocopy ut_data_value_refcursor, a_value sys_refcursor),
- overriding member function to_string return varchar2,
- overriding member function diff( a_other ut_data_value, a_match_options ut_matcher_options ) return varchar2,
- overriding member function compare_implementation(a_other ut_data_value) return integer,
- member function compare_implementation(
- a_other ut_data_value,
- a_match_options ut_matcher_options,
- a_inclusion_compare boolean := false,
- a_is_negated boolean := false
- ) return integer,
- overriding member function is_empty return boolean
-) not final
-/
diff --git a/source/expectations/data_values/ut_data_value_timestamp.tpb b/source/expectations/data_values/ut_data_value_timestamp.tpb
deleted file mode 100644
index 318f799a3..000000000
--- a/source/expectations/data_values/ut_data_value_timestamp.tpb
+++ /dev/null
@@ -1,58 +0,0 @@
-create or replace type body ut_data_value_timestamp as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_data_value_timestamp(self in out nocopy ut_data_value_timestamp, a_value timestamp_unconstrained) return self as result is
- begin
- self.data_value := a_value;
- self.self_type := $$plsql_unit;
- self.data_type := 'timestamp';
- self.data_type_plsql := 'timestamp_unconstrained';
- return;
- end;
-
- overriding member function is_null return boolean is
- begin
- return (self.data_value is null);
- end;
-
- overriding member function to_string return varchar2 is
- begin
- return ut_utils.to_string(self.data_value);
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- l_result integer;
- l_other ut_data_value_timestamp;
- begin
- if a_other is of (ut_data_value_timestamp) then
- l_other := treat(a_other as ut_data_value_timestamp);
- if self.data_value = l_other.data_value then
- l_result := 0;
- elsif self.data_value > l_other.data_value then
- l_result := 1;
- elsif self.data_value < l_other.data_value then
- l_result := -1;
- end if;
- else
- raise value_error;
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_timestamp.tps b/source/expectations/data_values/ut_data_value_timestamp.tps
deleted file mode 100644
index c047e3c79..000000000
--- a/source/expectations/data_values/ut_data_value_timestamp.tps
+++ /dev/null
@@ -1,24 +0,0 @@
-create or replace type ut_data_value_timestamp under ut_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_value timestamp(9),
- constructor function ut_data_value_timestamp(self in out nocopy ut_data_value_timestamp, a_value timestamp_unconstrained) return self as result,
- overriding member function is_null return boolean,
- overriding member function to_string return varchar2,
- overriding member function compare_implementation(a_other ut_data_value) return integer
-)
-/
diff --git a/source/expectations/data_values/ut_data_value_timestamp_ltz.tpb b/source/expectations/data_values/ut_data_value_timestamp_ltz.tpb
deleted file mode 100644
index 6127de5f1..000000000
--- a/source/expectations/data_values/ut_data_value_timestamp_ltz.tpb
+++ /dev/null
@@ -1,58 +0,0 @@
-create or replace type body ut_data_value_timestamp_ltz as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_data_value_timestamp_ltz(self in out nocopy ut_data_value_timestamp_ltz, a_value timestamp_ltz_unconstrained) return self as result is
- begin
- self.data_value := a_value;
- self.self_type := $$plsql_unit;
- self.data_type := 'timestamp with local time zone';
- self.data_type_plsql := 'timestamp_ltz_unconstrained';
- return;
- end;
-
- overriding member function is_null return boolean is
- begin
- return (self.data_value is null);
- end;
-
- overriding member function to_string return varchar2 is
- begin
- return ut_utils.to_string(self.data_value);
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- l_result integer;
- l_other ut_data_value_timestamp_ltz;
- begin
- if a_other is of (ut_data_value_timestamp_ltz) then
- l_other := treat(a_other as ut_data_value_timestamp_ltz);
- if self.data_value = l_other.data_value then
- l_result := 0;
- elsif self.data_value > l_other.data_value then
- l_result := 1;
- elsif self.data_value < l_other.data_value then
- l_result := -1;
- end if;
- else
- raise value_error;
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_timestamp_ltz.tps b/source/expectations/data_values/ut_data_value_timestamp_ltz.tps
deleted file mode 100644
index 7bb296bc9..000000000
--- a/source/expectations/data_values/ut_data_value_timestamp_ltz.tps
+++ /dev/null
@@ -1,24 +0,0 @@
-create or replace type ut_data_value_timestamp_ltz under ut_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_value timestamp(9) with local time zone,
- constructor function ut_data_value_timestamp_ltz(self in out nocopy ut_data_value_timestamp_ltz, a_value timestamp_ltz_unconstrained) return self as result,
- overriding member function is_null return boolean,
- overriding member function to_string return varchar2,
- overriding member function compare_implementation(a_other ut_data_value) return integer
-)
-/
diff --git a/source/expectations/data_values/ut_data_value_timestamp_tz.tpb b/source/expectations/data_values/ut_data_value_timestamp_tz.tpb
deleted file mode 100644
index d5d5cdd13..000000000
--- a/source/expectations/data_values/ut_data_value_timestamp_tz.tpb
+++ /dev/null
@@ -1,58 +0,0 @@
-create or replace type body ut_data_value_timestamp_tz as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_data_value_timestamp_tz(self in out nocopy ut_data_value_timestamp_tz, a_value timestamp_tz_unconstrained) return self as result is
- begin
- self.data_value := a_value;
- self.self_type := $$plsql_unit;
- self.data_type := 'timestamp with time zone';
- self.data_type_plsql := 'timestamp_tz_unconstrained';
- return;
- end;
-
- overriding member function is_null return boolean is
- begin
- return (self.data_value is null);
- end;
-
- overriding member function to_string return varchar2 is
- begin
- return ut_utils.to_string(self.data_value);
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- l_result integer;
- l_other ut_data_value_timestamp_tz;
- begin
- if a_other is of (ut_data_value_timestamp_tz) then
- l_other := treat(a_other as ut_data_value_timestamp_tz);
- if self.data_value = l_other.data_value then
- l_result := 0;
- elsif self.data_value > l_other.data_value then
- l_result := 1;
- elsif self.data_value < l_other.data_value then
- l_result := -1;
- end if;
- else
- raise value_error;
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_timestamp_tz.tps b/source/expectations/data_values/ut_data_value_timestamp_tz.tps
deleted file mode 100644
index 01cf11124..000000000
--- a/source/expectations/data_values/ut_data_value_timestamp_tz.tps
+++ /dev/null
@@ -1,24 +0,0 @@
-create or replace type ut_data_value_timestamp_tz under ut_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_value timestamp(9) with time zone,
- constructor function ut_data_value_timestamp_tz(self in out nocopy ut_data_value_timestamp_tz, a_value timestamp_tz_unconstrained) return self as result,
- overriding member function is_null return boolean,
- overriding member function to_string return varchar2,
- overriding member function compare_implementation(a_other ut_data_value) return integer
-)
-/
diff --git a/source/expectations/data_values/ut_data_value_varchar2.tpb b/source/expectations/data_values/ut_data_value_varchar2.tpb
deleted file mode 100644
index d04398697..000000000
--- a/source/expectations/data_values/ut_data_value_varchar2.tpb
+++ /dev/null
@@ -1,63 +0,0 @@
-create or replace type body ut_data_value_varchar2 as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_data_value_varchar2(self in out nocopy ut_data_value_varchar2, a_value varchar2) return self as result is
- begin
- self.data_value := a_value;
- self.self_type := $$plsql_unit;
- self.data_type := 'varchar2';
- self.data_type_plsql := 'varchar2(32767)';
- return;
- end;
-
- overriding member function is_null return boolean is
- begin
- return (self.data_value is null);
- end;
-
- overriding member function to_string return varchar2 is
- begin
- return ut_utils.to_string(self.data_value);
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- l_result integer;
- l_other ut_data_value_varchar2;
- begin
- if a_other is of (ut_data_value_varchar2) then
- l_other := treat(a_other as ut_data_value_varchar2);
- if self.data_value = l_other.data_value then
- l_result := 0;
- elsif self.data_value > l_other.data_value then
- l_result := 1;
- elsif self.data_value < l_other.data_value then
- l_result := -1;
- end if;
- else
- raise value_error;
- end if;
- return l_result;
- end;
-
- overriding member function is_multi_line return boolean is
- begin
- return not self.is_null() and (length(self.data_value) > 100 or instr(self.data_value,chr(10)) > 0);
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_varchar2.tps b/source/expectations/data_values/ut_data_value_varchar2.tps
deleted file mode 100644
index 3fbeb378b..000000000
--- a/source/expectations/data_values/ut_data_value_varchar2.tps
+++ /dev/null
@@ -1,25 +0,0 @@
-create or replace type ut_data_value_varchar2 under ut_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_value varchar2(32767 char),
- constructor function ut_data_value_varchar2(self in out nocopy ut_data_value_varchar2, a_value varchar2) return self as result,
- overriding member function is_null return boolean,
- overriding member function to_string return varchar2,
- overriding member function is_multi_line return boolean,
- overriding member function compare_implementation(a_other ut_data_value) return integer
-)
-/
diff --git a/source/expectations/data_values/ut_data_value_xmltype.tpb b/source/expectations/data_values/ut_data_value_xmltype.tpb
deleted file mode 100644
index 4b21a8937..000000000
--- a/source/expectations/data_values/ut_data_value_xmltype.tpb
+++ /dev/null
@@ -1,51 +0,0 @@
-create or replace type body ut_data_value_xmltype as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_data_value_xmltype(self in out nocopy ut_data_value_xmltype, a_value xmltype) return self as result is
- begin
- self.data_value := a_value;
- self.self_type := $$plsql_unit;
- self.data_type := 'xmltype';
- self.data_type_plsql := 'xmltype';
- return;
- end;
-
- overriding member function is_null return boolean is
- begin
- return (self.data_value is null);
- end;
-
- overriding member function to_string return varchar2 is
- begin
- return ut_utils.to_string(self.data_value.getClobVal());
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- l_result integer;
- l_other ut_data_value_xmltype;
- begin
- if a_other is of (ut_data_value_xmltype) then
- l_other := treat(a_other as ut_data_value_xmltype);
- l_result := dbms_lob.compare(self.data_value.getClobVal(),l_other.data_value.getClobVal());
- end if;
-
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_xmltype.tps b/source/expectations/data_values/ut_data_value_xmltype.tps
deleted file mode 100644
index 9ba738b88..000000000
--- a/source/expectations/data_values/ut_data_value_xmltype.tps
+++ /dev/null
@@ -1,24 +0,0 @@
-create or replace type ut_data_value_xmltype under ut_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_value xmltype,
- constructor function ut_data_value_xmltype(self in out nocopy ut_data_value_xmltype, a_value xmltype) return self as result,
- overriding member function is_null return boolean,
- overriding member function to_string return varchar2,
- overriding member function compare_implementation(a_other ut_data_value) return integer
-)
-/
diff --git a/source/expectations/data_values/ut_data_value_yminterval.tpb b/source/expectations/data_values/ut_data_value_yminterval.tpb
deleted file mode 100644
index a3a1e7a2f..000000000
--- a/source/expectations/data_values/ut_data_value_yminterval.tpb
+++ /dev/null
@@ -1,55 +0,0 @@
-create or replace type body ut_data_value_yminterval as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_data_value_yminterval(self in out nocopy ut_data_value_yminterval, a_value yminterval_unconstrained) return self as result is
- begin
- self.data_value := a_value;
- self.self_type := $$plsql_unit;
- self.data_type := 'interval year to month';
- self.data_type_plsql := 'yminterval_unconstrained';
- return;
- end;
-
- overriding member function is_null return boolean is
- begin
- return (self.data_value is null);
- end;
-
- overriding member function to_string return varchar2 is
- begin
- return ut_utils.interval_to_text(self.data_value);
- end;
-
- overriding member function compare_implementation(a_other ut_data_value) return integer is
- l_result integer;
- l_other ut_data_value_yminterval;
- begin
- if a_other is of (ut_data_value_yminterval) then
- l_other := treat(a_other as ut_data_value_yminterval);
- if self.data_value = l_other.data_value then
- l_result := 0;
- elsif self.data_value > l_other.data_value then
- l_result := 1;
- elsif self.data_value < l_other.data_value then
- l_result := -1;
- end if;
- end if;
- return l_result;
- end;
-end;
-/
diff --git a/source/expectations/data_values/ut_data_value_yminterval.tps b/source/expectations/data_values/ut_data_value_yminterval.tps
deleted file mode 100644
index c9ad2e776..000000000
--- a/source/expectations/data_values/ut_data_value_yminterval.tps
+++ /dev/null
@@ -1,24 +0,0 @@
-create or replace type ut_data_value_yminterval under ut_data_value(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- data_value interval year(9) to month,
- constructor function ut_data_value_yminterval(self in out nocopy ut_data_value_yminterval, a_value yminterval_unconstrained) return self as result,
- overriding member function is_null return boolean,
- overriding member function to_string return varchar2,
- overriding member function compare_implementation(a_other ut_data_value) return integer
-)
-/
diff --git a/source/expectations/data_values/ut_json_data_diff_tmp.sql b/source/expectations/data_values/ut_json_data_diff_tmp.sql
deleted file mode 100644
index 5ff3440d8..000000000
--- a/source/expectations/data_values/ut_json_data_diff_tmp.sql
+++ /dev/null
@@ -1,27 +0,0 @@
-create global temporary table ut_json_data_diff_tmp(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- diff_id raw(128),
- difference_type varchar2(250),
- act_element_name varchar2(2000),
- act_element_value varchar2(4000),
- act_json_type varchar2(100),
- act_access_path varchar2(4000),
- act_parent_path varchar2(4000),
- exp_element_name varchar2(2000),
- exp_element_value varchar2(4000),
- exp_json_type varchar2(2000),
- exp_access_path varchar2(4000),
- exp_parent_path varchar2(4000)
-) on commit delete rows;
diff --git a/source/expectations/data_values/ut_json_leaf.tpb b/source/expectations/data_values/ut_json_leaf.tpb
deleted file mode 100644
index 83f1009ef..000000000
--- a/source/expectations/data_values/ut_json_leaf.tpb
+++ /dev/null
@@ -1,32 +0,0 @@
-create or replace type body ut_json_leaf as
-
- member procedure init( self in out nocopy ut_json_leaf,
- a_element_name varchar2, a_element_value varchar2,a_parent_name varchar2,
- a_access_path varchar2, a_hierarchy_level integer, a_index_position integer, a_json_type in varchar2,
- a_parent_type varchar2, a_array_element integer:=0, a_parent_path varchar2) is
- begin
- self.element_name := a_element_name;
- self.element_value := a_element_value;
- self.parent_name := a_parent_name;
- self.hierarchy_level := a_hierarchy_level;
- self.access_path := a_access_path;
- self.index_position := a_index_position;
- self.json_type := a_json_type;
- self.is_array_element := a_array_element;
- self.parent_type := a_parent_type;
- self.parent_path := a_parent_path;
- end;
-
- constructor function ut_json_leaf( self in out nocopy ut_json_leaf,
- a_element_name varchar2, a_element_value varchar2,a_parent_name varchar2,
- a_access_path varchar2, a_hierarchy_level integer, a_index_position integer, a_json_type in varchar2,
- a_parent_type varchar2, a_array_element integer:=0, a_parent_path varchar2)
- return self as result is
- begin
- init(a_element_name,a_element_value,a_parent_name, a_access_path, a_hierarchy_level, a_index_position,
- a_json_type,a_parent_type,a_array_element, a_parent_path);
- return;
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_json_leaf.tps b/source/expectations/data_values/ut_json_leaf.tps
deleted file mode 100644
index 8aa8afd6a..000000000
--- a/source/expectations/data_values/ut_json_leaf.tps
+++ /dev/null
@@ -1,42 +0,0 @@
-create or replace type ut_json_leaf authid current_user as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- element_name varchar2(4000),
- element_value varchar2(4000),
- parent_name varchar2(4000),
- access_path varchar2(4000),
- tlength integer,
- display_path varchar2(4000),
- hierarchy_level integer,
- index_position integer,
- json_type varchar2(2000),
- is_array_element integer,
- parent_type varchar2(2000),
- parent_path varchar2(4000),
-
- member procedure init(self in out nocopy ut_json_leaf,
- a_element_name varchar2, a_element_value varchar2,a_parent_name varchar2,
- a_access_path varchar2, a_hierarchy_level integer, a_index_position integer, a_json_type in varchar2,
- a_parent_type varchar2, a_array_element integer:=0, a_parent_path varchar2),
-
- constructor function ut_json_leaf( self in out nocopy ut_json_leaf,
- a_element_name varchar2, a_element_value varchar2,a_parent_name varchar2,
- a_access_path varchar2, a_hierarchy_level integer, a_index_position integer, a_json_type in varchar2,
- a_parent_type varchar2, a_array_element integer:=0, a_parent_path varchar2)
- return self as result
-)
-/
diff --git a/source/expectations/data_values/ut_json_leaf_tab.tps b/source/expectations/data_values/ut_json_leaf_tab.tps
deleted file mode 100644
index 395ab5d9e..000000000
--- a/source/expectations/data_values/ut_json_leaf_tab.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_json_leaf_tab as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-table of ut_json_leaf
-/
\ No newline at end of file
diff --git a/source/expectations/data_values/ut_json_tree_details.tpb b/source/expectations/data_values/ut_json_tree_details.tpb
deleted file mode 100644
index a333ea71c..000000000
--- a/source/expectations/data_values/ut_json_tree_details.tpb
+++ /dev/null
@@ -1,207 +0,0 @@
-create or replace type body ut_json_tree_details as
-
- member function get_json_type(a_json_piece json_element_t) return varchar2 is
- begin
- return
- case
- when a_json_piece.is_object then 'object'
- when a_json_piece.is_array then 'array'
- when a_json_piece.is_string then 'string'
- when a_json_piece.is_number then 'number'
- when a_json_piece.is_boolean then 'boolean'
- when a_json_piece.is_true then 'true'
- when a_json_piece.is_false then 'false'
- when a_json_piece.is_null then 'null'
- when a_json_piece.is_date then 'date'
- when a_json_piece.is_timestamp then 'timestamp'
- when a_json_piece.is_scalar then 'scalar'
- else null
- end;
- end;
-
- member function get_json_value(a_json_piece json_element_t, a_key varchar2) return varchar2 is
- l_json_el json_element_t;
- l_val varchar2(4000);
- begin
- l_json_el := treat(a_json_piece as json_object_t).get(a_key);
- case
- when l_json_el.is_string then l_val := ut_utils.to_string(l_json_el.to_string(),null);
- when l_json_el.is_number then l_val := ut_utils.to_string(l_json_el.to_number());
- when l_json_el.is_boolean then l_val := ut_utils.to_string(l_json_el.to_boolean());
--- when l_json_el.is_true then l_val := ut_utils.to_string(l_json_el.to_boolean());
--- when l_json_el.is_false then l_val := ut_utils.to_string(l_json_el.to_boolean());
- when l_json_el.is_date then l_val := ut_utils.to_string(l_json_el.to_date());
- when l_json_el.is_timestamp then l_val := ut_utils.to_string(l_json_el.to_date());
- else null;
- end case;
- return l_val;
- end;
-
- member function get_json_value(a_json_piece json_element_t, a_key integer) return varchar2 is
- l_json_el json_element_t;
- l_val varchar2(4000);
- begin
- l_json_el := treat(a_json_piece as json_array_t).get(a_key);
- case
- when l_json_el.is_string then l_val := ut_utils.to_string(l_json_el.to_string(),null);
- when l_json_el.is_number then l_val := ut_utils.to_string(l_json_el.to_number());
- when l_json_el.is_boolean then l_val := ut_utils.to_string(l_json_el.to_boolean());
--- when l_json_el.is_true then l_val := ut_utils.to_string(l_json_el.to_boolean());
--- when l_json_el.is_false then l_val := ut_utils.to_string(l_json_el.to_boolean());
- when l_json_el.is_date then l_val := ut_utils.to_string(l_json_el.to_date());
- when l_json_el.is_timestamp then l_val := ut_utils.to_string(l_json_el.to_date());
- else null;
- end case;
- return l_val;
- end;
-
- member procedure add_json_leaf(
- self in out nocopy ut_json_tree_details,
- a_element_name varchar2,
- a_element_value varchar2,
- a_parent_name varchar2,
- a_access_path varchar2,
- a_hierarchy_level integer,
- a_index_position integer,
- a_json_type varchar2,
- a_parent_type varchar2,
- a_array_element integer := 0,
- a_parent_path varchar2
- ) is
- begin
- self.json_tree_info.extend;
- self.json_tree_info(self.json_tree_info.last) :=
- ut_json_leaf(
- a_element_name, a_element_value, a_parent_name, a_access_path,
- a_hierarchy_level, a_index_position,a_json_type, a_parent_type,
- a_array_element, a_parent_path
- );
- end;
-
- member procedure traverse_object(
- self in out nocopy ut_json_tree_details,
- a_json_piece json_element_t,
- a_parent_name varchar2 := null,
- a_hierarchy_level integer := 1,
- a_access_path varchar2 := '$'
- ) as
- l_keys json_key_list;
- l_object json_object_t := treat(a_json_piece as json_object_t);
- l_path varchar2(32767);
- l_type varchar2(50);
- l_name varchar2(4000);
- begin
- l_keys := coalesce(l_object.get_keys,json_key_list());
-
- for i in 1 .. l_keys.count loop
- l_type := get_json_type(l_object.get(l_keys(i)));
- l_name := '"'||l_keys(i)||'"';
- l_path := a_access_path||'.'||l_name;
-
- add_json_leaf(
- l_name,
- get_json_value(l_object,l_keys(i)),
- a_parent_name,
- l_path,
- a_hierarchy_level,
- i,
- l_type,
- 'object',
- 0,
- a_access_path
- );
- case l_type
- when 'array' then
- traverse_array (
- treat (l_object.get (l_keys(i)) as json_array_t),
- l_name,
- a_hierarchy_level + 1,
- l_path
- );
- when 'object' then
- traverse_object(
- treat (l_object.get (l_keys(i)) as json_object_t),
- l_name,
- a_hierarchy_level+1,
- l_path
- );
- else
- null;
- end case;
- end loop;
- end traverse_object;
-
- member procedure traverse_array(
- self in out nocopy ut_json_tree_details,
- a_json_piece json_element_t,
- a_parent_name varchar2 := null,
- a_hierarchy_level integer := 1,
- a_access_path varchar2 := '$'
- ) as
- l_array json_array_t;
- l_type varchar2(50);
- l_name varchar2(4000);
- l_path varchar2(32767);
- begin
- l_array := treat(a_json_piece as json_array_t);
-
- for i in 0 .. l_array.get_size - 1 loop
- l_type := get_json_type(l_array.get(i));
- l_name := case when l_type = 'object' then l_type else l_array.get(i).stringify end;
- l_path := a_access_path||'['||i||']';
-
- add_json_leaf(
- l_name,
- get_json_value(a_json_piece,i),
- a_parent_name,
- l_path,
- a_hierarchy_level,
- i,
- l_type,
- 'array',
- 1,
- l_path
- );
- case l_type
- when 'array' then
- traverse_array (
- treat (l_array.get (i) as json_array_t),
- l_name,
- a_hierarchy_level + 1,
- l_path
- );
- when 'object' then
- traverse_object(
- treat (l_array.get (i) as json_object_t),
- l_name,
- a_hierarchy_level + 1,
- l_path
- );
- else
- null;
- end case;
- end loop;
- end traverse_array;
-
- member procedure init(self in out nocopy ut_json_tree_details,a_json_doc in json_element_t, a_level_in integer := 0) is
- begin
- if a_json_doc.is_object then
- traverse_object(treat (a_json_doc as json_object_t));
- elsif a_json_doc.is_array then
- traverse_array(treat (a_json_doc as json_array_t));
- end if;
- end;
-
- constructor function ut_json_tree_details(
- self in out nocopy ut_json_tree_details, a_json_doc in json_element_t, a_level_in integer := 0
- ) return self as result is
- begin
- self.json_tree_info := ut_json_leaf_tab();
- if a_json_doc is not null then
- init(a_json_doc,a_level_in);
- end if;
- return;
- end;
-
-end;
-/
diff --git a/source/expectations/data_values/ut_json_tree_details.tps b/source/expectations/data_values/ut_json_tree_details.tps
deleted file mode 100644
index 20ac2fdcc..000000000
--- a/source/expectations/data_values/ut_json_tree_details.tps
+++ /dev/null
@@ -1,54 +0,0 @@
-create or replace type ut_json_tree_details force as object (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- json_tree_info ut_json_leaf_tab,
- member function get_json_type(a_json_piece json_element_t) return varchar2,
- member function get_json_value(a_json_piece json_element_t,a_key varchar2) return varchar2,
- member function get_json_value(a_json_piece json_element_t,a_key integer) return varchar2,
- member procedure add_json_leaf(
- self in out nocopy ut_json_tree_details,
- a_element_name varchar2,
- a_element_value varchar2,
- a_parent_name varchar2,
- a_access_path varchar2,
- a_hierarchy_level integer,
- a_index_position integer,
- a_json_type in varchar2,
- a_parent_type in varchar2,
- a_array_element integer := 0,
- a_parent_path varchar2
- ),
- member procedure traverse_object(
- self in out nocopy ut_json_tree_details,
- a_json_piece json_element_t,
- a_parent_name varchar2 := null,
- a_hierarchy_level integer := 1,
- a_access_path varchar2 := '$'
- ),
- member procedure traverse_array(
- self in out nocopy ut_json_tree_details,
- a_json_piece json_element_t,
- a_parent_name varchar2 := null,
- a_hierarchy_level integer := 1,
- a_access_path varchar2 := '$'
- ),
- member procedure init(self in out nocopy ut_json_tree_details,a_json_doc in json_element_t, a_level_in integer := 0),
- constructor function ut_json_tree_details(
- self in out nocopy ut_json_tree_details, a_json_doc in json_element_t, a_level_in integer := 0
- ) return self as result
-)
-/
diff --git a/source/expectations/data_values/ut_key_anyval_pair.tps b/source/expectations/data_values/ut_key_anyval_pair.tps
deleted file mode 100644
index d1068f109..000000000
--- a/source/expectations/data_values/ut_key_anyval_pair.tps
+++ /dev/null
@@ -1,21 +0,0 @@
-create or replace type ut_key_anyval_pair force as object(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- key varchar2(4000),
- value ut_data_value
-) not final
-/
diff --git a/source/expectations/data_values/ut_key_anyval_pairs.tps b/source/expectations/data_values/ut_key_anyval_pairs.tps
deleted file mode 100644
index 7e10bf50f..000000000
--- a/source/expectations/data_values/ut_key_anyval_pairs.tps
+++ /dev/null
@@ -1,19 +0,0 @@
-create or replace type ut_key_anyval_pairs as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- table of ut_key_anyval_pair
-/
diff --git a/source/expectations/data_values/ut_key_anyvalues.tpb b/source/expectations/data_values/ut_key_anyvalues.tpb
deleted file mode 100644
index d30d8a841..000000000
--- a/source/expectations/data_values/ut_key_anyvalues.tpb
+++ /dev/null
@@ -1,90 +0,0 @@
-create or replace type body ut_key_anyvalues as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- constructor function ut_key_anyvalues(self in out nocopy ut_key_anyvalues) return self as result is
- begin
- self.self_type := $$plsql_unit;
- self.pairs := ut_key_anyval_pairs();
- return;
- end;
- member function put(a_item ut_key_anyval_pair) return ut_key_anyvalues is
- l_result ut_key_anyvalues := self;
- begin
- l_result.pairs.extend();
- l_result.pairs(l_result.pairs.last) := a_item;
- return l_result;
- end;
- member function put(a_key varchar2, a_value anydata) return ut_key_anyvalues is
- begin
- return put(ut_key_anyval_pair(a_key, ut_data_value_anydata(a_value)));
- end;
-
- member function put(a_key varchar2, a_value blob) return ut_key_anyvalues is
- begin
- return put(ut_key_anyval_pair(a_key, ut_data_value_blob(a_value)));
- end;
-
- member function put(a_key varchar2, a_value boolean) return ut_key_anyvalues is
- begin
- return put(ut_key_anyval_pair(a_key, ut_data_value_boolean(a_value)));
- end;
-
- member function put(a_key varchar2, a_value clob) return ut_key_anyvalues is
- begin
- return put(ut_key_anyval_pair(a_key, ut_data_value_clob(a_value)));
- end;
-
- member function put(a_key varchar2, a_value date) return ut_key_anyvalues is
- begin
- return put(ut_key_anyval_pair(a_key, ut_data_value_date(a_value)));
- end;
-
- member function put(a_key varchar2, a_value number) return ut_key_anyvalues is
- begin
- return put(ut_key_anyval_pair(a_key, ut_data_value_number(a_value)));
- end;
- member function put(a_key varchar2, a_value timestamp_unconstrained) return ut_key_anyvalues is
- begin
- return put(ut_key_anyval_pair(a_key, ut_data_value_timestamp(a_value)));
- end;
-
- member function put(a_key varchar2, a_value timestamp_ltz_unconstrained) return ut_key_anyvalues is
- begin
- return put(ut_key_anyval_pair(a_key, ut_data_value_timestamp_ltz(a_value)));
- end;
-
- member function put(a_key varchar2, a_value timestamp_tz_unconstrained) return ut_key_anyvalues is
- begin
- return put(ut_key_anyval_pair(a_key, ut_data_value_timestamp_tz(a_value)));
- end;
-
- member function put(a_key varchar2, a_value varchar2) return ut_key_anyvalues is
- begin
- return put(ut_key_anyval_pair(a_key, ut_data_value_varchar2(a_value)));
- end;
-
- member function put(a_key varchar2, a_value yminterval_unconstrained) return ut_key_anyvalues is
- begin
- return put(ut_key_anyval_pair(a_key, ut_data_value_yminterval(a_value)));
- end;
-
- member function put(a_key varchar2, a_value dsinterval_unconstrained) return ut_key_anyvalues is
- begin
- return put(ut_key_anyval_pair(a_key, ut_data_value_dsinterval(a_value)));
- end;
-end;
-/
diff --git a/source/expectations/data_values/ut_key_anyvalues.tps b/source/expectations/data_values/ut_key_anyvalues.tps
deleted file mode 100644
index 8c672bd00..000000000
--- a/source/expectations/data_values/ut_key_anyvalues.tps
+++ /dev/null
@@ -1,34 +0,0 @@
-create or replace type ut_key_anyvalues under ut_event_item (
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- pairs ut_key_anyval_pairs,
- constructor function ut_key_anyvalues(self in out nocopy ut_key_anyvalues) return self as result,
- member function put(a_item ut_key_anyval_pair) return ut_key_anyvalues,
- member function put(a_key varchar2, a_value anydata) return ut_key_anyvalues,
- member function put(a_key varchar2, a_value blob) return ut_key_anyvalues,
- member function put(a_key varchar2, a_value boolean) return ut_key_anyvalues,
- member function put(a_key varchar2, a_value clob) return ut_key_anyvalues,
- member function put(a_key varchar2, a_value date) return ut_key_anyvalues,
- member function put(a_key varchar2, a_value number) return ut_key_anyvalues,
- member function put(a_key varchar2, a_value timestamp_unconstrained) return ut_key_anyvalues,
- member function put(a_key varchar2, a_value timestamp_ltz_unconstrained) return ut_key_anyvalues,
- member function put(a_key varchar2, a_value timestamp_tz_unconstrained) return ut_key_anyvalues,
- member function put(a_key varchar2, a_value varchar2) return ut_key_anyvalues,
- member function put(a_key varchar2, a_value yminterval_unconstrained) return ut_key_anyvalues,
- member function put(a_key varchar2, a_value dsinterval_unconstrained) return ut_key_anyvalues
-)
-/
diff --git a/source/expectations/json_objects_specs.sql b/source/expectations/json_objects_specs.sql
deleted file mode 100644
index a5d936afb..000000000
--- a/source/expectations/json_objects_specs.sql
+++ /dev/null
@@ -1,74 +0,0 @@
-BEGIN
- null;
- $if dbms_db_version.version < 21 $then
- dbms_output.put_line('Installing json structures specs for native json.');
- execute immediate q'[create or replace TYPE JSON FORCE AUTHID CURRENT_USER AS OBJECT(
- dummyobjt NUMBER
-) NOT FINAL NOT INSTANTIABLE;]';
- $end
- $if dbms_db_version.version = 12 and dbms_db_version.release = 1 or dbms_db_version.version < 12 $then
- dbms_output.put_line('Installing json structures specs.');
- execute immediate q'[create or replace TYPE JSON_Element_T FORCE AUTHID CURRENT_USER AS OBJECT(
- dummyobjt NUMBER,
- STATIC FUNCTION parse(jsn VARCHAR2) RETURN JSON_Element_T,
- STATIC FUNCTION parse(jsn CLOB) RETURN JSON_Element_T,
- STATIC FUNCTION parse(jsn BLOB) RETURN JSON_Element_T,
- MEMBER FUNCTION to_Clob RETURN CLOB,
- MEMBER FUNCTION stringify RETURN VARCHAR2,
- MEMBER FUNCTION is_Object RETURN BOOLEAN,
- MEMBER FUNCTION is_Array RETURN BOOLEAN,
- MEMBER FUNCTION is_Scalar RETURN BOOLEAN,
- MEMBER FUNCTION is_String RETURN BOOLEAN,
- MEMBER FUNCTION is_Number RETURN BOOLEAN,
- MEMBER FUNCTION is_Boolean RETURN BOOLEAN,
- MEMBER FUNCTION is_True RETURN BOOLEAN,
- MEMBER FUNCTION is_False RETURN BOOLEAN,
- MEMBER FUNCTION is_Null RETURN BOOLEAN,
- MEMBER FUNCTION is_Date RETURN BOOLEAN,
- MEMBER FUNCTION is_Timestamp RETURN BOOLEAN,
- MEMBER FUNCTION to_string RETURN VARCHAR2,
- MEMBER FUNCTION to_number RETURN NUMBER,
- MEMBER FUNCTION to_boolean RETURN BOOLEAN,
- MEMBER FUNCTION to_date RETURN VARCHAR2,
-
- MEMBER FUNCTION get_Size(self IN JSON_ELEMENT_T) RETURN NUMBER
-) NOT FINAL NOT INSTANTIABLE;]';
-
- execute immediate q'[create or replace TYPE JSON_KEY_LIST FORCE AS VARRAY(32767) OF VARCHAR2(4000);]';
-
- execute immediate q'[create or replace TYPE JSON_Array_T FORCE AUTHID CURRENT_USER UNDER JSON_Element_T(
- CONSTRUCTOR FUNCTION JSON_Array_T RETURN SELF AS RESULT,
- MEMBER FUNCTION get(pos NUMBER) RETURN JSON_Element_T,
- MEMBER FUNCTION get_String(pos NUMBER) RETURN VARCHAR2,
- MEMBER FUNCTION get_Number(pos NUMBER) RETURN NUMBER,
- MEMBER FUNCTION get_Boolean(pos NUMBER) RETURN BOOLEAN,
- MEMBER FUNCTION get_Date(pos NUMBER) RETURN DATE,
- MEMBER FUNCTION get_Timestamp(pos NUMBER) RETURN TIMESTAMP,
- MEMBER FUNCTION get_Clob(pos NUMBER) RETURN CLOB,
- MEMBER PROCEDURE get_Clob(pos NUMBER, c IN OUT NOCOPY CLOB),
- MEMBER FUNCTION get_Blob(pos NUMBER) RETURN BLOB,
- MEMBER PROCEDURE get_Blob(pos NUMBER, b IN OUT NOCOPY BLOB),
- MEMBER FUNCTION get_Type(pos NUMBER) RETURN VARCHAR2
-) FINAL;]';
-
- execute immediate q'[create or replace TYPE JSON_Object_T AUTHID CURRENT_USER UNDER JSON_Element_T(
- CONSTRUCTOR FUNCTION JSON_Object_T RETURN SELF AS RESULT,
- MEMBER FUNCTION get(key VARCHAR2) RETURN JSON_Element_T,
- MEMBER FUNCTION get_Object(key VARCHAR2) RETURN JSON_OBJECT_T,
- MEMBER FUNCTION get_Array(key VARCHAR2) RETURN JSON_ARRAY_T,
- MEMBER FUNCTION get_String(key VARCHAR2) RETURN VARCHAR2,
- MEMBER FUNCTION get_Number(key VARCHAR2) RETURN NUMBER,
- MEMBER FUNCTION get_Boolean(key VARCHAR2) RETURN BOOLEAN,
- MEMBER FUNCTION get_Date(key VARCHAR2) RETURN DATE,
- MEMBER FUNCTION get_Timestamp(key VARCHAR2) RETURN TIMESTAMP,
- MEMBER FUNCTION get_Clob(key VARCHAR2) RETURN CLOB,
- MEMBER PROCEDURE get_Clob(key VARCHAR2, c IN OUT NOCOPY CLOB),
- MEMBER FUNCTION get_Blob(key VARCHAR2) RETURN BLOB,
- MEMBER PROCEDURE get_Blob(key VARCHAR2, b IN OUT NOCOPY BLOB),
- MEMBER FUNCTION get_Type(key VARCHAR2) RETURN VARCHAR2,
- MEMBER FUNCTION get_Keys RETURN JSON_KEY_LIST
-) FINAL;]';
- $end
-
-END;
-/
\ No newline at end of file
diff --git a/source/expectations/matchers/ut_be_between.tpb b/source/expectations/matchers/ut_be_between.tpb
deleted file mode 100644
index 6aea96f55..000000000
--- a/source/expectations/matchers/ut_be_between.tpb
+++ /dev/null
@@ -1,109 +0,0 @@
-create or replace type body ut_be_between is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- member procedure init(self in out nocopy ut_be_between, a_lower_bound ut_data_value, a_upper_bound ut_data_value) is
- begin
- self.self_type := $$plsql_unit;
- self.lower_bound := a_lower_bound;
- self.upper_bound := a_upper_bound;
- end;
-
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound date, a_upper_bound date)
- return self as result is
- begin
- init(ut_data_value_date(a_lower_bound), ut_data_value_date(a_upper_bound));
- return;
- end;
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound number, a_upper_bound number)
- return self as result is
- begin
- init(ut_data_value_number(a_lower_bound), ut_data_value_number(a_upper_bound));
- return;
- end;
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound varchar2, a_upper_bound varchar2)
- return self as result is
- begin
- init(ut_data_value_varchar2(a_lower_bound), ut_data_value_varchar2(a_upper_bound));
- return;
- end;
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound timestamp_unconstrained, a_upper_bound timestamp_unconstrained)
- return self as result is
- begin
- init(ut_data_value_timestamp(a_lower_bound), ut_data_value_timestamp(a_upper_bound));
- return;
- end;
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound timestamp_tz_unconstrained, a_upper_bound timestamp_tz_unconstrained)
- return self as result is
- begin
- init(ut_data_value_timestamp_tz(a_lower_bound), ut_data_value_timestamp_tz(a_upper_bound));
- return;
- end;
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound timestamp_ltz_unconstrained, a_upper_bound timestamp_ltz_unconstrained)
- return self as result is
- begin
- init(ut_data_value_timestamp_ltz(a_lower_bound), ut_data_value_timestamp_ltz(a_upper_bound));
- return;
- end;
-
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound yminterval_unconstrained, a_upper_bound yminterval_unconstrained)
- return self as result is
- begin
- init(ut_data_value_yminterval(a_lower_bound), ut_data_value_yminterval(a_upper_bound));
- return;
- end;
-
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound dsinterval_unconstrained, a_upper_bound dsinterval_unconstrained)
- return self as result is
- begin
- init(ut_data_value_dsinterval(a_lower_bound), ut_data_value_dsinterval(a_upper_bound));
- return;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_be_between, a_actual ut_data_value) return boolean is
- l_lower_result boolean;
- l_upper_result boolean;
- l_result boolean;
- begin
- if self.lower_bound.data_type = a_actual.data_type then
- l_lower_result := a_actual >= self.lower_bound;
- l_upper_result := a_actual <= self.upper_bound;
- if l_lower_result is not null and l_upper_result is not null then
- l_result := l_lower_result and l_upper_result;
- end if;
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end;
-
- overriding member function failure_message(a_actual ut_data_value) return varchar2 is
- begin
- return (self as ut_matcher).failure_message(a_actual)
- || ': '|| self.lower_bound.to_string_report(true,false)
- || ' and ' || self.upper_bound.to_string_report(a_with_object_info => false);
- end;
-
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
- begin
- return (self as ut_matcher).failure_message_when_negated(a_actual)
- || ': '|| self.lower_bound.to_string_report(true,false)
- || ' and ' || self.upper_bound.to_string_report(a_with_object_info => false);
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_between.tps b/source/expectations/matchers/ut_be_between.tps
deleted file mode 100644
index 9e984085b..000000000
--- a/source/expectations/matchers/ut_be_between.tps
+++ /dev/null
@@ -1,41 +0,0 @@
-create or replace type ut_be_between under ut_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- lower_bound ut_data_value,
- upper_bound ut_data_value,
- member procedure init(self in out nocopy ut_be_between, a_lower_bound ut_data_value, a_upper_bound ut_data_value),
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound date, a_upper_bound date)
- return self as result,
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound number, a_upper_bound number)
- return self as result,
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound varchar2, a_upper_bound varchar2)
- return self as result,
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound timestamp_unconstrained, a_upper_bound timestamp_unconstrained)
- return self as result,
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound timestamp_tz_unconstrained, a_upper_bound timestamp_tz_unconstrained)
- return self as result,
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound timestamp_ltz_unconstrained, a_upper_bound timestamp_ltz_unconstrained)
- return self as result,
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound yminterval_unconstrained, a_upper_bound yminterval_unconstrained)
- return self as result,
- constructor function ut_be_between(self in out nocopy ut_be_between, a_lower_bound dsinterval_unconstrained, a_upper_bound dsinterval_unconstrained)
- return self as result,
- overriding member function run_matcher(self in out nocopy ut_be_between, a_actual ut_data_value) return boolean,
- overriding member function failure_message(a_actual ut_data_value) return varchar2,
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2
-)
-/
diff --git a/source/expectations/matchers/ut_be_empty.tpb b/source/expectations/matchers/ut_be_empty.tpb
deleted file mode 100644
index e5e02f6b2..000000000
--- a/source/expectations/matchers/ut_be_empty.tpb
+++ /dev/null
@@ -1,40 +0,0 @@
-create or replace type body ut_be_empty as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- member procedure init(self in out nocopy ut_be_empty) is
- begin
- self.self_type := $$plsql_unit;
- end;
-
- constructor function ut_be_empty(self in out nocopy ut_be_empty) return self as result is
- begin
- init();
- return;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_be_empty, a_actual ut_data_value) return boolean is
- l_result boolean;
- begin
- return a_actual.is_empty();
- exception
- when value_error then
- return (self as ut_matcher).run_matcher(a_actual);
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_empty.tps b/source/expectations/matchers/ut_be_empty.tps
deleted file mode 100644
index 9e9f899d0..000000000
--- a/source/expectations/matchers/ut_be_empty.tps
+++ /dev/null
@@ -1,22 +0,0 @@
-create or replace type ut_be_empty under ut_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- member procedure init(self in out nocopy ut_be_empty),
- constructor function ut_be_empty(self in out nocopy ut_be_empty) return self as result,
- overriding member function run_matcher(self in out nocopy ut_be_empty, a_actual ut_data_value) return boolean
-)
-/
diff --git a/source/expectations/matchers/ut_be_false.tpb b/source/expectations/matchers/ut_be_false.tpb
deleted file mode 100644
index 4cc88600a..000000000
--- a/source/expectations/matchers/ut_be_false.tpb
+++ /dev/null
@@ -1,37 +0,0 @@
-create or replace type body ut_be_false as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_be_false(self in out nocopy ut_be_false) return self as result is
- begin
- self.self_type := $$plsql_unit;
- return;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_be_false, a_actual ut_data_value) return boolean is
- l_result boolean;
- begin
- if a_actual is of (ut_data_value_boolean) then
- l_result := not ut_utils.int_to_boolean(treat(a_actual as ut_data_value_boolean).data_value);
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_false.tps b/source/expectations/matchers/ut_be_false.tps
deleted file mode 100644
index ede510719..000000000
--- a/source/expectations/matchers/ut_be_false.tps
+++ /dev/null
@@ -1,21 +0,0 @@
-create or replace type ut_be_false under ut_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- constructor function ut_be_false(self in out nocopy ut_be_false) return self as result,
- overriding member function run_matcher(self in out nocopy ut_be_false, a_actual ut_data_value) return boolean
-)
-/
diff --git a/source/expectations/matchers/ut_be_greater_or_equal.tpb b/source/expectations/matchers/ut_be_greater_or_equal.tpb
deleted file mode 100644
index 1c2a19c09..000000000
--- a/source/expectations/matchers/ut_be_greater_or_equal.tpb
+++ /dev/null
@@ -1,89 +0,0 @@
-create or replace type body ut_be_greater_or_equal AS
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- member procedure init(self in out nocopy ut_be_greater_or_equal, a_expected ut_data_value) is
- begin
- self.self_type := $$plsql_unit;
- self.expected := a_expected;
- end;
-
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected date) return self as result is
- begin
- init(ut_data_value_date(a_expected));
- return;
- end;
-
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected NUMBER) return self as result is
- begin
- init(ut_data_value_number(a_expected));
- return;
- end;
-
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected timestamp_unconstrained) return self as result is
- begin
- init(ut_data_value_timestamp(a_expected));
- return;
- end;
-
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected timestamp_tz_unconstrained) return self as result is
- begin
- init(ut_data_value_timestamp_tz(a_expected));
- return;
- end;
-
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected timestamp_ltz_unconstrained) return self as result is
- begin
- init(ut_data_value_timestamp_ltz(a_expected));
- return;
- end;
-
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected yminterval_unconstrained) return self as RESULT IS
- begin
- init(ut_data_value_yminterval(a_expected));
- return;
- end;
-
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected dsinterval_unconstrained) return self as RESULT IS
- begin
- init(ut_data_value_dsinterval(a_expected));
- return;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_be_greater_or_equal, a_actual ut_data_value) return boolean is
- l_result boolean;
- begin
- if self.expected.data_type = a_actual.data_type then
- l_result := a_actual >= self.expected;
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end;
-
- overriding member function failure_message(a_actual ut_data_value) return varchar2 is
- begin
- return (self as ut_matcher).failure_message(a_actual) || ': '|| expected.to_string_report();
- end;
-
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
- begin
- return (self as ut_matcher).failure_message_when_negated(a_actual) || ': '|| expected.to_string_report();
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_greater_or_equal.tps b/source/expectations/matchers/ut_be_greater_or_equal.tps
deleted file mode 100644
index b3ab54ff1..000000000
--- a/source/expectations/matchers/ut_be_greater_or_equal.tps
+++ /dev/null
@@ -1,30 +0,0 @@
-create or replace type ut_be_greater_or_equal under ut_comparison_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- member procedure init(self in out nocopy ut_be_greater_or_equal, a_expected ut_data_value),
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected date) return self as result,
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected number) return self as result,
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected timestamp_unconstrained) return self as result,
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected timestamp_tz_unconstrained) return self as result,
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected timestamp_ltz_unconstrained) return self as result,
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected yminterval_unconstrained) return self as result,
- constructor function ut_be_greater_or_equal(self in out nocopy ut_be_greater_or_equal, a_expected dsinterval_unconstrained) return self as result,
- overriding member function run_matcher(self in out nocopy ut_be_greater_or_equal, a_actual ut_data_value) return boolean,
- overriding member function failure_message(a_actual ut_data_value) return varchar2,
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2
-)
-/
diff --git a/source/expectations/matchers/ut_be_greater_than.tpb b/source/expectations/matchers/ut_be_greater_than.tpb
deleted file mode 100644
index 9cce79119..000000000
--- a/source/expectations/matchers/ut_be_greater_than.tpb
+++ /dev/null
@@ -1,89 +0,0 @@
-create or replace type body ut_be_greater_than AS
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- member procedure init(self in out nocopy ut_be_greater_than, a_expected ut_data_value) is
- begin
- self.self_type := $$plsql_unit;
- self.expected := a_expected;
- end;
-
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected date) return self as result is
- begin
- init(ut_data_value_date(a_expected));
- return;
- end;
-
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected NUMBER) return self as result is
- begin
- init(ut_data_value_number(a_expected));
- return;
- end;
-
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected timestamp_unconstrained) return self as result is
- begin
- init(ut_data_value_timestamp(a_expected));
- return;
- end;
-
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected timestamp_tz_unconstrained) return self as result is
- begin
- init(ut_data_value_timestamp_tz(a_expected));
- return;
- end;
-
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected timestamp_ltz_unconstrained) return self as result is
- begin
- init(ut_data_value_timestamp_ltz(a_expected));
- return;
- end;
-
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected yminterval_unconstrained) return self as RESULT IS
- begin
- init(ut_data_value_yminterval(a_expected));
- return;
- end;
-
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected dsinterval_unconstrained) return self as RESULT IS
- begin
- init(ut_data_value_dsinterval(a_expected));
- return;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_be_greater_than, a_actual ut_data_value) return boolean is
- l_result boolean;
- begin
- if self.expected.data_type = a_actual.data_type then
- l_result := a_actual > self.expected;
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end;
-
- overriding member function failure_message(a_actual ut_data_value) return varchar2 is
- begin
- return (self as ut_matcher).failure_message(a_actual) || ': '|| expected.to_string_report();
- end;
-
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
- begin
- return (self as ut_matcher).failure_message_when_negated(a_actual) || ': '|| expected.to_string_report();
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_greater_than.tps b/source/expectations/matchers/ut_be_greater_than.tps
deleted file mode 100644
index a5a44692d..000000000
--- a/source/expectations/matchers/ut_be_greater_than.tps
+++ /dev/null
@@ -1,30 +0,0 @@
-create or replace type ut_be_greater_than under ut_comparison_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- member procedure init(self in out nocopy ut_be_greater_than, a_expected ut_data_value),
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected date) return self as result,
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected number) return self as result,
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected timestamp_unconstrained) return self as result,
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected timestamp_tz_unconstrained) return self as result,
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected timestamp_ltz_unconstrained) return self as result,
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected yminterval_unconstrained) return self as result,
- constructor function ut_be_greater_than(self in out nocopy ut_be_greater_than, a_expected dsinterval_unconstrained) return self as result,
- overriding member function run_matcher(self in out nocopy ut_be_greater_than, a_actual ut_data_value) return boolean,
- overriding member function failure_message(a_actual ut_data_value) return varchar2,
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2
-)
-/
diff --git a/source/expectations/matchers/ut_be_less_or_equal.tpb b/source/expectations/matchers/ut_be_less_or_equal.tpb
deleted file mode 100644
index 6acec1dda..000000000
--- a/source/expectations/matchers/ut_be_less_or_equal.tpb
+++ /dev/null
@@ -1,89 +0,0 @@
-create or replace type body ut_be_less_or_equal AS
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- member procedure init(self in out nocopy ut_be_less_or_equal, a_expected ut_data_value) is
- begin
- self.self_type := $$plsql_unit;
- self.expected := a_expected;
- end;
-
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected date) return self as result is
- begin
- init(ut_data_value_date(a_expected));
- return;
- end;
-
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected NUMBER) return self as result is
- begin
- init(ut_data_value_number(a_expected));
- return;
- end;
-
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected timestamp_unconstrained) return self as result is
- begin
- init(ut_data_value_timestamp(a_expected));
- return;
- end;
-
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected timestamp_tz_unconstrained) return self as result is
- begin
- init(ut_data_value_timestamp_tz(a_expected));
- return;
- end;
-
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected timestamp_ltz_unconstrained) return self as result is
- begin
- init(ut_data_value_timestamp_ltz(a_expected));
- return;
- end;
-
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected yminterval_unconstrained) return self as RESULT IS
- begin
- init(ut_data_value_yminterval(a_expected));
- return;
- end;
-
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected dsinterval_unconstrained) return self as RESULT IS
- begin
- init(ut_data_value_dsinterval(a_expected));
- return;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_be_less_or_equal, a_actual ut_data_value) return boolean is
- l_result boolean;
- begin
- if self.expected.data_type = a_actual.data_type then
- l_result := a_actual <= self.expected;
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end;
-
- overriding member function failure_message(a_actual ut_data_value) return varchar2 is
- begin
- return (self as ut_matcher).failure_message(a_actual) || ': '|| expected.to_string_report();
- end;
-
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
- begin
- return (self as ut_matcher).failure_message_when_negated(a_actual) || ': '|| expected.to_string_report();
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_less_or_equal.tps b/source/expectations/matchers/ut_be_less_or_equal.tps
deleted file mode 100644
index 118611a41..000000000
--- a/source/expectations/matchers/ut_be_less_or_equal.tps
+++ /dev/null
@@ -1,30 +0,0 @@
-create or replace type ut_be_less_or_equal under ut_comparison_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- member procedure init(self in out nocopy ut_be_less_or_equal, a_expected ut_data_value),
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected date) return self as result,
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected number) return self as result,
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected timestamp_unconstrained) return self as result,
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected timestamp_tz_unconstrained) return self as result,
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected timestamp_ltz_unconstrained) return self as result,
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected yminterval_unconstrained) return self as result,
- constructor function ut_be_less_or_equal(self in out nocopy ut_be_less_or_equal, a_expected dsinterval_unconstrained) return self as result,
- overriding member function run_matcher(self in out nocopy ut_be_less_or_equal, a_actual ut_data_value) return boolean,
- overriding member function failure_message(a_actual ut_data_value) return varchar2,
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2
-)
-/
diff --git a/source/expectations/matchers/ut_be_less_than.tpb b/source/expectations/matchers/ut_be_less_than.tpb
deleted file mode 100644
index 7608e4917..000000000
--- a/source/expectations/matchers/ut_be_less_than.tpb
+++ /dev/null
@@ -1,94 +0,0 @@
-create or replace type body ut_be_less_than as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- member procedure init(self in out nocopy ut_be_less_than, a_expected ut_data_value) is
- begin
- self.self_type := $$plsql_unit;
- self.expected := a_expected;
- end;
-
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected date) return self as result is
- begin
- init(ut_data_value_date(a_expected));
- return;
- end;
-
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected number) return self as result is
- begin
- init(ut_data_value_number(a_expected));
- return;
- end;
-
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected timestamp_unconstrained)
- return self as result is
- begin
- init(ut_data_value_timestamp(a_expected));
- return;
- end;
-
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected timestamp_tz_unconstrained)
- return self as result is
- begin
- init(ut_data_value_timestamp_tz(a_expected));
- return;
- end;
-
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected timestamp_ltz_unconstrained)
- return self as result is
- begin
- init(ut_data_value_timestamp_ltz(a_expected));
- return;
- end;
-
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected yminterval_unconstrained)
- return self as result is
- begin
- init(ut_data_value_yminterval(a_expected));
- return;
- end;
-
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected dsinterval_unconstrained)
- return self as result is
- begin
- init(ut_data_value_dsinterval(a_expected));
- return;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_be_less_than, a_actual ut_data_value) return boolean is
- l_result boolean;
- begin
- if self.expected.data_type = a_actual.data_type then
- l_result := a_actual < self.expected;
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end;
-
- overriding member function failure_message(a_actual ut_data_value) return varchar2 is
- begin
- return (self as ut_matcher).failure_message(a_actual) || ': '|| expected.to_string_report();
- end;
-
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
- begin
- return (self as ut_matcher).failure_message_when_negated(a_actual) || ': '|| expected.to_string_report();
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_less_than.tps b/source/expectations/matchers/ut_be_less_than.tps
deleted file mode 100644
index b652de789..000000000
--- a/source/expectations/matchers/ut_be_less_than.tps
+++ /dev/null
@@ -1,30 +0,0 @@
-create or replace type ut_be_less_than under ut_comparison_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- member procedure init(self in out nocopy ut_be_less_than, a_expected ut_data_value),
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected date) return self as result,
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected number) return self as result,
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected timestamp_unconstrained) return self as result,
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected timestamp_tz_unconstrained) return self as result,
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected timestamp_ltz_unconstrained) return self as result,
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected yminterval_unconstrained) return self as result,
- constructor function ut_be_less_than(self in out nocopy ut_be_less_than, a_expected dsinterval_unconstrained) return self as result,
- overriding member function run_matcher(self in out nocopy ut_be_less_than, a_actual ut_data_value) return boolean,
- overriding member function failure_message(a_actual ut_data_value) return varchar2,
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2
-)
-/
diff --git a/source/expectations/matchers/ut_be_like.tpb b/source/expectations/matchers/ut_be_like.tpb
deleted file mode 100644
index 6865c2942..000000000
--- a/source/expectations/matchers/ut_be_like.tpb
+++ /dev/null
@@ -1,75 +0,0 @@
-create or replace type body ut_be_like as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_be_like(self in out nocopy ut_be_like, a_mask in varchar2, a_escape_char in varchar2 := null) return self as result is
- begin
- self.self_type := $$plsql_unit;
- self.mask := a_mask;
- self.escape_char := a_escape_char;
- return;
- end ut_be_like;
-
- overriding member function run_matcher(self in out nocopy ut_be_like, a_actual ut_data_value) return boolean is
- l_value clob;
- l_result boolean;
- begin
- if a_actual is of (ut_data_value_varchar2, ut_data_value_clob) then
-
- if a_actual is of (ut_data_value_varchar2) then
- l_value := treat(a_actual as ut_data_value_varchar2).data_value;
- else
- l_value := treat(a_actual as ut_data_value_clob).data_value;
- end if;
-
- if escape_char is not null then
- l_result := l_value like mask escape escape_char;
- else
- l_result := l_value like mask;
- end if;
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end run_matcher;
-
- overriding member function failure_message(a_actual ut_data_value) return varchar2 is
- l_result varchar2(32767);
- begin
- l_result := (self as ut_matcher).failure_message(a_actual);
- if self.escape_char is not null then
- l_result := l_result || ': '|| ut_data_value_varchar2(self.mask).to_string_report(true, false) || ', escape ''' || self.escape_char ||'''';
- else
- l_result := l_result || ': '|| ut_data_value_varchar2(self.mask).to_string_report(false, false);
- end if;
- return l_result;
- end;
-
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
- l_result varchar2(32767);
- begin
- l_result := (self as ut_matcher).failure_message_when_negated(a_actual);
- if self.escape_char is not null then
- l_result := l_result || ': '|| ut_data_value_varchar2(self.mask).to_string_report(true, false) || ', escape ''' || self.escape_char ||'''';
- else
- l_result := l_result || ': '|| ut_data_value_varchar2(self.mask).to_string_report(false, false);
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_like.tps b/source/expectations/matchers/ut_be_like.tps
deleted file mode 100644
index dae93a1d9..000000000
--- a/source/expectations/matchers/ut_be_like.tps
+++ /dev/null
@@ -1,25 +0,0 @@
-create or replace type ut_be_like under ut_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- mask varchar2(4000),
- escape_char varchar2(1),
- constructor function ut_be_like(self in out nocopy ut_be_like, a_mask in varchar2, a_escape_char in varchar2 := null) return self as result,
- overriding member function run_matcher(self in out nocopy ut_be_like, a_actual ut_data_value) return boolean,
- overriding member function failure_message(a_actual ut_data_value) return varchar2,
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2
-)
-/
diff --git a/source/expectations/matchers/ut_be_not_null.tpb b/source/expectations/matchers/ut_be_not_null.tpb
deleted file mode 100644
index 194e2ea32..000000000
--- a/source/expectations/matchers/ut_be_not_null.tpb
+++ /dev/null
@@ -1,31 +0,0 @@
-create or replace type body ut_be_not_null as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_be_not_null(self in out nocopy ut_be_not_null) return self as result is
- begin
- self.self_type := $$plsql_unit;
- return;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_be_not_null, a_actual ut_data_value) return boolean is
- begin
- return not a_actual.is_null;
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_not_null.tps b/source/expectations/matchers/ut_be_not_null.tps
deleted file mode 100644
index 196aac9fb..000000000
--- a/source/expectations/matchers/ut_be_not_null.tps
+++ /dev/null
@@ -1,21 +0,0 @@
-create or replace type ut_be_not_null under ut_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- constructor function ut_be_not_null(self in out nocopy ut_be_not_null) return self as result,
- overriding member function run_matcher(self in out nocopy ut_be_not_null, a_actual ut_data_value) return boolean
-)
-/
diff --git a/source/expectations/matchers/ut_be_null.tpb b/source/expectations/matchers/ut_be_null.tpb
deleted file mode 100644
index 8c672791b..000000000
--- a/source/expectations/matchers/ut_be_null.tpb
+++ /dev/null
@@ -1,31 +0,0 @@
-create or replace type body ut_be_null as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_be_null(self in out nocopy ut_be_null) return self as result is
- begin
- self.self_type := $$plsql_unit;
- return;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_be_null, a_actual ut_data_value) return boolean is
- begin
- return a_actual.is_null;
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_null.tps b/source/expectations/matchers/ut_be_null.tps
deleted file mode 100644
index 3b2d6ac84..000000000
--- a/source/expectations/matchers/ut_be_null.tps
+++ /dev/null
@@ -1,21 +0,0 @@
-create or replace type ut_be_null under ut_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- constructor function ut_be_null(self in out nocopy ut_be_null) return self as result,
- overriding member function run_matcher(self in out nocopy ut_be_null, a_actual ut_data_value) return boolean
-)
-/
diff --git a/source/expectations/matchers/ut_be_true.tpb b/source/expectations/matchers/ut_be_true.tpb
deleted file mode 100644
index fe78b4e22..000000000
--- a/source/expectations/matchers/ut_be_true.tpb
+++ /dev/null
@@ -1,37 +0,0 @@
-create or replace type body ut_be_true as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_be_true(self in out nocopy ut_be_true) return self as result is
- begin
- self.self_type := $$plsql_unit;
- return;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_be_true, a_actual ut_data_value) return boolean is
- l_result boolean;
- begin
- if a_actual is of (ut_data_value_boolean) then
- l_result := ut_utils.int_to_boolean( treat(a_actual as ut_data_value_boolean).data_value);
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_true.tps b/source/expectations/matchers/ut_be_true.tps
deleted file mode 100644
index 8b5491e39..000000000
--- a/source/expectations/matchers/ut_be_true.tps
+++ /dev/null
@@ -1,21 +0,0 @@
-create or replace type ut_be_true under ut_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- constructor function ut_be_true(self in out nocopy ut_be_true) return self as result,
- overriding member function run_matcher(self in out nocopy ut_be_true, a_actual ut_data_value) return boolean
-)
-/
diff --git a/source/expectations/matchers/ut_be_within.tpb b/source/expectations/matchers/ut_be_within.tpb
deleted file mode 100644
index e2aa792d0..000000000
--- a/source/expectations/matchers/ut_be_within.tpb
+++ /dev/null
@@ -1,137 +0,0 @@
-create or replace type body ut_be_within as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2019 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_be_within(self in out nocopy ut_be_within, a_distance_from_expected number) return self as result is
- begin
- self.init(ut_data_value_number(a_distance_from_expected), $$plsql_unit);
- return;
- end;
-
- constructor function ut_be_within(self in out nocopy ut_be_within, a_distance_from_expected dsinterval_unconstrained) return self as result is
- begin
- self.init(ut_data_value_dsinterval(a_distance_from_expected), $$plsql_unit);
- return;
- end;
-
- constructor function ut_be_within(self in out nocopy ut_be_within, a_distance_from_expected yminterval_unconstrained) return self as result is
- begin
- self.init(ut_data_value_yminterval(a_distance_from_expected), $$plsql_unit);
- return;
- end;
-
- member procedure of_(self in ut_be_within, a_expected date) is
- l_result ut_be_within := self;
- begin
- l_result.expected := ut_data_value_date(a_expected);
- if l_result.is_negated_flag = 1 then
- l_result.expectation.not_to(l_result);
- else
- l_result.expectation.to_(l_result);
- end if;
- end;
-
- member function of_(self in ut_be_within, a_expected date) return ut_be_within is
- l_result ut_be_within := self;
- begin
- l_result.expected := ut_data_value_date(a_expected);
- return l_result;
- end;
-
- member procedure of_(self in ut_be_within, a_expected timestamp_unconstrained) is
- l_result ut_be_within := self;
- begin
- l_result.expected := ut_data_value_timestamp(a_expected);
- if l_result.is_negated_flag = 1 then
- l_result.expectation.not_to(l_result);
- else
- l_result.expectation.to_(l_result);
- end if;
- end;
-
- member function of_(self in ut_be_within, a_expected timestamp_unconstrained) return ut_be_within is
- l_result ut_be_within := self;
- begin
- l_result.expected := ut_data_value_timestamp(a_expected);
- return l_result;
- end;
-
- member procedure of_(self in ut_be_within, a_expected timestamp_tz_unconstrained) is
- l_result ut_be_within := self;
- begin
- l_result.expected := ut_data_value_timestamp_tz(a_expected);
- if l_result.is_negated_flag = 1 then
- l_result.expectation.not_to(l_result);
- else
- l_result.expectation.to_(l_result);
- end if;
- end;
-
- member function of_(self in ut_be_within, a_expected timestamp_tz_unconstrained) return ut_be_within is
- l_result ut_be_within := self;
- begin
- l_result.expected := ut_data_value_timestamp_tz(a_expected);
- return l_result;
- end;
-
- member procedure of_(self in ut_be_within, a_expected timestamp_ltz_unconstrained) is
- l_result ut_be_within := self;
- begin
- l_result.expected := ut_data_value_timestamp_ltz(a_expected);
- if l_result.is_negated_flag = 1 then
- l_result.expectation.not_to(l_result);
- else
- l_result.expectation.to_(l_result);
- end if;
- end;
-
- member function of_(self in ut_be_within, a_expected timestamp_ltz_unconstrained) return ut_be_within is
- l_result ut_be_within := self;
- begin
- l_result.expected := ut_data_value_timestamp_ltz(a_expected);
- return l_result;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_be_within, a_actual ut_data_value) return boolean is
- l_result boolean;
- begin
- if self.expected.data_type = a_actual.data_type
- and (
- self.expected is of (ut_data_value_date, ut_data_value_timestamp, ut_data_value_timestamp_tz, ut_data_value_timestamp_ltz)
- and self.distance_from_expected is of (ut_data_value_yminterval, ut_data_value_dsinterval)
- or self.expected is of (ut_data_value_number) and self.distance_from_expected is of (ut_data_value_number)
- )
- then
- l_result := ut_be_within_helper.values_within_abs_distance( a_actual, self.expected, self.distance_from_expected) ;
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end;
-
- overriding member function failure_message(a_actual ut_data_value) return varchar2 is
- begin
- return (self as ut_matcher).failure_message(a_actual) || ' '||self.distance_from_expected.to_string ||' of '|| expected.to_string_report();
- end;
-
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
- begin
- return (self as ut_matcher).failure_message_when_negated(a_actual) || ' '||self.distance_from_expected.to_string ||' of '|| expected.to_string_report();
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_within.tps b/source/expectations/matchers/ut_be_within.tps
deleted file mode 100644
index 576f9ff37..000000000
--- a/source/expectations/matchers/ut_be_within.tps
+++ /dev/null
@@ -1,36 +0,0 @@
-create or replace type ut_be_within force under ut_be_within_pct(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2019 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-
- constructor function ut_be_within(self in out nocopy ut_be_within, a_distance_from_expected number) return self as result,
- constructor function ut_be_within(self in out nocopy ut_be_within, a_distance_from_expected dsinterval_unconstrained) return self as result,
- constructor function ut_be_within(self in out nocopy ut_be_within, a_distance_from_expected yminterval_unconstrained) return self as result,
- member procedure of_(self in ut_be_within, a_expected date),
- member function of_(self in ut_be_within, a_expected date) return ut_be_within,
- member procedure of_(self in ut_be_within, a_expected timestamp_unconstrained),
- member function of_(self in ut_be_within, a_expected timestamp_unconstrained) return ut_be_within,
- member procedure of_(self in ut_be_within, a_expected timestamp_tz_unconstrained ),
- member function of_(self in ut_be_within, a_expected timestamp_tz_unconstrained) return ut_be_within,
- member procedure of_(self in ut_be_within, a_expected timestamp_ltz_unconstrained),
- member function of_(self in ut_be_within, a_expected timestamp_ltz_unconstrained) return ut_be_within,
- overriding member function run_matcher(self in out nocopy ut_be_within, a_actual ut_data_value) return boolean,
- overriding member function failure_message(a_actual ut_data_value) return varchar2,
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2
-)
-not final
-/
diff --git a/source/expectations/matchers/ut_be_within_helper.pkb b/source/expectations/matchers/ut_be_within_helper.pkb
deleted file mode 100644
index 5dd82baa2..000000000
--- a/source/expectations/matchers/ut_be_within_helper.pkb
+++ /dev/null
@@ -1,55 +0,0 @@
-create or replace package body ut_be_within_helper as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2019 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- function values_within_abs_distance(
- a_actual ut_data_value, a_expected ut_data_value, a_distance ut_data_value
- ) return boolean is
- l_result integer;
- l_YM_conversion varchar2(50) := case when a_distance is of (ut_data_value_yminterval) then ' year to month ' end;
- l_formula varchar2(4000);
- l_code varchar2(4000);
- begin
- l_formula :=
- case
- when a_actual is of (ut_data_value_date)
- then '( cast(greatest(l_actual, l_expected) as timestamp) - cast(least(l_actual, l_expected) as timestamp) ) '||l_YM_conversion||' <= l_distance'
- else '( greatest(l_actual, l_expected) - least(l_actual, l_expected) ) '||l_YM_conversion||' <= l_distance'
- end;
- l_code :=
- q'[
- declare
- l_actual ]'||dbms_assert.simple_sql_name(a_actual.data_type_plsql)|| q'[ := treat(:a_actual as ]'||dbms_assert.simple_sql_name(a_actual.self_type)||q'[).data_value;
- l_expected ]'||dbms_assert.simple_sql_name(a_expected.data_type_plsql)||q'[ := treat(:a_expected as ]'||dbms_assert.simple_sql_name(a_expected.self_type)||q'[).data_value;
- l_distance ]'||dbms_assert.simple_sql_name(a_distance.data_type_plsql)||q'[ := treat(:a_distance as ]'||dbms_assert.simple_sql_name(a_distance.self_type)||q'[).data_value;
- begin
- :result :=
- case
- when
- ]'||l_formula||q'[
- then 1
- else 0
- end;
- end;
- ]';
- execute immediate l_code
- using a_actual, a_expected, a_distance, out l_result;
- return l_result > 0;
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_within_helper.pks b/source/expectations/matchers/ut_be_within_helper.pks
deleted file mode 100644
index 41737cc8f..000000000
--- a/source/expectations/matchers/ut_be_within_helper.pks
+++ /dev/null
@@ -1,24 +0,0 @@
-create or replace package ut_be_within_helper authid definer as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2019 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- function values_within_abs_distance(
- a_actual ut_data_value, a_expected ut_data_value, a_distance ut_data_value
- ) return boolean;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_within_pct.tpb b/source/expectations/matchers/ut_be_within_pct.tpb
deleted file mode 100644
index 8b280ffff..000000000
--- a/source/expectations/matchers/ut_be_within_pct.tpb
+++ /dev/null
@@ -1,84 +0,0 @@
-create or replace type body ut_be_within_pct as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2019 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_be_within_pct(self in out nocopy ut_be_within_pct, a_pct_of_expected number) return self as result is
- begin
- self.init(ut_data_value_number(a_pct_of_expected), $$plsql_unit);
- return;
- end;
-
- member procedure init(self in out nocopy ut_be_within_pct, a_distance_from_expected ut_data_value, self_type varchar2) is
- begin
- self.distance_from_expected := a_distance_from_expected;
- self.self_type := self_type;
- end;
-
- member procedure of_(self in ut_be_within_pct, a_expected number) is
- l_result ut_be_within_pct := self;
- begin
- l_result.expected := ut_data_value_number(a_expected);
- if l_result.is_negated_flag = 1 then
- l_result.expectation.not_to(l_result);
- else
- l_result.expectation.to_(l_result);
- end if;
- end;
-
- member function of_(self in ut_be_within_pct, a_expected number) return ut_be_within_pct is
- l_result ut_be_within_pct := self;
- begin
- l_result.expected := ut_data_value_number(a_expected);
- return l_result;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_be_within_pct, a_actual ut_data_value) return boolean is
- l_result boolean;
- begin
- if self.expected.data_type = a_actual.data_type then
- if self.expected is of (ut_data_value_number) then
- l_result :=
- abs(treat(self.distance_from_expected as ut_data_value_number).data_value) * treat(self.expected as ut_data_value_number).data_value
- >= abs( ( treat(self.expected as ut_data_value_number).data_value - treat(a_actual as ut_data_value_number).data_value ) * 100 );
- end if;
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end;
-
- overriding member function failure_message(a_actual ut_data_value) return varchar2 is
- begin
- return rtrim( (self as ut_matcher).failure_message(a_actual), 'pct' ) || self.distance_from_expected.to_string ||' % of '|| expected.to_string_report();
- end;
-
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
- begin
- return rtrim( (self as ut_matcher).failure_message_when_negated(a_actual), 'pct' ) || self.distance_from_expected.to_string ||' % of '|| expected.to_string_report();
- end;
-
- overriding member function error_message(a_actual ut_data_value) return varchar2 is
- l_result varchar2(32767);
- begin
- if ut_utils.int_to_boolean(self.is_errored) then
- l_result := 'Matcher '''||self.name()||''' cannot be used to compare Actual ('||a_actual.data_type||') with Expected ('||expected.data_type||') using distance ('||self.distance_from_expected.data_type||').';
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_be_within_pct.tps b/source/expectations/matchers/ut_be_within_pct.tps
deleted file mode 100644
index 499e9a2d8..000000000
--- a/source/expectations/matchers/ut_be_within_pct.tps
+++ /dev/null
@@ -1,35 +0,0 @@
-create or replace type ut_be_within_pct force under ut_comparison_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2019 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-
- /**
- * Holds information about mather options
- */
- distance_from_expected ut_data_value,
-
- constructor function ut_be_within_pct(self in out nocopy ut_be_within_pct, a_pct_of_expected number) return self as result,
- member procedure init(self in out nocopy ut_be_within_pct, a_distance_from_expected ut_data_value, self_type varchar2),
- member procedure of_(self in ut_be_within_pct, a_expected number),
- member function of_(self in ut_be_within_pct, a_expected number) return ut_be_within_pct,
- overriding member function run_matcher(self in out nocopy ut_be_within_pct, a_actual ut_data_value) return boolean,
- overriding member function failure_message(a_actual ut_data_value) return varchar2,
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2,
- overriding member function error_message(a_actual ut_data_value) return varchar2
-)
-not final
-/
diff --git a/source/expectations/matchers/ut_comparison_matcher.tpb b/source/expectations/matchers/ut_comparison_matcher.tpb
deleted file mode 100644
index 20ed35927..000000000
--- a/source/expectations/matchers/ut_comparison_matcher.tpb
+++ /dev/null
@@ -1,29 +0,0 @@
-create or replace type body ut_comparison_matcher as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- overriding member function error_message(a_actual ut_data_value) return varchar2 is
- l_result varchar2(32767);
- begin
- if ut_utils.int_to_boolean(self.is_errored) then
- l_result := 'Actual ('||a_actual.data_type||') cannot be compared to Expected ('||expected.data_type||') using matcher '''||self.name()||'''.';
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_comparison_matcher.tps b/source/expectations/matchers/ut_comparison_matcher.tps
deleted file mode 100644
index 68ecb4462..000000000
--- a/source/expectations/matchers/ut_comparison_matcher.tps
+++ /dev/null
@@ -1,22 +0,0 @@
-create or replace type ut_comparison_matcher under ut_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- expected ut_data_value,
- overriding member function error_message(a_actual ut_data_value) return varchar2
-) not final not instantiable
-/
diff --git a/source/expectations/matchers/ut_contain.tpb b/source/expectations/matchers/ut_contain.tpb
deleted file mode 100644
index c9691f731..000000000
--- a/source/expectations/matchers/ut_contain.tpb
+++ /dev/null
@@ -1,74 +0,0 @@
-create or replace type body ut_contain as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_contain(self in out nocopy ut_contain, a_expected sys_refcursor) return self as result is
- begin
- self.init(ut_data_value_refcursor(a_expected), null, $$plsql_unit);
- self.options.unordered();
- return;
- end;
-
- constructor function ut_contain(self in out nocopy ut_contain, a_expected anydata) return self as result is
- begin
- self.init(ut_data_value_anydata(a_expected), null, $$plsql_unit);
- self.options.unordered();
- return;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_contain, a_actual ut_data_value) return boolean is
- l_result boolean;
- begin
- if self.expected.data_type = a_actual.data_type then
- l_result :=
- ( 0
- = treat( self.expected as ut_data_value_refcursor )
- .compare_implementation( a_actual, self.options, true, self.is_negated() )
- );
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end;
-
- overriding member function run_matcher_negated(self in out nocopy ut_contain, a_actual ut_data_value) return boolean is
- begin
- self.negated();
- return run_matcher(a_actual);
- end;
-
- overriding member function failure_message(a_actual ut_data_value) return varchar2 is
- l_result varchar2(32767);
- begin
- if self.expected.data_type = a_actual.data_type and self.expected.is_diffable then
- l_result :=
- 'Actual: '||a_actual.get_object_info()||self.description()||': '||self.expected.get_object_info()
- || treat(expected as ut_data_value_refcursor).diff( a_actual, self.options );
- else
- l_result := (self as ut_matcher).failure_message(a_actual) || ': '|| self.expected.to_string_report();
- end if;
- return l_result;
- end;
-
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
- l_result varchar2(32767);
- begin
- return (self as ut_matcher).failure_message_when_negated(a_actual) || ':'|| expected.to_string_report();
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_contain.tps b/source/expectations/matchers/ut_contain.tps
deleted file mode 100644
index e572edf62..000000000
--- a/source/expectations/matchers/ut_contain.tps
+++ /dev/null
@@ -1,33 +0,0 @@
-create or replace type ut_contain under ut_equal(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Due to nature of inclusion compare the not is bit diffrente than standard.
- * Result is false when even one element belongs which can cause overlap.
- * e.g. set can fail at same time not_include and include. By that we mean
- * that false include not necessary mean true not include.
- */
-
- constructor function ut_contain(self in out nocopy ut_contain, a_expected sys_refcursor) return self as result,
- constructor function ut_contain(self in out nocopy ut_contain, a_expected anydata) return self as result,
- overriding member function run_matcher(self in out nocopy ut_contain, a_actual ut_data_value) return boolean,
- overriding member function run_matcher_negated(self in out nocopy ut_contain, a_actual ut_data_value) return boolean,
- overriding member function failure_message(a_actual ut_data_value) return varchar2,
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2
-)
-/
diff --git a/source/expectations/matchers/ut_equal.tpb b/source/expectations/matchers/ut_equal.tpb
deleted file mode 100644
index d514e34d0..000000000
--- a/source/expectations/matchers/ut_equal.tpb
+++ /dev/null
@@ -1,331 +0,0 @@
-create or replace type body ut_equal as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- member procedure init(self in out nocopy ut_equal, a_expected ut_data_value, a_nulls_are_equal boolean, a_self_type varchar2 := null) is
- begin
- self.expected := a_expected;
- self.options := ut_matcher_options( a_nulls_are_equal );
- self.self_type := nvl( a_self_type, $$plsql_unit );
- end;
-
- member function equal_with_nulls(a_assert_result boolean, a_actual ut_data_value) return boolean is
- begin
- ut_utils.debug_log('ut_equal.equal_with_nulls :' || ut_utils.to_test_result(a_assert_result) || ':');
- return ( a_assert_result or ( self.expected.is_null() and a_actual.is_null() and options.nulls_are_equal ) );
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected anydata, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_anydata(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected anydata, a_exclude varchar2, a_nulls_are_equal boolean := null) return self as result is
- l_deprecated integer;
- begin
- ut_expectation_processor.add_depreciation_warning(
- 'equal( a_expected anydata, a_exclude varchar2 )',
- 'equal( a_expected anydata ).exclude( a_exclude varchar2 )'
- );
- init(ut_data_value_anydata(a_expected), a_nulls_are_equal);
- self.options.exclude.add_items(a_exclude);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected anydata, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) return self as result is
- begin
- ut_expectation_processor.add_depreciation_warning(
- 'equal( a_expected anydata, a_exclude ut_varchar2_list )',
- 'equal( a_expected anydata ).exclude( a_exclude ut_varchar2_list )'
- );
- init(ut_data_value_anydata(a_expected), a_nulls_are_equal);
- self.options.exclude.add_items(a_exclude);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected blob, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_blob(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected boolean, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_boolean(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected clob, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_clob(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected date, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_date(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected number, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_number(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected sys_refcursor, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_refcursor(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected sys_refcursor, a_exclude varchar2, a_nulls_are_equal boolean := null) return self as result is
- begin
- ut_expectation_processor.add_depreciation_warning(
- 'equal( a_expected sys_refcursor, a_exclude varchar2 )',
- 'equal( a_expected sys_refcursor ).exclude( a_exclude varchar2 )'
- );
- init(ut_data_value_refcursor(a_expected), a_nulls_are_equal);
- self.options.exclude.add_items(a_exclude);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected sys_refcursor, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) return self as result is
- begin
- ut_expectation_processor.add_depreciation_warning(
- 'equal( a_expected sys_refcursor, a_exclude ut_varchar2_list )',
- 'equal( a_expected sys_refcursor ).exclude( a_exclude ut_varchar2_list )'
- );
- init(ut_data_value_refcursor(a_expected), a_nulls_are_equal);
- self.options.exclude.add_items(a_exclude);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected timestamp_unconstrained, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_timestamp(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected timestamp_tz_unconstrained, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_timestamp_tz(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected timestamp_ltz_unconstrained, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_timestamp_ltz(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected varchar2, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_varchar2(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected yminterval_unconstrained, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_yminterval(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_dsinterval(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected json_element_t, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_json(a_expected), a_nulls_are_equal);
- return;
- end;
-
- constructor function ut_equal(self in out nocopy ut_equal, a_expected json, a_nulls_are_equal boolean := null) return self as result is
- begin
- init(ut_data_value_json(a_expected), a_nulls_are_equal);
- return;
- end;
-
- member function include(a_items varchar2) return ut_equal is
- l_result ut_equal := self;
- begin
- l_result.options.include.add_items(a_items);
- return l_result;
- end;
-
- member function include(a_items ut_varchar2_list) return ut_equal is
- l_result ut_equal := self;
- begin
- l_result.options.include.add_items(a_items);
- return l_result;
- end;
-
- member procedure include(self in ut_equal, a_items varchar2) is
- begin
- include( ut_varchar2_list( a_items ) );
- end;
-
- member procedure include(self in ut_equal, a_items ut_varchar2_list) is
- l_result ut_equal := self;
- begin
- l_result.options.include.add_items(a_items);
- l_result.expectation.to_(l_result );
- end;
-
- member function exclude(a_items varchar2) return ut_equal is
- l_result ut_equal := self;
- begin
- l_result.options.exclude.add_items(a_items);
- return l_result;
- end;
-
- member function exclude(a_items ut_varchar2_list) return ut_equal is
- l_result ut_equal := self;
- begin
- l_result.options.exclude.add_items(a_items);
- return l_result;
- end;
-
- member procedure exclude(self in ut_equal, a_items varchar2) is
- begin
- exclude( ut_varchar2_list( a_items ) );
- end;
-
- member procedure exclude(self in ut_equal, a_items ut_varchar2_list) is
- l_result ut_equal := self;
- begin
- l_result.options.exclude.add_items(a_items);
- l_result.expectation.to_(l_result );
- end;
-
- member function unordered return ut_equal is
- l_result ut_equal := self;
- begin
- l_result.options.unordered();
- return l_result;
- end;
-
- member procedure unordered(self in ut_equal) is
- l_result ut_equal := self;
- begin
- l_result.options.unordered();
- l_result.expectation.to_(l_result );
- end;
-
- member function join_by(a_columns varchar2) return ut_equal is
- l_result ut_equal := self;
- begin
- l_result.options.unordered();
- l_result.options.join_by.add_items(a_columns);
- return l_result;
- end;
-
- member function join_by(a_columns ut_varchar2_list) return ut_equal is
- l_result ut_equal := self;
- begin
- l_result.options.unordered();
- l_result.options.join_by.add_items(a_columns);
- return l_result;
- end;
-
- member procedure join_by(self in ut_equal, a_columns varchar2) is
- begin
- join_by( ut_varchar2_list( a_columns ) );
- end;
-
- member procedure join_by(self in ut_equal, a_columns ut_varchar2_list) is
- l_result ut_equal := self;
- begin
- l_result.options.unordered();
- l_result.options.join_by.add_items(a_columns);
- l_result.expectation.to_(l_result );
- end;
-
- member function unordered_columns return ut_equal is
- l_result ut_equal := self;
- begin
- l_result.options.unordered_columns();
- return l_result;
- end;
-
- member procedure unordered_columns(self in ut_equal) is
- l_result ut_equal := self;
- begin
- l_result.options.unordered_columns();
- l_result.expectation.to_(l_result );
- end;
-
- member function uc return ut_equal is
- begin
- return unordered_columns;
- end;
-
- member procedure uc(self in ut_equal) is
- begin
- unordered_columns;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_equal, a_actual ut_data_value) return boolean is
- l_result boolean;
- begin
- if self.expected.data_type = a_actual.data_type then
- if self.expected is of (ut_data_value_anydata) then
- l_result := 0 = treat(self.expected as ut_data_value_anydata).compare_implementation( a_actual, options );
- elsif self.expected is of (ut_data_value_refcursor) then
- l_result := 0 = treat(self.expected as ut_data_value_refcursor).compare_implementation( a_actual, options );
- else
- l_result := equal_with_nulls((self.expected = a_actual), a_actual);
- end if;
- l_result := equal_with_nulls( l_result, a_actual );
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end;
-
- overriding member function failure_message(a_actual ut_data_value) return varchar2 is
- l_result varchar2(32767);
- begin
- if self.expected.data_type = a_actual.data_type and self.expected.is_diffable then
- l_result :=
- 'Actual: '||a_actual.get_object_info()||self.description()||': '||self.expected.get_object_info()
- ||case
- when self.expected is of (ut_data_value_refcursor) then
- treat(expected as ut_data_value_refcursor).diff( a_actual, options )
- when self.expected is of (ut_data_value_json) then
- treat(expected as ut_data_value_json).diff( a_actual, options )
- else
- expected.diff( a_actual, options )
- end;
- else
- l_result := (self as ut_matcher).failure_message(a_actual) || ': '|| self.expected.to_string_report();
- end if;
- return l_result;
- end;
-
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
- l_result varchar2(32767);
- begin
- return (self as ut_matcher).failure_message_when_negated(a_actual) || ': '|| expected.to_string_report();
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_equal.tps b/source/expectations/matchers/ut_equal.tps
deleted file mode 100644
index e48b797ed..000000000
--- a/source/expectations/matchers/ut_equal.tps
+++ /dev/null
@@ -1,69 +0,0 @@
-create or replace type ut_equal force under ut_comparison_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-
- /**
- * Holds information about mather options
- */
- options ut_matcher_options,
-
- member procedure init(self in out nocopy ut_equal, a_expected ut_data_value, a_nulls_are_equal boolean, a_self_type varchar2 := null),
- member function equal_with_nulls( self in ut_equal, a_assert_result boolean, a_actual ut_data_value) return boolean,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected anydata, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected anydata, a_exclude varchar2, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected anydata, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected blob, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected boolean, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected clob, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected date, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected number, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected sys_refcursor, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected sys_refcursor, a_exclude varchar2, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected sys_refcursor, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected timestamp_unconstrained, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected timestamp_tz_unconstrained, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected timestamp_ltz_unconstrained, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected varchar2, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected yminterval_unconstrained, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected json_element_t, a_nulls_are_equal boolean := null) return self as result,
- constructor function ut_equal(self in out nocopy ut_equal, a_expected json, a_nulls_are_equal boolean := null) return self as result,
- member function include(a_items varchar2) return ut_equal,
- member function include(a_items ut_varchar2_list) return ut_equal,
- member procedure include(self in ut_equal, a_items varchar2),
- member procedure include(self in ut_equal, a_items ut_varchar2_list),
- member function exclude(a_items varchar2) return ut_equal,
- member function exclude(a_items ut_varchar2_list) return ut_equal,
- member procedure exclude(self in ut_equal, a_items varchar2),
- member procedure exclude(self in ut_equal, a_items ut_varchar2_list),
- member function unordered return ut_equal,
- member procedure unordered(self in ut_equal),
- member function join_by(a_columns varchar2) return ut_equal,
- member function join_by(a_columns ut_varchar2_list) return ut_equal,
- member procedure join_by(self in ut_equal, a_columns varchar2),
- member procedure join_by(self in ut_equal, a_columns ut_varchar2_list),
- overriding member function run_matcher(self in out nocopy ut_equal, a_actual ut_data_value) return boolean,
- overriding member function failure_message(a_actual ut_data_value) return varchar2,
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2,
- member function unordered_columns return ut_equal,
- member procedure unordered_columns(self in ut_equal),
- member function uc return ut_equal,
- member procedure uc(self in ut_equal)
-)
-not final
-/
diff --git a/source/expectations/matchers/ut_have_count.tpb b/source/expectations/matchers/ut_have_count.tpb
deleted file mode 100644
index 457cd6272..000000000
--- a/source/expectations/matchers/ut_have_count.tpb
+++ /dev/null
@@ -1,54 +0,0 @@
-create or replace type body ut_have_count as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_have_count(self in out nocopy ut_have_count, a_expected integer) return self as result is
- begin
- self.self_type := $$plsql_unit;
- self.expected := a_expected;
- return;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_have_count, a_actual ut_data_value) return boolean is
- l_result boolean;
- begin
- if a_actual is of(ut_data_value_refcursor) and ( treat (a_actual as ut_data_value_refcursor).compound_type != 'object') then
- l_result := ( self.expected = treat(a_actual as ut_data_value_refcursor).elements_count );
- elsif a_actual is of(ut_data_value_json) then
- l_result := ( self.expected = treat(a_actual as ut_data_value_json).get_elements_count );
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end;
-
- overriding member function failure_message(a_actual ut_data_value) return varchar2 is
- begin
- return 'Actual: (' || case when a_actual is of (ut_data_value_json) then
- treat(a_actual as ut_data_value_json).get_json_count_info() else a_actual.get_object_info() end||
- ') was expected to have [ count = '||ut_utils.to_string(self.expected)||' ]';
- end;
-
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
- begin
- return 'Actual: ' || case when a_actual is of (ut_data_value_json) then
- treat(a_actual as ut_data_value_json).get_json_count_info() else a_actual.get_object_info() end||
- ' was expected not to have [ count = '||ut_utils.to_string(self.expected)||' ]';
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_have_count.tps b/source/expectations/matchers/ut_have_count.tps
deleted file mode 100644
index d48dc44c8..000000000
--- a/source/expectations/matchers/ut_have_count.tps
+++ /dev/null
@@ -1,26 +0,0 @@
-create or replace type ut_have_count under ut_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- expected integer,
-
- constructor function ut_have_count(self in out nocopy ut_have_count, a_expected integer) return self as result,
- overriding member function run_matcher(self in out nocopy ut_have_count, a_actual ut_data_value) return boolean,
- overriding member function failure_message(a_actual ut_data_value) return varchar2,
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2
-)
-/
diff --git a/source/expectations/matchers/ut_match.tpb b/source/expectations/matchers/ut_match.tpb
deleted file mode 100644
index 3c7a71402..000000000
--- a/source/expectations/matchers/ut_match.tpb
+++ /dev/null
@@ -1,65 +0,0 @@
-create or replace type body ut_match as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_match(self in out nocopy ut_match, a_pattern in varchar2, a_modifiers in varchar2 default null) return self as result is
- begin
- self.self_type := $$plsql_unit;
- self.pattern := a_pattern;
- self.modifiers := a_modifiers;
- return;
- end;
-
- overriding member function run_matcher(self in out nocopy ut_match, a_actual ut_data_value) return boolean is
- l_result boolean;
- begin
- if a_actual is of (ut_data_value_varchar2) then
- l_result := regexp_like(treat(a_actual as ut_data_value_varchar2).data_value, pattern, modifiers);
- elsif a_actual is of (ut_data_value_clob) then
- l_result := regexp_like(treat(a_actual as ut_data_value_clob).data_value, pattern, modifiers);
- else
- l_result := (self as ut_matcher).run_matcher(a_actual);
- end if;
- return l_result;
- end;
-
- overriding member function failure_message(a_actual ut_data_value) return varchar2 is
- l_result varchar2(32767);
- begin
- l_result := (self as ut_matcher).failure_message(a_actual);
- if self.modifiers is not null then
- l_result := l_result || ': '|| ut_data_value_varchar2(self.pattern).to_string_report(true, false) || ', modifiers ''' || self.modifiers ||'''';
- else
- l_result := l_result || ': '|| ut_data_value_varchar2(self.pattern).to_string_report(false, false);
- end if;
- return l_result;
- end;
-
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
- l_result varchar2(32767);
- begin
- l_result := (self as ut_matcher).failure_message_when_negated(a_actual);
- if self.modifiers is not null then
- l_result := l_result || ': '|| ut_data_value_varchar2(self.pattern).to_string_report(true, false) || ', modifiers ''' || self.modifiers ||'''';
- else
- l_result := l_result || ': '|| ut_data_value_varchar2(self.pattern).to_string_report(false, false);
- end if;
- return l_result;
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_match.tps b/source/expectations/matchers/ut_match.tps
deleted file mode 100644
index ee51a4c28..000000000
--- a/source/expectations/matchers/ut_match.tps
+++ /dev/null
@@ -1,25 +0,0 @@
-create or replace type ut_match under ut_matcher(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- pattern varchar2(4000),
- modifiers varchar2(4000),
- constructor function ut_match(self in out nocopy ut_match, a_pattern in varchar2, a_modifiers in varchar2 default null) return self as result,
- overriding member function run_matcher(self in out nocopy ut_match, a_actual ut_data_value) return boolean,
- overriding member function failure_message(a_actual ut_data_value) return varchar2,
- overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2
-)
-/
diff --git a/source/expectations/matchers/ut_matcher.tpb b/source/expectations/matchers/ut_matcher.tpb
deleted file mode 100644
index 6b5b98465..000000000
--- a/source/expectations/matchers/ut_matcher.tpb
+++ /dev/null
@@ -1,83 +0,0 @@
-create or replace type body ut_matcher as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- member function run_matcher(self in out nocopy ut_matcher, a_actual ut_data_value) return boolean is
- begin
- ut_utils.debug_log('Failure - ut_matcher.run_matcher'||'(a_actual '||a_actual.data_type||')');
- self.is_errored := ut_utils.boolean_to_int(true);
- return null;
- end;
-
- member function run_matcher_negated(self in out nocopy ut_matcher, a_actual ut_data_value) return boolean is
- begin
- return not run_matcher(a_actual);
- end;
-
- member function name return varchar2 is
- begin
- return replace(ltrim(lower(self.self_type),'ut_'),'_',' ');
- end;
-
- member function description return varchar2 is
- begin
- return ' was expected to '||name();
- end;
-
- member function description_when_negated return varchar2 is
- begin
- return ' was expected not to '||name();
- end;
-
- member function error_message(a_actual ut_data_value) return varchar2 is
- l_result varchar2(32767);
- begin
- if ut_utils.int_to_boolean(self.is_errored) then
- l_result := 'The matcher '''||name()||''' cannot be used with data type ('||a_actual.data_type||').';
- end if;
- return l_result;
- end;
-
- member function failure_message(a_actual ut_data_value) return varchar2 is
- begin
- return 'Actual: ' || a_actual.to_string_report(true) || description();
- end;
-
- member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
- begin
- return 'Actual: ' || a_actual.to_string_report(true) || description_when_negated();
- end;
-
- member procedure negated is
- begin
- is_negated_flag := ut_utils.boolean_to_int(true);
- end;
-
- member function negated return ut_matcher is
- l_result ut_matcher := self;
- begin
- l_result.negated();
- return l_result;
- end;
-
- member function is_negated return boolean is
- begin
- return coalesce(ut_utils.int_to_boolean(is_negated_flag), false);
- end;
-
-end;
-/
diff --git a/source/expectations/matchers/ut_matcher.tps b/source/expectations/matchers/ut_matcher.tps
deleted file mode 100644
index a034e4ed2..000000000
--- a/source/expectations/matchers/ut_matcher.tps
+++ /dev/null
@@ -1,43 +0,0 @@
-create or replace type ut_matcher under ut_matcher_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- is_errored integer,
- is_negated_flag number(1,0),
- expectation ut_expectation_base,
- /*
- function: run_matcher
-
- A superclass function that executes the matcher.
- This is actually a fallback function, that should be called by subtype when there is a data type mismatch.
- The subtype should override this function and return:
- - true for success of a matcher,
- - false for faulure of a matcher,
- - null when result cannot be determined (type mismatch or exception)
- */
- member function run_matcher(self in out nocopy ut_matcher, a_actual ut_data_value) return boolean,
- member function run_matcher_negated(self in out nocopy ut_matcher, a_actual ut_data_value) return boolean,
- member function name return varchar2,
- member function description return varchar2,
- member function description_when_negated return varchar2,
- member function error_message(a_actual ut_data_value) return varchar2,
- member function failure_message(a_actual ut_data_value) return varchar2,
- member function failure_message_when_negated(a_actual ut_data_value) return varchar2,
- member procedure negated,
- member function negated return ut_matcher,
- member function is_negated return boolean
-) not final not instantiable
-/
diff --git a/source/expectations/matchers/ut_matcher_base.tps b/source/expectations/matchers/ut_matcher_base.tps
deleted file mode 100644
index ef7fd98a2..000000000
--- a/source/expectations/matchers/ut_matcher_base.tps
+++ /dev/null
@@ -1,5 +0,0 @@
-create or replace type ut_matcher_base force authid current_user as object(
- self_type varchar2(250)
-)
-not final not instantiable
-/
diff --git a/source/expectations/matchers/ut_matcher_options.tpb b/source/expectations/matchers/ut_matcher_options.tpb
deleted file mode 100644
index 8730c204b..000000000
--- a/source/expectations/matchers/ut_matcher_options.tpb
+++ /dev/null
@@ -1,60 +0,0 @@
-create or replace type body ut_matcher_options as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_matcher_options(self in out nocopy ut_matcher_options, a_nulls_are_equal in boolean := null) return self as result is
- begin
- nulls_are_equal_flag := ut_utils.boolean_to_int( coalesce(a_nulls_are_equal, ut_expectation_processor.nulls_are_equal()) );
- is_unordered := ut_utils.boolean_to_int(false);
- columns_are_unordered_flag := ut_utils.boolean_to_int(false);
- include := ut_matcher_options_items();
- exclude := ut_matcher_options_items();
- join_by := ut_matcher_options_items();
- return;
- end;
-
- member procedure nulls_are_equal(self in out nocopy ut_matcher_options) is
- begin
- self.nulls_are_equal_flag := ut_utils.boolean_to_int(true);
- end;
-
- member function nulls_are_equal return boolean is
- begin
- return ut_utils.int_to_boolean(self.nulls_are_equal_flag);
- end;
-
- member procedure unordered_columns(self in out nocopy ut_matcher_options) is
- begin
- columns_are_unordered_flag := ut_utils.boolean_to_int(true);
- end;
-
- member function ordered_columns return boolean is
- begin
- return not ut_utils.int_to_boolean(columns_are_unordered_flag);
- end;
-
- member procedure unordered(self in out nocopy ut_matcher_options) is
- begin
- is_unordered := ut_utils.boolean_to_int(true);
- end;
-
- member function unordered return boolean is
- begin
- return ut_utils.int_to_boolean(is_unordered);
- end;
-end;
-/
diff --git a/source/expectations/matchers/ut_matcher_options.tps b/source/expectations/matchers/ut_matcher_options.tps
deleted file mode 100644
index 276cad2ec..000000000
--- a/source/expectations/matchers/ut_matcher_options.tps
+++ /dev/null
@@ -1,57 +0,0 @@
-create or replace type ut_matcher_options authid current_user as object(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Flag indicating that columns order is to be ignored
- */
- columns_are_unordered_flag number(1,0),
-
- /**
- * Flag indicating that rows/items order is to be ignored
- */
- is_unordered number(1,0),
-
- /**
- * Flag determining how to react to null values
- */
- nulls_are_equal_flag number(1,0),
-
- /**
- * Holds (list of columns/attributes) to exclude when comparing compound types
- */
- exclude ut_matcher_options_items,
-
- /**
- * Holds (list of columns/attributes) to incude when comparing compound types
- */
- include ut_matcher_options_items,
-
- /**
- * Holds list of columns to be used as a join PK on sys_refcursor comparision
- */
- join_by ut_matcher_options_items,
-
- constructor function ut_matcher_options(self in out nocopy ut_matcher_options, a_nulls_are_equal in boolean := null) return self as result,
- member procedure nulls_are_equal(self in out nocopy ut_matcher_options),
- member function nulls_are_equal return boolean,
- member procedure unordered_columns(self in out nocopy ut_matcher_options),
- member function ordered_columns return boolean,
- member procedure unordered(self in out nocopy ut_matcher_options),
- member function unordered return boolean
-)
-/
diff --git a/source/expectations/matchers/ut_matcher_options_items.tpb b/source/expectations/matchers/ut_matcher_options_items.tpb
deleted file mode 100644
index 92da588ce..000000000
--- a/source/expectations/matchers/ut_matcher_options_items.tpb
+++ /dev/null
@@ -1,56 +0,0 @@
-create or replace type body ut_matcher_options_items is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_matcher_options_items(self in out nocopy ut_matcher_options_items) return self as result is
- begin
- items := ut_varchar2_list();
- return;
- end;
-
- member procedure add_items(self in out nocopy ut_matcher_options_items, a_items varchar2) is
- begin
- items :=
- items
- multiset union all
- ut_utils.filter_list(
- ut_utils.trim_list_elements(
- ut_utils.string_to_table( replace( a_items , '|', ',' ), ',' )
- )
- , '.+'
- );
- end;
-
- member procedure add_items(self in out nocopy ut_matcher_options_items, a_items ut_varchar2_list) is
- l_idx binary_integer;
- begin
- if a_items is not null then
- l_idx := a_items.first;
- while l_idx is not null loop
- add_items( a_items(l_idx) );
- l_idx := a_items.next(l_idx);
- end loop;
- end if;
- end;
-
- member function to_xpath return varchar2 is
- begin
- return ut_utils.to_xpath(items);
- end;
-
-end;
-/
\ No newline at end of file
diff --git a/source/expectations/matchers/ut_matcher_options_items.tps b/source/expectations/matchers/ut_matcher_options_items.tps
deleted file mode 100644
index 53787070d..000000000
--- a/source/expectations/matchers/ut_matcher_options_items.tps
+++ /dev/null
@@ -1,29 +0,0 @@
-create or replace type ut_matcher_options_items authid current_user as object(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- /**
- * Attributes / columns list
- */
- items ut_varchar2_list,
-
- constructor function ut_matcher_options_items(self in out nocopy ut_matcher_options_items) return self as result,
- member procedure add_items(self in out nocopy ut_matcher_options_items, a_items varchar2),
- member procedure add_items(self in out nocopy ut_matcher_options_items, a_items ut_varchar2_list),
- member function to_xpath return varchar2
-)
-/
diff --git a/source/expectations/ut_expectation.tpb b/source/expectations/ut_expectation.tpb
deleted file mode 100644
index 309759d48..000000000
--- a/source/expectations/ut_expectation.tpb
+++ /dev/null
@@ -1,768 +0,0 @@
-create or replace type body ut_expectation as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- member procedure to_be_null(self in ut_expectation) is
- begin
- self.to_( ut_be_null() );
- end;
-
- member procedure to_be_not_null(self in ut_expectation) is
- begin
- self.to_( ut_be_not_null() );
- end;
-
- member procedure not_to_be_null(self in ut_expectation) is
- begin
- self.not_to( ut_be_null() );
- end;
-
- member procedure not_to_be_not_null(self in ut_expectation) is
- begin
- self.not_to( ut_be_not_null() );
- end;
-
- member procedure to_be_true(self in ut_expectation) is
- begin
- self.to_( ut_be_true() );
- end;
-
- member procedure to_be_false(self in ut_expectation) is
- begin
- self.to_( ut_be_false() );
- end;
-
- member procedure not_to_be_true(self in ut_expectation) is
- begin
- self.not_to( ut_be_true() );
- end;
-
- member procedure not_to_be_false(self in ut_expectation) is
- begin
- self.not_to( ut_be_false() );
- end;
-
- member procedure to_be_empty(self in ut_expectation) is
- begin
- self.to_( ut_be_empty() );
- end;
-
- member procedure not_to_be_empty(self in ut_expectation) is
- begin
- self.not_to( ut_be_empty() );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected anydata, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected anydata, a_exclude varchar2, a_nulls_are_equal boolean := null) is
- begin
- ut_expectation_processor.add_warning(
- ut_utils.build_depreciation_warning(
- 'to_equal( a_expected anydata, a_exclude varchar2 )',
- 'to_equal( a_expected anydata ).exclude( a_exclude varchar2 )'
- )
- );
- self.to_( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected anydata, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) is
- begin
- ut_expectation_processor.add_warning(
- ut_utils.build_depreciation_warning(
- 'to_equal( a_expected anydata, a_exclude ut_varchar2_list )',
- 'to_equal( a_expected anydata ).exclude( a_exclude ut_varchar2_list )'
- )
- );
- self.to_( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected blob, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected boolean, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected clob, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected date, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected number, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected sys_refcursor, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude varchar2, a_nulls_are_equal boolean := null) is
- begin
- ut_expectation_processor.add_depreciation_warning(
- 'to_equal( a_expected sys_refcursor, a_exclude varchar2 )',
- 'to_equal( a_expected sys_refcursor ).exclude( a_exclude varchar2 )'
- );
- self.to_( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) is
- begin
- ut_expectation_processor.add_depreciation_warning(
- 'to_equal( a_expected sys_refcursor, a_exclude ut_varchar2_list )',
- 'to_equal( a_expected sys_refcursor ).exclude( a_exclude ut_varchar2_list )'
- );
- self.to_( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected timestamp_unconstrained, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected varchar2, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected yminterval_unconstrained, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected json_element_t, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_equal(self in ut_expectation, a_expected json, a_nulls_are_equal boolean := null) is
- begin
- self.to_( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected anydata, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected anydata, a_exclude varchar2, a_nulls_are_equal boolean := null) is
- begin
- ut_expectation_processor.add_depreciation_warning(
- 'not_to_equal( a_expected anydata, a_exclude varchar2 )',
- 'not_to_equal( a_expected anydata ).exclude( a_exclude varchar2 )'
- );
- self.not_to( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected anydata, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) is
- begin
- ut_expectation_processor.add_depreciation_warning(
- 'not_to_equal( a_expected anydata, a_exclude ut_varchar2_list )',
- 'not_to_equal( a_expected anydata ).exclude( a_exclude ut_varchar2_list )'
- );
- self.not_to( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected blob, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected boolean, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected clob, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected date, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected number, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude varchar2, a_nulls_are_equal boolean := null) is
- begin
- ut_expectation_processor.add_depreciation_warning(
- 'not_to_equal( a_expected sys_refcursor, a_exclude varchar2 )',
- 'not_to_equal( a_expected sys_refcursor ).exclude( a_exclude varchar2 )'
- );
- self.not_to( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) is
- begin
- ut_expectation_processor.add_depreciation_warning(
- 'not_to_equal( a_expected sys_refcursor, a_exclude ut_varchar2_list )',
- 'not_to_equal( a_expected sys_refcursor ).exclude( a_exclude ut_varchar2_list )'
- );
- self.not_to( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected timestamp_unconstrained, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected varchar2, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected yminterval_unconstrained, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure not_to_equal(self in ut_expectation, a_expected json_element_t, a_nulls_are_equal boolean := null) is
- begin
- self.not_to( ut_equal(a_expected, a_nulls_are_equal) );
- end;
-
- member procedure to_be_like(self in ut_expectation, a_mask in varchar2, a_escape_char in varchar2 := null) is
- begin
- self.to_( ut_be_like(a_mask, a_escape_char) );
- end;
-
-
- member procedure to_match(self in ut_expectation, a_pattern in varchar2, a_modifiers in varchar2 default null) is
- begin
- self.to_( ut_match(a_pattern, a_modifiers) );
- end;
-
-
- member procedure not_to_be_like(self in ut_expectation, a_mask in varchar2, a_escape_char in varchar2 := null) is
- begin
- self.not_to( ut_be_like(a_mask, a_escape_char) );
- end;
-
-
- member procedure not_to_match(self in ut_expectation, a_pattern in varchar2, a_modifiers in varchar2 default null) is
- begin
- self.not_to( ut_match(a_pattern, a_modifiers) );
- end;
-
-
- member procedure to_be_between(self in ut_expectation, a_lower_bound date, a_upper_bound date) is
- begin
- self.to_( ut_be_between(a_lower_bound,a_upper_bound) );
- end;
-
- member procedure to_be_between(self in ut_expectation, a_lower_bound dsinterval_unconstrained, a_upper_bound dsinterval_unconstrained) is
- begin
- self.to_( ut_be_between(a_lower_bound,a_upper_bound) );
- end;
-
- member procedure to_be_between(self in ut_expectation, a_lower_bound number, a_upper_bound number) is
- begin
- self.to_( ut_be_between(a_lower_bound,a_upper_bound) );
- end;
-
- member procedure to_be_between(self in ut_expectation, a_lower_bound timestamp_unconstrained, a_upper_bound timestamp_unconstrained) is
- begin
- self.to_( ut_be_between(a_lower_bound, a_upper_bound) );
- end;
-
- member procedure to_be_between(self in ut_expectation, a_lower_bound timestamp_ltz_unconstrained, a_upper_bound timestamp_ltz_unconstrained) is
- begin
- self.to_( ut_be_between(a_lower_bound, a_upper_bound) );
- end;
-
- member procedure to_be_between(self in ut_expectation, a_lower_bound timestamp_tz_unconstrained, a_upper_bound timestamp_tz_unconstrained) is
- begin
- self.to_( ut_be_between(a_lower_bound, a_upper_bound) );
- end;
-
- member procedure to_be_between(self in ut_expectation, a_lower_bound varchar2, a_upper_bound varchar2) is
- begin
- self.to_( ut_be_between(a_lower_bound,a_upper_bound) );
- end;
-
- member procedure to_be_between(self in ut_expectation, a_lower_bound yminterval_unconstrained, a_upper_bound yminterval_unconstrained) is
- begin
- self.to_( ut_be_between(a_lower_bound,a_upper_bound) );
- end;
-
-
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected date) is
- begin
- self.to_( ut_be_greater_or_equal (a_expected) );
- end;
-
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected dsinterval_unconstrained) is
- begin
- self.to_( ut_be_greater_or_equal (a_expected) );
- end;
-
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected number) is
- begin
- self.to_( ut_be_greater_or_equal (a_expected) );
- end;
-
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected timestamp_unconstrained) is
- begin
- self.to_( ut_be_greater_or_equal (a_expected) );
- end;
-
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained) is
- begin
- self.to_( ut_be_greater_or_equal (a_expected) );
- end;
-
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained) is
- begin
- self.to_( ut_be_greater_or_equal (a_expected) );
- end;
-
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected yminterval_unconstrained) is
- begin
- self.to_( ut_be_greater_or_equal (a_expected) );
- end;
-
- member procedure to_be_greater_than(self in ut_expectation, a_expected date) is
- begin
- self.to_( ut_be_greater_than (a_expected) );
- end;
-
- member procedure to_be_greater_than(self in ut_expectation, a_expected dsinterval_unconstrained) is
- begin
- self.to_( ut_be_greater_than (a_expected) );
- end;
-
- member procedure to_be_greater_than(self in ut_expectation, a_expected number) is
- begin
- self.to_( ut_be_greater_than (a_expected) );
- end;
-
- member procedure to_be_greater_than(self in ut_expectation, a_expected timestamp_unconstrained) is
- begin
- self.to_( ut_be_greater_than (a_expected) );
- end;
-
- member procedure to_be_greater_than(self in ut_expectation, a_expected timestamp_ltz_unconstrained) is
- begin
- self.to_( ut_be_greater_than (a_expected) );
- end;
-
- member procedure to_be_greater_than(self in ut_expectation, a_expected timestamp_tz_unconstrained) is
- begin
- self.to_( ut_be_greater_than (a_expected) );
- end;
-
- member procedure to_be_greater_than(self in ut_expectation, a_expected yminterval_unconstrained) is
- begin
- self.to_( ut_be_greater_than (a_expected) );
- end;
-
-
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected date) is
- begin
- self.to_( ut_be_less_or_equal (a_expected) );
- end;
-
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected dsinterval_unconstrained) is
- begin
- self.to_( ut_be_less_or_equal (a_expected) );
- end;
-
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected number) is
- begin
- self.to_( ut_be_less_or_equal (a_expected) );
- end;
-
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected timestamp_unconstrained) is
- begin
- self.to_( ut_be_less_or_equal (a_expected) );
- end;
-
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained) is
- begin
- self.to_( ut_be_less_or_equal (a_expected) );
- end;
-
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained) is
- begin
- self.to_( ut_be_less_or_equal (a_expected) );
- end;
-
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected yminterval_unconstrained) is
- begin
- self.to_( ut_be_less_or_equal (a_expected) );
- end;
-
-
- member procedure to_be_less_than(self in ut_expectation, a_expected date) is
- begin
- self.to_( ut_be_less_than (a_expected) );
- end;
-
- member procedure to_be_less_than(self in ut_expectation, a_expected dsinterval_unconstrained) is
- begin
- self.to_( ut_be_less_than (a_expected) );
- end;
-
- member procedure to_be_less_than(self in ut_expectation, a_expected number) is
- begin
- self.to_( ut_be_less_than (a_expected) );
- end;
-
- member procedure to_be_less_than(self in ut_expectation, a_expected timestamp_unconstrained) is
- begin
- self.to_( ut_be_less_than (a_expected) );
- end;
-
- member procedure to_be_less_than(self in ut_expectation, a_expected timestamp_ltz_unconstrained) is
- begin
- self.to_( ut_be_less_than (a_expected) );
- end;
-
- member procedure to_be_less_than(self in ut_expectation, a_expected timestamp_tz_unconstrained) is
- begin
- self.to_( ut_be_less_than (a_expected) );
- end;
-
- member procedure to_be_less_than(self in ut_expectation, a_expected yminterval_unconstrained) is
- begin
- self.to_( ut_be_less_than (a_expected) );
- end;
-
-
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound date, a_upper_bound date) is
- begin
- self.not_to( ut_be_between(a_lower_bound,a_upper_bound) );
- end;
-
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound dsinterval_unconstrained, a_upper_bound dsinterval_unconstrained) is
- begin
- self.not_to( ut_be_between(a_lower_bound,a_upper_bound) );
- end;
-
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound number, a_upper_bound number) is
- begin
- self.not_to( ut_be_between(a_lower_bound,a_upper_bound) );
- end;
-
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound timestamp_unconstrained, a_upper_bound timestamp_unconstrained) is
- begin
- self.not_to( ut_be_between(a_lower_bound, a_upper_bound) );
- end;
-
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound timestamp_ltz_unconstrained, a_upper_bound timestamp_ltz_unconstrained) is
- begin
- self.not_to( ut_be_between(a_lower_bound, a_upper_bound) );
- end;
-
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound timestamp_tz_unconstrained, a_upper_bound timestamp_tz_unconstrained) is
- begin
- self.not_to( ut_be_between(a_lower_bound, a_upper_bound) );
- end;
-
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound varchar2, a_upper_bound varchar2) is
- begin
- self.not_to( ut_be_between(a_lower_bound,a_upper_bound) );
- end;
-
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound yminterval_unconstrained, a_upper_bound yminterval_unconstrained) is
- begin
- self.not_to( ut_be_between(a_lower_bound,a_upper_bound) );
- end;
-
-
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected date) is
- begin
- self.not_to( ut_be_greater_or_equal (a_expected) );
- end;
-
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected dsinterval_unconstrained) is
- begin
- self.not_to( ut_be_greater_or_equal (a_expected) );
- end;
-
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected number) is
- begin
- self.not_to( ut_be_greater_or_equal (a_expected) );
- end;
-
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected timestamp_unconstrained) is
- begin
- self.not_to( ut_be_greater_or_equal (a_expected) );
- end;
-
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained) is
- begin
- self.not_to( ut_be_greater_or_equal (a_expected) );
- end;
-
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained) is
- begin
- self.not_to( ut_be_greater_or_equal (a_expected) );
- end;
-
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected yminterval_unconstrained) is
- begin
- self.not_to( ut_be_greater_or_equal (a_expected) );
- end;
-
-
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected date) is
- begin
- self.not_to( ut_be_greater_than (a_expected) );
- end;
-
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected dsinterval_unconstrained) is
- begin
- self.not_to( ut_be_greater_than (a_expected) );
- end;
-
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected number) is
- begin
- self.not_to( ut_be_greater_than (a_expected) );
- end;
-
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected timestamp_unconstrained) is
- begin
- self.not_to( ut_be_greater_than (a_expected) );
- end;
-
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected timestamp_ltz_unconstrained) is
- begin
- self.not_to( ut_be_greater_than (a_expected) );
- end;
-
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected timestamp_tz_unconstrained) is
- begin
- self.not_to( ut_be_greater_than (a_expected) );
- end;
-
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected yminterval_unconstrained) is
- begin
- self.not_to( ut_be_greater_than (a_expected) );
- end;
-
-
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected date) is
- begin
- self.not_to( ut_be_less_or_equal (a_expected) );
- end;
-
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected dsinterval_unconstrained) is
- begin
- self.not_to( ut_be_less_or_equal (a_expected) );
- end;
-
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected number) is
- begin
- self.not_to( ut_be_less_or_equal (a_expected) );
- end;
-
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected timestamp_unconstrained) is
- begin
- self.not_to( ut_be_less_or_equal (a_expected) );
- end;
-
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained) is
- begin
- self.not_to( ut_be_less_or_equal (a_expected) );
- end;
-
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained) is
- begin
- self.not_to( ut_be_less_or_equal (a_expected) );
- end;
-
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected yminterval_unconstrained) is
- begin
- self.not_to( ut_be_less_or_equal (a_expected) );
- end;
-
-
- member procedure not_to_be_less_than(self in ut_expectation, a_expected date) is
- begin
- self.not_to( ut_be_less_than (a_expected) );
- end;
-
- member procedure not_to_be_less_than(self in ut_expectation, a_expected dsinterval_unconstrained) is
- begin
- self.not_to( ut_be_less_than (a_expected) );
- end;
-
- member procedure not_to_be_less_than(self in ut_expectation, a_expected number) is
- begin
- self.not_to( ut_be_less_than (a_expected) );
- end;
-
- member procedure not_to_be_less_than(self in ut_expectation, a_expected timestamp_unconstrained) is
- begin
- self.not_to( ut_be_less_than (a_expected) );
- end;
-
- member procedure not_to_be_less_than(self in ut_expectation, a_expected timestamp_ltz_unconstrained) is
- begin
- self.not_to( ut_be_less_than (a_expected) );
- end;
-
- member procedure not_to_be_less_than(self in ut_expectation, a_expected timestamp_tz_unconstrained) is
- begin
- self.not_to( ut_be_less_than (a_expected) );
- end;
-
- member procedure not_to_be_less_than(self in ut_expectation, a_expected yminterval_unconstrained) is
- begin
- self.not_to( ut_be_less_than (a_expected) );
- end;
-
- member procedure to_contain(self in ut_expectation, a_expected sys_refcursor) is
- begin
- self.to_( ut_contain(a_expected) );
- end;
-
- member procedure not_to_contain(self in ut_expectation, a_expected sys_refcursor) is
- begin
- self.not_to( ut_contain(a_expected));
- end;
-
- member procedure to_contain(self in ut_expectation, a_expected anydata) is
- begin
- self.to_( ut_contain(a_expected) );
- end;
-
- member procedure not_to_contain(self in ut_expectation, a_expected anydata) is
- begin
- self.not_to( ut_contain(a_expected));
- end;
-
- member function to_be_within(a_dist number) return ut_be_within is
- l_result ut_be_within;
- begin
- l_result := ut_be_within(a_dist);
- l_result.expectation := self;
- return l_result;
- end;
-
- member function to_be_within(a_dist dsinterval_unconstrained) return ut_be_within is
- l_result ut_be_within;
- begin
- l_result := ut_be_within(a_dist);
- l_result.expectation := self;
- return l_result;
- end;
-
- member function to_be_within(a_dist yminterval_unconstrained) return ut_be_within is
- l_result ut_be_within;
- begin
- l_result := ut_be_within(a_dist);
- l_result.expectation := self;
- return l_result;
- end;
-
- member function to_be_within_pct(a_dist number) return ut_be_within_pct is
- l_result ut_be_within_pct;
- begin
- l_result := ut_be_within_pct(a_dist);
- l_result.expectation := self;
- return l_result;
- end;
-
- member function not_to_be_within(a_dist number) return ut_be_within is
- l_result ut_be_within;
- begin
- l_result := treat( ut_be_within(a_dist).negated() as ut_be_within);
- l_result.expectation := self;
- return l_result;
- end;
-
- member function not_to_be_within(a_dist dsinterval_unconstrained) return ut_be_within is
- l_result ut_be_within;
- begin
- l_result := treat( ut_be_within(a_dist).negated() as ut_be_within);
- l_result.expectation := self;
- return l_result;
- end;
-
- member function not_to_be_within(a_dist yminterval_unconstrained) return ut_be_within is
- l_result ut_be_within;
- begin
- l_result := treat( ut_be_within(a_dist).negated() as ut_be_within);
- l_result.expectation := self;
- return l_result;
- end;
-
- member function not_to_be_within_pct(a_dist number) return ut_be_within_pct is
- l_result ut_be_within_pct;
- begin
- l_result := treat( ut_be_within_pct(a_dist).negated() as ut_be_within_pct);
- l_result.expectation := self;
- return l_result;
- end;
-
-end;
-/
-
diff --git a/source/expectations/ut_expectation.tps b/source/expectations/ut_expectation.tps
deleted file mode 100644
index 30fe985d3..000000000
--- a/source/expectations/ut_expectation.tps
+++ /dev/null
@@ -1,178 +0,0 @@
-create or replace type ut_expectation force under ut_expectation_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- --shortcuts
- member procedure to_be_null(self in ut_expectation),
- member procedure to_be_not_null(self in ut_expectation),
- member procedure not_to_be_null(self in ut_expectation),
- member procedure not_to_be_not_null(self in ut_expectation),
-
- member procedure to_be_true(self in ut_expectation),
- member procedure to_be_false(self in ut_expectation),
- member procedure not_to_be_true(self in ut_expectation),
- member procedure not_to_be_false(self in ut_expectation),
-
- member procedure to_be_empty(self in ut_expectation),
- member procedure not_to_be_empty(self in ut_expectation),
-
- -- this is done to provide strong type comparison. other comporators should be implemented in the type-specific classes
- member procedure to_equal(self in ut_expectation, a_expected anydata, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected anydata, a_exclude varchar2, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected anydata, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected blob, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected boolean, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected clob, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected date, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected number, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected sys_refcursor, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude varchar2, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected timestamp_unconstrained, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected varchar2, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected yminterval_unconstrained, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected json_element_t, a_nulls_are_equal boolean := null),
- member procedure to_equal(self in ut_expectation, a_expected json, a_nulls_are_equal boolean := null),
-
- member procedure not_to_equal(self in ut_expectation, a_expected anydata, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected anydata, a_exclude varchar2, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected anydata, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected blob, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected boolean, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected clob, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected date, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected number, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude varchar2, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected timestamp_unconstrained, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected varchar2, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected yminterval_unconstrained, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected dsinterval_unconstrained, a_nulls_are_equal boolean := null),
- member procedure not_to_equal(self in ut_expectation, a_expected json_element_t, a_nulls_are_equal boolean := null),
-
- member procedure to_be_like(self in ut_expectation, a_mask in varchar2, a_escape_char in varchar2 := null),
-
- member procedure to_match(self in ut_expectation, a_pattern in varchar2, a_modifiers in varchar2 := null),
-
- member procedure not_to_be_like(self in ut_expectation, a_mask in varchar2, a_escape_char in varchar2 := null),
-
- member procedure not_to_match(self in ut_expectation, a_pattern in varchar2, a_modifiers in varchar2 := null),
-
- member procedure to_be_between(self in ut_expectation, a_lower_bound date, a_upper_bound date),
- member procedure to_be_between(self in ut_expectation, a_lower_bound dsinterval_unconstrained, a_upper_bound dsinterval_unconstrained),
- member procedure to_be_between(self in ut_expectation, a_lower_bound number, a_upper_bound number),
- member procedure to_be_between(self in ut_expectation, a_lower_bound timestamp_unconstrained, a_upper_bound timestamp_unconstrained),
- member procedure to_be_between(self in ut_expectation, a_lower_bound timestamp_ltz_unconstrained, a_upper_bound timestamp_ltz_unconstrained),
- member procedure to_be_between(self in ut_expectation, a_lower_bound timestamp_tz_unconstrained, a_upper_bound timestamp_tz_unconstrained),
- member procedure to_be_between(self in ut_expectation, a_lower_bound varchar2, a_upper_bound varchar2),
- member procedure to_be_between(self in ut_expectation, a_lower_bound yminterval_unconstrained, a_upper_bound yminterval_unconstrained),
-
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected date),
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected dsinterval_unconstrained),
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected number),
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected timestamp_unconstrained),
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained),
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained),
- member procedure to_be_greater_or_equal(self in ut_expectation, a_expected yminterval_unconstrained),
-
- member procedure to_be_greater_than(self in ut_expectation, a_expected date),
- member procedure to_be_greater_than(self in ut_expectation, a_expected dsinterval_unconstrained),
- member procedure to_be_greater_than(self in ut_expectation, a_expected number),
- member procedure to_be_greater_than(self in ut_expectation, a_expected timestamp_unconstrained),
- member procedure to_be_greater_than(self in ut_expectation, a_expected timestamp_ltz_unconstrained),
- member procedure to_be_greater_than(self in ut_expectation, a_expected timestamp_tz_unconstrained),
- member procedure to_be_greater_than(self in ut_expectation, a_expected yminterval_unconstrained),
-
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected date),
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected dsinterval_unconstrained),
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected number),
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected timestamp_unconstrained),
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained),
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained),
- member procedure to_be_less_or_equal(self in ut_expectation, a_expected yminterval_unconstrained),
-
- member procedure to_be_less_than(self in ut_expectation, a_expected date),
- member procedure to_be_less_than(self in ut_expectation, a_expected dsinterval_unconstrained),
- member procedure to_be_less_than(self in ut_expectation, a_expected number),
- member procedure to_be_less_than(self in ut_expectation, a_expected timestamp_unconstrained),
- member procedure to_be_less_than(self in ut_expectation, a_expected timestamp_ltz_unconstrained),
- member procedure to_be_less_than(self in ut_expectation, a_expected timestamp_tz_unconstrained),
- member procedure to_be_less_than(self in ut_expectation, a_expected yminterval_unconstrained),
-
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound date, a_upper_bound date),
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound dsinterval_unconstrained, a_upper_bound dsinterval_unconstrained),
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound number, a_upper_bound number),
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound timestamp_unconstrained, a_upper_bound timestamp_unconstrained),
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound timestamp_ltz_unconstrained, a_upper_bound timestamp_ltz_unconstrained),
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound timestamp_tz_unconstrained, a_upper_bound timestamp_tz_unconstrained),
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound varchar2, a_upper_bound varchar2),
- member procedure not_to_be_between(self in ut_expectation, a_lower_bound yminterval_unconstrained, a_upper_bound yminterval_unconstrained),
-
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected date),
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected dsinterval_unconstrained),
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected number),
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected timestamp_unconstrained),
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained),
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained),
- member procedure not_to_be_greater_or_equal(self in ut_expectation, a_expected yminterval_unconstrained),
-
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected date),
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected dsinterval_unconstrained),
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected number),
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected timestamp_unconstrained),
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected timestamp_ltz_unconstrained),
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected timestamp_tz_unconstrained),
- member procedure not_to_be_greater_than(self in ut_expectation, a_expected yminterval_unconstrained),
-
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected date),
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected dsinterval_unconstrained),
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected number),
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected timestamp_unconstrained),
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected timestamp_ltz_unconstrained),
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected timestamp_tz_unconstrained),
- member procedure not_to_be_less_or_equal(self in ut_expectation, a_expected yminterval_unconstrained),
-
- member procedure not_to_be_less_than(self in ut_expectation, a_expected date),
- member procedure not_to_be_less_than(self in ut_expectation, a_expected dsinterval_unconstrained),
- member procedure not_to_be_less_than(self in ut_expectation, a_expected number),
- member procedure not_to_be_less_than(self in ut_expectation, a_expected timestamp_unconstrained),
- member procedure not_to_be_less_than(self in ut_expectation, a_expected timestamp_ltz_unconstrained),
- member procedure not_to_be_less_than(self in ut_expectation, a_expected timestamp_tz_unconstrained),
- member procedure not_to_be_less_than(self in ut_expectation, a_expected yminterval_unconstrained),
-
- member procedure to_contain(self in ut_expectation, a_expected sys_refcursor),
- member procedure not_to_contain(self in ut_expectation, a_expected sys_refcursor),
- member procedure to_contain(self in ut_expectation, a_expected anydata),
- member procedure not_to_contain(self in ut_expectation, a_expected anydata),
-
- member function to_be_within(a_dist number) return ut_be_within,
- member function to_be_within(a_dist dsinterval_unconstrained) return ut_be_within,
- member function to_be_within(a_dist yminterval_unconstrained) return ut_be_within,
- member function to_be_within_pct(a_dist number) return ut_be_within_pct,
- member function not_to_be_within(a_dist number) return ut_be_within,
- member function not_to_be_within(a_dist dsinterval_unconstrained) return ut_be_within,
- member function not_to_be_within(a_dist yminterval_unconstrained) return ut_be_within,
- member function not_to_be_within_pct(a_dist number) return ut_be_within_pct
-)
-not final
-/
diff --git a/source/expectations/ut_expectation_base.tpb b/source/expectations/ut_expectation_base.tpb
deleted file mode 100644
index 20b3e7a95..000000000
--- a/source/expectations/ut_expectation_base.tpb
+++ /dev/null
@@ -1,44 +0,0 @@
-create or replace type body ut_expectation_base as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2019 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- member procedure to_(self in ut_expectation_base, a_matcher ut_matcher_base) is
- l_expectation_result boolean;
- l_matcher ut_matcher := treat(a_matcher as ut_matcher);
- l_message varchar2(32767);
- begin
- if l_matcher.is_negated() then
- self.not_to( a_matcher );
- else
- l_expectation_result := l_matcher.run_matcher( self.actual_data );
- l_expectation_result := coalesce(l_expectation_result,false);
- l_message := coalesce( l_matcher.error_message( self.actual_data ), l_matcher.failure_message( self.actual_data ) );
- ut_expectation_processor.add_expectation_result( ut_expectation_result( ut_utils.to_test_result( l_expectation_result ), self.description, l_message ) );
- end if;
- end;
-
- member procedure not_to(self in ut_expectation_base, a_matcher ut_matcher_base) is
- l_expectation_result boolean;
- l_matcher ut_matcher := treat(a_matcher as ut_matcher);
- l_message varchar2(32767);
- begin
- l_expectation_result := coalesce( l_matcher.run_matcher_negated( self.actual_data ), false );
-
- l_message := coalesce( l_matcher.error_message( self.actual_data ), l_matcher.failure_message_when_negated( self.actual_data ) );
- ut_expectation_processor.add_expectation_result( ut_expectation_result( ut_utils.to_test_result( l_expectation_result ), self.description, l_message ) );
- end;
-end;
-/
diff --git a/source/expectations/ut_expectation_base.tps b/source/expectations/ut_expectation_base.tps
deleted file mode 100644
index a542d26ea..000000000
--- a/source/expectations/ut_expectation_base.tps
+++ /dev/null
@@ -1,25 +0,0 @@
-create or replace type ut_expectation_base authid current_user as object(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2019 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- actual_data ut_data_value,
- description varchar2(4000 char),
-
- --base matcher executors
- member procedure to_(self in ut_expectation_base, a_matcher ut_matcher_base),
- member procedure not_to(self in ut_expectation_base, a_matcher ut_matcher_base)
-) not final not instantiable
-/
diff --git a/source/expectations/ut_expectation_compound.tpb b/source/expectations/ut_expectation_compound.tpb
deleted file mode 100644
index 6fc2e2647..000000000
--- a/source/expectations/ut_expectation_compound.tpb
+++ /dev/null
@@ -1,102 +0,0 @@
-create or replace type body ut_expectation_compound as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_expectation_compound(self in out nocopy ut_expectation_compound, a_actual_data ut_data_value, a_description varchar2) return self as result is
- begin
- self.actual_data := a_actual_data;
- self.description := a_description;
- return;
- end;
-
- member procedure to_have_count(self in ut_expectation_compound, a_expected integer) is
- begin
- self.to_( ut_have_count(a_expected) );
- end;
-
- member procedure not_to_have_count(self in ut_expectation_compound, a_expected integer) is
- begin
- self.not_to( ut_have_count(a_expected) );
- end;
-
-
- member function to_equal(a_expected anydata, a_nulls_are_equal boolean := null) return ut_equal is
- l_result ut_equal;
- begin
- l_result := ut_equal(a_expected, a_nulls_are_equal);
- l_result.expectation := self;
- return l_result;
- end;
-
- member function not_to_equal(a_expected anydata, a_nulls_are_equal boolean := null) return ut_equal is
- l_result ut_matcher;
- begin
- l_result := ut_equal(a_expected, a_nulls_are_equal).negated();
- l_result.expectation := self;
- return treat(l_result as ut_equal);
- end;
-
- member function to_equal(a_expected sys_refcursor, a_nulls_are_equal boolean := null) return ut_equal is
- l_result ut_equal;
- begin
- l_result := ut_equal(a_expected, a_nulls_are_equal);
- l_result.expectation := self;
- return l_result;
- end;
-
- member function not_to_equal(a_expected sys_refcursor, a_nulls_are_equal boolean := null) return ut_equal is
- l_result ut_matcher;
- begin
- l_result := ut_equal(a_expected, a_nulls_are_equal).negated();
- l_result.expectation := self;
- return treat(l_result as ut_equal);
- end;
-
- member function to_contain(a_expected sys_refcursor) return ut_contain is
- l_result ut_contain;
- begin
- l_result := ut_contain(a_expected);
- l_result.expectation := self;
- return l_result;
- end;
-
- member function not_to_contain(a_expected sys_refcursor) return ut_contain is
- l_result ut_matcher;
- begin
- l_result := ut_contain(a_expected).negated();
- l_result.expectation := self;
- return treat(l_result as ut_contain);
- end;
-
- member function to_contain(a_expected anydata) return ut_contain is
- l_result ut_contain;
- begin
- l_result := ut_contain(a_expected);
- l_result.expectation := self;
- return l_result;
- end;
-
- member function not_to_contain(a_expected anydata) return ut_contain is
- l_result ut_matcher;
- begin
- l_result := ut_contain(a_expected).negated();
- l_result.expectation := self;
- return treat(l_result as ut_contain);
- end;
-
-end;
-/
diff --git a/source/expectations/ut_expectation_compound.tps b/source/expectations/ut_expectation_compound.tps
deleted file mode 100644
index 46da23fea..000000000
--- a/source/expectations/ut_expectation_compound.tps
+++ /dev/null
@@ -1,36 +0,0 @@
-create or replace type ut_expectation_compound under ut_expectation(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- matcher ut_matcher,
-
- constructor function ut_expectation_compound(self in out nocopy ut_expectation_compound, a_actual_data ut_data_value, a_description varchar2) return self as result,
-
- member procedure to_have_count(self in ut_expectation_compound, a_expected integer),
- member procedure not_to_have_count(self in ut_expectation_compound, a_expected integer),
-
- member function to_equal(a_expected anydata, a_nulls_are_equal boolean := null) return ut_equal,
- member function not_to_equal(a_expected anydata, a_nulls_are_equal boolean := null) return ut_equal,
- member function to_equal(a_expected sys_refcursor, a_nulls_are_equal boolean := null) return ut_equal,
- member function not_to_equal(a_expected sys_refcursor, a_nulls_are_equal boolean := null) return ut_equal,
- member function to_contain(a_expected sys_refcursor) return ut_contain,
- member function not_to_contain(a_expected sys_refcursor) return ut_contain,
- member function to_contain(a_expected anydata) return ut_contain,
- member function not_to_contain(a_expected anydata) return ut_contain
-)
-/
-
-
diff --git a/source/expectations/ut_expectation_json.tpb b/source/expectations/ut_expectation_json.tpb
deleted file mode 100644
index b71e8ea83..000000000
--- a/source/expectations/ut_expectation_json.tpb
+++ /dev/null
@@ -1,51 +0,0 @@
-create or replace type body ut_expectation_json as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_expectation_json(self in out nocopy ut_expectation_json, a_actual_data ut_data_value, a_description varchar2) return self as result is
- begin
- self.actual_data := a_actual_data;
- self.description := a_description;
- return;
- end;
-
- member function to_equal(a_expected json_element_t, a_nulls_are_equal boolean := null) return ut_expectation_json is
- l_result ut_expectation_json := self;
- begin
- l_result.matcher := ut_equal(a_expected, a_nulls_are_equal);
- return l_result;
- end;
-
- member function not_to_equal(a_expected json_element_t, a_nulls_are_equal boolean := null) return ut_expectation_json is
- l_result ut_expectation_json := self;
- begin
- l_result.matcher := ut_equal(a_expected, a_nulls_are_equal).negated();
- return l_result;
- end;
-
- member procedure to_have_count(self in ut_expectation_json, a_expected integer) is
- begin
- self.to_( ut_have_count(a_expected) );
- end;
-
- member procedure not_to_have_count(self in ut_expectation_json, a_expected integer) is
- begin
- self.not_to( ut_have_count(a_expected) );
- end;
-
-end;
-/
diff --git a/source/expectations/ut_expectation_json.tps b/source/expectations/ut_expectation_json.tps
deleted file mode 100644
index 561c5d11f..000000000
--- a/source/expectations/ut_expectation_json.tps
+++ /dev/null
@@ -1,27 +0,0 @@
-create or replace type ut_expectation_json under ut_expectation(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- matcher ut_matcher,
-
- constructor function ut_expectation_json(self in out nocopy ut_expectation_json, a_actual_data ut_data_value, a_description varchar2) return self as result,
-
- member function to_equal(a_expected json_element_t , a_nulls_are_equal boolean := null) return ut_expectation_json,
- member function not_to_equal(a_expected json_element_t , a_nulls_are_equal boolean := null) return ut_expectation_json,
- member procedure to_have_count(self in ut_expectation_json, a_expected integer),
- member procedure not_to_have_count(self in ut_expectation_json, a_expected integer)
-)
-/
\ No newline at end of file
diff --git a/source/install.sql b/source/install.sql
deleted file mode 100644
index 22ce75365..000000000
--- a/source/install.sql
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-@@define_ut3_owner_param.sql
-
-spool install.log
-
-prompt &&line_separator
-prompt Installing utPLSQL v3 framework into &&ut3_owner schema
-prompt &&line_separator
-
-whenever sqlerror exit failure rollback
-whenever oserror exit failure rollback
-
-prompt Switching current schema to &&ut3_owner
-prompt &&line_separator
-alter session set current_schema = &&ut3_owner;
-
-@@check_object_grants.sql
-@@check_sys_grants.sql "'CREATE TYPE','CREATE VIEW','CREATE SYNONYM','CREATE SEQUENCE','CREATE PROCEDURE','CREATE TABLE', 'CREATE CONTEXT'"
---set define off
-
-create or replace context &&ut3_owner._info using &&ut3_owner..ut_session_context;
-
---dbms_output buffer cache table
-@@install_component.sql 'core/ut_dbms_output_cache.sql'
-
---common utilities
-@@install_component.sql 'core/types/ut_varchar2_list.tps'
-@@install_component.sql 'core/types/ut_varchar2_rows.tps'
-@@install_component.sql 'core/types/ut_integer_list.tps'
-@@install_component.sql 'core/types/ut_object_name.tps'
-@@install_component.sql 'core/types/ut_object_name.tpb'
-@@install_component.sql 'core/types/ut_object_names.tps'
-@@install_component.sql 'core/types/ut_key_value_pair.tps'
-@@install_component.sql 'core/types/ut_key_value_pairs.tps'
-@@install_component.sql 'core/types/ut_reporter_info.tps'
-@@install_component.sql 'core/types/ut_reporters_info.tps'
-@@install_component.sql 'core/types/ut_stack.tps'
-@@install_component.sql 'core/types/ut_stack.tpb'
-@@install_component.sql 'core/ut_utils.pks'
-@@install_component.sql 'core/ut_metadata.pks'
-@@install_component.sql 'core/ut_savepoint_seq.sql'
-@@install_component.sql 'core/ut_utils.pkb'
-@@install_component.sql 'core/ut_metadata.pkb'
-@@install_component.sql 'reporters/ut_ansiconsole_helper.pks'
-@@install_component.sql 'reporters/ut_ansiconsole_helper.pkb'
-
-@@install_component.sql 'api/ut_suite_item_info.tps'
-@@install_component.sql 'api/ut_suite_item_info.tpb'
-@@install_component.sql 'api/ut_suite_items_info.tps'
-
---event manager objects
-@@install_component.sql 'core/events/ut_event_item.tps'
-@@install_component.sql 'core/events/ut_event_listener.tps'
-@@install_component.sql 'core/events/ut_event_manager.pks'
-@@install_component.sql 'core/events/ut_event_manager.pkb'
-
---core types
-@@install_component.sql 'core/types/ut_run_info.tps'
-@@install_component.sql 'core/types/ut_run_info.tpb'
-@@install_component.sql 'core/types/ut_expectation_result.tps'
-@@install_component.sql 'core/types/ut_expectation_results.tps'
-@@install_component.sql 'core/types/ut_results_counter.tps'
-@@install_component.sql 'core/types/ut_suite_item.tps'
-@@install_component.sql 'core/types/ut_suite_items.tps'
-@@install_component.sql 'core/types/ut_executable.tps'
-@@install_component.sql 'core/types/ut_executables.tps'
-@@install_component.sql 'core/types/ut_executable_test.tps'
-@@install_component.sql 'core/types/ut_test.tps'
-@@install_component.sql 'core/types/ut_logical_suite.tps'
-@@install_component.sql 'core/types/ut_suite.tps'
-@@install_component.sql 'core/types/ut_suite_context.tps'
-@@install_component.sql 'core/types/ut_file_mapping.tps'
-@@install_component.sql 'core/types/ut_file_mappings.tps'
-@@install_component.sql 'core/types/ut_coverage_options.tps'
-@@install_component.sql 'core/types/ut_run.tps'
-@@install_component.sql 'core/types/ut_reporter_base.tps'
-@@install_component.sql 'core/types/ut_reporters.tps'
-@@install_component.sql 'core/types/ut_path_item.tps'
-@@install_component.sql 'core/types/ut_path_items.tps'
-
-@@install_component.sql 'expectations/json_objects_specs.sql'
-@@install_component.sql 'expectations/matchers/ut_matcher_options_items.tps'
-@@install_component.sql 'expectations/matchers/ut_matcher_options.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value.tps'
-@@install_component.sql 'expectations/data_values/ut_key_anyval_pair.tps'
-@@install_component.sql 'expectations/data_values/ut_key_anyval_pairs.tps'
-@@install_component.sql 'expectations/data_values/ut_key_anyvalues.tps'
-
---session_context
-@@install_component.sql 'core/session_context/ut_session_context.pks'
-@@install_component.sql 'core/session_context/ut_session_context.pkb'
-@@install_component.sql 'core/session_context/ut_session_info.tps'
-@@install_component.sql 'core/session_context/ut_session_info.tpb'
-
---output buffer table
-@@install_component.sql 'core/output_buffers/ut_output_buffer_info_tmp.sql'
-@@install_component.sql 'core/output_buffers/ut_output_buffer_tmp.sql'
-@@install_component.sql 'core/output_buffers/ut_output_clob_buffer_tmp.sql'
---output buffer base api
-@@install_component.sql 'core/output_buffers/ut_output_data_row.tps'
-@@install_component.sql 'core/output_buffers/ut_output_data_rows.tps'
-@@install_component.sql 'core/output_buffers/ut_output_buffer_base.tps'
-@@install_component.sql 'core/output_buffers/ut_output_buffer_base.tpb'
---output buffer table api
-@@install_component.sql 'core/output_buffers/ut_output_table_buffer.tps'
-@@install_component.sql 'core/output_buffers/ut_output_table_buffer.tpb'
-@@install_component.sql 'core/output_buffers/ut_output_clob_table_buffer.tps'
-@@install_component.sql 'core/output_buffers/ut_output_clob_table_buffer.tpb'
-@@install_component.sql 'core/output_buffers/ut_output_bulk_buffer.tps'
-@@install_component.sql 'core/output_buffers/ut_output_bulk_buffer.tpb'
-
-@@install_component.sql 'core/types/ut_output_reporter_base.tps'
-
---annotations
-@@install_component.sql 'core/annotations/ut_trigger_check.pks'
-@@install_component.sql 'core/annotations/ut_trigger_check.pkb'
-@@install_component.sql 'core/annotations/ut_annotation.tps'
-@@install_component.sql 'core/annotations/ut_annotations.tps'
-@@install_component.sql 'core/annotations/ut_annotated_object.tps'
-@@install_component.sql 'core/annotations/ut_annotated_objects.tps'
-@@install_component.sql 'core/annotations/ut_annotation_obj_cache_info.tps'
-@@install_component.sql 'core/annotations/ut_annotation_objs_cache_info.tps'
-@@install_component.sql 'core/annotations/ut_annotation_cache_seq.sql'
-@@install_component.sql 'core/annotations/ut_annotation_cache_schema.sql'
-@@install_component.sql 'core/annotations/ut_annotation_cache_info.sql'
-@@install_component.sql 'core/annotations/ut_annotation_cache.sql'
-@@install_component.sql 'core/annotations/ut_annotation_cache_manager.pks'
-@@install_component.sql 'core/annotations/ut_annotation_cache_manager.pkb'
-@@install_component.sql 'core/annotations/ut_annotation_parser.pks'
-@@install_component.sql 'core/annotations/ut_annotation_parser.pkb'
-@@install_component.sql 'core/annotations/ut_annotation_manager.pks'
-@@install_component.sql 'core/annotations/ut_annotation_manager.pkb'
-
---suite builder
-@@install_component.sql 'core/types/ut_suite_cache_row.tps'
-@@install_component.sql 'core/types/ut_suite_cache_rows.tps'
-@@install_component.sql 'core/ut_suite_cache_schema.sql'
-@@install_component.sql 'core/ut_suite_cache_package.sql'
-@@install_component.sql 'core/ut_suite_cache_seq.sql'
-@@install_component.sql 'core/ut_suite_cache.sql'
-
-@@install_component.sql 'core/ut_suite_tag_filter.pks'
-@@install_component.sql 'core/ut_suite_tag_filter.pkb'
-@@install_component.sql 'core/ut_suite_cache_manager.pks'
-@@install_component.sql 'core/ut_suite_cache_manager.pkb'
-@@install_component.sql 'core/ut_suite_builder.pks'
-@@install_component.sql 'core/ut_suite_builder.pkb'
---suite manager
-@@install_component.sql 'core/ut_suite_manager.pks'
-@@install_component.sql 'core/ut_suite_manager.pkb'
-
---expectations execution state interface
-@@install_component.sql 'core/ut_expectation_processor.pks'
-@@install_component.sql 'core/ut_expectation_processor.pkb'
-
-prompt Installing PLSQL profiler objects into &&ut3_owner schema
-@@core/coverage/proftab.sql
-
-prompt Installing DBMSPLSQL Tables objects into &&ut3_owner schema
-@@core/coverage/dbms_plssqlcode.sql
-
-@@install_component.sql 'core/ut_file_mapper.pks'
-@@install_component.sql 'core/ut_file_mapper.pkb'
-
-
---gathering coverage
-@@install_component.sql 'core/coverage/ut_coverage_sources_tmp.sql'
-@@install_component.sql 'core/coverage/ut_coverage_runs.sql'
-@@install_component.sql 'core/coverage/ut_coverage_helper.pks'
-@@install_component.sql 'core/coverage/ut_coverage_helper_block.pks'
-@@install_component.sql 'core/coverage/ut_coverage_helper_profiler.pks'
-@@install_component.sql 'core/coverage/ut_coverage.pks'
-@@install_component.sql 'core/coverage/ut_coverage_block.pks'
-@@install_component.sql 'core/coverage/ut_coverage_profiler.pks'
-@@install_component.sql 'core/coverage/ut_coverage_reporter_base.tps'
-@@install_component.sql 'core/coverage/ut_coverage_helper.pkb'
-@@install_component.sql 'core/coverage/ut_coverage_helper_block.pkb'
-@@install_component.sql 'core/coverage/ut_coverage_helper_profiler.pkb'
-@@install_component.sql 'core/coverage/ut_coverage.pkb'
-@@install_component.sql 'core/coverage/ut_coverage_block.pkb'
-@@install_component.sql 'core/coverage/ut_coverage_profiler.pkb'
-@@install_component.sql 'core/coverage/ut_coverage_reporter_base.tpb'
-
---core type bodies
-@@install_component.sql 'core/types/ut_results_counter.tpb'
-@@install_component.sql 'core/types/ut_suite_item.tpb'
-@@install_component.sql 'core/types/ut_test.tpb'
-@@install_component.sql 'core/types/ut_logical_suite.tpb'
-@@install_component.sql 'core/types/ut_suite.tpb'
-@@install_component.sql 'core/types/ut_suite_context.tpb'
-@@install_component.sql 'core/types/ut_coverage_options.tpb'
-@@install_component.sql 'core/types/ut_run.tpb'
-@@install_component.sql 'core/types/ut_expectation_result.tpb'
-@@install_component.sql 'core/types/ut_reporter_base.tpb'
-@@install_component.sql 'core/types/ut_output_reporter_base.tpb'
-@@install_component.sql 'core/types/ut_file_mapping.tpb'
-@@install_component.sql 'core/types/ut_executable.tpb'
-@@install_component.sql 'core/types/ut_executable_test.tpb'
-@@install_component.sql 'core/types/ut_console_reporter_base.tps'
-@@install_component.sql 'core/types/ut_console_reporter_base.tpb'
-@@install_component.sql 'core/types/ut_path_item.tpb'
-
---expectations and matchers
-@@install_component.sql 'expectations/data_values/ut_compound_data_tmp.sql'
-@@install_component.sql 'expectations/data_values/ut_compound_data_diff_tmp.sql'
-@@install_component.sql 'expectations/data_values/ut_json_data_diff_tmp.sql'
-@@install_component.sql 'expectations/data_values/ut_compound_data_value.tps'
-@@install_component.sql 'expectations/data_values/ut_json_leaf.tps'
-@@install_component.sql 'expectations/data_values/ut_json_leaf_tab.tps'
-@@install_component.sql 'expectations/data_values/ut_json_tree_details.tps'
-@@install_component.sql 'expectations/data_values/ut_cursor_column.tps'
-@@install_component.sql 'expectations/data_values/ut_cursor_column_tab.tps'
-@@install_component.sql 'expectations/data_values/ut_cursor_details.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_blob.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_boolean.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_clob.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_date.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_dsinterval.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_number.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_refcursor.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_anydata.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_timestamp.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_timestamp_tz.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_timestamp_ltz.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_varchar2.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_yminterval.tps'
-@@install_component.sql 'expectations/data_values/ut_data_value_xmltype.tps'
-@@install_component.sql 'expectations/data_values/ut_compound_data_helper.pks'
-@@install_component.sql 'expectations/data_values/ut_data_value_json.tps'
-@@install_component.sql 'expectations/matchers/ut_matcher_base.tps'
-@@install_component.sql 'expectations/ut_expectation_base.tps'
-@@install_component.sql 'expectations/matchers/ut_matcher.tps'
-@@install_component.sql 'expectations/matchers/ut_comparison_matcher.tps'
-@@install_component.sql 'expectations/matchers/ut_be_within_pct.tps'
-@@install_component.sql 'expectations/matchers/ut_be_within.tps'
-@@install_component.sql 'expectations/matchers/ut_be_within_helper.pks'
-@@install_component.sql 'expectations/ut_expectation.tps'
-@@install_component.sql 'expectations/matchers/ut_be_false.tps'
-@@install_component.sql 'expectations/matchers/ut_be_greater_or_equal.tps'
-@@install_component.sql 'expectations/matchers/ut_be_greater_than.tps'
-@@install_component.sql 'expectations/matchers/ut_be_less_or_equal.tps'
-@@install_component.sql 'expectations/matchers/ut_be_less_than.tps'
-@@install_component.sql 'expectations/matchers/ut_be_like.tps'
-@@install_component.sql 'expectations/matchers/ut_be_not_null.tps'
-@@install_component.sql 'expectations/matchers/ut_be_null.tps'
-@@install_component.sql 'expectations/matchers/ut_be_true.tps'
-@@install_component.sql 'expectations/matchers/ut_equal.tps'
-@@install_component.sql 'expectations/matchers/ut_contain.tps'
-@@install_component.sql 'expectations/matchers/ut_have_count.tps'
-@@install_component.sql 'expectations/matchers/ut_be_between.tps'
-@@install_component.sql 'expectations/matchers/ut_be_empty.tps'
-@@install_component.sql 'expectations/matchers/ut_match.tps'
-@@install_component.sql 'expectations/data_values/ut_json_leaf.tpb'
-@@install_component.sql 'expectations/data_values/ut_json_tree_details.tpb'
-@@install_component.sql 'expectations/data_values/ut_cursor_column.tpb'
-@@install_component.sql 'expectations/data_values/ut_cursor_details.tpb'
-@@install_component.sql 'expectations/ut_expectation_compound.tps'
-@@install_component.sql 'expectations/ut_expectation_json.tps'
-
-@@install_component.sql 'expectations/matchers/ut_matcher_options_items.tpb'
-@@install_component.sql 'expectations/matchers/ut_matcher_options.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value.tpb'
-@@install_component.sql 'expectations/data_values/ut_compound_data_value.tpb'
-@@install_component.sql 'expectations/data_values/ut_compound_data_helper.pkb'
-@@install_component.sql 'expectations/data_values/ut_data_value_blob.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_boolean.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_clob.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_date.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_dsinterval.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_number.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_refcursor.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_anydata.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_timestamp.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_timestamp_tz.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_timestamp_ltz.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_varchar2.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_yminterval.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_xmltype.tpb'
-@@install_component.sql 'expectations/data_values/ut_data_value_json.tpb'
-@@install_component.sql 'expectations/matchers/ut_matcher.tpb'
-@@install_component.sql 'expectations/matchers/ut_comparison_matcher.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_false.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_greater_or_equal.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_greater_than.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_less_or_equal.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_less_than.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_like.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_not_null.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_null.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_true.tpb'
-@@install_component.sql 'expectations/matchers/ut_equal.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_within_pct.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_within.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_within_helper.pkb'
-@@install_component.sql 'expectations/matchers/ut_contain.tpb'
-@@install_component.sql 'expectations/matchers/ut_have_count.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_between.tpb'
-@@install_component.sql 'expectations/matchers/ut_be_empty.tpb'
-@@install_component.sql 'expectations/matchers/ut_match.tpb'
-@@install_component.sql 'expectations/ut_expectation_base.tpb'
-@@install_component.sql 'expectations/ut_expectation.tpb'
-@@install_component.sql 'expectations/ut_expectation_compound.tpb'
-@@install_component.sql 'expectations/ut_expectation_json.tpb'
-@@install_component.sql 'expectations/data_values/ut_key_anyvalues.tpb'
-
---core reporter
-@@install_component.sql 'reporters/ut_documentation_reporter.tps'
-@@install_component.sql 'reporters/ut_documentation_reporter.tpb'
-
---plugin interface API for running utPLSQL
-@@install_component.sql 'api/ut_runner.pks'
-@@install_component.sql 'api/ut_runner.pkb'
-
---developer interface for expectations and running utPLSQL
-@@install_component.sql 'api/ut.pks'
-@@install_component.sql 'api/ut.pkb'
-
---additional reporters
-@@install_component.sql 'reporters/ut_debug_reporter.tps'
-@@install_component.sql 'reporters/ut_debug_reporter.tpb'
-@@install_component.sql 'reporters/ut_teamcity_reporter.tps'
-@@install_component.sql 'reporters/ut_teamcity_reporter_helper.pks'
-@@install_component.sql 'reporters/ut_teamcity_reporter_helper.pkb'
-@@install_component.sql 'reporters/ut_teamcity_reporter.tpb'
-@@install_component.sql 'reporters/ut_junit_reporter.tps'
-@@install_component.sql 'reporters/ut_junit_reporter.tpb'
-@@install_component.sql 'reporters/ut_tfs_junit_reporter.tps'
-@@install_component.sql 'reporters/ut_tfs_junit_reporter.tpb'
-@@install_component.sql 'reporters/ut_xunit_reporter.tps'
-@@install_component.sql 'reporters/ut_xunit_reporter.tpb'
-@@install_component.sql 'reporters/ut_sonar_test_reporter.tps'
-@@install_component.sql 'reporters/ut_sonar_test_reporter.tpb'
-@@install_component.sql 'reporters/ut_tap_reporter.tps'
-@@install_component.sql 'reporters/ut_tap_reporter.tpb'
-
-@@install_component.sql 'reporters/ut_coverage_html_reporter.tps'
-@@install_component.sql 'reporters/ut_coverage_report_html_helper.pks'
-@@install_component.sql 'reporters/ut_coverage_report_html_helper.pkb'
-@@install_component.sql 'reporters/ut_coverage_html_reporter.tpb'
-@@install_component.sql 'reporters/ut_coverage_sonar_reporter.tps'
-@@install_component.sql 'reporters/ut_coverage_sonar_reporter.tpb'
-@@install_component.sql 'reporters/ut_coveralls_reporter.tps'
-@@install_component.sql 'reporters/ut_coveralls_reporter.tpb'
-@@install_component.sql 'reporters/ut_coverage_cobertura_reporter.tps'
-@@install_component.sql 'reporters/ut_coverage_cobertura_reporter.tpb'
-@@install_component.sql 'reporters/ut_realtime_reporter.tps'
-@@install_component.sql 'reporters/ut_realtime_reporter.tpb'
-
-@@install_component.sql 'api/be_between.syn'
-@@install_component.sql 'api/be_empty.syn'
-@@install_component.sql 'api/be_false.syn'
-@@install_component.sql 'api/be_greater_or_equal.syn'
-@@install_component.sql 'api/be_greater_than.syn'
-@@install_component.sql 'api/be_less_or_equal.syn'
-@@install_component.sql 'api/be_less_than.syn'
-@@install_component.sql 'api/be_like.syn'
-@@install_component.sql 'api/be_not_null.syn'
-@@install_component.sql 'api/be_null.syn'
-@@install_component.sql 'api/be_true.syn'
-@@install_component.sql 'api/be_within_pct.syn'
-@@install_component.sql 'api/be_within.syn'
-@@install_component.sql 'api/equal.syn'
-@@install_component.sql 'api/have_count.syn'
-@@install_component.sql 'api/match.syn'
-@@install_component.sql 'api/contain.syn'
-
-set linesize 200
-set define on
-column text format a100
-column error_count noprint new_value error_count
-
-prompt Validating installation
-prompt &&line_separator
-set heading on
-select type, name, sequence, line, position, text, count(1) over() error_count
- from all_errors
- where owner = upper('&&ut3_owner')
- and name not like 'BIN$%' --not recycled
- and (name = 'UT' or name like 'UT\_%' escape '\')
- -- errors only. ignore warnings
- and attribute = 'ERROR'
- order by name, type, sequence
-/
-
-begin
- if to_number('&&error_count') > 0 then
- raise_application_error(-20000, 'Not all sources were successfully installed.');
- else
- dbms_output.put_line('Installation completed successfully');
- dbms_output.put_line('&&line_separator');
- end if;
-end;
-/
-
-spool off
diff --git a/source/install_above_12_1.sql b/source/install_above_12_1.sql
deleted file mode 100644
index 69e47ce9a..000000000
--- a/source/install_above_12_1.sql
+++ /dev/null
@@ -1,27 +0,0 @@
-def FILE_NAME = '&&1'
-column SCRIPT_NAME new_value SCRIPT_NAME noprint
-
-VAR V_FILE_NAME VARCHAR2(1000);
-begin
- if dbms_db_version.version = 12 and dbms_db_version.release >= 2
- or dbms_db_version.version > 12
- then
- :V_FILE_NAME := '&&FILE_NAME';
- else
- :V_FILE_NAME := 'dummy.sql';
- end if;
-end;
-/
-
-set verify off
-select :V_FILE_NAME as SCRIPT_NAME from dual;
-set termout on
-
-set heading off
-set feedback off
-exec dbms_output.put_line('Installing component '||upper(regexp_substr('&&1','\/(\w*)\.',1,1,'i',1)));
-@@&&SCRIPT_NAME
-exec dbms_output.put_line('&&line_separator');
-
-
-
diff --git a/source/install_component.sql b/source/install_component.sql
deleted file mode 100644
index 373c85c54..000000000
--- a/source/install_component.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-set heading off
-set feedback off
-exec dbms_output.put_line('Installing component '||upper(regexp_substr('&&1','\/(\w*)\.',1,1,'i',1)));
-@@&&1
-show errors
-exec dbms_output.put_line('&&line_separator');
-
diff --git a/source/install_ddl_trigger.sql b/source/install_ddl_trigger.sql
deleted file mode 100644
index bc147c2be..000000000
--- a/source/install_ddl_trigger.sql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-@@define_ut3_owner_param.sql
-
-@@check_sys_grants.sql "'ADMINISTER DATABASE TRIGGER','CREATE TRIGGER'"
-
-grant administer database trigger to &&ut3_owner;
-@@install_component.sql 'core/annotations/ut_trigger_annotation_parsing.trg'
-revoke administer database trigger from &&ut3_owner;
diff --git a/source/install_headless.sql b/source/install_headless.sql
deleted file mode 100644
index 183262675..000000000
--- a/source/install_headless.sql
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-@@set_install_params.sql
-
-@@create_utplsql_owner.sql &&ut3_owner &&ut3_password &&ut3_tablespace
-@@install.sql &&ut3_owner
-@@create_synonyms_and_grants_for_public.sql &&ut3_owner
-
-exit
diff --git a/source/install_headless_with_trigger.sql b/source/install_headless_with_trigger.sql
deleted file mode 100644
index 76ae48ccb..000000000
--- a/source/install_headless_with_trigger.sql
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-@@set_install_params.sql
-
-@@create_utplsql_owner.sql &&ut3_owner &&ut3_password &&ut3_tablespace
-@@install.sql &&ut3_owner
-@@create_synonyms_and_grants_for_public.sql &&ut3_owner
-
-@@install_ddl_trigger.sql &&ut3_owner
-
-exit
diff --git a/source/license.txt b/source/license.txt
new file mode 100644
index 000000000..8f5b408d9
--- /dev/null
+++ b/source/license.txt
@@ -0,0 +1,281 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991
+ Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
diff --git a/source/reporters/ut_ansiconsole_helper.pkb b/source/reporters/ut_ansiconsole_helper.pkb
deleted file mode 100644
index 53e6bc6aa..000000000
--- a/source/reporters/ut_ansiconsole_helper.pkb
+++ /dev/null
@@ -1,60 +0,0 @@
-create or replace package body ut_ansiconsole_helper as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- gc_red constant varchar2(7) := chr(27) || '[31m';
- gc_green constant varchar2(7) := chr(27) || '[32m';
- gc_yellow constant varchar2(7) := chr(27) || '[33m';
- gc_cyan constant varchar2(7) := chr(27) || '[36m';
- gc_reset constant varchar2(7) := chr(27) || '[0m';
- g_enabled boolean := false;
-
- procedure color_enabled(a_enabled boolean) is
- begin
- g_enabled := a_enabled;
- end;
-
- function add_color(a_text varchar2, a_color varchar2 := gc_reset) return varchar2 is
- begin
- if g_enabled and a_text is not null then
- return a_color||a_text||gc_reset;
- else
- return a_text;
- end if;
- end;
-
- function red(a_text varchar2) return varchar2 is
- begin
- return add_color(a_text, gc_red);
- end;
-
- function green(a_text varchar2) return varchar2 is
- begin
- return add_color(a_text, gc_green);
- end;
-
- function yellow(a_text varchar2) return varchar2 is
- begin
- return add_color(a_text, gc_yellow);
- end;
-
- function cyan(a_text varchar2) return varchar2 is
- begin
- return add_color(a_text, gc_cyan);
- end;
-
-end;
-/
diff --git a/source/reporters/ut_ansiconsole_helper.pks b/source/reporters/ut_ansiconsole_helper.pks
deleted file mode 100644
index 217d36a49..000000000
--- a/source/reporters/ut_ansiconsole_helper.pks
+++ /dev/null
@@ -1,28 +0,0 @@
-create or replace package ut_ansiconsole_helper as
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- procedure color_enabled(a_enabled boolean);
-
- function red(a_text varchar2) return varchar2;
-
- function green(a_text varchar2) return varchar2;
-
- function yellow(a_text varchar2) return varchar2;
-
- function cyan(a_text varchar2) return varchar2;
-end;
-/
diff --git a/source/reporters/ut_coverage_cobertura_reporter.tpb b/source/reporters/ut_coverage_cobertura_reporter.tpb
deleted file mode 100644
index d833ac0aa..000000000
--- a/source/reporters/ut_coverage_cobertura_reporter.tpb
+++ /dev/null
@@ -1,191 +0,0 @@
-create or replace type body ut_coverage_cobertura_reporter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_coverage_cobertura_reporter(
- self in out nocopy ut_coverage_cobertura_reporter
- ) return self as result is
- begin
- self.init($$plsql_unit,ut_output_bulk_buffer());
- return;
- end;
-
-
- overriding member procedure after_calling_run(self in out nocopy ut_coverage_cobertura_reporter, a_run in ut_run) as
- l_report_lines ut_varchar2_list;
- l_coverage_data ut_coverage.t_coverage;
-
- function get_line_rate(a_lines_covered in integer, a_lines_hit in integer) return varchar2 is
- begin
- return to_char(round((case a_lines_covered when 0 then 0 else a_lines_covered/a_lines_hit end), 17), rpad('FM0.0',20,'9') , 'NLS_NUMERIC_CHARACTERS=''. ''');
- end;
-
- procedure get_lines_xml(a_unit_coverage ut_coverage.t_unit_coverage,
- a_lines_result in out nocopy clob, a_lines_hits out number, a_lines_total out number) is
- l_file_part varchar2(32767);
- l_result clob;
- l_line_no binary_integer;
- l_pct integer;
- l_lines_hits integer := 0;
- l_lines_total integer := 0;
- begin
- dbms_lob.createtemporary(l_result, true);
- l_line_no := a_unit_coverage.lines.first;
- if l_line_no is null then
- for i in 1 .. a_unit_coverage.total_lines loop
- ut_utils.append_to_clob(l_result, ''||chr(10));
- end loop;
- l_lines_hits:=0;
- l_lines_total:= a_unit_coverage.total_lines;
- else
- while l_line_no is not null loop
- if a_unit_coverage.lines(l_line_no).executions = 0 then
- l_file_part := ''||chr(10);
- else
- l_lines_hits:= l_lines_hits+1;
- l_file_part := ''||chr(10);
- end if;
- ut_utils.append_to_clob(l_result, l_file_part);
- l_line_no := a_unit_coverage.lines.next(l_line_no);
- l_lines_total := l_lines_total + 1;
- end loop;
- end if;
- a_lines_result := l_result;
- a_lines_hits :=l_lines_hits;
- a_lines_total := l_lines_total;
- end;
-
- function get_coverage_xml(
- a_coverage_data ut_coverage.t_coverage,
- a_run ut_run
- ) return ut_varchar2_rows is
-
- l_file_part varchar2(32767);
- l_lines_xml clob;
- l_result ut_varchar2_rows := ut_varchar2_rows();
- l_unit ut_coverage.t_object_name;
- l_obj_name ut_coverage.t_object_name;
- c_coverage_def constant varchar2(200) := '';
- c_file_footer constant varchar2(30) := '';
- c_coverage_footer constant varchar2(30) := '';
- c_sources_footer constant varchar2(30) := '';
- c_packages_footer constant varchar2(30) := '';
- c_package_footer constant varchar2(30) := '';
- c_class_footer constant varchar2(30) := '';
- c_classes_footer constant varchar2(30) := '';
- c_lines_footer constant varchar2(30) := '';
- l_epoch varchar2(50) := (sysdate - to_date('01-01-1970 00:00:00', 'dd-mm-yyyy hh24:mi:ss')) * 24 * 60 * 60;
- l_lines_valid integer := a_coverage_data.covered_lines + a_coverage_data.uncovered_lines;
- l_line_hits integer;
- l_line_total integer;
- begin
-
- ut_utils.append_to_list( l_result, ut_utils.get_xml_header(a_run.client_character_set) );
- ut_utils.append_to_list( l_result, c_coverage_def );
-
- --write header
- ut_utils.append_to_list(
- l_result,
- ''
- );
-
-
- --Write sources
- l_unit := a_coverage_data.objects.first;
- ut_utils.append_to_list( l_result, '' );
-
- while l_unit is not null loop
- ut_utils.append_to_list(l_result, ''||dbms_xmlgen.convert(l_unit)||'');
- l_unit := a_coverage_data.objects.next(l_unit);
- end loop;
- ut_utils.append_to_list(l_result, c_sources_footer);
-
- --write packages
- l_unit := a_coverage_data.objects.first;
- ut_utils.append_to_list(l_result, '');
-
- while l_unit is not null loop
- l_obj_name := a_coverage_data.objects(l_unit).name;
- dbms_lob.createtemporary(l_lines_xml, true);
- get_lines_xml(a_coverage_data.objects(l_unit),l_lines_xml,l_line_hits,l_line_total);
-
- ut_utils.append_to_list(
- l_result,
- ''
- );
-
- ut_utils.append_to_list(
- l_result,
- ''
- );
-
- ut_utils.append_to_list(
- l_result,
- ''
- );
-
- ut_utils.append_to_list(l_result, '');
- ut_utils.append_to_list( l_result,l_lines_xml);
- dbms_lob.freetemporary(l_lines_xml);
-
- ut_utils.append_to_list(l_result, c_lines_footer);
- ut_utils.append_to_list(l_result, c_class_footer);
- ut_utils.append_to_list(l_result, c_classes_footer);
- ut_utils.append_to_list(l_result, c_package_footer);
-
- l_unit := a_coverage_data.objects.next(l_unit);
- end loop;
-
- ut_utils.append_to_list(l_result, c_packages_footer);
- ut_utils.append_to_list(l_result, c_coverage_footer);
- return l_result;
- end;
- begin
- ut_coverage.coverage_stop();
-
- l_coverage_data := ut_coverage.get_coverage_data(a_run.coverage_options);
-
- self.print_text_lines( get_coverage_xml( l_coverage_data, a_run ) );
-
- (self as ut_reporter_base).after_calling_run(a_run);
- end;
-
- overriding member function get_description return varchar2 as
- begin
- return 'Generates a Cobertura coverage report providing information on code coverage with line numbers.' || chr(10) ||
- 'Designed for Jenkins and TFS to report coverage. ' || chr(10) ||
- 'Cobertura Document Type Definition can be found: http://cobertura.sourceforge.net/xml/coverage-04.dtd.'|| chr(10) ||
- 'Sample file: https://github.com/leobalter/testing-examples/blob/master/solutions/3/report/cobertura-coverage.xml.';
- end;
-
-end;
-/
diff --git a/source/reporters/ut_coverage_cobertura_reporter.tps b/source/reporters/ut_coverage_cobertura_reporter.tps
deleted file mode 100644
index 1292e60fb..000000000
--- a/source/reporters/ut_coverage_cobertura_reporter.tps
+++ /dev/null
@@ -1,28 +0,0 @@
-create or replace type ut_coverage_cobertura_reporter under ut_coverage_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_coverage_cobertura_reporter(
- self in out nocopy ut_coverage_cobertura_reporter
- ) return self as result,
-
- overriding member procedure after_calling_run(self in out nocopy ut_coverage_cobertura_reporter, a_run in ut_run),
-
- overriding member function get_description return varchar2
-)
-/
-
diff --git a/source/reporters/ut_coverage_html_reporter.tpb b/source/reporters/ut_coverage_html_reporter.tpb
deleted file mode 100644
index b1f9f6651..000000000
--- a/source/reporters/ut_coverage_html_reporter.tpb
+++ /dev/null
@@ -1,56 +0,0 @@
-create or replace type body ut_coverage_html_reporter is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- constructor function ut_coverage_html_reporter(
- self in out nocopy ut_coverage_html_reporter,
- a_project_name varchar2 := null,
- a_html_report_assets_path varchar2 := null
- ) return self as result is
- begin
- self.init($$plsql_unit,ut_output_bulk_buffer());
- self.project_name := a_project_name;
- assets_path := nvl(a_html_report_assets_path, ut_coverage_report_html_helper.get_default_html_assets_path());
- return;
- end;
-
- overriding member procedure after_calling_run(self in out nocopy ut_coverage_html_reporter, a_run in ut_run) as
- l_coverage_data ut_coverage.t_coverage;
- begin
- ut_coverage.coverage_stop();
- l_coverage_data := ut_coverage.get_coverage_data(a_run.coverage_options);
-
- self.print_text_lines(
- ut_coverage_report_html_helper.get_index(
- a_coverage_data => l_coverage_data,
- a_assets_path => self.assets_path,
- a_project_name => self.project_name,
- a_charset => a_run.client_character_set
- )
- );
- end;
-
-
- overriding member function get_description return varchar2 as
- begin
- return 'Generates a HTML coverage report with summary and line by line information on code coverage.' || chr(10) ||
- 'Based on open-source simplecov-html coverage reporter for Ruby.' || chr(10) ||
- 'Includes source code in the report.';
- end;
-
-end;
-/
diff --git a/source/reporters/ut_coverage_html_reporter.tps b/source/reporters/ut_coverage_html_reporter.tps
deleted file mode 100644
index 42f2fd4e3..000000000
--- a/source/reporters/ut_coverage_html_reporter.tps
+++ /dev/null
@@ -1,30 +0,0 @@
-create or replace type ut_coverage_html_reporter under ut_coverage_reporter_base(
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- project_name varchar2(4000),
- assets_path varchar2(4000),
- constructor function ut_coverage_html_reporter(
- self in out nocopy ut_coverage_html_reporter,
- a_project_name varchar2 := null,
- a_html_report_assets_path varchar2 := null
- ) return self as result,
-
- overriding member procedure after_calling_run(self in out nocopy ut_coverage_html_reporter, a_run in ut_run),
-
- overriding member function get_description return varchar2
-)
-/
diff --git a/source/reporters/ut_coverage_report_html_helper.pkb b/source/reporters/ut_coverage_report_html_helper.pkb
deleted file mode 100644
index f7e0b5ed0..000000000
--- a/source/reporters/ut_coverage_report_html_helper.pkb
+++ /dev/null
@@ -1,360 +0,0 @@
-create or replace package body ut_coverage_report_html_helper is
- /*
- utPLSQL - Version 3
- Copyright 2016 - 2021 utPLSQL Project
-
- Licensed under the Apache License, Version 2.0 (the "License"):
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
- gc_green_coverage_pct constant integer := 90;
- gc_yellow_coverage_pct constant integer := 80;
-
- gc_green_css constant varchar2(10) := 'green';
- gc_yellow_css constant varchar2(10) := 'yellow';
- gc_red_css constant varchar2(10) := 'red';
-
- gc_missed constant varchar2(7) := 'missed';
- gc_skipped constant varchar2(7) := 'skipped';
- gc_disabled constant varchar2(7) := 'never';
- gc_covered constant varchar2(7) := 'covered';
- gc_partcovered constant varchar2(7) := 'partcov';
-
- function get_default_html_assets_path return varchar2 deterministic is
- c_assets_path constant varchar2(200) := 'https://utplsql.github.io/utPLSQL-coverage-html/assets/';
- begin
- return c_assets_path;
- end;
-
- function coverage_css_class(a_covered_pct number) return varchar2 is
- l_result varchar2(10);
- begin
- if a_covered_pct > gc_green_coverage_pct then
- l_result := gc_green_css;
- elsif a_covered_pct > gc_yellow_coverage_pct then
- l_result := gc_yellow_css;
- else
- l_result := gc_red_css;
- end if;
- return l_result;
- end;
-
- function line_status(a_executions in ut_coverage.t_line_executions) return varchar2 is
- l_result varchar2(10);
- begin
- if a_executions.executions > 0 then
- if NVL(a_executions.partcove,0) = 0 then
- l_result := gc_covered;
- else
- l_result := gc_partcovered;
- end if;
- elsif a_executions.executions = 0 then
- l_result := gc_missed;
- else
- l_result := gc_disabled;
- end if;
- return l_result;
- end;
-
- function executions_per_line(a_executions number, a_lines integer) return integer is
- begin
- return nvl(a_executions / nullif(a_lines, 0), 0);
- end;
-
- function line_hits_css_class(a_line_hist number) return varchar2 is
- l_result varchar2(10);
- begin
- if a_line_hist > 1 then
- l_result := gc_green_css;
- elsif a_line_hist = 1 then
- l_result := gc_yellow_css;
- else
- l_result := gc_red_css;
- end if;
- return l_result;
- end;
-
- function coverage_pct(a_covered_lines integer, a_uncovered_lines integer) return number is
- begin
- return ROUND(nvl(a_covered_lines / nullif(a_covered_lines + a_uncovered_lines, 0), 0) * 100, 2);
- end;
-
- function object_id(a_object_full_name varchar2) return varchar2 is
- begin
- return rawtohex(dbms_crypto.hash(src => utl_raw.cast_to_raw(a_object_full_name), typ => dbms_crypto.hash_md5));
- end;
-
- function link_to_source_file(a_object_full_name varchar2) return varchar2 is
- begin
- return '' || a_object_full_name || '';
- end;
-
-
-
-
- function get_details_file_content(
- a_object_id varchar2,
- a_unit ut_object_name,
- a_unit_coverage ut_coverage.t_unit_coverage
- ) return ut_varchar2_rows is
-
- function get_block_file_attributes(a_coverage_unit ut_coverage.t_unit_coverage) return varchar2 is
- l_result varchar2(32767);
- begin
- if (a_coverage_unit.partcovered_lines is not null) AND (a_coverage_unit.partcovered_lines > 0) then
- l_result := ' (including '|| a_coverage_unit.partcovered_lines ||' lines partially covered )';
- else
- l_result := null;
- end if;
- return l_result;
- end;
-
- function get_common_file_attributes(a_coverage_unit ut_coverage.t_unit_coverage) return varchar2 is
- l_attributes varchar2(32767);
- begin
- l_attributes := '