From 54fcc10a36c68985df9e792d25b58e4e0fb4284b Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 14 Dec 2021 16:48:35 +0100 Subject: [PATCH 1/8] Update for next development version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b27f7ce..922a508 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.9 + 3.1.10-SNAPSHOT maven-plugin utPLSQL Maven Plugin From 6daaa78b4da024db2a683f49628b45f6b40f39f7 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 14 Dec 2021 16:49:07 +0100 Subject: [PATCH 2/8] Updated version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e9b0f9b..0372794 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Please refer to the following usage example for the parameters descriptions: org.utplsql utplsql-maven-plugin - 3.1.9 + 3.1.10 From 3613c9e7fb441baddf0622a52180efb41aa20542 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 14 Dec 2021 17:09:28 +0100 Subject: [PATCH 3/8] Removed test that don't test anything --- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 9364ab3..051b65c 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -305,40 +305,6 @@ public void db_config_using_system_properties() throws Exception { System.setProperty("dbPass", ""); } - /** - * Exclude object from coverage report - *

- * Given : a pom.xml with excludeObject set - * When : pom is read - * Then : excludeObject is present - */ - @Test - public void exclude_object() throws Exception { - UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("exclude_object"); - assertNotNull(utPlsqlMojo); - - utPlsqlMojo.execute(); - - assertEquals("app.pkg_test_me,app.test_pkg_test_me", utPlsqlMojo.excludeObject); - } - - /** - * Include object from coverage report - *

- * Given : a pom.xml with includeObject set - * When : pom is read - * Then : includeObject is present - */ - @Test - public void include_object() throws Exception { - UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("include_object"); - assertNotNull(utPlsqlMojo); - - utPlsqlMojo.execute(); - - assertEquals("app.pkg_test_me,app.test_pkg_test_me", utPlsqlMojo.includeObject); - } - private UtPlsqlMojo createUtPlsqlMojo(String directory) throws Exception { return (UtPlsqlMojo) rule.lookupConfiguredMojo(new File("src/test/resources/unit-tests/" + directory), "test"); } From 58e269e2dd54d17973461bf314429f11a9b35c2c Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 14 Dec 2021 17:22:58 +0100 Subject: [PATCH 4/8] Revert "Removed test that don't test anything" This reverts commit 3613c9e7fb441baddf0622a52180efb41aa20542. --- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 051b65c..9364ab3 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -305,6 +305,40 @@ public void db_config_using_system_properties() throws Exception { System.setProperty("dbPass", ""); } + /** + * Exclude object from coverage report + *

+ * Given : a pom.xml with excludeObject set + * When : pom is read + * Then : excludeObject is present + */ + @Test + public void exclude_object() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("exclude_object"); + assertNotNull(utPlsqlMojo); + + utPlsqlMojo.execute(); + + assertEquals("app.pkg_test_me,app.test_pkg_test_me", utPlsqlMojo.excludeObject); + } + + /** + * Include object from coverage report + *

+ * Given : a pom.xml with includeObject set + * When : pom is read + * Then : includeObject is present + */ + @Test + public void include_object() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("include_object"); + assertNotNull(utPlsqlMojo); + + utPlsqlMojo.execute(); + + assertEquals("app.pkg_test_me,app.test_pkg_test_me", utPlsqlMojo.includeObject); + } + private UtPlsqlMojo createUtPlsqlMojo(String directory) throws Exception { return (UtPlsqlMojo) rule.lookupConfiguredMojo(new File("src/test/resources/unit-tests/" + directory), "test"); } From 955f8bf2de7a38471e537a4ef1dbb4a909bc99c4 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 15 Dec 2021 15:58:24 +0100 Subject: [PATCH 5/8] Clean up of test files --- .gitignore | 1 + scripts/sql/create_app_objects.sql | 10 +- scripts/sql/create_source_owner_objects.sql | 6 +- scripts/sql/create_tests_owner_objects.sql | 4 +- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 4 +- .../foo/package_bodies/PKG_TEST_ME.sql | 27 ---- .../sources/foo/packages/PKG_TEST_ME.sql | 8 -- .../bar/package_bodies/TEST_PKG_TEST_ME.sql | 126 ------------------ .../test/bar/packages/TEST_PKG_TEST_ME.sql | 86 ------------ .../utplsql/coverage-sonar-report.xml | 2 +- .../utplsql/sonar-test-report.xml | 4 +- .../plugin/UtPlsqlMojoIT/owner_param/pom.xml | 7 +- .../foo/package_bodies/PKG_TEST_ME.pkb} | 0 .../foo/package_bodies/PKG_TEST_ME.sql | 27 ---- .../sources/foo/packages/PKG_TEST_ME.pks} | 0 .../sources/foo/packages/PKG_TEST_ME.sql | 8 -- .../sources/foo/tables/TO_TEST_ME.sql} | 0 .../bar/package_bodies/TEST_PKG_TEST_ME.pkb} | 0 .../bar/package_bodies/TEST_PKG_TEST_ME.sql | 126 ------------------ .../test/bar/packages/TEST_PKG_TEST_ME.pks} | 0 .../test/bar/packages/TEST_PKG_TEST_ME.sql | 86 ------------ .../utplsql/coverage-sonar-report.xml | 2 +- .../utplsql/sonar-test-report.xml | 4 +- .../maven/plugin/UtPlsqlMojoIT/regex/pom.xml | 12 +- .../{PKG_TEST_ME.bdy => PKG_TEST_ME.pkb} | 0 .../{PKG_TEST_ME.spc => PKG_TEST_ME.pks} | 0 .../sources/app/tables/TO_TEST_ME.sql} | 0 ...T_PKG_TEST_ME.bdy => TEST_PKG_TEST_ME.pkb} | 0 ...T_PKG_TEST_ME.spc => TEST_PKG_TEST_ME.pks} | 0 .../utplsql/coverage-sonar-report.xml | 2 +- .../utplsql/sonar-test-report.xml | 4 +- .../maven/plugin/UtPlsqlMojoIT/simple/pom.xml | 8 +- ...PP.PKG_TEST_ME.bdy => APP.PKG_TEST_ME.pkb} | 0 ...PP.PKG_TEST_ME.spc => APP.PKG_TEST_ME.pks} | 0 .../scripts/sources/TO_TEST_ME.sql} | 0 .../simple/scripts/sources/TO_TEST_ME.tab | 8 -- ...G_TEST_ME.bdy => APP.TEST_PKG_TEST_ME.pkb} | 0 ...G_TEST_ME.spc => APP.TEST_PKG_TEST_ME.pks} | 0 .../maven/plugin/UtPlsqlMojoIT/skip/pom.xml | 34 ----- .../utplsql/sonar-test-report.xml | 4 +- .../maven/plugin/UtPlsqlMojoIT/tags/pom.xml | 4 +- ...G_TEST_ME.bdy => APP.TEST_PKG_TEST_ME.pkb} | 0 ...G_TEST_ME.spc => APP.TEST_PKG_TEST_ME.pks} | 0 .../utplsql/coverage-sonar-report.xml | 2 +- .../utplsql/sonar-test-report.xml | 4 +- .../plugin/UtPlsqlMojoIT/type_mapping/pom.xml | 7 +- .../{PKG_TEST_ME.sql => PKG_TEST_ME.pkb} | 0 .../{PKG_TEST_ME.sql => PKG_TEST_ME.pks} | 0 .../sources/app/tables/TO_TEST_ME.sql} | 0 .../scripts/sources/app/tables/TO_TEST_ME.tab | 8 -- ...T_PKG_TEST_ME.sql => TEST_PKG_TEST_ME.pkb} | 0 ...T_PKG_TEST_ME.sql => TEST_PKG_TEST_ME.pks} | 0 .../invalid_tests_directory/pom.xml | 4 +- .../unit-tests/skip_utplsql_tests/pom.xml | 4 +- .../sources_tests_parameters/pom.xml | 4 +- .../srcs/{file.bdy => file.pkb} | 0 .../srcs/{spec.spc => spec.pks} | 0 .../te/st/{file.bdy => file.pkb} | 0 .../te/st/{spec.spc => spec.pks} | 0 59 files changed, 55 insertions(+), 592 deletions(-) delete mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql delete mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/packages/PKG_TEST_ME.sql delete mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql delete mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/{exclude_object/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql => owner_param/scripts/sources/foo/package_bodies/PKG_TEST_ME.pkb} (100%) delete mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/{exclude_object/scripts/sources/foo/packages/PKG_TEST_ME.sql => owner_param/scripts/sources/foo/packages/PKG_TEST_ME.pks} (100%) delete mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/packages/PKG_TEST_ME.sql rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/{exclude_object/scripts/sources/foo/tables/TO_TEST_ME.tab => owner_param/scripts/sources/foo/tables/TO_TEST_ME.sql} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/{exclude_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql => owner_param/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.pkb} (100%) delete mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/{exclude_object/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql => owner_param/scripts/test/bar/packages/TEST_PKG_TEST_ME.pks} (100%) delete mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/packages/{PKG_TEST_ME.bdy => PKG_TEST_ME.pkb} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/packages/{PKG_TEST_ME.spc => PKG_TEST_ME.pks} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/{include_object/scripts/sources/foo/tables/TO_TEST_ME.tab => regex/scripts/sources/app/tables/TO_TEST_ME.sql} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/test/app/packages/{TEST_PKG_TEST_ME.bdy => TEST_PKG_TEST_ME.pkb} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/test/app/packages/{TEST_PKG_TEST_ME.spc => TEST_PKG_TEST_ME.pks} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/{APP.PKG_TEST_ME.bdy => APP.PKG_TEST_ME.pkb} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/{APP.PKG_TEST_ME.spc => APP.PKG_TEST_ME.pks} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/{owner_param/scripts/sources/foo/tables/TO_TEST_ME.tab => simple/scripts/sources/TO_TEST_ME.sql} (100%) delete mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/TO_TEST_ME.tab rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/{APP.TEST_PKG_TEST_ME.bdy => APP.TEST_PKG_TEST_ME.pkb} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/{APP.TEST_PKG_TEST_ME.spc => APP.TEST_PKG_TEST_ME.pks} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/scripts/tests/{APP.TEST_PKG_TEST_ME.bdy => APP.TEST_PKG_TEST_ME.pkb} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/scripts/tests/{APP.TEST_PKG_TEST_ME.spc => APP.TEST_PKG_TEST_ME.pks} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/package_bodies/{PKG_TEST_ME.sql => PKG_TEST_ME.pkb} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/packages/{PKG_TEST_ME.sql => PKG_TEST_ME.pks} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/{regex/scripts/sources/app/tables/TO_TEST_ME.tab => type_mapping/scripts/sources/app/tables/TO_TEST_ME.sql} (100%) delete mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/tables/TO_TEST_ME.tab rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/test/app/package_bodies/{TEST_PKG_TEST_ME.sql => TEST_PKG_TEST_ME.pkb} (100%) rename src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/test/app/packages/{TEST_PKG_TEST_ME.sql => TEST_PKG_TEST_ME.pks} (100%) rename src/test/resources/unit-tests/sources_tests_parameters/srcs/{file.bdy => file.pkb} (100%) rename src/test/resources/unit-tests/sources_tests_parameters/srcs/{spec.spc => spec.pks} (100%) rename src/test/resources/unit-tests/sources_tests_parameters/te/st/{file.bdy => file.pkb} (100%) rename src/test/resources/unit-tests/sources_tests_parameters/te/st/{spec.spc => spec.pks} (100%) diff --git a/.gitignore b/.gitignore index ca5b9cd..ed6f99b 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ dependency-reduced-pom.xml doc/ /utPLSQL/ /utPLSQL.zip +/tree.txt diff --git a/scripts/sql/create_app_objects.sql b/scripts/sql/create_app_objects.sql index 7c889cc..9afffba 100644 --- a/scripts/sql/create_app_objects.sql +++ b/scripts/sql/create_app_objects.sql @@ -1,9 +1,9 @@ whenever sqlerror exit failure rollback whenever oserror exit failure rollback -@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/TO_TEST_ME.tab -@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.spc -@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.bdy +@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/TO_TEST_ME.sql +@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.pks +@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.pkb -@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/APP.TEST_PKG_TEST_ME.spc -@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/APP.TEST_PKG_TEST_ME.bdy +@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pks +@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pkb diff --git a/scripts/sql/create_source_owner_objects.sql b/scripts/sql/create_source_owner_objects.sql index d2cebe6..35cb4aa 100644 --- a/scripts/sql/create_source_owner_objects.sql +++ b/scripts/sql/create_source_owner_objects.sql @@ -1,6 +1,6 @@ whenever sqlerror exit failure rollback whenever oserror exit failure rollback -@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/tables/TO_TEST_ME.tab -@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/packages/PKG_TEST_ME.sql -@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql +@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/tables/TO_TEST_ME.sql +@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/packages/PKG_TEST_ME.pks +@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/package_bodies/PKG_TEST_ME.pkb diff --git a/scripts/sql/create_tests_owner_objects.sql b/scripts/sql/create_tests_owner_objects.sql index 3fbcb1b..777dd95 100644 --- a/scripts/sql/create_tests_owner_objects.sql +++ b/scripts/sql/create_tests_owner_objects.sql @@ -4,5 +4,5 @@ whenever oserror exit failure rollback create synonym TO_TEST_ME for CODE_OWNER.TO_TEST_ME; create synonym PKG_TEST_ME for CODE_OWNER.PKG_TEST_ME; -@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql -@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql +@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/packages/TEST_PKG_TEST_ME.pks +@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.pkb diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 9364ab3..743f7e4 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -87,8 +87,8 @@ public void sources_tests_parameters() throws Exception { // check tests FileMapperOptions tests = utPlsqlMojo.buildTestsOptions(); assertEquals(2, tests.getFilePaths().size()); - assertTrue(tests.getFilePaths().contains("te/st/file.bdy")); - assertTrue(tests.getFilePaths().contains("te/st/spec.spc")); + assertTrue(tests.getFilePaths().contains("te/st/file.pkb")); + assertTrue(tests.getFilePaths().contains("te/st/spec.pks")); assertEquals("tests_owner", tests.getObjectOwner()); assertEquals(".*/\\w+/(\\w+)/(\\w+)\\.\\w{3}", tests.getRegexPattern()); assertEquals(Integer.valueOf(54), tests.getNameSubExpression()); diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql deleted file mode 100644 index d6846b2..0000000 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE OR REPLACE PACKAGE BODY CODE_OWNER.PKG_TEST_ME IS - -- - -- This - -- - FUNCTION FC_TEST_ME(PPARAM1 IN VARCHAR2) RETURN NUMBER IS - BEGIN - IF PPARAM1 IS NULL THEN - RETURN NULL; - ELSIF PPARAM1 = '1' THEN - RETURN 1; - ELSE - RETURN 0; - END IF; - END FC_TEST_ME; - - PROCEDURE PR_TEST_ME(PSNAME IN VARCHAR2) IS - BEGIN - IF PSNAME IS NULL THEN - NULL; - ELSE - INSERT INTO TO_TEST_ME (SNAME) VALUES (PSNAME); - COMMIT; - END IF; - END PR_TEST_ME; - -END PKG_TEST_ME; -/ diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/packages/PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/packages/PKG_TEST_ME.sql deleted file mode 100644 index 959b122..0000000 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/packages/PKG_TEST_ME.sql +++ /dev/null @@ -1,8 +0,0 @@ --- --- This package is used TO demonstrate the utPL/SQL possibilities --- -CREATE OR REPLACE PACKAGE CODE_OWNER.PKG_TEST_ME AS - FUNCTION FC_TEST_ME(PPARAM1 IN VARCHAR2) RETURN NUMBER; - PROCEDURE PR_TEST_ME(PSNAME IN VARCHAR2); -END PKG_TEST_ME; -/ \ No newline at end of file diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql deleted file mode 100644 index 1b34f08..0000000 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql +++ /dev/null @@ -1,126 +0,0 @@ -CREATE OR REPLACE PACKAGE BODY TESTS_OWNER.TEST_PKG_TEST_ME AS - - --------------------------------------------------------------------------- - PROCEDURE SETUP_GLOBAL IS - BEGIN - -- Put here the code which is valid for all tests and that should be - -- executed once. - NULL; - END SETUP_GLOBAL; - - --------------------------------------------------------------------------- - PROCEDURE TEARDOWN_GLOBAL IS - BEGIN - -- Put here the code that should be called only once after all the test - -- have executed - NULL; - END TEARDOWN_GLOBAL; - - --------------------------------------------------------------------------- - PROCEDURE SETUP_TEST IS - BEGIN - -- Nothing to clean up globally - NULL; - END SETUP_TEST; - - PROCEDURE TEARDOWN_TEST IS - BEGIN - -- Nothing to clean up globally - NULL; - END TEARDOWN_TEST; - - PROCEDURE TEST_FC_INPUT_1 IS - BEGIN - -- Ok this is a real test where I check that the function return 1 - -- when called with a '1' parameter - UT.EXPECT(PKG_TEST_ME.FC_TEST_ME('1')).TO_EQUAL(1); - END; - - PROCEDURE SETUP_TEST_FC_INPUT_1 IS - BEGIN - -- Nothing to be done really - NULL; - END; - - PROCEDURE TEARDOWN_TEST_FC_INPUT_1 IS - BEGIN - -- Nothing to be done really - NULL; - END; - - PROCEDURE TEST_FC_INPUT_0 IS - BEGIN - -- Ok this is a real test where I check that the function return 0 - -- when called with a '0' parameter - UT.EXPECT(PKG_TEST_ME.FC_TEST_ME('0')).TO_EQUAL(0); - END; - - PROCEDURE TEST_FC_INPUT_NULL IS - BEGIN - -- Ok I check that the function return NULL - -- when called with a NULL parameter - UT.EXPECT(PKG_TEST_ME.FC_TEST_ME(NULL)).TO_BE_NULL; - END TEST_FC_INPUT_NULL; - - PROCEDURE TEST_PR_TEST_ME_NULL IS - VNCOUNT1 PLS_INTEGER; - VNCOUNT2 PLS_INTEGER; - BEGIN - -- In this example I check that the procedure does - -- not insert anything when passing it a NULL parameter - SELECT COUNT(1) INTO VNCOUNT1 FROM TO_TEST_ME; - PKG_TEST_ME.PR_TEST_ME(NULL); - SELECT COUNT(1) INTO VNCOUNT2 FROM TO_TEST_ME; - UT.EXPECT(VNCOUNT1).TO_EQUAL(VNCOUNT2); - END; - - PROCEDURE TEST_PR_TEST_ME_NOT_NULL IS - VNCOUNT1 PLS_INTEGER; - VNCOUNT2 PLS_INTEGER; - VSNAME TO_TEST_ME.SNAME%TYPE; - BEGIN - -- In this test I will check that I do insert a value - -- when the parameter is not null. I futher check that - -- the procedure has inserted the value I specified. - SELECT COUNT(1) INTO VNCOUNT1 FROM TO_TEST_ME; - VSNAME := TO_CHAR(VNCOUNT1); - PKG_TEST_ME.PR_TEST_ME(VSNAME); - SELECT COUNT(1) INTO VNCOUNT2 FROM TO_TEST_ME; - - -- Check that I have inserted the value - UT.EXPECT(VNCOUNT1 + 1).TO_EQUAL(VNCOUNT2); - SELECT COUNT(1) INTO VNCOUNT2 FROM TO_TEST_ME T WHERE T.SNAME = VSNAME; - - -- Check that I inserted the one I said I would insert - UT.EXPECT(VNCOUNT2).TO_EQUAL(1); - DELETE FROM TO_TEST_ME T WHERE T.SNAME = VSNAME; - COMMIT; - END; - - PROCEDURE TEST_PR_TEST_ME_EXISTS IS - BEGIN - -- In case the value exists the procedure should fail with an exception. - BEGIN - PKG_TEST_ME.PR_TEST_ME('EXISTS'); - PKG_TEST_ME.PR_TEST_ME('EXISTS'); - EXCEPTION - WHEN OTHERS THEN - UT.FAIL('Unexpected exception raised'); - END; - END; - - PROCEDURE TEST_PR_TEST_ME_CURSOR IS - TYPE REF_CURSOR IS REF CURSOR; - VEXPECTED REF_CURSOR; - VACTUAL REF_CURSOR; - BEGIN - EXECUTE IMMEDIATE 'TRUNCATE TABLE CODE_OWNER.TO_TEST_ME'; - OPEN VEXPECTED FOR - SELECT T.SNAME FROM TO_TEST_ME T; - OPEN VACTUAL FOR - SELECT T.SNAME FROM TO_TEST_ME T; - UT.EXPECT(VEXPECTED).TO_(EQUAL(VACTUAL)); - END; - -END; -/ diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql deleted file mode 100644 index b0cdf54..0000000 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql +++ /dev/null @@ -1,86 +0,0 @@ -CREATE OR REPLACE PACKAGE TESTS_OWNER.TEST_PKG_TEST_ME AS - -- %suite(TEST_PKG_TEST_ME) - -- %suitepath(plsql.examples) - -- - -- This package shows all the possibilities to unit test - -- your PL/SQL package. NOTE that it is not limited to - -- testing your package. You can do that on all your - -- procedure/functions... - -- - - /** - * This two parameters are used by the test framework in - * order to identify the test suite to run - */ - - /* - * This method is invoked once before any other method. - * It should contain all the setup code that is relevant - * for all your test. It might be inserting a register, - * creating a type, etc... - */ - -- %beforeall - PROCEDURE SETUP_GLOBAL; - - /* - * This method is invoked once after all other method. - * It can be used to clean up all the resources that - * you created in your script - */ - -- %afterall - PROCEDURE TEARDOWN_GLOBAL; - - /* - * This method is called once before each test. - */ - -- %beforeeach - PROCEDURE SETUP_TEST; - - /* - * This method is called once after each test. - */ - -- %aftereach - PROCEDURE TEARDOWN_TEST; - - /** - * This is a real test. The main test can declare a setup - * and teardown method in order to setup and cleanup things - * for that specific test. - */ - -- %test - -- %displayname(Checking if function ('1') returns 1) - -- %beforetest(SETUP_TEST_FC_INPUT_1) - -- %aftertest(TEARDOWN_TEST_FC_INPUT_1) - PROCEDURE TEST_FC_INPUT_1; - PROCEDURE SETUP_TEST_FC_INPUT_1; - PROCEDURE TEARDOWN_TEST_FC_INPUT_1; - - -- %test - -- %displayname(Checking if function ('0') returns 0) - PROCEDURE TEST_FC_INPUT_0; - - -- %test - -- %displayname(Checking if function (NULL) returns NULL) - PROCEDURE TEST_FC_INPUT_NULL; - - -- %test - -- %displayname(Checking if procedure (NULL) insert) - PROCEDURE TEST_PR_TEST_ME_NULL; - - -- %test - -- %displayname(Checking if procedure (NOT NULL) insert) - -- %rollback(manual) - PROCEDURE TEST_PR_TEST_ME_NOT_NULL; - - -- %test - -- %displayname(Checking if procedure (NOT NULL) insert while existing) - -- %rollback(manual) - PROCEDURE TEST_PR_TEST_ME_EXISTS; - - -- %test - -- %displayname(Demonstrating the use of cursor) - -- %rollback(manual) - PROCEDURE TEST_PR_TEST_ME_CURSOR; - -END; -/ diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/expected-output/utplsql/coverage-sonar-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/expected-output/utplsql/coverage-sonar-report.xml index 22f929c..07ab94a 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/expected-output/utplsql/coverage-sonar-report.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/expected-output/utplsql/coverage-sonar-report.xml @@ -1,5 +1,5 @@ - + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/expected-output/utplsql/sonar-test-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/expected-output/utplsql/sonar-test-report.xml index e558e2f..afefd7c 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/expected-output/utplsql/sonar-test-report.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/expected-output/utplsql/sonar-test-report.xml @@ -1,5 +1,5 @@ - + @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/pom.xml index c523eab..961940b 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/pom.xml @@ -46,7 +46,9 @@ scripts/sources - **/*sql + **/**.sql + **/**.pks + **/**.pkb @@ -64,7 +66,8 @@ scripts/test - **/*sql + **/**.pks + **/**.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/package_bodies/PKG_TEST_ME.pkb similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/package_bodies/PKG_TEST_ME.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql deleted file mode 100644 index d6846b2..0000000 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE OR REPLACE PACKAGE BODY CODE_OWNER.PKG_TEST_ME IS - -- - -- This - -- - FUNCTION FC_TEST_ME(PPARAM1 IN VARCHAR2) RETURN NUMBER IS - BEGIN - IF PPARAM1 IS NULL THEN - RETURN NULL; - ELSIF PPARAM1 = '1' THEN - RETURN 1; - ELSE - RETURN 0; - END IF; - END FC_TEST_ME; - - PROCEDURE PR_TEST_ME(PSNAME IN VARCHAR2) IS - BEGIN - IF PSNAME IS NULL THEN - NULL; - ELSE - INSERT INTO TO_TEST_ME (SNAME) VALUES (PSNAME); - COMMIT; - END IF; - END PR_TEST_ME; - -END PKG_TEST_ME; -/ diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/packages/PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/packages/PKG_TEST_ME.pks similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/packages/PKG_TEST_ME.sql rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/packages/PKG_TEST_ME.pks diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/packages/PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/packages/PKG_TEST_ME.sql deleted file mode 100644 index 959b122..0000000 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/packages/PKG_TEST_ME.sql +++ /dev/null @@ -1,8 +0,0 @@ --- --- This package is used TO demonstrate the utPL/SQL possibilities --- -CREATE OR REPLACE PACKAGE CODE_OWNER.PKG_TEST_ME AS - FUNCTION FC_TEST_ME(PPARAM1 IN VARCHAR2) RETURN NUMBER; - PROCEDURE PR_TEST_ME(PSNAME IN VARCHAR2); -END PKG_TEST_ME; -/ \ No newline at end of file diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/tables/TO_TEST_ME.tab b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/tables/TO_TEST_ME.sql similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/tables/TO_TEST_ME.tab rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/tables/TO_TEST_ME.sql diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.pkb similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql deleted file mode 100644 index 1b34f08..0000000 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql +++ /dev/null @@ -1,126 +0,0 @@ -CREATE OR REPLACE PACKAGE BODY TESTS_OWNER.TEST_PKG_TEST_ME AS - - --------------------------------------------------------------------------- - PROCEDURE SETUP_GLOBAL IS - BEGIN - -- Put here the code which is valid for all tests and that should be - -- executed once. - NULL; - END SETUP_GLOBAL; - - --------------------------------------------------------------------------- - PROCEDURE TEARDOWN_GLOBAL IS - BEGIN - -- Put here the code that should be called only once after all the test - -- have executed - NULL; - END TEARDOWN_GLOBAL; - - --------------------------------------------------------------------------- - PROCEDURE SETUP_TEST IS - BEGIN - -- Nothing to clean up globally - NULL; - END SETUP_TEST; - - PROCEDURE TEARDOWN_TEST IS - BEGIN - -- Nothing to clean up globally - NULL; - END TEARDOWN_TEST; - - PROCEDURE TEST_FC_INPUT_1 IS - BEGIN - -- Ok this is a real test where I check that the function return 1 - -- when called with a '1' parameter - UT.EXPECT(PKG_TEST_ME.FC_TEST_ME('1')).TO_EQUAL(1); - END; - - PROCEDURE SETUP_TEST_FC_INPUT_1 IS - BEGIN - -- Nothing to be done really - NULL; - END; - - PROCEDURE TEARDOWN_TEST_FC_INPUT_1 IS - BEGIN - -- Nothing to be done really - NULL; - END; - - PROCEDURE TEST_FC_INPUT_0 IS - BEGIN - -- Ok this is a real test where I check that the function return 0 - -- when called with a '0' parameter - UT.EXPECT(PKG_TEST_ME.FC_TEST_ME('0')).TO_EQUAL(0); - END; - - PROCEDURE TEST_FC_INPUT_NULL IS - BEGIN - -- Ok I check that the function return NULL - -- when called with a NULL parameter - UT.EXPECT(PKG_TEST_ME.FC_TEST_ME(NULL)).TO_BE_NULL; - END TEST_FC_INPUT_NULL; - - PROCEDURE TEST_PR_TEST_ME_NULL IS - VNCOUNT1 PLS_INTEGER; - VNCOUNT2 PLS_INTEGER; - BEGIN - -- In this example I check that the procedure does - -- not insert anything when passing it a NULL parameter - SELECT COUNT(1) INTO VNCOUNT1 FROM TO_TEST_ME; - PKG_TEST_ME.PR_TEST_ME(NULL); - SELECT COUNT(1) INTO VNCOUNT2 FROM TO_TEST_ME; - UT.EXPECT(VNCOUNT1).TO_EQUAL(VNCOUNT2); - END; - - PROCEDURE TEST_PR_TEST_ME_NOT_NULL IS - VNCOUNT1 PLS_INTEGER; - VNCOUNT2 PLS_INTEGER; - VSNAME TO_TEST_ME.SNAME%TYPE; - BEGIN - -- In this test I will check that I do insert a value - -- when the parameter is not null. I futher check that - -- the procedure has inserted the value I specified. - SELECT COUNT(1) INTO VNCOUNT1 FROM TO_TEST_ME; - VSNAME := TO_CHAR(VNCOUNT1); - PKG_TEST_ME.PR_TEST_ME(VSNAME); - SELECT COUNT(1) INTO VNCOUNT2 FROM TO_TEST_ME; - - -- Check that I have inserted the value - UT.EXPECT(VNCOUNT1 + 1).TO_EQUAL(VNCOUNT2); - SELECT COUNT(1) INTO VNCOUNT2 FROM TO_TEST_ME T WHERE T.SNAME = VSNAME; - - -- Check that I inserted the one I said I would insert - UT.EXPECT(VNCOUNT2).TO_EQUAL(1); - DELETE FROM TO_TEST_ME T WHERE T.SNAME = VSNAME; - COMMIT; - END; - - PROCEDURE TEST_PR_TEST_ME_EXISTS IS - BEGIN - -- In case the value exists the procedure should fail with an exception. - BEGIN - PKG_TEST_ME.PR_TEST_ME('EXISTS'); - PKG_TEST_ME.PR_TEST_ME('EXISTS'); - EXCEPTION - WHEN OTHERS THEN - UT.FAIL('Unexpected exception raised'); - END; - END; - - PROCEDURE TEST_PR_TEST_ME_CURSOR IS - TYPE REF_CURSOR IS REF CURSOR; - VEXPECTED REF_CURSOR; - VACTUAL REF_CURSOR; - BEGIN - EXECUTE IMMEDIATE 'TRUNCATE TABLE CODE_OWNER.TO_TEST_ME'; - OPEN VEXPECTED FOR - SELECT T.SNAME FROM TO_TEST_ME T; - OPEN VACTUAL FOR - SELECT T.SNAME FROM TO_TEST_ME T; - UT.EXPECT(VEXPECTED).TO_(EQUAL(VACTUAL)); - END; - -END; -/ diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/packages/TEST_PKG_TEST_ME.pks similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/packages/TEST_PKG_TEST_ME.pks diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql deleted file mode 100644 index b0cdf54..0000000 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql +++ /dev/null @@ -1,86 +0,0 @@ -CREATE OR REPLACE PACKAGE TESTS_OWNER.TEST_PKG_TEST_ME AS - -- %suite(TEST_PKG_TEST_ME) - -- %suitepath(plsql.examples) - -- - -- This package shows all the possibilities to unit test - -- your PL/SQL package. NOTE that it is not limited to - -- testing your package. You can do that on all your - -- procedure/functions... - -- - - /** - * This two parameters are used by the test framework in - * order to identify the test suite to run - */ - - /* - * This method is invoked once before any other method. - * It should contain all the setup code that is relevant - * for all your test. It might be inserting a register, - * creating a type, etc... - */ - -- %beforeall - PROCEDURE SETUP_GLOBAL; - - /* - * This method is invoked once after all other method. - * It can be used to clean up all the resources that - * you created in your script - */ - -- %afterall - PROCEDURE TEARDOWN_GLOBAL; - - /* - * This method is called once before each test. - */ - -- %beforeeach - PROCEDURE SETUP_TEST; - - /* - * This method is called once after each test. - */ - -- %aftereach - PROCEDURE TEARDOWN_TEST; - - /** - * This is a real test. The main test can declare a setup - * and teardown method in order to setup and cleanup things - * for that specific test. - */ - -- %test - -- %displayname(Checking if function ('1') returns 1) - -- %beforetest(SETUP_TEST_FC_INPUT_1) - -- %aftertest(TEARDOWN_TEST_FC_INPUT_1) - PROCEDURE TEST_FC_INPUT_1; - PROCEDURE SETUP_TEST_FC_INPUT_1; - PROCEDURE TEARDOWN_TEST_FC_INPUT_1; - - -- %test - -- %displayname(Checking if function ('0') returns 0) - PROCEDURE TEST_FC_INPUT_0; - - -- %test - -- %displayname(Checking if function (NULL) returns NULL) - PROCEDURE TEST_FC_INPUT_NULL; - - -- %test - -- %displayname(Checking if procedure (NULL) insert) - PROCEDURE TEST_PR_TEST_ME_NULL; - - -- %test - -- %displayname(Checking if procedure (NOT NULL) insert) - -- %rollback(manual) - PROCEDURE TEST_PR_TEST_ME_NOT_NULL; - - -- %test - -- %displayname(Checking if procedure (NOT NULL) insert while existing) - -- %rollback(manual) - PROCEDURE TEST_PR_TEST_ME_EXISTS; - - -- %test - -- %displayname(Demonstrating the use of cursor) - -- %rollback(manual) - PROCEDURE TEST_PR_TEST_ME_CURSOR; - -END; -/ diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/expected-output/utplsql/coverage-sonar-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/expected-output/utplsql/coverage-sonar-report.xml index b7a6aa2..a4c6cf5 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/expected-output/utplsql/coverage-sonar-report.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/expected-output/utplsql/coverage-sonar-report.xml @@ -1,5 +1,5 @@ - + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/expected-output/utplsql/sonar-test-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/expected-output/utplsql/sonar-test-report.xml index 6e6fad7..d4acc02 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/expected-output/utplsql/sonar-test-report.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/expected-output/utplsql/sonar-test-report.xml @@ -1,5 +1,5 @@ - + @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/pom.xml index 036785a..2620738 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/pom.xml @@ -46,13 +46,13 @@ scripts/sources - **/*bdy - **/*spc + **/**.sql + **/**.pks + **/**.pkb - .*(\\|\/)(\w+)(\\|\/)(\w+)(\\|\/)(\w+).(\w{3}) - + .*(\\|\/)(\w+)(\\|\/)(\w+)(\\|\/)(\w+).(\w{3}) 2 6 7 @@ -60,8 +60,8 @@ scripts/test - **/*bdy - **/*spc + **/**.pks + **/**.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/packages/PKG_TEST_ME.bdy b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/packages/PKG_TEST_ME.pkb similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/packages/PKG_TEST_ME.bdy rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/packages/PKG_TEST_ME.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/packages/PKG_TEST_ME.spc b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/packages/PKG_TEST_ME.pks similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/packages/PKG_TEST_ME.spc rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/packages/PKG_TEST_ME.pks diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/tables/TO_TEST_ME.tab b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/tables/TO_TEST_ME.sql similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/tables/TO_TEST_ME.tab rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/tables/TO_TEST_ME.sql diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/test/app/packages/TEST_PKG_TEST_ME.bdy b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/test/app/packages/TEST_PKG_TEST_ME.pkb similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/test/app/packages/TEST_PKG_TEST_ME.bdy rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/test/app/packages/TEST_PKG_TEST_ME.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/test/app/packages/TEST_PKG_TEST_ME.spc b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/test/app/packages/TEST_PKG_TEST_ME.pks similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/test/app/packages/TEST_PKG_TEST_ME.spc rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/test/app/packages/TEST_PKG_TEST_ME.pks diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/expected-output/utplsql/coverage-sonar-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/expected-output/utplsql/coverage-sonar-report.xml index 4709376..4d584c2 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/expected-output/utplsql/coverage-sonar-report.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/expected-output/utplsql/coverage-sonar-report.xml @@ -1,5 +1,5 @@ - + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/expected-output/utplsql/sonar-test-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/expected-output/utplsql/sonar-test-report.xml index 1908eac..03b1ce5 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/expected-output/utplsql/sonar-test-report.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/expected-output/utplsql/sonar-test-report.xml @@ -1,5 +1,5 @@ - + @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/pom.xml index be0d8b6..c174c87 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/pom.xml @@ -46,8 +46,8 @@ scripts/sources - **/*bdy - **/*spc + **/**.pks + **/**.pkb @@ -55,8 +55,8 @@ scripts/tests - **/*bdy - **/*spc + **/**.pks + **/**.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.bdy b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.pkb similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.bdy rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.spc b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.pks similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.spc rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.pks diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/tables/TO_TEST_ME.tab b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/TO_TEST_ME.sql similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/sources/foo/tables/TO_TEST_ME.tab rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/TO_TEST_ME.sql diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/TO_TEST_ME.tab b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/TO_TEST_ME.tab deleted file mode 100644 index b2e90d9..0000000 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/TO_TEST_ME.tab +++ /dev/null @@ -1,8 +0,0 @@ --- --- This is a table used to demonstrate the UNIT test framework. --- -CREATE TABLE TO_TEST_ME -( - SNAME VARCHAR2(10) -) -/ diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/APP.TEST_PKG_TEST_ME.bdy b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pkb similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/APP.TEST_PKG_TEST_ME.bdy rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/APP.TEST_PKG_TEST_ME.spc b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pks similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/APP.TEST_PKG_TEST_ME.spc rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/APP.TEST_PKG_TEST_ME.pks diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/skip/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/skip/pom.xml index 57911d0..f9264fb 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/skip/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/skip/pom.xml @@ -27,40 +27,6 @@ true - false - - app - - - - UT_COVERAGE_SONAR_REPORTER - utplsql/coverage-sonar-report.xml - true - - - UT_SONAR_TEST_REPORTER - utplsql/sonar-test-report.xml - true - - - - - scripts/sources - - **/*bdy - **/*spc - - - - - - scripts/tests - - **/*bdy - **/*spc - - - diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/expected-output/utplsql/sonar-test-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/expected-output/utplsql/sonar-test-report.xml index e8d63ee..a99f26c 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/expected-output/utplsql/sonar-test-report.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/expected-output/utplsql/sonar-test-report.xml @@ -1,8 +1,8 @@ - + - \ No newline at end of file + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/pom.xml index 433d2c0..01150a1 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/pom.xml @@ -45,8 +45,8 @@ scripts/tests - **/*bdy - **/*spc + **/**.pks + **/**.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/scripts/tests/APP.TEST_PKG_TEST_ME.bdy b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/scripts/tests/APP.TEST_PKG_TEST_ME.pkb similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/scripts/tests/APP.TEST_PKG_TEST_ME.bdy rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/scripts/tests/APP.TEST_PKG_TEST_ME.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/scripts/tests/APP.TEST_PKG_TEST_ME.spc b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/scripts/tests/APP.TEST_PKG_TEST_ME.pks similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/scripts/tests/APP.TEST_PKG_TEST_ME.spc rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/scripts/tests/APP.TEST_PKG_TEST_ME.pks diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/expected-output/utplsql/coverage-sonar-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/expected-output/utplsql/coverage-sonar-report.xml index 8392f3d..5f0d19f 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/expected-output/utplsql/coverage-sonar-report.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/expected-output/utplsql/coverage-sonar-report.xml @@ -1,5 +1,5 @@ - + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/expected-output/utplsql/sonar-test-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/expected-output/utplsql/sonar-test-report.xml index cd174ad..d318de9 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/expected-output/utplsql/sonar-test-report.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/expected-output/utplsql/sonar-test-report.xml @@ -1,5 +1,5 @@ - + @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/pom.xml index e50ba96..3cf0033 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/pom.xml @@ -51,7 +51,9 @@ scripts/sources - **/*sql + **/**.sql + **/**.pks + **/**.pkb @@ -70,7 +72,8 @@ scripts/test - **/*sql + **/**.pks + **/**.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/package_bodies/PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/package_bodies/PKG_TEST_ME.pkb similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/package_bodies/PKG_TEST_ME.sql rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/package_bodies/PKG_TEST_ME.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/packages/PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/packages/PKG_TEST_ME.pks similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/packages/PKG_TEST_ME.sql rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/packages/PKG_TEST_ME.pks diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/tables/TO_TEST_ME.tab b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/tables/TO_TEST_ME.sql similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/tables/TO_TEST_ME.tab rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/tables/TO_TEST_ME.sql diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/tables/TO_TEST_ME.tab b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/tables/TO_TEST_ME.tab deleted file mode 100644 index b2e90d9..0000000 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/sources/app/tables/TO_TEST_ME.tab +++ /dev/null @@ -1,8 +0,0 @@ --- --- This is a table used to demonstrate the UNIT test framework. --- -CREATE TABLE TO_TEST_ME -( - SNAME VARCHAR2(10) -) -/ diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/test/app/package_bodies/TEST_PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/test/app/package_bodies/TEST_PKG_TEST_ME.pkb similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/test/app/package_bodies/TEST_PKG_TEST_ME.sql rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/test/app/package_bodies/TEST_PKG_TEST_ME.pkb diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/test/app/packages/TEST_PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/test/app/packages/TEST_PKG_TEST_ME.pks similarity index 100% rename from src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/test/app/packages/TEST_PKG_TEST_ME.sql rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/scripts/test/app/packages/TEST_PKG_TEST_ME.pks diff --git a/src/test/resources/unit-tests/invalid_tests_directory/pom.xml b/src/test/resources/unit-tests/invalid_tests_directory/pom.xml index 15a85ce..c7380ef 100644 --- a/src/test/resources/unit-tests/invalid_tests_directory/pom.xml +++ b/src/test/resources/unit-tests/invalid_tests_directory/pom.xml @@ -45,8 +45,8 @@ bar - **/*.spc - **/*.bdy + **/**.pks + **/**.pkb diff --git a/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml b/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml index 0f723cc..3e978d5 100644 --- a/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml +++ b/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml @@ -60,8 +60,8 @@ bar - **/*.spc - **/*.bdy + **/**.pks + **/**.pkb diff --git a/src/test/resources/unit-tests/sources_tests_parameters/pom.xml b/src/test/resources/unit-tests/sources_tests_parameters/pom.xml index 2ef33aa..6f4c2d0 100644 --- a/src/test/resources/unit-tests/sources_tests_parameters/pom.xml +++ b/src/test/resources/unit-tests/sources_tests_parameters/pom.xml @@ -64,8 +64,8 @@ te/st - **/*.spc - **/*.bdy + **/**.pks + **/**.pkb diff --git a/src/test/resources/unit-tests/sources_tests_parameters/srcs/file.bdy b/src/test/resources/unit-tests/sources_tests_parameters/srcs/file.pkb similarity index 100% rename from src/test/resources/unit-tests/sources_tests_parameters/srcs/file.bdy rename to src/test/resources/unit-tests/sources_tests_parameters/srcs/file.pkb diff --git a/src/test/resources/unit-tests/sources_tests_parameters/srcs/spec.spc b/src/test/resources/unit-tests/sources_tests_parameters/srcs/spec.pks similarity index 100% rename from src/test/resources/unit-tests/sources_tests_parameters/srcs/spec.spc rename to src/test/resources/unit-tests/sources_tests_parameters/srcs/spec.pks diff --git a/src/test/resources/unit-tests/sources_tests_parameters/te/st/file.bdy b/src/test/resources/unit-tests/sources_tests_parameters/te/st/file.pkb similarity index 100% rename from src/test/resources/unit-tests/sources_tests_parameters/te/st/file.bdy rename to src/test/resources/unit-tests/sources_tests_parameters/te/st/file.pkb diff --git a/src/test/resources/unit-tests/sources_tests_parameters/te/st/spec.spc b/src/test/resources/unit-tests/sources_tests_parameters/te/st/spec.pks similarity index 100% rename from src/test/resources/unit-tests/sources_tests_parameters/te/st/spec.spc rename to src/test/resources/unit-tests/sources_tests_parameters/te/st/spec.pks From d40f1864140990d1688c3dea6b031b749b68f7cd Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Wed, 23 Feb 2022 02:06:37 +0200 Subject: [PATCH 6/8] Update of trigger event --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 094d959..b3a4e7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ on: workflow_dispatch: repository_dispatch: - type: [utPLSQL-build] + type: [utPLSQL-build,utPLSQL-java-api-build] jobs: build: From 76c7e4a40082eb023e09257e0a13287eb87e310a Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 10 Jun 2022 09:21:49 +0200 Subject: [PATCH 7/8] #70 Updated to new API and added oraStuckTimeout parameter --- README.md | 4 + mvnw | 87 +++++++++++- mvnw.cmd | 47 ++++++- pom.xml | 4 +- .../org/utplsql/maven/plugin/UtPlsqlMojo.java | 6 +- .../utplsql/maven/plugin/UtPlsqlMojoIT.java | 7 + .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 16 +++ .../utplsql/coverage-sonar-report.xml | 12 ++ .../utplsql/sonar-test-report.xml | 18 +++ .../UtPlsqlMojoIT/ora_stuck_timeout/pom.xml | 70 ++++++++++ .../scripts/sources/APP.PKG_TEST_ME.pkb | 27 ++++ .../scripts/sources/APP.PKG_TEST_ME.pks | 8 ++ .../scripts/sources/TO_TEST_ME.sql | 8 ++ .../scripts/tests/APP.TEST_PKG_TEST_ME.pkb | 126 ++++++++++++++++++ .../scripts/tests/APP.TEST_PKG_TEST_ME.pks | 88 ++++++++++++ .../unit-tests/ora_stuck_timeout/pom.xml | 55 ++++++++ 16 files changed, 574 insertions(+), 9 deletions(-) create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/expected-output/utplsql/coverage-sonar-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/expected-output/utplsql/sonar-test-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/pom.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/sources/APP.PKG_TEST_ME.pkb create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/sources/APP.PKG_TEST_ME.pks create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/sources/TO_TEST_ME.sql create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/tests/APP.TEST_PKG_TEST_ME.pkb create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/tests/APP.TEST_PKG_TEST_ME.pks create mode 100644 src/test/resources/unit-tests/ora_stuck_timeout/pom.xml diff --git a/README.md b/README.md index 0372794..6385883 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,10 @@ Please refer to the following usage example for the parameters descriptions: false + + + + 0 diff --git a/mvnw b/mvnw index e96ccd5..41c0f0c 100755 --- a/mvnw +++ b/mvnw @@ -19,7 +19,7 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script +# Maven Start Up Batch script # # Required ENV vars: # ------------------ @@ -114,7 +114,6 @@ if $mingw ; then M2_HOME="`(cd "$M2_HOME"; pwd)`" [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? fi if [ -z "$JAVA_HOME" ]; then @@ -200,6 +199,85 @@ if [ -z "$BASE_DIR" ]; then exit 1; fi +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} if [ "$MVNW_VERBOSE" = true ]; then echo $MAVEN_PROJECTBASEDIR @@ -218,6 +296,11 @@ if $cygwin; then MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` fi +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain exec "$JAVACMD" \ diff --git a/mvnw.cmd b/mvnw.cmd index 019bd74..8611571 100755 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -18,7 +18,7 @@ @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script +@REM Maven Start Up Batch script @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @@ -26,7 +26,7 @@ @REM Optional ENV vars @REM M2_HOME - location of maven2's installed home dir @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @REM e.g. to debug Maven itself, use @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @@ -35,7 +35,9 @@ @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' @echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% @REM set %HOME% to equivalent of $HOME @@ -115,10 +117,47 @@ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do s :endReadAdditionalConfig SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* if ERRORLEVEL 1 goto error goto end diff --git a/pom.xml b/pom.xml index 922a508..116cbe5 100644 --- a/pom.xml +++ b/pom.xml @@ -78,13 +78,13 @@ org.apache.maven.shared maven-shared-utils - 3.1.0 + 3.3.4 org.utplsql java-api - 3.1.8 + 3.1.9 diff --git a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java index 5aa52b6..86dd27d 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java @@ -125,6 +125,9 @@ public class UtPlsqlMojo extends AbstractMojo { @Parameter boolean dbmsOutput; + @Parameter(defaultValue = "0") + Integer oraStuckTimeout; + private final SqlFileScanner sqlFileScanner = new SqlFileScanner(); @Override @@ -160,7 +163,8 @@ public void execute() throws MojoExecutionException { .addTags(tags) .randomTestOrder(randomTestOrder) .randomTestOrderSeed(randomTestOrderSeed) - .failOnErrors(!ignoreFailure); + .failOnErrors(!ignoreFailure) + .oraStuckTimeout(oraStuckTimeout); if (isNotBlank(excludeObject)) { if (excludeObject.contains(",")) { diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java index 7057b7f..db91d70 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java @@ -75,4 +75,11 @@ void include_object(MavenExecutionResult result) { assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); } + + @MavenTest + void ora_stuck_timeout(MavenExecutionResult result) { + assertThat(result).isSuccessful(); + + assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); + } } diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 743f7e4..40d5bc0 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -272,6 +272,22 @@ public void skip_utplsql_tests() throws Exception { *

* Given : a pom.xml with dbmsOutput=true * When : pom is read + * Then : Property is set + */ + @Test + public void ora_stuck_timeout() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("ora_stuck_timeout"); + assertNotNull(utPlsqlMojo); + + utPlsqlMojo.execute(); + } + + + /** + * Ora Stuck Timeout + *

+ * Given : a pom.xml with ora-stuck-timeout set + * When : pom is read * Then : DBMS_OUTPUT is enabled */ @Test diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/expected-output/utplsql/coverage-sonar-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/expected-output/utplsql/coverage-sonar-report.xml new file mode 100644 index 0000000..4d584c2 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/expected-output/utplsql/coverage-sonar-report.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/expected-output/utplsql/sonar-test-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/expected-output/utplsql/sonar-test-report.xml new file mode 100644 index 0000000..03b1ce5 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/expected-output/utplsql/sonar-test-report.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/pom.xml new file mode 100644 index 0000000..f0c33da --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/pom.xml @@ -0,0 +1,70 @@ + + 4.0.0 + + org.utplsql + ora-stuck-timeout + 1.0.0 + pom + + + jdbc:oracle:thin:@localhost:1521:xe + UT3 + UT3 + + + + + + org.utplsql + utplsql-maven-plugin + @project.version@ + + + + test + + + 1 + false + + app + + + + UT_COVERAGE_SONAR_REPORTER + utplsql/coverage-sonar-report.xml + true + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + + + scripts/sources + + **/**.pks + **/**.pkb + + + + + + scripts/tests + + **/**.pks + **/**.pkb + + + + + + + + + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/sources/APP.PKG_TEST_ME.pkb b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/sources/APP.PKG_TEST_ME.pkb new file mode 100644 index 0000000..331959d --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/sources/APP.PKG_TEST_ME.pkb @@ -0,0 +1,27 @@ +CREATE OR REPLACE PACKAGE BODY PKG_TEST_ME IS + -- + -- This + -- + FUNCTION FC_TEST_ME(PPARAM1 IN VARCHAR2) RETURN NUMBER IS + BEGIN + IF PPARAM1 IS NULL THEN + RETURN NULL; + ELSIF PPARAM1 = '1' THEN + RETURN 1; + ELSE + RETURN 0; + END IF; + END FC_TEST_ME; + + PROCEDURE PR_TEST_ME(PSNAME IN VARCHAR2) IS + BEGIN + IF PSNAME IS NULL THEN + NULL; + ELSE + INSERT INTO TO_TEST_ME (SNAME) VALUES (PSNAME); + COMMIT; + END IF; + END PR_TEST_ME; + +END PKG_TEST_ME; +/ diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/sources/APP.PKG_TEST_ME.pks b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/sources/APP.PKG_TEST_ME.pks new file mode 100644 index 0000000..26b2589 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/sources/APP.PKG_TEST_ME.pks @@ -0,0 +1,8 @@ +-- +-- This package is used TO demonstrate the utPL/SQL possibilities +-- +CREATE OR REPLACE PACKAGE PKG_TEST_ME AS + FUNCTION FC_TEST_ME(PPARAM1 IN VARCHAR2) RETURN NUMBER; + PROCEDURE PR_TEST_ME(PSNAME IN VARCHAR2); +END PKG_TEST_ME; +/ \ No newline at end of file diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/sources/TO_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/sources/TO_TEST_ME.sql new file mode 100644 index 0000000..b2e90d9 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/sources/TO_TEST_ME.sql @@ -0,0 +1,8 @@ +-- +-- This is a table used to demonstrate the UNIT test framework. +-- +CREATE TABLE TO_TEST_ME +( + SNAME VARCHAR2(10) +) +/ diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/tests/APP.TEST_PKG_TEST_ME.pkb b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/tests/APP.TEST_PKG_TEST_ME.pkb new file mode 100644 index 0000000..115bc15 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/tests/APP.TEST_PKG_TEST_ME.pkb @@ -0,0 +1,126 @@ +CREATE OR REPLACE PACKAGE BODY TEST_PKG_TEST_ME AS + + --------------------------------------------------------------------------- + PROCEDURE SETUP_GLOBAL IS + BEGIN + -- Put here the code which is valid for all tests and that should be + -- executed once. + NULL; + END SETUP_GLOBAL; + + --------------------------------------------------------------------------- + PROCEDURE TEARDOWN_GLOBAL IS + BEGIN + -- Put here the code that should be called only once after all the test + -- have executed + NULL; + END TEARDOWN_GLOBAL; + + --------------------------------------------------------------------------- + PROCEDURE SETUP_TEST IS + BEGIN + -- Nothing to clean up globally + NULL; + END SETUP_TEST; + + PROCEDURE TEARDOWN_TEST IS + BEGIN + -- Nothing to clean up globally + NULL; + END TEARDOWN_TEST; + + PROCEDURE TEST_FC_INPUT_1 IS + BEGIN + -- Ok this is a real test where I check that the function return 1 + -- when called with a '1' parameter + UT.EXPECT(PKG_TEST_ME.FC_TEST_ME('1')).TO_EQUAL(1); + END; + + PROCEDURE SETUP_TEST_FC_INPUT_1 IS + BEGIN + -- Nothing to be done really + NULL; + END; + + PROCEDURE TEARDOWN_TEST_FC_INPUT_1 IS + BEGIN + -- Nothing to be done really + NULL; + END; + + PROCEDURE TEST_FC_INPUT_0 IS + BEGIN + -- Ok this is a real test where I check that the function return 0 + -- when called with a '0' parameter + UT.EXPECT(PKG_TEST_ME.FC_TEST_ME('0')).TO_EQUAL(0); + END; + + PROCEDURE TEST_FC_INPUT_NULL IS + BEGIN + -- Ok I check that the function return NULL + -- when called with a NULL parameter + UT.EXPECT(PKG_TEST_ME.FC_TEST_ME(NULL)).TO_BE_NULL; + END TEST_FC_INPUT_NULL; + + PROCEDURE TEST_PR_TEST_ME_NULL IS + VNCOUNT1 PLS_INTEGER; + VNCOUNT2 PLS_INTEGER; + BEGIN + -- In this example I check that the procedure does + -- not insert anything when passing it a NULL parameter + SELECT COUNT(1) INTO VNCOUNT1 FROM TO_TEST_ME; + PKG_TEST_ME.PR_TEST_ME(NULL); + SELECT COUNT(1) INTO VNCOUNT2 FROM TO_TEST_ME; + UT.EXPECT(VNCOUNT1).TO_EQUAL(VNCOUNT2); + END; + + PROCEDURE TEST_PR_TEST_ME_NOT_NULL IS + VNCOUNT1 PLS_INTEGER; + VNCOUNT2 PLS_INTEGER; + VSNAME TO_TEST_ME.SNAME%TYPE; + BEGIN + -- In this test I will check that I do insert a value + -- when the parameter is not null. I futher check that + -- the procedure has inserted the value I specified. + SELECT COUNT(1) INTO VNCOUNT1 FROM TO_TEST_ME; + VSNAME := TO_CHAR(VNCOUNT1); + PKG_TEST_ME.PR_TEST_ME(VSNAME); + SELECT COUNT(1) INTO VNCOUNT2 FROM TO_TEST_ME; + + -- Check that I have inserted the value + UT.EXPECT(VNCOUNT1 + 1).TO_EQUAL(VNCOUNT2); + SELECT COUNT(1) INTO VNCOUNT2 FROM TO_TEST_ME T WHERE T.SNAME = VSNAME; + + -- Check that I inserted the one I said I would insert + UT.EXPECT(VNCOUNT2).TO_EQUAL(1); + DELETE FROM TO_TEST_ME T WHERE T.SNAME = VSNAME; + COMMIT; + END; + + PROCEDURE TEST_PR_TEST_ME_EXISTS IS + BEGIN + -- In case the value exists the procedure should fail with an exception. + BEGIN + PKG_TEST_ME.PR_TEST_ME('EXISTS'); + PKG_TEST_ME.PR_TEST_ME('EXISTS'); + EXCEPTION + WHEN OTHERS THEN + UT.FAIL('Unexpected exception raised'); + END; + END; + + PROCEDURE TEST_PR_TEST_ME_CURSOR IS + TYPE REF_CURSOR IS REF CURSOR; + VEXPECTED REF_CURSOR; + VACTUAL REF_CURSOR; + BEGIN + EXECUTE IMMEDIATE 'TRUNCATE TABLE TO_TEST_ME'; + OPEN VEXPECTED FOR + SELECT T.SNAME FROM TO_TEST_ME T; + OPEN VACTUAL FOR + SELECT T.SNAME FROM TO_TEST_ME T; + UT.EXPECT(VEXPECTED).TO_(EQUAL(VACTUAL)); + END; + +END; +/ diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/tests/APP.TEST_PKG_TEST_ME.pks b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/tests/APP.TEST_PKG_TEST_ME.pks new file mode 100644 index 0000000..8a2b852 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/scripts/tests/APP.TEST_PKG_TEST_ME.pks @@ -0,0 +1,88 @@ +CREATE OR REPLACE PACKAGE TEST_PKG_TEST_ME AS + -- %suite(TEST_PKG_TEST_ME) + -- %suitepath(plsql.examples) + -- + -- This package shows all the possibilities to unit test + -- your PL/SQL package. NOTE that it is not limited to + -- testing your package. You can do that on all your + -- procedure/functions... + -- + + /** + * This two parameters are used by the test framework in + * order to identify the test suite to run + */ + + /* + * This method is invoked once before any other method. + * It should contain all the setup code that is relevant + * for all your test. It might be inserting a register, + * creating a type, etc... + */ + -- %beforeall + PROCEDURE SETUP_GLOBAL; + + /* + * This method is invoked once after all other method. + * It can be used to clean up all the resources that + * you created in your script + */ + -- %afterall + PROCEDURE TEARDOWN_GLOBAL; + + /* + * This method is called once before each test. + */ + -- %beforeeach + PROCEDURE SETUP_TEST; + + /* + * This method is called once after each test. + */ + -- %aftereach + PROCEDURE TEARDOWN_TEST; + + /** + * This is a real test. The main test can declare a setup + * and teardown method in order to setup and cleanup things + * for that specific test. + */ + -- %test + -- %displayname(Checking if function ('1') returns 1) + -- %beforetest(SETUP_TEST_FC_INPUT_1) + -- %aftertest(TEARDOWN_TEST_FC_INPUT_1) + PROCEDURE TEST_FC_INPUT_1; + PROCEDURE SETUP_TEST_FC_INPUT_1; + PROCEDURE TEARDOWN_TEST_FC_INPUT_1; + + -- %test + -- %displayname(Checking if function ('0') returns 0) + PROCEDURE TEST_FC_INPUT_0; + + -- %test + -- %displayname(Checking if function (NULL) returns NULL) + PROCEDURE TEST_FC_INPUT_NULL; + + -- %test + -- %displayname(Checking if procedure (NULL) insert) + PROCEDURE TEST_PR_TEST_ME_NULL; + + -- %test + -- %displayname(Checking if procedure (NOT NULL) insert) + -- %rollback(manual) + PROCEDURE TEST_PR_TEST_ME_NOT_NULL; + + -- %test + -- %displayname(Checking if procedure (NOT NULL) insert while existing) + -- %rollback(manual) + -- %tags(exists) + PROCEDURE TEST_PR_TEST_ME_EXISTS; + + -- %test + -- %displayname(Demonstrating the use of cursor) + -- %rollback(manual) + -- %tags(cursor) + PROCEDURE TEST_PR_TEST_ME_CURSOR; + +END; +/ diff --git a/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml b/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml new file mode 100644 index 0000000..08824f7 --- /dev/null +++ b/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + org.utplsql + utplsql-maven-plugin-test + 3.1.0-SNAPSHOT + pom + + + jdbc:oracle:thin:@127.0.0.1:1521:xe + UT3 + UT3 + + + + ../../../target + + + org.utplsql + utplsql-maven-plugin + @proj + + test + + + 0 + false + + app + + + + UT_DOCUMENTATION_REPORTER + + + UT_DOCUMENTATION_REPORTER + false + + + UT_COVERAGE_SONAR_REPORTER + coverage-sonar-report.xml + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + + + + + From 0afdbd51d310bbfa624838b9ebc2b26dcd1a4c19 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 10 Jun 2022 09:31:08 +0200 Subject: [PATCH 8/8] Update versions for release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 116cbe5..5a97c58 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.10-SNAPSHOT + 3.1.10 maven-plugin utPLSQL Maven Plugin