From e062fb9c0c66d76060f5feae218aacb99fe17f41 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 09:54:55 +0100 Subject: [PATCH 001/200] Update for next development version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b4422e6..95825cb 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.5 + 3.1.6-SNAPSHOT maven-plugin utPLSQL Maven Plugin From 01a7defd1e3dd0d771be4c63fd2c7d5af3ead727 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 10:21:18 +0100 Subject: [PATCH 002/200] Deploy from tags --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ffb48ba..0591815 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,7 +52,7 @@ deploy: script: bash .travis/deploy_release.sh on: repo: utPLSQL/utPLSQL-maven-plugin - branch: main + tags: true notifications: slack: From ee89c89fc2e6e0ab3e77a182c461bc4fd714cda2 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 10:30:48 +0100 Subject: [PATCH 003/200] Update versions for release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 95825cb..6fec584 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.6-SNAPSHOT + 3.1.6 maven-plugin utPLSQL Maven Plugin From d2c8c3a2139a61bfb3d490e13977efe1d30169d0 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 10:30:51 +0100 Subject: [PATCH 004/200] Update for next development version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6fec584..381a393 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.6 + 3.1.7-SNAPSHOT maven-plugin utPLSQL Maven Plugin From b612a046b66bf8d53aab0c38428e26af7cb80098 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 10:32:20 +0100 Subject: [PATCH 005/200] Updated to most recent version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 96c7e87..9312db8 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Please refer to the following usage example for the parameters descriptions: org.utplsql utplsql-maven-plugin - 3.1.5 + 3.1.6 From 569539d8d20f8578a93fb0bfb430e648a270ee1d Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 10:52:45 +0100 Subject: [PATCH 006/200] Update versions for release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 381a393..1990734 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.7-SNAPSHOT + 3.1.7 maven-plugin utPLSQL Maven Plugin From d8318fad7da4d5d94f272215de17280cea00554c Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 10:52:48 +0100 Subject: [PATCH 007/200] Update for next development version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1990734..00fe8ea 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.7 + 3.1.8-SNAPSHOT maven-plugin utPLSQL Maven Plugin From d6161841f902bd81889111aa794b69928168aec0 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 11:43:12 +0100 Subject: [PATCH 008/200] Updated to most recent version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9312db8..96c7e87 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Please refer to the following usage example for the parameters descriptions: org.utplsql utplsql-maven-plugin - 3.1.6 + 3.1.5 From 4e75a68165f6b7dafafcf0dd0b00c5c077c9c272 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 11:50:33 +0100 Subject: [PATCH 009/200] Fixed version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 00fe8ea..95825cb 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.8-SNAPSHOT + 3.1.6-SNAPSHOT maven-plugin utPLSQL Maven Plugin From 240b2333452a66e80e38eaf9011d462093c2a6ce Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 12:19:59 +0100 Subject: [PATCH 010/200] Cleaned Maven scripts --- .travis/deploy_release.sh | 3 --- .travis/deploy_snapshot.sh | 8 -------- 2 files changed, 11 deletions(-) diff --git a/.travis/deploy_release.sh b/.travis/deploy_release.sh index d6590e9..5e41660 100755 --- a/.travis/deploy_release.sh +++ b/.travis/deploy_release.sh @@ -1,7 +1,4 @@ #!/bin/bash set -ev -VERSION=$(tr -d "/v/" <<<${TRAVIS_TAG}) -mvn org.codehaus.mojo:versions-maven-plugin:2.7:set -DnewVersion=${VERSION} - mvn deploy -DskipTests -U -Prelease diff --git a/.travis/deploy_snapshot.sh b/.travis/deploy_snapshot.sh index 27a6878..5e41660 100755 --- a/.travis/deploy_snapshot.sh +++ b/.travis/deploy_snapshot.sh @@ -1,12 +1,4 @@ #!/bin/bash set -ev -#DATE=`date +%Y%m%d%H%M` -# Using this solution to get version into variable: https://stackoverflow.com/a/26514030/1470603 -#OLD_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) -#VERSION=`sed "s/-SNAPSHOT/-${DATE}-SNAPSHOT/g" <<<"${OLD_VERSION}"` - -#echo "Changing snapshot version, OLD: ${OLD_VERSION} NEW: ${VERSION}" -#mvn org.codehaus.mojo:versions-maven-plugin:2.7:set -DnewVersion=${VERSION} - mvn deploy -DskipTests -U -Prelease From 12e57f96d6536369132874eeca0b6acdc1a1790d Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 13:36:04 +0100 Subject: [PATCH 011/200] Updated dependencies. Restructured test artifacts --- pom.xml | 47 +++++------- .../plugin/{test => }/UtPLSQLMojoIT.java | 2 +- .../plugin/{test => }/UtPLSQLMojoTest.java | 71 +++++++++---------- .../defaultConsoleOutputBehaviour/pom.xml | 0 .../invalidTestsSourcesDirectories/pom.xml | 0 .../missingDirectory/pom.xml | 0 .../missingDirectory/src/main/plsql/f1.sql | 0 .../src/main/plsql/foo/f2.sql | 0 .../missingDirectory/src/test/plsql/f2.pkg | 0 .../src/test/plsql/foo/f1.pkg | 0 .../src/test/plsql/foo/f1.sql | 0 .../missingIncludes/pom.xml | 0 .../missingIncludes/src/main/foo/f1.sql | 0 .../missingIncludes/src/main/foo/foo/f2.sql | 0 .../missingIncludes/src/test/bar/f2.pkg | 0 .../missingIncludes/src/test/bar/foo/f1.pkg | 0 .../missingIncludes/src/test/bar/foo/f1.sql | 0 .../{ => unit-tests}/skipUtplsqlTests/pom.xml | 0 .../directoryDoesNotExist/pom.xml | 0 .../directoryExists/pom.xml | 0 .../directoryExists/src/main/plsql/f1.sql | 0 .../directoryExists/src/main/plsql/f2.sql | 0 .../directoryExists/src/test/plsql/f2.pkg | 0 .../directoryExists/src/test/plsql/foo/f1.pkg | 0 .../directoryExists/src/test/plsql/foo/f1.sql | 0 .../testSourcesTestsParams/pom.xml | 0 .../testSourcesTestsParams/srcs/file.bdy | 0 .../testSourcesTestsParams/srcs/foo.sql | 0 .../testSourcesTestsParams/srcs/spec.spc | 0 .../testSourcesTestsParams/te/st/file.bdy | 0 .../testSourcesTestsParams/te/st/foo.sql | 0 .../testSourcesTestsParams/te/st/spec.spc | 0 32 files changed, 49 insertions(+), 71 deletions(-) rename src/test/java/org/utplsql/maven/plugin/{test => }/UtPLSQLMojoIT.java (99%) rename src/test/java/org/utplsql/maven/plugin/{test => }/UtPLSQLMojoTest.java (86%) rename src/test/resources/{ => unit-tests}/defaultConsoleOutputBehaviour/pom.xml (100%) rename src/test/resources/{ => unit-tests}/invalidTestsSourcesDirectories/pom.xml (100%) rename src/test/resources/{ => unit-tests}/partialSourceAndTestTag/missingDirectory/pom.xml (100%) rename src/test/resources/{ => unit-tests}/partialSourceAndTestTag/missingDirectory/src/main/plsql/f1.sql (100%) rename src/test/resources/{ => unit-tests}/partialSourceAndTestTag/missingDirectory/src/main/plsql/foo/f2.sql (100%) rename src/test/resources/{ => unit-tests}/partialSourceAndTestTag/missingDirectory/src/test/plsql/f2.pkg (100%) rename src/test/resources/{ => unit-tests}/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.pkg (100%) rename src/test/resources/{ => unit-tests}/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.sql (100%) rename src/test/resources/{ => unit-tests}/partialSourceAndTestTag/missingIncludes/pom.xml (100%) rename src/test/resources/{ => unit-tests}/partialSourceAndTestTag/missingIncludes/src/main/foo/f1.sql (100%) rename src/test/resources/{ => unit-tests}/partialSourceAndTestTag/missingIncludes/src/main/foo/foo/f2.sql (100%) rename src/test/resources/{ => unit-tests}/partialSourceAndTestTag/missingIncludes/src/test/bar/f2.pkg (100%) rename src/test/resources/{ => unit-tests}/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.pkg (100%) rename src/test/resources/{ => unit-tests}/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.sql (100%) rename src/test/resources/{ => unit-tests}/skipUtplsqlTests/pom.xml (100%) rename src/test/resources/{ => unit-tests}/testNoSourcesTestsParams/directoryDoesNotExist/pom.xml (100%) rename src/test/resources/{ => unit-tests}/testNoSourcesTestsParams/directoryExists/pom.xml (100%) rename src/test/resources/{ => unit-tests}/testNoSourcesTestsParams/directoryExists/src/main/plsql/f1.sql (100%) rename src/test/resources/{ => unit-tests}/testNoSourcesTestsParams/directoryExists/src/main/plsql/f2.sql (100%) rename src/test/resources/{ => unit-tests}/testNoSourcesTestsParams/directoryExists/src/test/plsql/f2.pkg (100%) rename src/test/resources/{ => unit-tests}/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.pkg (100%) rename src/test/resources/{ => unit-tests}/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.sql (100%) rename src/test/resources/{ => unit-tests}/testSourcesTestsParams/pom.xml (100%) rename src/test/resources/{ => unit-tests}/testSourcesTestsParams/srcs/file.bdy (100%) rename src/test/resources/{ => unit-tests}/testSourcesTestsParams/srcs/foo.sql (100%) rename src/test/resources/{ => unit-tests}/testSourcesTestsParams/srcs/spec.spc (100%) rename src/test/resources/{ => unit-tests}/testSourcesTestsParams/te/st/file.bdy (100%) rename src/test/resources/{ => unit-tests}/testSourcesTestsParams/te/st/foo.sql (100%) rename src/test/resources/{ => unit-tests}/testSourcesTestsParams/te/st/spec.spc (100%) diff --git a/pom.xml b/pom.xml index 95825cb..f007e47 100644 --- a/pom.xml +++ b/pom.xml @@ -64,13 +64,11 @@ jaxb-core 3.0.1 - javax.xml.bind jaxb-api ${jaxb.version} - com.sun.xml.bind jaxb-impl @@ -94,19 +92,16 @@ maven-core ${maven.version} - org.apache.maven maven-model ${maven.version} - org.apache.maven maven-plugin-api ${maven.version} - org.apache.maven.plugin-tools maven-plugin-annotations @@ -127,54 +122,44 @@ ${maven.version} test - - - org.powermock - powermock-module-junit4 - ${powermock.version} - test - - - - org.powermock - powermock-api-mockito2 - ${powermock.version} - test - - org.apache.maven.plugin-testing maven-plugin-testing-harness 3.3.0 test - - org.assertj - assertj-core - 3.21.0 + org.apache.maven.shared + maven-verifier + 1.7.2 test - junit - junit - 4.13.2 + org.powermock + powermock-module-junit4 + ${powermock.version} test - - org.apache.maven.shared - maven-verifier - 1.6 + org.powermock + powermock-api-mockito2 + ${powermock.version} test + commons-io commons-io 2.6 test + + org.slf4j + slf4j-simple + 1.7.32 + test + diff --git a/src/test/java/org/utplsql/maven/plugin/test/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java similarity index 99% rename from src/test/java/org/utplsql/maven/plugin/test/UtPLSQLMojoIT.java rename to src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java index c3f322a..bac7f18 100644 --- a/src/test/java/org/utplsql/maven/plugin/test/UtPLSQLMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java @@ -1,4 +1,4 @@ -package org.utplsql.maven.plugin.test; +package org.utplsql.maven.plugin; import org.apache.commons.io.FileUtils; import org.apache.maven.it.VerificationException; diff --git a/src/test/java/org/utplsql/maven/plugin/test/UtPLSQLMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java similarity index 86% rename from src/test/java/org/utplsql/maven/plugin/test/UtPLSQLMojoTest.java rename to src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java index 024a672..058afa6 100644 --- a/src/test/java/org/utplsql/maven/plugin/test/UtPLSQLMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java @@ -1,4 +1,4 @@ -package org.utplsql.maven.plugin.test; +package org.utplsql.maven.plugin; import org.apache.commons.lang3.tuple.Pair; import org.apache.maven.plugin.MojoExecutionException; @@ -47,9 +47,6 @@ public class UtPLSQLMojoTest { @Rule public MojoRule rule = new MojoRule(); - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Mock public Connection mockConnection; @@ -71,54 +68,50 @@ public void setUp() throws Exception { /** * testInvalidSourcesDirectory. *

- * Given : a pom.xml with invalid sources' directory When : pom is read and - * buildSourcesOptions is run Then : it should throw a MojoExecutionException + * Given : a pom.xml with invalid sources' directory + * When : pom is read andbuildSourcesOptions is run + * Then : it should throw a MojoExecutionException */ @Test public void testInvalidSourcesDirectory() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/invalidTestsSourcesDirectories/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalidTestsSourcesDirectories/"), "test"); Assert.assertNotNull(utplsqlMojo); - // Expected exception - thrown.expect(MojoExecutionException.class); - // Excepted message - thrown.expectMessage("Invalid in your pom.xml"); + MojoExecutionException exception = Assert.assertThrows(MojoExecutionException.class, () -> Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions")); - Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions"); + Assert.assertEquals("Invalid in your pom.xml", exception.getMessage()); } /** * testInvalidTestsDirectory. *

- * Given : a pom.xml with invalid tests' directory When : pom is read and - * buildTestsOptions is run Then : it should throw a MojoExecutionException + * Given : a pom.xml with invalid tests' directory + * When : pom is read and buildTestsOptions is run + * Then : it should throw a MojoExecutionException */ @Test public void testInvalidTestsDirectory() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/invalidTestsSourcesDirectories/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalidTestsSourcesDirectories/"), "test"); Assert.assertNotNull(utplsqlMojo); - // Expected exception - thrown.expect(MojoExecutionException.class); - // Excepted message - thrown.expectMessage("Invalid in your pom.xml"); + MojoExecutionException exception = Assert.assertThrows(MojoExecutionException.class, () -> Whitebox.invokeMethod(utplsqlMojo, "buildTestsOptions")); - Whitebox.invokeMethod(utplsqlMojo, "buildTestsOptions"); + Assert.assertEquals("Invalid in your pom.xml: Invalid bar in resource. Check your pom.xml", exception.getMessage()); } /** * testSourcesTestsParameters. *

- * Given : a pom.xml with sources and tests with a lot of parameters When : pom - * is read and buildSourcesOptions / buildTestsOptions are run Then : it should - * fill all parameters correctly + * Given : a pom.xml with sources and tests with a lot of parameters + * When : pom is read and buildSourcesOptions / buildTestsOptions are run + * Then : it should fill all parameters correctly */ @Test public void testSourcesTestsParameters() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/testSourcesTestsParams/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/testSourcesTestsParams/"), "test"); Assert.assertNotNull(utplsqlMojo); // TODO : move to another test about reporters @@ -156,14 +149,14 @@ public void testSourcesTestsParameters() throws Exception { /** * testSourcesAndTestsParameterDoesNotExist. *

- * Given : a pom.xml with no sources / tests tags and default directory does not - * exist. When : pom is read and buildSourcesOptions / buildTestsOptions are run + * Given : a pom.xml with no sources / tests tags and default directory does not exist. + * When : pom is read and buildSourcesOptions / buildTestsOptions are run * Then : it should not find any source files */ @Test public void testSourcesAndTestsParameterDoesNotExist() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule.lookupConfiguredMojo( - new File("src/test/resources/testNoSourcesTestsParams/directoryDoesNotExist/"), "test"); + new File("src/test/resources/unit-tests/testNoSourcesTestsParams/directoryDoesNotExist/"), "test"); Assert.assertNotNull(utplsqlMojo); // check sources @@ -179,13 +172,13 @@ public void testSourcesAndTestsParameterDoesNotExist() throws Exception { * testSourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists. *

* Given : a pom.xml with no sources / tests tags but default directory exists. - * When : pom is read and buildSourcesOptions / buildTestsOptions are run Then : - * it should find all sources/tests files in default directories + * When : pom is read and buildSourcesOptions / buildTestsOptions are run + * Then : it should find all sources/tests files in default directories */ @Test public void testSourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/testNoSourcesTestsParams/directoryExists/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/"), "test"); Assert.assertNotNull(utplsqlMojo); // check sources @@ -205,13 +198,13 @@ public void testSourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() * testSourcesAndTestsParameterHaveNotDirectoryTag. *

* Given : a pom.xml with source and test tag not containing a directory tag. - * When : pom is read and buildSourcesOptions / buildTestsOptions are run Then : - * it should find all sources/tests files in default directories + * When : pom is read and buildSourcesOptions / buildTestsOptions are run + * Then : it should find all sources/tests files in default directories */ @Test public void testSourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/partialSourceAndTestTag/missingDirectory/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/"), "test"); Assert.assertNotNull(utplsqlMojo); // check sources @@ -232,13 +225,13 @@ public void testSourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { * testSourcesAndTestsParameterHaveNotDirectoryTag. *

* Given : a pom.xml with source and test tag not containing a directory tag. - * When : pom is read and buildSourcesOptions / buildTestsOptions are run Then : - * it should find all sources/tests files in default directories + * When : pom is read and buildSourcesOptions / buildTestsOptions are run + * Then : it should find all sources/tests files in default directories */ @Test public void testSourcesAndTestsParameterHaveNotIncludesTag() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/partialSourceAndTestTag/missingIncludes/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/"), "test"); Assert.assertNotNull(utplsqlMojo); // check sources @@ -257,7 +250,7 @@ public void testSourcesAndTestsParameterHaveNotIncludesTag() throws Exception { @Test public void testDefaultConsoleBehaviour() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/defaultConsoleOutputBehaviour/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/defaultConsoleOutputBehaviour/"), "test"); Assert.assertNotNull(utplsqlMojo); List reporterList = new ArrayList<>(); @@ -302,7 +295,7 @@ public void testDefaultConsoleBehaviour() throws Exception { @Test public void testAddDefaultReporter() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/defaultConsoleOutputBehaviour/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/defaultConsoleOutputBehaviour/"), "test"); Assert.assertNotNull(utplsqlMojo); List reporterList = new ArrayList<>(); @@ -326,7 +319,7 @@ public void testAddDefaultReporter() throws Exception { @Test public void testSkipUtplsqlTests() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/skipUtplsqlTests/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/skipUtplsqlTests/"), "test"); Assert.assertNotNull(utplsqlMojo); final ByteArrayOutputStream console = new ByteArrayOutputStream(); diff --git a/src/test/resources/defaultConsoleOutputBehaviour/pom.xml b/src/test/resources/unit-tests/defaultConsoleOutputBehaviour/pom.xml similarity index 100% rename from src/test/resources/defaultConsoleOutputBehaviour/pom.xml rename to src/test/resources/unit-tests/defaultConsoleOutputBehaviour/pom.xml diff --git a/src/test/resources/invalidTestsSourcesDirectories/pom.xml b/src/test/resources/unit-tests/invalidTestsSourcesDirectories/pom.xml similarity index 100% rename from src/test/resources/invalidTestsSourcesDirectories/pom.xml rename to src/test/resources/unit-tests/invalidTestsSourcesDirectories/pom.xml diff --git a/src/test/resources/partialSourceAndTestTag/missingDirectory/pom.xml b/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/pom.xml similarity index 100% rename from src/test/resources/partialSourceAndTestTag/missingDirectory/pom.xml rename to src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/pom.xml diff --git a/src/test/resources/partialSourceAndTestTag/missingDirectory/src/main/plsql/f1.sql b/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/main/plsql/f1.sql similarity index 100% rename from src/test/resources/partialSourceAndTestTag/missingDirectory/src/main/plsql/f1.sql rename to src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/main/plsql/f1.sql diff --git a/src/test/resources/partialSourceAndTestTag/missingDirectory/src/main/plsql/foo/f2.sql b/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/main/plsql/foo/f2.sql similarity index 100% rename from src/test/resources/partialSourceAndTestTag/missingDirectory/src/main/plsql/foo/f2.sql rename to src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/main/plsql/foo/f2.sql diff --git a/src/test/resources/partialSourceAndTestTag/missingDirectory/src/test/plsql/f2.pkg b/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/test/plsql/f2.pkg similarity index 100% rename from src/test/resources/partialSourceAndTestTag/missingDirectory/src/test/plsql/f2.pkg rename to src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/test/plsql/f2.pkg diff --git a/src/test/resources/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.pkg b/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.pkg similarity index 100% rename from src/test/resources/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.pkg rename to src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.pkg diff --git a/src/test/resources/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.sql b/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.sql similarity index 100% rename from src/test/resources/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.sql rename to src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.sql diff --git a/src/test/resources/partialSourceAndTestTag/missingIncludes/pom.xml b/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/pom.xml similarity index 100% rename from src/test/resources/partialSourceAndTestTag/missingIncludes/pom.xml rename to src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/pom.xml diff --git a/src/test/resources/partialSourceAndTestTag/missingIncludes/src/main/foo/f1.sql b/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/main/foo/f1.sql similarity index 100% rename from src/test/resources/partialSourceAndTestTag/missingIncludes/src/main/foo/f1.sql rename to src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/main/foo/f1.sql diff --git a/src/test/resources/partialSourceAndTestTag/missingIncludes/src/main/foo/foo/f2.sql b/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/main/foo/foo/f2.sql similarity index 100% rename from src/test/resources/partialSourceAndTestTag/missingIncludes/src/main/foo/foo/f2.sql rename to src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/main/foo/foo/f2.sql diff --git a/src/test/resources/partialSourceAndTestTag/missingIncludes/src/test/bar/f2.pkg b/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/test/bar/f2.pkg similarity index 100% rename from src/test/resources/partialSourceAndTestTag/missingIncludes/src/test/bar/f2.pkg rename to src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/test/bar/f2.pkg diff --git a/src/test/resources/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.pkg b/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.pkg similarity index 100% rename from src/test/resources/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.pkg rename to src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.pkg diff --git a/src/test/resources/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.sql b/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.sql similarity index 100% rename from src/test/resources/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.sql rename to src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.sql diff --git a/src/test/resources/skipUtplsqlTests/pom.xml b/src/test/resources/unit-tests/skipUtplsqlTests/pom.xml similarity index 100% rename from src/test/resources/skipUtplsqlTests/pom.xml rename to src/test/resources/unit-tests/skipUtplsqlTests/pom.xml diff --git a/src/test/resources/testNoSourcesTestsParams/directoryDoesNotExist/pom.xml b/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryDoesNotExist/pom.xml similarity index 100% rename from src/test/resources/testNoSourcesTestsParams/directoryDoesNotExist/pom.xml rename to src/test/resources/unit-tests/testNoSourcesTestsParams/directoryDoesNotExist/pom.xml diff --git a/src/test/resources/testNoSourcesTestsParams/directoryExists/pom.xml b/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/pom.xml similarity index 100% rename from src/test/resources/testNoSourcesTestsParams/directoryExists/pom.xml rename to src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/pom.xml diff --git a/src/test/resources/testNoSourcesTestsParams/directoryExists/src/main/plsql/f1.sql b/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/main/plsql/f1.sql similarity index 100% rename from src/test/resources/testNoSourcesTestsParams/directoryExists/src/main/plsql/f1.sql rename to src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/main/plsql/f1.sql diff --git a/src/test/resources/testNoSourcesTestsParams/directoryExists/src/main/plsql/f2.sql b/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/main/plsql/f2.sql similarity index 100% rename from src/test/resources/testNoSourcesTestsParams/directoryExists/src/main/plsql/f2.sql rename to src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/main/plsql/f2.sql diff --git a/src/test/resources/testNoSourcesTestsParams/directoryExists/src/test/plsql/f2.pkg b/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/test/plsql/f2.pkg similarity index 100% rename from src/test/resources/testNoSourcesTestsParams/directoryExists/src/test/plsql/f2.pkg rename to src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/test/plsql/f2.pkg diff --git a/src/test/resources/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.pkg b/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.pkg similarity index 100% rename from src/test/resources/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.pkg rename to src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.pkg diff --git a/src/test/resources/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.sql b/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.sql similarity index 100% rename from src/test/resources/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.sql rename to src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.sql diff --git a/src/test/resources/testSourcesTestsParams/pom.xml b/src/test/resources/unit-tests/testSourcesTestsParams/pom.xml similarity index 100% rename from src/test/resources/testSourcesTestsParams/pom.xml rename to src/test/resources/unit-tests/testSourcesTestsParams/pom.xml diff --git a/src/test/resources/testSourcesTestsParams/srcs/file.bdy b/src/test/resources/unit-tests/testSourcesTestsParams/srcs/file.bdy similarity index 100% rename from src/test/resources/testSourcesTestsParams/srcs/file.bdy rename to src/test/resources/unit-tests/testSourcesTestsParams/srcs/file.bdy diff --git a/src/test/resources/testSourcesTestsParams/srcs/foo.sql b/src/test/resources/unit-tests/testSourcesTestsParams/srcs/foo.sql similarity index 100% rename from src/test/resources/testSourcesTestsParams/srcs/foo.sql rename to src/test/resources/unit-tests/testSourcesTestsParams/srcs/foo.sql diff --git a/src/test/resources/testSourcesTestsParams/srcs/spec.spc b/src/test/resources/unit-tests/testSourcesTestsParams/srcs/spec.spc similarity index 100% rename from src/test/resources/testSourcesTestsParams/srcs/spec.spc rename to src/test/resources/unit-tests/testSourcesTestsParams/srcs/spec.spc diff --git a/src/test/resources/testSourcesTestsParams/te/st/file.bdy b/src/test/resources/unit-tests/testSourcesTestsParams/te/st/file.bdy similarity index 100% rename from src/test/resources/testSourcesTestsParams/te/st/file.bdy rename to src/test/resources/unit-tests/testSourcesTestsParams/te/st/file.bdy diff --git a/src/test/resources/testSourcesTestsParams/te/st/foo.sql b/src/test/resources/unit-tests/testSourcesTestsParams/te/st/foo.sql similarity index 100% rename from src/test/resources/testSourcesTestsParams/te/st/foo.sql rename to src/test/resources/unit-tests/testSourcesTestsParams/te/st/foo.sql diff --git a/src/test/resources/testSourcesTestsParams/te/st/spec.spc b/src/test/resources/unit-tests/testSourcesTestsParams/te/st/spec.spc similarity index 100% rename from src/test/resources/testSourcesTestsParams/te/st/spec.spc rename to src/test/resources/unit-tests/testSourcesTestsParams/te/st/spec.spc From 7157a4b91cf3bd20d6c03a2cef4f2caf11444231 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 13:41:44 +0100 Subject: [PATCH 012/200] Code clean up --- pom.xml | 4 +- .../org/utplsql/maven/plugin/UtPLSQLMojo.java | 99 +++++++------------ .../maven/plugin/reporter/ReporterWriter.java | 1 - .../utplsql/maven/plugin/UtPLSQLMojoTest.java | 10 +- 4 files changed, 44 insertions(+), 70 deletions(-) diff --git a/pom.xml b/pom.xml index f007e47..6339468 100644 --- a/pom.xml +++ b/pom.xml @@ -247,7 +247,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.1 attach-javadocs @@ -274,7 +274,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.0.1 sign-artifacts diff --git a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java index aaad826..6643e2c 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java @@ -67,14 +67,14 @@ public class UtPLSQLMojo extends AbstractMojo { protected boolean skipCompatibilityCheck; @Parameter - protected List reporters = new ArrayList<>(); + protected final List reporters = new ArrayList<>(); @Parameter - protected List paths = new ArrayList<>(); + protected final List paths = new ArrayList<>(); // Sources Configuration @Parameter - protected List sources = new ArrayList<>(); + protected final List sources = new ArrayList<>(); @Parameter private String sourcesOwner; @@ -96,7 +96,7 @@ public class UtPLSQLMojo extends AbstractMojo { // Tests Configuration @Parameter - protected List tests = new ArrayList<>(); + protected final List tests = new ArrayList<>(); @Parameter private String testsOwner; @@ -244,37 +244,7 @@ private FileMapperOptions buildSourcesOptions() throws MojoExecutionException { List scripts = SQLScannerHelper.findSQLs(project.getBasedir(), sources, PluginDefault.SOURCE_DIRECTORY, PluginDefault.SOURCE_FILE_PATTERN); - FileMapperOptions fileMapperOptions = new FileMapperOptions(scripts); - - if (StringUtils.isNotEmpty(sourcesOwner)) { - fileMapperOptions.setObjectOwner(sourcesOwner); - } - - if (StringUtils.isNotEmpty(sourcesRegexExpression)) { - fileMapperOptions.setRegexPattern(sourcesRegexExpression); - } - - if (sourcesOwnerSubexpression != null) { - fileMapperOptions.setOwnerSubExpression(sourcesOwnerSubexpression); - } - - if (sourcesNameSubexpression != null) { - fileMapperOptions.setNameSubExpression(sourcesNameSubexpression); - } - - if (sourcesTypeSubexpression != null) { - fileMapperOptions.setTypeSubExpression(sourcesTypeSubexpression); - } - - if (sourcesCustomTypeMapping != null && !sourcesCustomTypeMapping.isEmpty()) { - fileMapperOptions.setTypeMappings(new ArrayList<>()); - for (CustomTypeMapping typeMapping : sourcesCustomTypeMapping) { - fileMapperOptions.getTypeMappings() - .add(new KeyValuePair(typeMapping.getCustomMapping(), typeMapping.getType())); - } - } - - return fileMapperOptions; + return createFileMapperOptions(scripts, sourcesOwner, sourcesRegexExpression, sourcesOwnerSubexpression, sourcesNameSubexpression, sourcesTypeSubexpression, sourcesCustomTypeMapping); } catch (Exception e) { throw new MojoExecutionException("Invalid in your pom.xml", e); @@ -295,42 +265,49 @@ private FileMapperOptions buildTestsOptions() throws MojoExecutionException { List scripts = SQLScannerHelper.findSQLs(project.getBasedir(), tests, PluginDefault.TEST_DIRECTORY, PluginDefault.TEST_FILE_PATTERN); - FileMapperOptions fileMapperOptions = new FileMapperOptions(scripts); + return createFileMapperOptions(scripts, testsOwner, testsRegexExpression, testsOwnerSubexpression, + testsNameSubexpression, testsTypeSubexpression, testsCustomTypeMapping); - if (StringUtils.isNotEmpty(testsOwner)) { - fileMapperOptions.setObjectOwner(testsOwner); - } + } catch (Exception e) { + throw new MojoExecutionException("Invalid in your pom.xml: " + e.getMessage()); + } - if (StringUtils.isNotEmpty(testsRegexExpression)) { - fileMapperOptions.setRegexPattern(testsRegexExpression); - } + } - if (testsOwnerSubexpression != null) { - fileMapperOptions.setOwnerSubExpression(testsOwnerSubexpression); - } + private FileMapperOptions createFileMapperOptions(List scripts, String objectOwner, String regexPattern, + Integer ownerSubExpression, Integer nameSubExpression, + Integer typeSubExpression, List typeMappings) { + FileMapperOptions fileMapperOptions = new FileMapperOptions(scripts); - if (testsNameSubexpression != null) { - fileMapperOptions.setNameSubExpression(testsNameSubexpression); - } + if (StringUtils.isNotEmpty(objectOwner)) { + fileMapperOptions.setObjectOwner(objectOwner); + } - if (testsTypeSubexpression != null) { - fileMapperOptions.setTypeSubExpression(testsTypeSubexpression); - } + if (StringUtils.isNotEmpty(regexPattern)) { + fileMapperOptions.setRegexPattern(regexPattern); + } - if (testsCustomTypeMapping != null && !testsCustomTypeMapping.isEmpty()) { - fileMapperOptions.setTypeMappings(new ArrayList<>()); - for (CustomTypeMapping typeMapping : testsCustomTypeMapping) { - fileMapperOptions.getTypeMappings() - .add(new KeyValuePair(typeMapping.getCustomMapping(), typeMapping.getType())); - } - } + if (ownerSubExpression != null) { + fileMapperOptions.setOwnerSubExpression(ownerSubExpression); + } - return fileMapperOptions; + if (nameSubExpression != null) { + fileMapperOptions.setNameSubExpression(nameSubExpression); + } - } catch (Exception e) { - throw new MojoExecutionException("Invalid in your pom.xml: " + e.getMessage()); + if (typeSubExpression != null) { + fileMapperOptions.setTypeSubExpression(typeSubExpression); + } + + if (typeMappings != null && !typeMappings.isEmpty()) { + fileMapperOptions.setTypeMappings(new ArrayList<>()); + for (CustomTypeMapping typeMapping : typeMappings) { + fileMapperOptions.getTypeMappings() + .add(new KeyValuePair(typeMapping.getCustomMapping(), typeMapping.getType())); + } } + return fileMapperOptions; } private List initReporters(Connection connection, Version utlVersion, ReporterFactory reporterFactory) diff --git a/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java b/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java index 78a0b39..0a8eea4 100644 --- a/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java +++ b/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java @@ -3,7 +3,6 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; -import org.apache.maven.plugin.logging.SystemStreamLog; import org.utplsql.api.Version; import org.utplsql.api.outputBuffer.OutputBuffer; import org.utplsql.api.outputBuffer.OutputBufferProvider; diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java index 058afa6..ad19cec 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java @@ -7,7 +7,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.Mock; import org.powermock.core.classloader.annotations.PrepareForTest; @@ -18,7 +17,6 @@ import org.utplsql.api.Version; import org.utplsql.api.reporter.Reporter; import org.utplsql.api.reporter.ReporterFactory; -import org.utplsql.maven.plugin.UtPLSQLMojo; import org.utplsql.maven.plugin.model.ReporterParameter; import org.utplsql.maven.plugin.reporter.ReporterWriter; @@ -45,7 +43,7 @@ public class UtPLSQLMojoTest { @Rule - public MojoRule rule = new MojoRule(); + public final MojoRule rule = new MojoRule(); @Mock public Connection mockConnection; @@ -69,7 +67,7 @@ public void setUp() throws Exception { * testInvalidSourcesDirectory. *

* Given : a pom.xml with invalid sources' directory - * When : pom is read andbuildSourcesOptions is run + * When : pom is read and buildSourcesOptions is run * Then : it should throw a MojoExecutionException */ @Test @@ -275,8 +273,8 @@ public void testDefaultConsoleBehaviour() throws Exception { } // Assert that we added only the necessary reporters to the writer. - ReporterWriter reporterWritter = Whitebox.getInternalState(utplsqlMojo, "reporterWriter"); - List> listReporters = Whitebox.getInternalState(reporterWritter, "listReporters"); + ReporterWriter reporterWriter = Whitebox.getInternalState(utplsqlMojo, "reporterWriter"); + List> listReporters = Whitebox.getInternalState(reporterWriter, "listReporters"); assertEquals(3, listReporters.size()); ReporterParameter reporterParameter1 = listReporters.get(0).getRight(); From c5ad29568292f9cd2385cfeeb8f56fd7ccea6ab7 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 13:47:37 +0100 Subject: [PATCH 013/200] Create maven-publish.yml --- .github/workflows/maven-publish.yml | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/maven-publish.yml diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..34005ed --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,34 @@ +# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path + +name: Maven Package + +on: + release: + types: [created] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }}/.travis # location for the settings.xml file + + - name: Build with Maven + run: mvn -B package --file pom.xml + + - name: Publish to Maven Central + run: mvn deploy -s $GITHUB_WORKSPACE/.travis/settings.xml + env: + GITHUB_TOKEN: ${{ github.token }} From 10636583bc495a9b97e51f06563910b78ef3f629 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 13:49:24 +0100 Subject: [PATCH 014/200] Code clean up --- src/main/java/org/utplsql/maven/plugin/helper/PluginDefault.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/utplsql/maven/plugin/helper/PluginDefault.java b/src/main/java/org/utplsql/maven/plugin/helper/PluginDefault.java index ef50d39..e3a2b88 100644 --- a/src/main/java/org/utplsql/maven/plugin/helper/PluginDefault.java +++ b/src/main/java/org/utplsql/maven/plugin/helper/PluginDefault.java @@ -33,7 +33,6 @@ public class PluginDefault { public static final String TEST_FILE_PATTERN = "**/*.pkg"; private PluginDefault() { - // NA } /** From dc4e45fd5e3acd4050f225a4a337843187c25584 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 13:50:59 +0100 Subject: [PATCH 015/200] Reverted maven-verifier version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6339468..f66d8cf 100644 --- a/pom.xml +++ b/pom.xml @@ -131,7 +131,7 @@ org.apache.maven.shared maven-verifier - 1.7.2 + 1.6 test From badb196e53b866af83a6d08f6bb220407ac99224 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 13:55:15 +0100 Subject: [PATCH 016/200] Added maven-test.yml --- .github/workflows/maven-publish.yml | 34 --------------------------- .github/workflows/maven-test.yml | 36 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 34 deletions(-) delete mode 100644 .github/workflows/maven-publish.yml create mode 100644 .github/workflows/maven-test.yml diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml deleted file mode 100644 index 34005ed..0000000 --- a/.github/workflows/maven-publish.yml +++ /dev/null @@ -1,34 +0,0 @@ -# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created -# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path - -name: Maven Package - -on: - release: - types: [created] - -jobs: - build: - - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 8 - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'adopt' - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }}/.travis # location for the settings.xml file - - - name: Build with Maven - run: mvn -B package --file pom.xml - - - name: Publish to Maven Central - run: mvn deploy -s $GITHUB_WORKSPACE/.travis/settings.xml - env: - GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/maven-test.yml b/.github/workflows/maven-test.yml new file mode 100644 index 0000000..f3ce1fa --- /dev/null +++ b/.github/workflows/maven-test.yml @@ -0,0 +1,36 @@ +name: Maven Test + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the develop branch + push: + branches: [ develop ] + pull_request: + branches: [ develop ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Maven test + run: mvn test From 257a372b6419709f681d152ed7ba9faa2448c50e Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 20 Nov 2021 13:56:56 +0100 Subject: [PATCH 017/200] Re-added JUnit dependency --- pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pom.xml b/pom.xml index f66d8cf..ad92810 100644 --- a/pom.xml +++ b/pom.xml @@ -135,6 +135,13 @@ test + + junit + junit + 4.13.2 + test + + org.powermock powermock-module-junit4 From 087df26e8e64ae1583b9f80d779644f25b02c11a Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 09:38:42 +0100 Subject: [PATCH 018/200] Updated build status --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 96c7e87..73cfe18 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build status](https://travis-ci.org/utPLSQL/utPLSQL-maven-plugin.svg?branch=develop)](https://travis-ci.org/utPLSQL/utPLSQL-maven-plugin) +![Build status](https://github.com/utPLSQL/utPLSQL-maven-plugin/actions/workflows/maven-test.yml/badge.svg) [![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=org.utplsql%3Autplsql-maven-plugin&metric=alert_status)](https://sonarcloud.io/dashboard?id=org.utplsql%3Autplsql-maven-plugin) # utPLSQL-maven-plugin From bd74fed8181e67f1496c1755508e6c2208c60ba5 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 09:41:33 +0100 Subject: [PATCH 019/200] Updated build status --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 73cfe18..68a32e6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Build status](https://github.com/utPLSQL/utPLSQL-maven-plugin/actions/workflows/maven-test.yml/badge.svg) +[![Build status](https://github.com/utPLSQL/utPLSQL-maven-plugin/actions/workflows/maven-test.yml/badge.svg)](https://github.com/utPLSQL/utPLSQL-maven-plugin/actions/workflows/maven-test.yml) [![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=org.utplsql%3Autplsql-maven-plugin&metric=alert_status)](https://sonarcloud.io/dashboard?id=org.utplsql%3Autplsql-maven-plugin) # utPLSQL-maven-plugin From 1afc55652f9fd97a37d16784170838d01245117a Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 17:26:56 +0100 Subject: [PATCH 020/200] Migration to GitHub Actions --- .github/init_scripts/1_install_utplsql.sh | 9 + .github/init_scripts/2_create_users.sql | 25 ++ .github/init_scripts/3_create_app_objects.sql | 263 ++++++++++++++++++ .../4_create_source_owner_objects.sql | 47 ++++ .../5_create_tests_owner_objects.sql | 215 ++++++++++++++ .../workflows/{maven-test.yml => build.yml} | 0 .travis.yml | 62 ----- README.md | 2 +- .../utplsql/maven/plugin/UtPLSQLMojoIT.java | 69 ++--- .../utplsql/coverage-sonar-reporter.xml | 10 +- .../foo/package_bodies/PKG_TEST_ME.sql | 3 +- .../utplsql/coverage-sonar-reporter.xml | 10 +- .../sources/app/packages/PKG_TEST_ME.bdy | 3 +- .../utplsql/coverage-sonar-reporter.xml | 10 +- .../scripts/sources/APP.PKG_TEST_ME.bdy | 3 +- .../utplsql/coverage-sonar-reporter.xml | 10 +- 16 files changed, 605 insertions(+), 136 deletions(-) create mode 100644 .github/init_scripts/1_install_utplsql.sh create mode 100644 .github/init_scripts/2_create_users.sql create mode 100644 .github/init_scripts/3_create_app_objects.sql create mode 100644 .github/init_scripts/4_create_source_owner_objects.sql create mode 100644 .github/init_scripts/5_create_tests_owner_objects.sql rename .github/workflows/{maven-test.yml => build.yml} (100%) delete mode 100644 .travis.yml diff --git a/.github/init_scripts/1_install_utplsql.sh b/.github/init_scripts/1_install_utplsql.sh new file mode 100644 index 0000000..f650ed1 --- /dev/null +++ b/.github/init_scripts/1_install_utplsql.sh @@ -0,0 +1,9 @@ +UTPLSQL_DOWNLOAD_URL=$(curl --silent https://api.github.com/repos/utPLSQL/utPLSQL/releases/latest | awk '/browser_download_url/ { print $2 }' | grep ".zip\"" | sed 's/"//g') + +curl -Lk "${UTPLSQL_DOWNLOAD_URL}" -o utPLSQL.zip + +unzip -q utPLSQL.zip + +cd utPLSQL/source + +sqlplus sys/oracle@//localhost/XE as sysdba @install_headless.sql UT3 UT3 users diff --git a/.github/init_scripts/2_create_users.sql b/.github/init_scripts/2_create_users.sql new file mode 100644 index 0000000..23ad31b --- /dev/null +++ b/.github/init_scripts/2_create_users.sql @@ -0,0 +1,25 @@ +define UTPLSQL_USER = 'UT3'; +define APP_USER = 'APP'; +define CODE_OWNER = 'CODE_OWNER'; +define TESTS_OWNER = 'TESTS_OWNER'; +define DB_PASS = 'pass'; + +grant execute any procedure to &UTPLSQL_USER; +grant create any procedure to &UTPLSQL_USER; +grant execute on dbms_lob to &UTPLSQL_USER; +grant execute on dbms_sql to &UTPLSQL_USER; +grant execute on dbms_xmlgen to &UTPLSQL_USER; +grant execute on dbms_lock to &UTPLSQL_USER; + +create user &APP_USER identified by &DB_PASS quota unlimited on USERS default tablespace USERS; +grant create session, create procedure, create type, create table, create sequence, create view to &APP_USER; +grant select any dictionary to &APP_USER; + +create user &CODE_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS; +grant create session, create procedure, create type, create table, create sequence, create view to &CODE_OWNER; + +create user &TESTS_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS; +grant create session, create procedure, create type, create table, create sequence, create view, create synonym to &TESTS_OWNER; +grant select any dictionary to &TESTS_OWNER; +grant select any table, delete any table, drop any table to &TESTS_OWNER; +grant execute any procedure to &TESTS_OWNER; diff --git a/.github/init_scripts/3_create_app_objects.sql b/.github/init_scripts/3_create_app_objects.sql new file mode 100644 index 0000000..f15cc3f --- /dev/null +++ b/.github/init_scripts/3_create_app_objects.sql @@ -0,0 +1,263 @@ +ALTER SESSION SET CURRENT_SCHEMA = APP; + +-- +-- This is a table used to demonstrate the UNIT test framework. +-- +CREATE TABLE TO_TEST_ME +( + SNAME VARCHAR2(10) +); +/ + +-- +-- 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; +/ + +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; +/ + +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; +/ + +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/.github/init_scripts/4_create_source_owner_objects.sql b/.github/init_scripts/4_create_source_owner_objects.sql new file mode 100644 index 0000000..0c16344 --- /dev/null +++ b/.github/init_scripts/4_create_source_owner_objects.sql @@ -0,0 +1,47 @@ +ALTER SESSION SET CURRENT_SCHEMA = CODE_OWNER; + +-- +-- This is a table used to demonstrate the UNIT test framework. +-- +CREATE TABLE TO_TEST_ME +( + SNAME VARCHAR2(10) +); +/ + +-- +-- 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; +/ + +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/.github/init_scripts/5_create_tests_owner_objects.sql b/.github/init_scripts/5_create_tests_owner_objects.sql new file mode 100644 index 0000000..dddf677 --- /dev/null +++ b/.github/init_scripts/5_create_tests_owner_objects.sql @@ -0,0 +1,215 @@ +ALTER SESSION SET CURRENT_SCHEMA = TESTS_OWNER; + +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) + PROCEDURE TEST_PR_TEST_ME_EXISTS; + + -- %test + -- %displayname(Demonstrating the use of cursor) + -- %rollback(manual) + PROCEDURE TEST_PR_TEST_ME_CURSOR; + +END; +/ + +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(CODE_OWNER.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(CODE_OWNER.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(CODE_OWNER.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 CODE_OWNER.TO_TEST_ME; + CODE_OWNER.PKG_TEST_ME.PR_TEST_ME(NULL); + SELECT COUNT(1) INTO VNCOUNT2 FROM CODE_OWNER.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 CODE_OWNER.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 CODE_OWNER.TO_TEST_ME; + VSNAME := TO_CHAR(VNCOUNT1); + CODE_OWNER.PKG_TEST_ME.PR_TEST_ME(VSNAME); + SELECT COUNT(1) INTO VNCOUNT2 FROM CODE_OWNER.TO_TEST_ME; + + -- Check that I have inserted the value + UT.EXPECT(VNCOUNT1 + 1).TO_EQUAL(VNCOUNT2); + SELECT COUNT(1) INTO VNCOUNT2 FROM CODE_OWNER.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 CODE_OWNER.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 + CODE_OWNER.PKG_TEST_ME.PR_TEST_ME('EXISTS'); + CODE_OWNER.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 CODE_OWNER.TO_TEST_ME T; + OPEN VACTUAL FOR + SELECT T.SNAME FROM CODE_OWNER.TO_TEST_ME T; + UT.EXPECT(VEXPECTED).TO_(EQUAL(VACTUAL)); + END; + +END; +/ diff --git a/.github/workflows/maven-test.yml b/.github/workflows/build.yml similarity index 100% rename from .github/workflows/maven-test.yml rename to .github/workflows/build.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0591815..0000000 --- a/.travis.yml +++ /dev/null @@ -1,62 +0,0 @@ -sudo: required -language: java - -services: - - docker - -jdk: - - openjdk8 - -env: - global: - - DOCKER_CFG=$HOME/.docker - - DOCKER_REPO="utplsqlv3/oracledb" - - CACHE_DIR=$HOME/.cache - - MAVEN_HOME=/usr/local/maven - - MAVEN_CFG=$HOME/.m2 - - DB_URL="127.0.0.1:1521:XE" - - DB_UT3_USER=ut3 - - DB_UT3_PASS=ut3 - - ORACLE_VERSION="11g-r2-xe" - - DOCKER_OPTIONS="--shm-size=1g" - -cache: - directories: - - $DOCKER_CFG - - $CACHE_DIR - - $MAVEN_CFG - -install: - - bash .travis/maven_cfg.sh - - bash .travis/start_db.sh - - bash .travis/install_utplsql.sh - - bash .travis/install_demo_project.sh - -script: - - echo "Run Verify with Coverage" - - mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify -DdbUser="${DB_UT3_USER}" -DdbPass="${DB_UT3_PASS}" -DdbUrl="jdbc:oracle:thin:@${DB_URL}" - -before_deploy: - - echo $GPG_SECRET_KEYS | base64 --decode | ${GPG_EXECUTABLE} --import - - echo $GPG_OWNERTRUST | base64 --decode | ${GPG_EXECUTABLE} --import-ownertrust - -deploy: - - provider: script - skip_cleanup: true - script: bash .travis/deploy_snapshot.sh - on: - repo: utPLSQL/utPLSQL-maven-plugin - branch: develop - - provider: script - skip_cleanup: true - script: bash .travis/deploy_release.sh - on: - repo: utPLSQL/utPLSQL-maven-plugin - tags: true - -notifications: - slack: - rooms: - - secure: "Gz0pGOOM6xbnz8Q/B3RzOFoVr8QGXsDSHcgCloPnO3ZkEOh4JJikqWAVdZrksMxhewIBRpbdIWAZOgsNXvW+cEDXxfml3X9Clj2wg5Uon97UeI+5WEHDhLYHn7t9EYr9QvVSOuQgBIiddk6kURxY4N0eAA4VUti8BDcMRq+gPxF1w/toFJXVR/I/tkLxcHPTbWQ9X87nNWcQgMoHe2AixYpglntmtoLXJ5F8MF08fcyTX7GJQ5xjq7HbYy+/39nEhQo2ZPhHHfk2rS6gIUY0wc+MAqobxvesplgGDybdTQyrdl48VjJ/CiQDedglUbNN9VYTFjPIYMdWCUCLV1uL866aNMiBpB7CQoNhi5WS7RERE9gblVPX2k6tOda27fEWlhjha6OmdK6TQ9qTITU7U4OTSOz41dDPeVfqMHRggxo3ozlLONTiZ1y9fz/Ez9WjiJjtUDt60vgnVIo7BcQV/yDJcqAtQbfWyf0n73g5lMBvLGnO2Agm2N7hNEeCbpr+PZUoqkEM/e4SxdUCQGi8Ppi9Zp0E4v0iG7hyjzol+G4T8JN0bUGg0OOow/bfZa5J2aUsrC1qP/ZLpMA94NI6ZlL2wRHhZ9JtVSDLjtSwq9yW5XF7o7kdqBWBCslbGnYPoCoHOzfZuUvArSlRoGNu75dw/Qhoo9gFl1RG/RlChaU=" - on_success: change - on_failure: always diff --git a/README.md b/README.md index 68a32e6..536d11c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build status](https://github.com/utPLSQL/utPLSQL-maven-plugin/actions/workflows/maven-test.yml/badge.svg)](https://github.com/utPLSQL/utPLSQL-maven-plugin/actions/workflows/maven-test.yml) +[![Build status](https://github.com/utPLSQL/utPLSQL-maven-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/utPLSQL/utPLSQL-maven-plugin/actions/workflows/build.yml) [![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=org.utplsql%3Autplsql-maven-plugin&metric=alert_status)](https://sonarcloud.io/dashboard?id=org.utplsql%3Autplsql-maven-plugin) # utPLSQL-maven-plugin diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java index bac7f18..1722a79 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java @@ -45,12 +45,7 @@ public void testSimpleProject() { File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); Verifier verifier; - verifier = new Verifier(testProject.getAbsolutePath()); - verifier.addCliOption("-N"); - verifier.addCliOption("-Dutplsql-maven-plugin-version=" + pluginVersion); - verifier.addCliOption("-DdbUrl=" + System.getProperty("dbUrl")); - verifier.addCliOption("-DdbUser=" + System.getProperty("dbUser")); - verifier.addCliOption("-DdbPass=" + System.getProperty("dbPass")); + verifier = createVerifier(testProject); verifier.executeGoal("test"); @@ -68,14 +63,7 @@ public void testRegexProject() { final String PROJECT_NAME = "regex-project"; File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); - Verifier verifier; - verifier = new Verifier(testProject.getAbsolutePath()); - verifier.addCliOption("-N"); - verifier.addCliOption("-Dutplsql-maven-plugin-version=" + pluginVersion); - verifier.addCliOption("-DdbUrl=" + System.getProperty("dbUrl")); - verifier.addCliOption("-DdbUser=" + System.getProperty("dbUser")); - verifier.addCliOption("-DdbPass=" + System.getProperty("dbPass")); - + Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", @@ -92,14 +80,7 @@ public void testTypeMappingProject() { final String PROJECT_NAME = "type-mapping-project"; File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); - Verifier verifier; - verifier = new Verifier(testProject.getAbsolutePath()); - verifier.addCliOption("-N"); - verifier.addCliOption("-Dutplsql-maven-plugin-version=" + pluginVersion); - verifier.addCliOption("-DdbUrl=" + System.getProperty("dbUrl")); - verifier.addCliOption("-DdbUser=" + System.getProperty("dbUser")); - verifier.addCliOption("-DdbPass=" + System.getProperty("dbPass")); - + Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", @@ -116,14 +97,7 @@ public void testOwnerParameterProject() { final String PROJECT_NAME = "owner-param-project"; File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); - Verifier verifier; - verifier = new Verifier(testProject.getAbsolutePath()); - verifier.addCliOption("-N"); - verifier.addCliOption("-Dutplsql-maven-plugin-version=" + pluginVersion); - verifier.addCliOption("-DdbUrl=" + System.getProperty("dbUrl")); - verifier.addCliOption("-DdbUser=" + System.getProperty("dbUser")); - verifier.addCliOption("-DdbPass=" + System.getProperty("dbPass")); - + Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", @@ -140,14 +114,7 @@ public void testMinimalistProject() { final String PROJECT_NAME = "minimalist-project"; File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); - Verifier verifier; - verifier = new Verifier(testProject.getAbsolutePath()); - verifier.addCliOption("-N"); - verifier.addCliOption("-Dutplsql-maven-plugin-version=" + pluginVersion); - verifier.addCliOption("-DdbUrl=" + System.getProperty("dbUrl")); - verifier.addCliOption("-DdbUser=" + System.getProperty("dbUser")); - verifier.addCliOption("-DdbPass=" + System.getProperty("dbPass")); - + Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); } catch (Exception e) { e.printStackTrace(); @@ -161,14 +128,7 @@ public void testTagsProject() { final String PROJECT_NAME = "tags-project"; File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); - Verifier verifier; - verifier = new Verifier(testProject.getAbsolutePath()); - verifier.addCliOption("-N"); - verifier.addCliOption("-Dutplsql-maven-plugin-version=" + pluginVersion); - verifier.addCliOption("-DdbUrl=" + System.getProperty("dbUrl")); - verifier.addCliOption("-DdbUser=" + System.getProperty("dbUser")); - verifier.addCliOption("-DdbPass=" + System.getProperty("dbPass")); - + Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml"); @@ -199,11 +159,26 @@ private void checkReportsGenerated(String projectName, String... files) { stream.close(); Assert.assertEquals("The files differ!", - FileUtils.readFileToString(expectedOutputFile, "utf-8").replace("\r", ""), outputContent); + FileUtils.readFileToString(expectedOutputFile, "utf-8") + .replace("\r", "") + .replace("\n", ""), + outputContent.replace("\n", "")); } catch (IOException e) { e.printStackTrace(); Assert.fail("Unexpected Exception running the test : " + e.getMessage()); } } } + + private Verifier createVerifier(File testProject) throws VerificationException { + Verifier verifier; + verifier = new Verifier(testProject.getAbsolutePath()); + verifier.addCliOption("-N"); + verifier.addCliOption("-Dutplsql-maven-plugin-version=" + pluginVersion); + verifier.addCliOption("-DdbUrl=jdbc:oracle:thin:@localhost:1521:XE"); + verifier.addCliOption("-DdbUser=UT3"); + verifier.addCliOption("-DdbPass=UT3"); + return verifier; + } + } diff --git a/src/test/resources/owner-param-project/expected-output/utplsql/coverage-sonar-reporter.xml b/src/test/resources/owner-param-project/expected-output/utplsql/coverage-sonar-reporter.xml index 6718aa5..22f929c 100644 --- a/src/test/resources/owner-param-project/expected-output/utplsql/coverage-sonar-reporter.xml +++ b/src/test/resources/owner-param-project/expected-output/utplsql/coverage-sonar-reporter.xml @@ -1,12 +1,12 @@ + - - - + + + - - \ No newline at end of file + diff --git a/src/test/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql b/src/test/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql index 894119f..d6846b2 100644 --- a/src/test/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql +++ b/src/test/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql @@ -1,5 +1,4 @@ CREATE OR REPLACE PACKAGE BODY CODE_OWNER.PKG_TEST_ME IS - -- -- This -- @@ -25,4 +24,4 @@ CREATE OR REPLACE PACKAGE BODY CODE_OWNER.PKG_TEST_ME IS END PR_TEST_ME; END PKG_TEST_ME; -/ \ No newline at end of file +/ diff --git a/src/test/resources/regex-project/expected-output/utplsql/coverage-sonar-reporter.xml b/src/test/resources/regex-project/expected-output/utplsql/coverage-sonar-reporter.xml index 0628e51..b7a6aa2 100644 --- a/src/test/resources/regex-project/expected-output/utplsql/coverage-sonar-reporter.xml +++ b/src/test/resources/regex-project/expected-output/utplsql/coverage-sonar-reporter.xml @@ -1,12 +1,12 @@ + - - - + + + - - \ No newline at end of file + diff --git a/src/test/resources/regex-project/scripts/sources/app/packages/PKG_TEST_ME.bdy b/src/test/resources/regex-project/scripts/sources/app/packages/PKG_TEST_ME.bdy index 29cea5e..8769df3 100644 --- a/src/test/resources/regex-project/scripts/sources/app/packages/PKG_TEST_ME.bdy +++ b/src/test/resources/regex-project/scripts/sources/app/packages/PKG_TEST_ME.bdy @@ -1,5 +1,4 @@ CREATE OR REPLACE PACKAGE BODY APP.PKG_TEST_ME IS - -- -- This -- @@ -25,4 +24,4 @@ CREATE OR REPLACE PACKAGE BODY APP.PKG_TEST_ME IS END PR_TEST_ME; END PKG_TEST_ME; -/ \ No newline at end of file +/ diff --git a/src/test/resources/simple-project/expected-output/utplsql/coverage-sonar-reporter.xml b/src/test/resources/simple-project/expected-output/utplsql/coverage-sonar-reporter.xml index 5824011..4709376 100644 --- a/src/test/resources/simple-project/expected-output/utplsql/coverage-sonar-reporter.xml +++ b/src/test/resources/simple-project/expected-output/utplsql/coverage-sonar-reporter.xml @@ -1,12 +1,12 @@ + - - - + + + - - \ No newline at end of file + diff --git a/src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy b/src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy index d7f60de..331959d 100644 --- a/src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy +++ b/src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy @@ -1,5 +1,4 @@ CREATE OR REPLACE PACKAGE BODY PKG_TEST_ME IS - -- -- This -- @@ -25,4 +24,4 @@ CREATE OR REPLACE PACKAGE BODY PKG_TEST_ME IS END PR_TEST_ME; END PKG_TEST_ME; -/ \ No newline at end of file +/ diff --git a/src/test/resources/type-mapping-project/expected-output/utplsql/coverage-sonar-reporter.xml b/src/test/resources/type-mapping-project/expected-output/utplsql/coverage-sonar-reporter.xml index f046682..8392f3d 100644 --- a/src/test/resources/type-mapping-project/expected-output/utplsql/coverage-sonar-reporter.xml +++ b/src/test/resources/type-mapping-project/expected-output/utplsql/coverage-sonar-reporter.xml @@ -1,12 +1,12 @@ + - - - + + + - - \ No newline at end of file + From 3b9e463421b4395e0868ac57d8b273691826e23d Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 17:27:31 +0100 Subject: [PATCH 021/200] Renamed build --- .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 f3ce1fa..1ca3b1b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Maven Test +name: Build # Controls when the workflow will run on: From 4d8deeb7f107a52913d6320080b972318e753b0e Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 17:32:51 +0100 Subject: [PATCH 022/200] Added oracle service --- .github/workflows/build.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ca3b1b..978575a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,8 +16,23 @@ jobs: runs-on: ubuntu-latest + services: + + oracle: + image: gvenzl/oracle-xe:18.4.0-slim + env: + ORACLE_PASSWORD: oracle + ports: + - 1521:1521 + options: >- + --health-cmd healthcheck.sh + --health-interval 10s + --health-timeout 5s + --health-retries 10 + steps: - uses: actions/checkout@v2 + - name: Set up JDK 8 uses: actions/setup-java@v2 with: From 6ddd6b0c657398bcba1f63f76e67f4422f3b4515 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 17:37:05 +0100 Subject: [PATCH 023/200] Maven verfiy activated --- .github/workflows/build.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 978575a..b0dbd8f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,11 +24,7 @@ jobs: ORACLE_PASSWORD: oracle ports: - 1521:1521 - options: >- - --health-cmd healthcheck.sh - --health-interval 10s - --health-timeout 5s - --health-retries 10 + options: -v ${{ github.workspace }}/.github/init_scripts:/container-entrypoint-initdb.d --health-cmd healthcheck.sh --health-interval 10s --health-timeout 5s --health-retries 10 steps: - uses: actions/checkout@v2 @@ -47,5 +43,5 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - - name: Maven test - run: mvn test + - name: Maven verify + run: mvn verify From ccb59ab5a97f747f1d68c4d4a17bb841575fbecd Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 17:40:14 +0100 Subject: [PATCH 024/200] Moved init scripts --- .github/workflows/build.yml | 2 +- .../1_install_utplsql.sh | 0 .../2_create_users.sql | 0 .../3_create_app_objects.sql | 0 .../4_create_source_owner_objects.sql | 0 .../5_create_tests_owner_objects.sql | 0 6 files changed, 1 insertion(+), 1 deletion(-) rename {.github/init_scripts => container-entrypoint-initdb.d}/1_install_utplsql.sh (100%) rename {.github/init_scripts => container-entrypoint-initdb.d}/2_create_users.sql (100%) rename {.github/init_scripts => container-entrypoint-initdb.d}/3_create_app_objects.sql (100%) rename {.github/init_scripts => container-entrypoint-initdb.d}/4_create_source_owner_objects.sql (100%) rename {.github/init_scripts => container-entrypoint-initdb.d}/5_create_tests_owner_objects.sql (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0dbd8f..6de7b2b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: ORACLE_PASSWORD: oracle ports: - 1521:1521 - options: -v ${{ github.workspace }}/.github/init_scripts:/container-entrypoint-initdb.d --health-cmd healthcheck.sh --health-interval 10s --health-timeout 5s --health-retries 10 + options: -v ${{ github.workspace }}/container-entrypoint-initdb.d:/container-entrypoint-initdb.d --health-cmd healthcheck.sh --health-interval 10s --health-timeout 5s --health-retries 10 steps: - uses: actions/checkout@v2 diff --git a/.github/init_scripts/1_install_utplsql.sh b/container-entrypoint-initdb.d/1_install_utplsql.sh similarity index 100% rename from .github/init_scripts/1_install_utplsql.sh rename to container-entrypoint-initdb.d/1_install_utplsql.sh diff --git a/.github/init_scripts/2_create_users.sql b/container-entrypoint-initdb.d/2_create_users.sql similarity index 100% rename from .github/init_scripts/2_create_users.sql rename to container-entrypoint-initdb.d/2_create_users.sql diff --git a/.github/init_scripts/3_create_app_objects.sql b/container-entrypoint-initdb.d/3_create_app_objects.sql similarity index 100% rename from .github/init_scripts/3_create_app_objects.sql rename to container-entrypoint-initdb.d/3_create_app_objects.sql diff --git a/.github/init_scripts/4_create_source_owner_objects.sql b/container-entrypoint-initdb.d/4_create_source_owner_objects.sql similarity index 100% rename from .github/init_scripts/4_create_source_owner_objects.sql rename to container-entrypoint-initdb.d/4_create_source_owner_objects.sql diff --git a/.github/init_scripts/5_create_tests_owner_objects.sql b/container-entrypoint-initdb.d/5_create_tests_owner_objects.sql similarity index 100% rename from .github/init_scripts/5_create_tests_owner_objects.sql rename to container-entrypoint-initdb.d/5_create_tests_owner_objects.sql From fa681aae7103d032558a3a5cd4a347183e65d9cb Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 17:46:34 +0100 Subject: [PATCH 025/200] Moved init scripts because . are not allowed --- .github/workflows/build.yml | 2 +- .../1_install_utplsql.sh | 0 .../2_create_users.sql | 0 .../3_create_app_objects.sql | 0 .../4_create_source_owner_objects.sql | 0 .../5_create_tests_owner_objects.sql | 0 scripts/oraclexe_local.sh | 1 + 7 files changed, 2 insertions(+), 1 deletion(-) rename {container-entrypoint-initdb.d => init_scripts}/1_install_utplsql.sh (100%) rename {container-entrypoint-initdb.d => init_scripts}/2_create_users.sql (100%) rename {container-entrypoint-initdb.d => init_scripts}/3_create_app_objects.sql (100%) rename {container-entrypoint-initdb.d => init_scripts}/4_create_source_owner_objects.sql (100%) rename {container-entrypoint-initdb.d => init_scripts}/5_create_tests_owner_objects.sql (100%) create mode 100644 scripts/oraclexe_local.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6de7b2b..2509bd9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: ORACLE_PASSWORD: oracle ports: - 1521:1521 - options: -v ${{ github.workspace }}/container-entrypoint-initdb.d:/container-entrypoint-initdb.d --health-cmd healthcheck.sh --health-interval 10s --health-timeout 5s --health-retries 10 + options: -v ${{ github.workspace }}/init_scripts:/container-entrypoint-initdb.d --health-cmd healthcheck.sh --health-interval 10s --health-timeout 5s --health-retries 10 steps: - uses: actions/checkout@v2 diff --git a/container-entrypoint-initdb.d/1_install_utplsql.sh b/init_scripts/1_install_utplsql.sh similarity index 100% rename from container-entrypoint-initdb.d/1_install_utplsql.sh rename to init_scripts/1_install_utplsql.sh diff --git a/container-entrypoint-initdb.d/2_create_users.sql b/init_scripts/2_create_users.sql similarity index 100% rename from container-entrypoint-initdb.d/2_create_users.sql rename to init_scripts/2_create_users.sql diff --git a/container-entrypoint-initdb.d/3_create_app_objects.sql b/init_scripts/3_create_app_objects.sql similarity index 100% rename from container-entrypoint-initdb.d/3_create_app_objects.sql rename to init_scripts/3_create_app_objects.sql diff --git a/container-entrypoint-initdb.d/4_create_source_owner_objects.sql b/init_scripts/4_create_source_owner_objects.sql similarity index 100% rename from container-entrypoint-initdb.d/4_create_source_owner_objects.sql rename to init_scripts/4_create_source_owner_objects.sql diff --git a/container-entrypoint-initdb.d/5_create_tests_owner_objects.sql b/init_scripts/5_create_tests_owner_objects.sql similarity index 100% rename from container-entrypoint-initdb.d/5_create_tests_owner_objects.sql rename to init_scripts/5_create_tests_owner_objects.sql diff --git a/scripts/oraclexe_local.sh b/scripts/oraclexe_local.sh new file mode 100644 index 0000000..7240eff --- /dev/null +++ b/scripts/oraclexe_local.sh @@ -0,0 +1 @@ +docker run --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle -v ../init_scripts:/container-entrypoint-initdb.d gvenzl/oracle-xe:18.4.0-slim From eaf7706f707e2c72dfc45e04c4d50312a5406a74 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 17:57:12 +0100 Subject: [PATCH 026/200] Using 127.0.0.1 --- scripts/oraclexe_local.sh | 2 +- src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/oraclexe_local.sh b/scripts/oraclexe_local.sh index 7240eff..9d2a6ba 100644 --- a/scripts/oraclexe_local.sh +++ b/scripts/oraclexe_local.sh @@ -1 +1 @@ -docker run --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle -v ../init_scripts:/container-entrypoint-initdb.d gvenzl/oracle-xe:18.4.0-slim +docker run --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle -v /mnt/c/Users/simon/Workspace/utPLSQL/utPLSQL-maven-plugin/init_scripts:/container-entrypoint-initdb.d gvenzl/oracle-xe:18.4.0-slim diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java index 1722a79..3477383 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java @@ -175,7 +175,7 @@ private Verifier createVerifier(File testProject) throws VerificationException { verifier = new Verifier(testProject.getAbsolutePath()); verifier.addCliOption("-N"); verifier.addCliOption("-Dutplsql-maven-plugin-version=" + pluginVersion); - verifier.addCliOption("-DdbUrl=jdbc:oracle:thin:@localhost:1521:XE"); + verifier.addCliOption("-DdbUrl=jdbc:oracle:thin:@127.0.0.1:1521:XE"); verifier.addCliOption("-DdbUser=UT3"); verifier.addCliOption("-DdbPass=UT3"); return verifier; From 097872b2b8d9de5809e28442dbae299ddfc84a97 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 18:03:23 +0100 Subject: [PATCH 027/200] Log Docker --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2509bd9..f7e5f5b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,6 @@ jobs: runs-on: ubuntu-latest services: - oracle: image: gvenzl/oracle-xe:18.4.0-slim env: @@ -29,6 +28,9 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Verify MySQL connection from host + run: docker logs "${{ job.services.oracle.id }}" + - name: Set up JDK 8 uses: actions/setup-java@v2 with: From d507ebc99abca68772a131df9175bbf491569357 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 18:08:26 +0100 Subject: [PATCH 028/200] Mouting volumn --- .github/workflows/build.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f7e5f5b..07fc223 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,12 +23,18 @@ jobs: ORACLE_PASSWORD: oracle ports: - 1521:1521 - options: -v ${{ github.workspace }}/init_scripts:/container-entrypoint-initdb.d --health-cmd healthcheck.sh --health-interval 10s --health-timeout 5s --health-retries 10 + volumes: + - ${{ github.workspace }}/init_scripts:/container-entrypoint-initdb.d + options: >- + --health-cmd healthcheck.sh + --health-interval 10s + --health-timeout 5s + --health-retries 10 steps: - uses: actions/checkout@v2 - - name: Verify MySQL connection from host + - name: Oracle run: docker logs "${{ job.services.oracle.id }}" - name: Set up JDK 8 From 39e114992f4b303746afd9d37ebdb5799c5b13e5 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 18:14:43 +0100 Subject: [PATCH 029/200] Logs first --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 07fc223..cb2b740 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,11 +32,11 @@ jobs: --health-retries 10 steps: - - uses: actions/checkout@v2 - - - name: Oracle + - name: Oracle container logs run: docker logs "${{ job.services.oracle.id }}" + - uses: actions/checkout@v2 + - name: Set up JDK 8 uses: actions/setup-java@v2 with: From 329c92d4c4fa49c604734764776d67b403b51ff6 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 18:27:56 +0100 Subject: [PATCH 030/200] Restart Oracle container --- .github/workflows/build.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb2b740..4b0e0a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,13 +30,19 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 10 + --name oraclexe steps: + - uses: actions/checkout@v2 + + - name: Restart Oracle container + uses: docker://docker + with: + args: docker restart oraclexe + - name: Oracle container logs run: docker logs "${{ job.services.oracle.id }}" - - uses: actions/checkout@v2 - - name: Set up JDK 8 uses: actions/setup-java@v2 with: From 466a4a4e251e20744fbcaac35961b37744588e40 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Mon, 22 Nov 2021 18:31:29 +0100 Subject: [PATCH 031/200] Removed init script execution --- .github/workflows/build.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b0e0a5..7c01153 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,23 +23,15 @@ jobs: ORACLE_PASSWORD: oracle ports: - 1521:1521 - volumes: - - ${{ github.workspace }}/init_scripts:/container-entrypoint-initdb.d options: >- --health-cmd healthcheck.sh --health-interval 10s --health-timeout 5s --health-retries 10 - --name oraclexe steps: - uses: actions/checkout@v2 - - name: Restart Oracle container - uses: docker://docker - with: - args: docker restart oraclexe - - name: Oracle container logs run: docker logs "${{ job.services.oracle.id }}" @@ -57,5 +49,5 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - - name: Maven verify - run: mvn verify + - name: Maven test + run: mvn test From 51ab619ed3c78abc28cb0d5d81d9a82b62b88f1a Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 08:01:39 +0100 Subject: [PATCH 032/200] Execute install_utplsql.sh --- .github/workflows/build.yml | 3 ++ .travis.yml | 62 +++++++++++++++++++++++++++++++ github_scripts/install_utplsql.sh | 7 ++++ 3 files changed, 72 insertions(+) create mode 100644 .travis.yml create mode 100644 github_scripts/install_utplsql.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c01153..b8b6dd2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,9 @@ jobs: - name: Oracle container logs run: docker logs "${{ job.services.oracle.id }}" + - name: Install utPLSQL + run: sh ${{ github.workspace }}/github_scripts/install_utplsql.sh + - name: Set up JDK 8 uses: actions/setup-java@v2 with: diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..0591815 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,62 @@ +sudo: required +language: java + +services: + - docker + +jdk: + - openjdk8 + +env: + global: + - DOCKER_CFG=$HOME/.docker + - DOCKER_REPO="utplsqlv3/oracledb" + - CACHE_DIR=$HOME/.cache + - MAVEN_HOME=/usr/local/maven + - MAVEN_CFG=$HOME/.m2 + - DB_URL="127.0.0.1:1521:XE" + - DB_UT3_USER=ut3 + - DB_UT3_PASS=ut3 + - ORACLE_VERSION="11g-r2-xe" + - DOCKER_OPTIONS="--shm-size=1g" + +cache: + directories: + - $DOCKER_CFG + - $CACHE_DIR + - $MAVEN_CFG + +install: + - bash .travis/maven_cfg.sh + - bash .travis/start_db.sh + - bash .travis/install_utplsql.sh + - bash .travis/install_demo_project.sh + +script: + - echo "Run Verify with Coverage" + - mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify -DdbUser="${DB_UT3_USER}" -DdbPass="${DB_UT3_PASS}" -DdbUrl="jdbc:oracle:thin:@${DB_URL}" + +before_deploy: + - echo $GPG_SECRET_KEYS | base64 --decode | ${GPG_EXECUTABLE} --import + - echo $GPG_OWNERTRUST | base64 --decode | ${GPG_EXECUTABLE} --import-ownertrust + +deploy: + - provider: script + skip_cleanup: true + script: bash .travis/deploy_snapshot.sh + on: + repo: utPLSQL/utPLSQL-maven-plugin + branch: develop + - provider: script + skip_cleanup: true + script: bash .travis/deploy_release.sh + on: + repo: utPLSQL/utPLSQL-maven-plugin + tags: true + +notifications: + slack: + rooms: + - secure: "Gz0pGOOM6xbnz8Q/B3RzOFoVr8QGXsDSHcgCloPnO3ZkEOh4JJikqWAVdZrksMxhewIBRpbdIWAZOgsNXvW+cEDXxfml3X9Clj2wg5Uon97UeI+5WEHDhLYHn7t9EYr9QvVSOuQgBIiddk6kURxY4N0eAA4VUti8BDcMRq+gPxF1w/toFJXVR/I/tkLxcHPTbWQ9X87nNWcQgMoHe2AixYpglntmtoLXJ5F8MF08fcyTX7GJQ5xjq7HbYy+/39nEhQo2ZPhHHfk2rS6gIUY0wc+MAqobxvesplgGDybdTQyrdl48VjJ/CiQDedglUbNN9VYTFjPIYMdWCUCLV1uL866aNMiBpB7CQoNhi5WS7RERE9gblVPX2k6tOda27fEWlhjha6OmdK6TQ9qTITU7U4OTSOz41dDPeVfqMHRggxo3ozlLONTiZ1y9fz/Ez9WjiJjtUDt60vgnVIo7BcQV/yDJcqAtQbfWyf0n73g5lMBvLGnO2Agm2N7hNEeCbpr+PZUoqkEM/e4SxdUCQGi8Ppi9Zp0E4v0iG7hyjzol+G4T8JN0bUGg0OOow/bfZa5J2aUsrC1qP/ZLpMA94NI6ZlL2wRHhZ9JtVSDLjtSwq9yW5XF7o7kdqBWBCslbGnYPoCoHOzfZuUvArSlRoGNu75dw/Qhoo9gFl1RG/RlChaU=" + on_success: change + on_failure: always diff --git a/github_scripts/install_utplsql.sh b/github_scripts/install_utplsql.sh new file mode 100644 index 0000000..83e7a4c --- /dev/null +++ b/github_scripts/install_utplsql.sh @@ -0,0 +1,7 @@ +UTPLSQL_DOWNLOAD_URL=$(curl --silent https://api.github.com/repos/utPLSQL/utPLSQL/releases/latest | awk '/browser_download_url/ { print $2 }' | grep ".zip\"" | sed 's/"//g') + +curl -Lk "${UTPLSQL_DOWNLOAD_URL}" -o utPLSQL.zip + +unzip -q utPLSQL.zip + +docker run --rm -v ${{ github.workspace }}/utPLSQL/source:utPLSQL -w utPLSQL/source --network host --entrypoint sqlplus truemark/sqlplus sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users From 0f6234782e70d861e4fda54b9cbea3ca863e97b8 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 08:05:44 +0100 Subject: [PATCH 033/200] Execute install_utplsql.sh --- github_scripts/install_utplsql.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/github_scripts/install_utplsql.sh b/github_scripts/install_utplsql.sh index 83e7a4c..71b125c 100644 --- a/github_scripts/install_utplsql.sh +++ b/github_scripts/install_utplsql.sh @@ -4,4 +4,6 @@ curl -Lk "${UTPLSQL_DOWNLOAD_URL}" -o utPLSQL.zip unzip -q utPLSQL.zip +dir + docker run --rm -v ${{ github.workspace }}/utPLSQL/source:utPLSQL -w utPLSQL/source --network host --entrypoint sqlplus truemark/sqlplus sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users From 639100d506aeb15b67b9eb42f36e80dc9f39e9eb Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 08:08:25 +0100 Subject: [PATCH 034/200] Execute install_utplsql.sh --- .github/workflows/build.yml | 2 +- github_scripts/install_utplsql.sh | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8b6dd2..22fb98f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Oracle container logs + - name: Print Oracle container logs run: docker logs "${{ job.services.oracle.id }}" - name: Install utPLSQL diff --git a/github_scripts/install_utplsql.sh b/github_scripts/install_utplsql.sh index 71b125c..2f72df9 100644 --- a/github_scripts/install_utplsql.sh +++ b/github_scripts/install_utplsql.sh @@ -4,6 +4,4 @@ curl -Lk "${UTPLSQL_DOWNLOAD_URL}" -o utPLSQL.zip unzip -q utPLSQL.zip -dir - -docker run --rm -v ${{ github.workspace }}/utPLSQL/source:utPLSQL -w utPLSQL/source --network host --entrypoint sqlplus truemark/sqlplus sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/utPLSQL/source:utPLSQL -w utPLSQL/source --network host --entrypoint sqlplus truemark/sqlplus sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users From 44d5001ed1c48aec34f05d638c94401c25150abf Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 08:11:33 +0100 Subject: [PATCH 035/200] Fixed sqlplus docker call --- github_scripts/install_utplsql.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github_scripts/install_utplsql.sh b/github_scripts/install_utplsql.sh index 2f72df9..834a874 100644 --- a/github_scripts/install_utplsql.sh +++ b/github_scripts/install_utplsql.sh @@ -4,4 +4,4 @@ curl -Lk "${UTPLSQL_DOWNLOAD_URL}" -o utPLSQL.zip unzip -q utPLSQL.zip -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/utPLSQL/source:utPLSQL -w utPLSQL/source --network host --entrypoint sqlplus truemark/sqlplus sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/utPLSQL/source:/utPLSQL -w /utPLSQL/source --network host --entrypoint sqlplus truemark/sqlplus sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users From f790e6b8187d9702ff3065c56727ec52c58fb8f9 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 08:16:16 +0100 Subject: [PATCH 036/200] Fixed sqlplus docker call --- .travis.yml => .travis.yml_old | 0 github_scripts/install_utplsql.sh | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .travis.yml => .travis.yml_old (100%) diff --git a/.travis.yml b/.travis.yml_old similarity index 100% rename from .travis.yml rename to .travis.yml_old diff --git a/github_scripts/install_utplsql.sh b/github_scripts/install_utplsql.sh index 834a874..6481e5b 100644 --- a/github_scripts/install_utplsql.sh +++ b/github_scripts/install_utplsql.sh @@ -4,4 +4,4 @@ curl -Lk "${UTPLSQL_DOWNLOAD_URL}" -o utPLSQL.zip unzip -q utPLSQL.zip -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/utPLSQL/source:/utPLSQL -w /utPLSQL/source --network host --entrypoint sqlplus truemark/sqlplus sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/utPLSQL:/utPLSQL -w /utPLSQL/source --network host --entrypoint sqlplus truemark/sqlplus sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users From ba15724262290160d71c5ad4265e76deaff786bb Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 08:23:11 +0100 Subject: [PATCH 037/200] Added install_demo_project.sh --- .github/workflows/build.yml | 6 ++-- github_scripts/install_demo_project.sh | 11 +++++++ github_scripts/install_utplsql.sh | 2 ++ github_scripts/sql/create_app_objects.sql | 9 ++++++ .../sql/create_source_owner_objects.sql | 6 ++++ .../sql/create_tests_owner_objects.sql | 7 +++++ github_scripts/sql/create_users.sql | 30 +++++++++++++++++++ 7 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 github_scripts/install_demo_project.sh create mode 100644 github_scripts/sql/create_app_objects.sql create mode 100644 github_scripts/sql/create_source_owner_objects.sql create mode 100644 github_scripts/sql/create_tests_owner_objects.sql create mode 100644 github_scripts/sql/create_users.sql diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22fb98f..1ec9dda 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,12 +32,12 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Print Oracle container logs - run: docker logs "${{ job.services.oracle.id }}" - - name: Install utPLSQL run: sh ${{ github.workspace }}/github_scripts/install_utplsql.sh + - name: Install demo project + run: sh ${{ github.workspace }}/github_scripts/install_demo_project.sh + - name: Set up JDK 8 uses: actions/setup-java@v2 with: diff --git a/github_scripts/install_demo_project.sh b/github_scripts/install_demo_project.sh new file mode 100644 index 0000000..999a11d --- /dev/null +++ b/github_scripts/install_demo_project.sh @@ -0,0 +1,11 @@ +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/project -w /project --network host --entrypoint sqlplus truemark/sqlplus \ + sys/oracle@//127.0.0.1:1521/XE as sysdba @.travis/sql/create_users.sql + +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/project -w /project --network host --entrypoint sqlplus truemark/sqlplus \ + app/pass@//127.0.0.1:1521/XE @.travis/sql/create_app_objects.sql + +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/project -w /project --network host --entrypoint sqlplus truemark/sqlplus \ + code_owner/pass@//127.0.0.1:1521/XE @.travis/sql/create_source_owner_objects.sql + +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/project -w /project --network host --entrypoint sqlplus truemark/sqlplus \ + tests_owner/pass@//127.0.0.1:1521/XE @.travis/sql/create_tests_owner_objects.sql diff --git a/github_scripts/install_utplsql.sh b/github_scripts/install_utplsql.sh index 6481e5b..98eb317 100644 --- a/github_scripts/install_utplsql.sh +++ b/github_scripts/install_utplsql.sh @@ -1,3 +1,5 @@ +#!/bin/bash + UTPLSQL_DOWNLOAD_URL=$(curl --silent https://api.github.com/repos/utPLSQL/utPLSQL/releases/latest | awk '/browser_download_url/ { print $2 }' | grep ".zip\"" | sed 's/"//g') curl -Lk "${UTPLSQL_DOWNLOAD_URL}" -o utPLSQL.zip diff --git a/github_scripts/sql/create_app_objects.sql b/github_scripts/sql/create_app_objects.sql new file mode 100644 index 0000000..734b51e --- /dev/null +++ b/github_scripts/sql/create_app_objects.sql @@ -0,0 +1,9 @@ +whenever sqlerror exit failure rollback +whenever oserror exit failure rollback + +@src/test/resources/simple-project/scripts/sources/TO_TEST_ME.tab +@src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.spc +@src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy + +@src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc +@src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy diff --git a/github_scripts/sql/create_source_owner_objects.sql b/github_scripts/sql/create_source_owner_objects.sql new file mode 100644 index 0000000..2d15146 --- /dev/null +++ b/github_scripts/sql/create_source_owner_objects.sql @@ -0,0 +1,6 @@ +whenever sqlerror exit failure rollback +whenever oserror exit failure rollback + +@src/test/resources/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab +@src/test/resources/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql +@src/test/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql diff --git a/github_scripts/sql/create_tests_owner_objects.sql b/github_scripts/sql/create_tests_owner_objects.sql new file mode 100644 index 0000000..e2d9a7c --- /dev/null +++ b/github_scripts/sql/create_tests_owner_objects.sql @@ -0,0 +1,7 @@ +whenever sqlerror exit failure rollback +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/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql +@src/test/resources/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql diff --git a/github_scripts/sql/create_users.sql b/github_scripts/sql/create_users.sql new file mode 100644 index 0000000..fe64882 --- /dev/null +++ b/github_scripts/sql/create_users.sql @@ -0,0 +1,30 @@ +whenever sqlerror exit failure rollback +whenever oserror exit failure rollback +set echo off +set verify off + +define UTPLSQL_USER = 'UT3'; +define APP_USER = 'APP'; +define CODE_OWNER = 'CODE_OWNER'; +define TESTS_OWNER = 'TESTS_OWNER'; +define DB_PASS = 'pass'; + +grant execute any procedure to &UTPLSQL_USER; +grant create any procedure to &UTPLSQL_USER; +grant execute on dbms_lob to &UTPLSQL_USER; +grant execute on dbms_sql to &UTPLSQL_USER; +grant execute on dbms_xmlgen to &UTPLSQL_USER; +grant execute on dbms_lock to &UTPLSQL_USER; + +create user &APP_USER identified by &DB_PASS quota unlimited on USERS default tablespace USERS; +grant create session, create procedure, create type, create table, create sequence, create view to &APP_USER; +grant select any dictionary to &APP_USER; + +create user &CODE_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS; +grant create session, create procedure, create type, create table, create sequence, create view to &CODE_OWNER; + +create user &TESTS_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS; +grant create session, create procedure, create type, create table, create sequence, create view, create synonym to &TESTS_OWNER; +grant select any dictionary to &TESTS_OWNER; +grant select any table, delete any table, drop any table to &TESTS_OWNER; +grant execute any procedure to &TESTS_OWNER; From 6a3edab0522519481f6d3fae47c4d1d9f8589b5d Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 08:26:36 +0100 Subject: [PATCH 038/200] Added install_demo_project.sh --- github_scripts/install_demo_project.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/github_scripts/install_demo_project.sh b/github_scripts/install_demo_project.sh index 999a11d..d7a1953 100644 --- a/github_scripts/install_demo_project.sh +++ b/github_scripts/install_demo_project.sh @@ -1,11 +1,11 @@ docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/project -w /project --network host --entrypoint sqlplus truemark/sqlplus \ - sys/oracle@//127.0.0.1:1521/XE as sysdba @.travis/sql/create_users.sql + sys/oracle@//127.0.0.1:1521/XE as sysdba @github_scripts/sql/create_users.sql docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/project -w /project --network host --entrypoint sqlplus truemark/sqlplus \ - app/pass@//127.0.0.1:1521/XE @.travis/sql/create_app_objects.sql + app/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_app_objects.sql docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/project -w /project --network host --entrypoint sqlplus truemark/sqlplus \ - code_owner/pass@//127.0.0.1:1521/XE @.travis/sql/create_source_owner_objects.sql + code_owner/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_source_owner_objects.sql docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/project -w /project --network host --entrypoint sqlplus truemark/sqlplus \ - tests_owner/pass@//127.0.0.1:1521/XE @.travis/sql/create_tests_owner_objects.sql + tests_owner/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_tests_owner_objects.sql From 202bc2b697ec86e236b1ebc2a5025b2861ba5219 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 08:30:46 +0100 Subject: [PATCH 039/200] Added install_demo_project.sh --- github_scripts/install_demo_project.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/github_scripts/install_demo_project.sh b/github_scripts/install_demo_project.sh index d7a1953..d239b75 100644 --- a/github_scripts/install_demo_project.sh +++ b/github_scripts/install_demo_project.sh @@ -1,11 +1,15 @@ -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/project -w /project --network host --entrypoint sqlplus truemark/sqlplus \ - sys/oracle@//127.0.0.1:1521/XE as sysdba @github_scripts/sql/create_users.sql +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/github_scripts -w /github_scripts/sql \ + --network host --entrypoint sqlplus truemark/sqlplus \ + sys/oracle@//127.0.0.1:1521/XE as sysdba @create_users.sql -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/project -w /project --network host --entrypoint sqlplus truemark/sqlplus \ - app/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_app_objects.sql +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/github_scripts -w /github_scripts/sql \ + --network host --entrypoint sqlplus truemark/sqlplus \ + app/pass@//127.0.0.1:1521/XE @create_app_objects.sql -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/project -w /project --network host --entrypoint sqlplus truemark/sqlplus \ - code_owner/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_source_owner_objects.sql +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/github_scripts -w /github_scripts/sql \ + --network host --entrypoint sqlplus truemark/sqlplus \ + code_owner/pass@//127.0.0.1:1521/XE @create_source_owner_objects.sql -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/project -w /project --network host --entrypoint sqlplus truemark/sqlplus \ - tests_owner/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_tests_owner_objects.sql +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/github_scripts -w /github_scripts/sql \ + --network host --entrypoint sqlplus truemark/sqlplus \ + tests_owner/pass@//127.0.0.1:1521/XE @create_tests_owner_objects.sql From ed38f0370e76dd2fe1e7d7d9ed374c273ce41fd0 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 08:35:56 +0100 Subject: [PATCH 040/200] Fixed pathes --- github_scripts/install_demo_project.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/github_scripts/install_demo_project.sh b/github_scripts/install_demo_project.sh index d239b75..4e7ad37 100644 --- a/github_scripts/install_demo_project.sh +++ b/github_scripts/install_demo_project.sh @@ -1,15 +1,15 @@ -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/github_scripts -w /github_scripts/sql \ +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin:/work -w /work/ \ --network host --entrypoint sqlplus truemark/sqlplus \ - sys/oracle@//127.0.0.1:1521/XE as sysdba @create_users.sql + sys/oracle@//127.0.0.1:1521/XE as sysdba @github_scripts/sql/create_users.sql -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/github_scripts -w /github_scripts/sql \ +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin:/work -w /work/ \ --network host --entrypoint sqlplus truemark/sqlplus \ - app/pass@//127.0.0.1:1521/XE @create_app_objects.sql + app/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_app_objects.sql -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/github_scripts -w /github_scripts/sql \ +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin:/work -w /work/ \ --network host --entrypoint sqlplus truemark/sqlplus \ - code_owner/pass@//127.0.0.1:1521/XE @create_source_owner_objects.sql + code_owner/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_source_owner_objects.sql -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/github_scripts:/github_scripts -w /github_scripts/sql \ +docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin:/work -w /work/ \ --network host --entrypoint sqlplus truemark/sqlplus \ - tests_owner/pass@//127.0.0.1:1521/XE @create_tests_owner_objects.sql + tests_owner/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_tests_owner_objects.sql From 2a3c584616db3ae0fdad53a429ce3db8c283d242 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 08:40:38 +0100 Subject: [PATCH 041/200] Changed to verify --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ec9dda..38ea9d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,5 +52,5 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - - name: Maven test - run: mvn test + - name: Maven verify + run: mvn verify From e434e8bcec8a8d07e64ab16351470df468a95b48 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 08:47:37 +0100 Subject: [PATCH 042/200] use $(pwd) instead of fix path --- .github/workflows/build.yml | 4 +- .travis.yml_old => .travis/.travis.yml_old | 0 github_scripts/install_demo_project.sh | 15 - github_scripts/install_utplsql.sh | 9 - init_scripts/2_create_users.sql | 25 -- init_scripts/3_create_app_objects.sql | 263 ------------------ .../4_create_source_owner_objects.sql | 47 ---- init_scripts/5_create_tests_owner_objects.sql | 215 -------------- scripts/0_start_db.sh | 1 + .../1_install_utplsql.sh | 5 +- scripts/2_install_demo_project.sh | 11 + scripts/oraclexe_local.sh | 1 - .../sql/create_app_objects.sql | 0 .../sql/create_source_owner_objects.sql | 0 .../sql/create_tests_owner_objects.sql | 0 .../sql/create_users.sql | 0 16 files changed, 16 insertions(+), 580 deletions(-) rename .travis.yml_old => .travis/.travis.yml_old (100%) delete mode 100644 github_scripts/install_demo_project.sh delete mode 100644 github_scripts/install_utplsql.sh delete mode 100644 init_scripts/2_create_users.sql delete mode 100644 init_scripts/3_create_app_objects.sql delete mode 100644 init_scripts/4_create_source_owner_objects.sql delete mode 100644 init_scripts/5_create_tests_owner_objects.sql create mode 100644 scripts/0_start_db.sh rename {init_scripts => scripts}/1_install_utplsql.sh (55%) create mode 100644 scripts/2_install_demo_project.sh delete mode 100644 scripts/oraclexe_local.sh rename {github_scripts => scripts}/sql/create_app_objects.sql (100%) rename {github_scripts => scripts}/sql/create_source_owner_objects.sql (100%) rename {github_scripts => scripts}/sql/create_tests_owner_objects.sql (100%) rename {github_scripts => scripts}/sql/create_users.sql (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38ea9d6..9d5c0eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,10 +33,10 @@ jobs: - uses: actions/checkout@v2 - name: Install utPLSQL - run: sh ${{ github.workspace }}/github_scripts/install_utplsql.sh + run: sh ${{ github.workspace }}/scripts/1_install_utplsql.sh - name: Install demo project - run: sh ${{ github.workspace }}/github_scripts/install_demo_project.sh + run: sh ${{ github.workspace }}/scripts/2_install_demo_project.sh - name: Set up JDK 8 uses: actions/setup-java@v2 diff --git a/.travis.yml_old b/.travis/.travis.yml_old similarity index 100% rename from .travis.yml_old rename to .travis/.travis.yml_old diff --git a/github_scripts/install_demo_project.sh b/github_scripts/install_demo_project.sh deleted file mode 100644 index 4e7ad37..0000000 --- a/github_scripts/install_demo_project.sh +++ /dev/null @@ -1,15 +0,0 @@ -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin:/work -w /work/ \ - --network host --entrypoint sqlplus truemark/sqlplus \ - sys/oracle@//127.0.0.1:1521/XE as sysdba @github_scripts/sql/create_users.sql - -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin:/work -w /work/ \ - --network host --entrypoint sqlplus truemark/sqlplus \ - app/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_app_objects.sql - -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin:/work -w /work/ \ - --network host --entrypoint sqlplus truemark/sqlplus \ - code_owner/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_source_owner_objects.sql - -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin:/work -w /work/ \ - --network host --entrypoint sqlplus truemark/sqlplus \ - tests_owner/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_tests_owner_objects.sql diff --git a/github_scripts/install_utplsql.sh b/github_scripts/install_utplsql.sh deleted file mode 100644 index 98eb317..0000000 --- a/github_scripts/install_utplsql.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -UTPLSQL_DOWNLOAD_URL=$(curl --silent https://api.github.com/repos/utPLSQL/utPLSQL/releases/latest | awk '/browser_download_url/ { print $2 }' | grep ".zip\"" | sed 's/"//g') - -curl -Lk "${UTPLSQL_DOWNLOAD_URL}" -o utPLSQL.zip - -unzip -q utPLSQL.zip - -docker run --rm -v /home/runner/work/utPLSQL-maven-plugin/utPLSQL-maven-plugin/utPLSQL:/utPLSQL -w /utPLSQL/source --network host --entrypoint sqlplus truemark/sqlplus sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users diff --git a/init_scripts/2_create_users.sql b/init_scripts/2_create_users.sql deleted file mode 100644 index 23ad31b..0000000 --- a/init_scripts/2_create_users.sql +++ /dev/null @@ -1,25 +0,0 @@ -define UTPLSQL_USER = 'UT3'; -define APP_USER = 'APP'; -define CODE_OWNER = 'CODE_OWNER'; -define TESTS_OWNER = 'TESTS_OWNER'; -define DB_PASS = 'pass'; - -grant execute any procedure to &UTPLSQL_USER; -grant create any procedure to &UTPLSQL_USER; -grant execute on dbms_lob to &UTPLSQL_USER; -grant execute on dbms_sql to &UTPLSQL_USER; -grant execute on dbms_xmlgen to &UTPLSQL_USER; -grant execute on dbms_lock to &UTPLSQL_USER; - -create user &APP_USER identified by &DB_PASS quota unlimited on USERS default tablespace USERS; -grant create session, create procedure, create type, create table, create sequence, create view to &APP_USER; -grant select any dictionary to &APP_USER; - -create user &CODE_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS; -grant create session, create procedure, create type, create table, create sequence, create view to &CODE_OWNER; - -create user &TESTS_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS; -grant create session, create procedure, create type, create table, create sequence, create view, create synonym to &TESTS_OWNER; -grant select any dictionary to &TESTS_OWNER; -grant select any table, delete any table, drop any table to &TESTS_OWNER; -grant execute any procedure to &TESTS_OWNER; diff --git a/init_scripts/3_create_app_objects.sql b/init_scripts/3_create_app_objects.sql deleted file mode 100644 index f15cc3f..0000000 --- a/init_scripts/3_create_app_objects.sql +++ /dev/null @@ -1,263 +0,0 @@ -ALTER SESSION SET CURRENT_SCHEMA = APP; - --- --- This is a table used to demonstrate the UNIT test framework. --- -CREATE TABLE TO_TEST_ME -( - SNAME VARCHAR2(10) -); -/ - --- --- 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; -/ - -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; -/ - -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; -/ - -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/init_scripts/4_create_source_owner_objects.sql b/init_scripts/4_create_source_owner_objects.sql deleted file mode 100644 index 0c16344..0000000 --- a/init_scripts/4_create_source_owner_objects.sql +++ /dev/null @@ -1,47 +0,0 @@ -ALTER SESSION SET CURRENT_SCHEMA = CODE_OWNER; - --- --- This is a table used to demonstrate the UNIT test framework. --- -CREATE TABLE TO_TEST_ME -( - SNAME VARCHAR2(10) -); -/ - --- --- 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; -/ - -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/init_scripts/5_create_tests_owner_objects.sql b/init_scripts/5_create_tests_owner_objects.sql deleted file mode 100644 index dddf677..0000000 --- a/init_scripts/5_create_tests_owner_objects.sql +++ /dev/null @@ -1,215 +0,0 @@ -ALTER SESSION SET CURRENT_SCHEMA = TESTS_OWNER; - -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) - PROCEDURE TEST_PR_TEST_ME_EXISTS; - - -- %test - -- %displayname(Demonstrating the use of cursor) - -- %rollback(manual) - PROCEDURE TEST_PR_TEST_ME_CURSOR; - -END; -/ - -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(CODE_OWNER.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(CODE_OWNER.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(CODE_OWNER.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 CODE_OWNER.TO_TEST_ME; - CODE_OWNER.PKG_TEST_ME.PR_TEST_ME(NULL); - SELECT COUNT(1) INTO VNCOUNT2 FROM CODE_OWNER.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 CODE_OWNER.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 CODE_OWNER.TO_TEST_ME; - VSNAME := TO_CHAR(VNCOUNT1); - CODE_OWNER.PKG_TEST_ME.PR_TEST_ME(VSNAME); - SELECT COUNT(1) INTO VNCOUNT2 FROM CODE_OWNER.TO_TEST_ME; - - -- Check that I have inserted the value - UT.EXPECT(VNCOUNT1 + 1).TO_EQUAL(VNCOUNT2); - SELECT COUNT(1) INTO VNCOUNT2 FROM CODE_OWNER.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 CODE_OWNER.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 - CODE_OWNER.PKG_TEST_ME.PR_TEST_ME('EXISTS'); - CODE_OWNER.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 CODE_OWNER.TO_TEST_ME T; - OPEN VACTUAL FOR - SELECT T.SNAME FROM CODE_OWNER.TO_TEST_ME T; - UT.EXPECT(VEXPECTED).TO_(EQUAL(VACTUAL)); - END; - -END; -/ diff --git a/scripts/0_start_db.sh b/scripts/0_start_db.sh new file mode 100644 index 0000000..4168354 --- /dev/null +++ b/scripts/0_start_db.sh @@ -0,0 +1 @@ +docker run --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle gvenzl/oracle-xe:18.4.0-slim diff --git a/init_scripts/1_install_utplsql.sh b/scripts/1_install_utplsql.sh similarity index 55% rename from init_scripts/1_install_utplsql.sh rename to scripts/1_install_utplsql.sh index f650ed1..1f3f314 100644 --- a/init_scripts/1_install_utplsql.sh +++ b/scripts/1_install_utplsql.sh @@ -4,6 +4,5 @@ curl -Lk "${UTPLSQL_DOWNLOAD_URL}" -o utPLSQL.zip unzip -q utPLSQL.zip -cd utPLSQL/source - -sqlplus sys/oracle@//localhost/XE as sysdba @install_headless.sql UT3 UT3 users +docker run --rm -v $(pwd)/utPLSQL:/utPLSQL -w /utPLSQL/source --network host \ + --entrypoint sqlplus truemark/sqlplus sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users diff --git a/scripts/2_install_demo_project.sh b/scripts/2_install_demo_project.sh new file mode 100644 index 0000000..1bed11f --- /dev/null +++ b/scripts/2_install_demo_project.sh @@ -0,0 +1,11 @@ +docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus \ + sys/oracle@//127.0.0.1:1521/XE as sysdba @github_scripts/sql/create_users.sql + +docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus \ + app/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_app_objects.sql + +docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus \ + code_owner/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_source_owner_objects.sql + +docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus \ + tests_owner/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_tests_owner_objects.sql diff --git a/scripts/oraclexe_local.sh b/scripts/oraclexe_local.sh deleted file mode 100644 index 9d2a6ba..0000000 --- a/scripts/oraclexe_local.sh +++ /dev/null @@ -1 +0,0 @@ -docker run --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle -v /mnt/c/Users/simon/Workspace/utPLSQL/utPLSQL-maven-plugin/init_scripts:/container-entrypoint-initdb.d gvenzl/oracle-xe:18.4.0-slim diff --git a/github_scripts/sql/create_app_objects.sql b/scripts/sql/create_app_objects.sql similarity index 100% rename from github_scripts/sql/create_app_objects.sql rename to scripts/sql/create_app_objects.sql diff --git a/github_scripts/sql/create_source_owner_objects.sql b/scripts/sql/create_source_owner_objects.sql similarity index 100% rename from github_scripts/sql/create_source_owner_objects.sql rename to scripts/sql/create_source_owner_objects.sql diff --git a/github_scripts/sql/create_tests_owner_objects.sql b/scripts/sql/create_tests_owner_objects.sql similarity index 100% rename from github_scripts/sql/create_tests_owner_objects.sql rename to scripts/sql/create_tests_owner_objects.sql diff --git a/github_scripts/sql/create_users.sql b/scripts/sql/create_users.sql similarity index 100% rename from github_scripts/sql/create_users.sql rename to scripts/sql/create_users.sql From eaecff3870e89610eb3b013d8bb0aaa5a3b71c91 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 08:52:52 +0100 Subject: [PATCH 043/200] scripts instead of github_scripts --- scripts/2_install_demo_project.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/2_install_demo_project.sh b/scripts/2_install_demo_project.sh index 1bed11f..8ef285a 100644 --- a/scripts/2_install_demo_project.sh +++ b/scripts/2_install_demo_project.sh @@ -1,11 +1,11 @@ docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus \ - sys/oracle@//127.0.0.1:1521/XE as sysdba @github_scripts/sql/create_users.sql + sys/oracle@//127.0.0.1:1521/XE as sysdba @scripts/sql/create_users.sql docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus \ - app/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_app_objects.sql + app/pass@//127.0.0.1:1521/XE @scripts/sql/create_app_objects.sql docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus \ - code_owner/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_source_owner_objects.sql + code_owner/pass@//127.0.0.1:1521/XE @scripts/sql/create_source_owner_objects.sql docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus \ - tests_owner/pass@//127.0.0.1:1521/XE @github_scripts/sql/create_tests_owner_objects.sql + tests_owner/pass@//127.0.0.1:1521/XE @scripts/sql/create_tests_owner_objects.sql From c3bf5e70772e5c9f7860311b1d29d47fcae19147 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 09:15:23 +0100 Subject: [PATCH 044/200] Added Jacoco and Sonar --- .github/workflows/build.yml | 6 +++++- .gitignore | 2 ++ scripts/0_start_db.sh | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d5c0eb..94844ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,4 +53,8 @@ jobs: ${{ runner.os }}-maven- - name: Maven verify - run: mvn verify + run: mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify + + - name: Sonar + run: mvn sonar:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + diff --git a/.gitignore b/.gitignore index 1bb6467..ca5b9cd 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ dependency-reduced-pom.xml # Docs doc/ +/utPLSQL/ +/utPLSQL.zip diff --git a/scripts/0_start_db.sh b/scripts/0_start_db.sh index 4168354..c5a8d7f 100644 --- a/scripts/0_start_db.sh +++ b/scripts/0_start_db.sh @@ -1 +1 @@ -docker run --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle gvenzl/oracle-xe:18.4.0-slim +docker run -d --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle gvenzl/oracle-xe:18.4.0-slim From 501554d5df4c8a74089129893474afd4125f6ce3 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 09:22:08 +0100 Subject: [PATCH 045/200] Temporarly removed sonar --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94844ef..980fa25 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,7 +54,3 @@ jobs: - name: Maven verify run: mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify - - - name: Sonar - run: mvn sonar:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin - From 3e56661d53e2bcd13ae2b8ead92550ffd7c7d734 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 09:56:16 +0100 Subject: [PATCH 046/200] Code clean up --- .../maven/plugin/CustomTypeMapping.java | 1 + .../org/utplsql/maven/plugin/UtPLSQLMojo.java | 25 +++++++++++------- .../maven/plugin/helper/PluginDefault.java | 9 +++---- .../maven/plugin/helper/ReporterDefault.java | 3 +-- ...annerHelper.java => SqlScannerHelper.java} | 10 +++---- .../maven/plugin/model/ReporterParameter.java | 26 +++++++------------ .../maven/plugin/reporter/ReporterWriter.java | 17 +++++------- 7 files changed, 43 insertions(+), 48 deletions(-) rename src/main/java/org/utplsql/maven/plugin/helper/{SQLScannerHelper.java => SqlScannerHelper.java} (84%) diff --git a/src/main/java/org/utplsql/maven/plugin/CustomTypeMapping.java b/src/main/java/org/utplsql/maven/plugin/CustomTypeMapping.java index 57d4080..48328bf 100644 --- a/src/main/java/org/utplsql/maven/plugin/CustomTypeMapping.java +++ b/src/main/java/org/utplsql/maven/plugin/CustomTypeMapping.java @@ -2,6 +2,7 @@ /** * Bean used by Maven to populate its model. + * * {@code * * ... diff --git a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java index 6643e2c..8f92b81 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java @@ -24,7 +24,7 @@ import org.utplsql.api.reporter.Reporter; import org.utplsql.api.reporter.ReporterFactory; import org.utplsql.maven.plugin.helper.PluginDefault; -import org.utplsql.maven.plugin.helper.SQLScannerHelper; +import org.utplsql.maven.plugin.helper.SqlScannerHelper; import org.utplsql.maven.plugin.model.ReporterParameter; import org.utplsql.maven.plugin.reporter.ReporterWriter; @@ -72,7 +72,10 @@ public class UtPLSQLMojo extends AbstractMojo { @Parameter protected final List paths = new ArrayList<>(); - // Sources Configuration + /** + * Sources Configuration + */ + @Parameter protected final List sources = new ArrayList<>(); @@ -94,7 +97,9 @@ public class UtPLSQLMojo extends AbstractMojo { @Parameter private List sourcesCustomTypeMapping; - // Tests Configuration + /** + * Tests Configuration + */ @Parameter protected final List tests = new ArrayList<>(); @@ -137,7 +142,9 @@ public class UtPLSQLMojo extends AbstractMojo { @Parameter protected boolean dbmsOutput; - // Color in the console, bases on Maven logging configuration. + /** + * Color in the console, bases on Maven logging configuration. + */ private final boolean colorConsole = MessageUtils.isColorEnabled(); private ReporterWriter reporterWriter; @@ -242,9 +249,10 @@ private FileMapperOptions buildSourcesOptions() throws MojoExecutionException { } } - List scripts = SQLScannerHelper.findSQLs(project.getBasedir(), sources, + List scripts = SqlScannerHelper.findSqlScripts(project.getBasedir(), sources, PluginDefault.SOURCE_DIRECTORY, PluginDefault.SOURCE_FILE_PATTERN); - return createFileMapperOptions(scripts, sourcesOwner, sourcesRegexExpression, sourcesOwnerSubexpression, sourcesNameSubexpression, sourcesTypeSubexpression, sourcesCustomTypeMapping); + return createFileMapperOptions(scripts, sourcesOwner, sourcesRegexExpression, sourcesOwnerSubexpression, + sourcesNameSubexpression, sourcesTypeSubexpression, sourcesCustomTypeMapping); } catch (Exception e) { throw new MojoExecutionException("Invalid in your pom.xml", e); @@ -263,7 +271,7 @@ private FileMapperOptions buildTestsOptions() throws MojoExecutionException { } } - List scripts = SQLScannerHelper.findSQLs(project.getBasedir(), tests, PluginDefault.TEST_DIRECTORY, + List scripts = SqlScannerHelper.findSqlScripts(project.getBasedir(), tests, PluginDefault.TEST_DIRECTORY, PluginDefault.TEST_FILE_PATTERN); return createFileMapperOptions(scripts, testsOwner, testsRegexExpression, testsOwnerSubexpression, testsNameSubexpression, testsTypeSubexpression, testsCustomTypeMapping); @@ -342,8 +350,7 @@ private List initReporters(Connection connection, Version utlVersion, return reporterList; } - private void logParameters(FileMapperOptions sourceMappingOptions, FileMapperOptions testMappingOptions, - List reporterList) { + private void logParameters(FileMapperOptions sourceMappingOptions, FileMapperOptions testMappingOptions, List reporterList) { Log log = getLog(); log.info("Invoking TestRunner with: " + targetDir); diff --git a/src/main/java/org/utplsql/maven/plugin/helper/PluginDefault.java b/src/main/java/org/utplsql/maven/plugin/helper/PluginDefault.java index e3a2b88..430a694 100644 --- a/src/main/java/org/utplsql/maven/plugin/helper/PluginDefault.java +++ b/src/main/java/org/utplsql/maven/plugin/helper/PluginDefault.java @@ -5,9 +5,8 @@ import java.util.Collections; /** - * This class provides methods to retrieve the list of resources in the default - * {@literal and } directories. - * + * This class provides methods to retrieve the list of resources in the default {@literal and } directories. + * * @author Alberto Hernández */ public class PluginDefault { @@ -37,7 +36,7 @@ private PluginDefault() { /** * This method returns {@link Resource} for the default {@code source} directory - * + * * @return a {@link Resource} */ public static Resource buildDefaultSource() { @@ -46,7 +45,7 @@ public static Resource buildDefaultSource() { /** * This method returns {@link Resource} for the default {@code test} directory - * + * * @return a {@link Resource} */ public static Resource buildDefaultTest() { diff --git a/src/main/java/org/utplsql/maven/plugin/helper/ReporterDefault.java b/src/main/java/org/utplsql/maven/plugin/helper/ReporterDefault.java index 3838a8c..fd89c9e 100644 --- a/src/main/java/org/utplsql/maven/plugin/helper/ReporterDefault.java +++ b/src/main/java/org/utplsql/maven/plugin/helper/ReporterDefault.java @@ -5,8 +5,7 @@ /** * This class is an enumeration of all the known reporter in {@code utPLSQL}. * Furthermore, it defines the default output file for each {@link Reporter}. - * In case the output file is set to {@code -}, it will mean the stdout of the - * process. + * In case the output file is set to {@code -}, it will mean the stdout of the process. * * @author Alberto Hernández */ diff --git a/src/main/java/org/utplsql/maven/plugin/helper/SQLScannerHelper.java b/src/main/java/org/utplsql/maven/plugin/helper/SqlScannerHelper.java similarity index 84% rename from src/main/java/org/utplsql/maven/plugin/helper/SQLScannerHelper.java rename to src/main/java/org/utplsql/maven/plugin/helper/SqlScannerHelper.java index 392c850..dfe1cd6 100644 --- a/src/main/java/org/utplsql/maven/plugin/helper/SQLScannerHelper.java +++ b/src/main/java/org/utplsql/maven/plugin/helper/SqlScannerHelper.java @@ -15,10 +15,9 @@ * * @author Alberto Hernández */ -public class SQLScannerHelper { +public class SqlScannerHelper { - private SQLScannerHelper() { - // NA + private SqlScannerHelper() { } /** @@ -30,7 +29,7 @@ private SQLScannerHelper() { * @param defaultFilePattern the default file pattern * @return a list of the files found */ - public static List findSQLs(File baseDir, List resources, String defaultDirectory, String defaultFilePattern) { + public static List findSqlScripts(File baseDir, List resources, String defaultDirectory, String defaultFilePattern) { List founds = new ArrayList<>(); for (Resource resource : resources) { @@ -61,8 +60,7 @@ private static DirectoryScanner buildScanner(String baseDir, Resource resource) if (resource != null) { File fileBaseDir = new File(baseDir, resource.getDirectory()); if (!fileBaseDir.exists() || !fileBaseDir.isDirectory() || !fileBaseDir.canRead()) { - throw new IllegalArgumentException( - format("Invalid %s in resource. Check your pom.xml", resource.getDirectory())); + throw new IllegalArgumentException(format("Invalid %s in resource. Check your pom.xml", resource.getDirectory())); } DirectoryScanner scanner = new DirectoryScanner(); diff --git a/src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java b/src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java index 472236d..198ba5f 100644 --- a/src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java +++ b/src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java @@ -4,6 +4,7 @@ /** * Represents a reporter parameter in the pom file. + * * {@code * * ... @@ -11,7 +12,7 @@ * ... * * } - * + * * @author Alberto Hernández */ public class ReporterParameter { @@ -20,16 +21,9 @@ public class ReporterParameter { private String fileOutput; private Boolean consoleOutput; - /** - * Creates a new reporter parameter. - */ - public ReporterParameter() { - super(); - } - /** * Returns the reporter name. - * + * * @return the reporter name */ public String getName() { @@ -38,7 +32,7 @@ public String getName() { /** * Sets the reporter name. - * + * * @param name the reporter name */ public void setName(String name) { @@ -47,7 +41,7 @@ public void setName(String name) { /** * Returns reporter output file. - * + * * @return the output file name */ public String getFileOutput() { @@ -56,7 +50,7 @@ public String getFileOutput() { /** * Returns whether the file output is enabled or not. - * + * * @return true if the file output is enabled, false otherwise */ public boolean isFileOutput() { @@ -65,7 +59,7 @@ public boolean isFileOutput() { /** * Sets the output file. - * + * * @param fileOutput the output file name */ public void setFileOutput(String fileOutput) { @@ -74,7 +68,7 @@ public void setFileOutput(String fileOutput) { /** * Returns the console output option. - * + * * @return the console output option */ public Boolean getConsoleOutput() { @@ -83,7 +77,7 @@ public Boolean getConsoleOutput() { /** * Returns whether the console output should be enabled or not. - * + * * @return true if console output is enable, false otherwise */ public Boolean isConsoleOutput() { @@ -92,7 +86,7 @@ public Boolean isConsoleOutput() { /** * Sets the console output option. - * + * * @param consoleOutput the console output option */ public void setConsoleOutput(boolean consoleOutput) { diff --git a/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java b/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java index 0a8eea4..8123d07 100644 --- a/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java +++ b/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java @@ -65,14 +65,11 @@ public void writeReporters(Connection connection) throws MojoExecutionException } } - private void writeReports(Connection connection, Reporter reporter, ReporterParameter reporterParameter) - throws MojoExecutionException { - List printStreams = new ArrayList<>(); - FileOutputStream fout = null; - - // + private void writeReports(Connection connection, Reporter reporter, ReporterParameter reporterParameter) throws MojoExecutionException { + FileOutputStream fileOutputStream = null; try { OutputBuffer buffer = OutputBufferProvider.getCompatibleOutputBuffer(databaseVersion, reporter, connection); + List printStreams = new ArrayList<>(); if (reporterParameter.isFileOutput()) { @@ -86,11 +83,11 @@ private void writeReports(Connection connection, Reporter reporter, ReporterPara file.getParentFile().mkdirs(); } - fout = new FileOutputStream(file); + fileOutputStream = new FileOutputStream(file); log.info(format("Writing report %s to %s", reporter.getTypeName(), file.getAbsolutePath())); // Added to the Report - printStreams.add(new PrintStream(fout)); + printStreams.add(new PrintStream(fileOutputStream)); } if (reporterParameter.isConsoleOutput()) { @@ -101,9 +98,9 @@ private void writeReports(Connection connection, Reporter reporter, ReporterPara } catch (Exception e) { throw new MojoExecutionException("Unexpected error opening file ouput ", e); } finally { - if (fout != null) { + if (fileOutputStream != null) { try { - fout.close(); + fileOutputStream.close(); } catch (IOException e) { log.info(format("Failed to closing the reporting %s", reporterParameter.getClass())); } From 5f6299c745aebd9d411653fe89bf7d87e9be29ec Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 10:27:11 +0100 Subject: [PATCH 047/200] Test code clean up --- .../utplsql/maven/plugin/UtPLSQLMojoIT.java | 77 ++++++++++--------- .../utplsql/maven/plugin/UtPLSQLMojoTest.java | 68 +++++++++------- 2 files changed, 78 insertions(+), 67 deletions(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java index 3477383..e6a1f41 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java @@ -7,7 +7,6 @@ import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; -import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; @@ -19,6 +18,10 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + public class UtPLSQLMojoIT { private static String pluginVersion = null; @@ -44,16 +47,13 @@ public void testSimpleProject() { final String PROJECT_NAME = "simple-project"; File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); - Verifier verifier; - verifier = createVerifier(testProject); - + Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", - "utplsql/coverage-sonar-reporter.xml"); + checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); } catch (Exception e) { e.printStackTrace(); - Assert.fail("Unexpected Exception running the test of Definition " + e.getMessage()); + fail("Unexpected Exception running the test of Definition " + e.getMessage()); } } @@ -66,11 +66,10 @@ public void testRegexProject() { Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", - "utplsql/coverage-sonar-reporter.xml"); + checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); } catch (Exception e) { e.printStackTrace(); - Assert.fail("Unexpected Exception running the test : " + e.getMessage()); + fail("Unexpected Exception running the test : " + e.getMessage()); } } @@ -83,11 +82,10 @@ public void testTypeMappingProject() { Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", - "utplsql/coverage-sonar-reporter.xml"); + checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); } catch (Exception e) { e.printStackTrace(); - Assert.fail("Unexpected Exception running the test : " + e.getMessage()); + fail("Unexpected Exception running the test : " + e.getMessage()); } } @@ -100,11 +98,10 @@ public void testOwnerParameterProject() { Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", - "utplsql/coverage-sonar-reporter.xml"); + checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); } catch (Exception e) { e.printStackTrace(); - Assert.fail("Unexpected Exception running the test : " + e.getMessage()); + fail("Unexpected Exception running the test : " + e.getMessage()); } } @@ -118,7 +115,7 @@ public void testMinimalistProject() { verifier.executeGoal("test"); } catch (Exception e) { e.printStackTrace(); - Assert.fail("Unexpected Exception running the test : " + e.getMessage()); + fail("Unexpected Exception running the test : " + e.getMessage()); } } @@ -134,38 +131,42 @@ public void testTagsProject() { checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml"); } catch (Exception e) { e.printStackTrace(); - Assert.fail("Unexpected Exception running the test of Definition " + e.getMessage()); + fail("Unexpected Exception running the test of Definition " + e.getMessage()); } } + /** + * Duration is set to 1 before comparing contents as it is always different. + * Path separator is set to "/" to ensure windows / linux / mac compatibility. + * \r and \n are removed to provide simpler comparison. + * + * @param projectName Project name + * @param files Files to compare + */ private void checkReportsGenerated(String projectName, String... files) { for (String filename : files) { File outputFile = new File("target/test-classes/" + projectName + "/target", filename); File expectedOutputFile = new File("target/test-classes/" + projectName + "/expected-output", filename); - Assert.assertTrue("The reporter for " + filename + " was not generated", outputFile.exists()); + assertTrue("The reporter for " + filename + " was not generated", outputFile.exists()); + try { - // Duration is set to 1 before comparing contents as it is always different. - // Path separator is set to "/" to ensure windows / linux / mac compatibility. - Stream stream = Files - .lines(Paths.get("target", "test-classes", projectName, "target", filename)); - - String outputContent = stream - .filter(line -> !line.contains(" line.replaceAll("(duration=\"[0-9.]*\")", "duration=\"1\"")) - .map(line -> line.replaceAll("\\\\", "/")) - .map(line -> line.replaceAll("\r", "").replaceAll("\n", "")) - .collect(Collectors.joining("\n")); - - stream.close(); - Assert.assertEquals("The files differ!", - FileUtils.readFileToString(expectedOutputFile, "utf-8") - .replace("\r", "") - .replace("\n", ""), - outputContent.replace("\n", "")); + try (Stream stream = Files.lines(Paths.get("target", "test-classes", projectName, "target", filename))) { + String outputContent = stream + .filter(line -> !line.contains(" line.replaceAll("(duration=\"[0-9.]*\")", "duration=\"1\"")) + .map(line -> line.replaceAll("\\\\", "/")) + .map(line -> line.replaceAll("\r", "").replaceAll("\n", "")) + .collect(Collectors.joining("\n")); + assertEquals("The files differ!", + FileUtils.readFileToString(expectedOutputFile, "utf-8") + .replace("\r", "") + .replace("\n", ""), + outputContent.replace("\n", "")); + } } catch (IOException e) { e.printStackTrace(); - Assert.fail("Unexpected Exception running the test : " + e.getMessage()); + fail("Unexpected Exception running the test : " + e.getMessage()); } } } diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java index ad19cec..b436162 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java @@ -3,7 +3,6 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.testing.MojoRule; -import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -29,6 +28,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; @@ -64,7 +65,7 @@ public void setUp() throws Exception { } /** - * testInvalidSourcesDirectory. + * Invalid Sources Directory *

* Given : a pom.xml with invalid sources' directory * When : pom is read and buildSourcesOptions is run @@ -74,15 +75,15 @@ public void setUp() throws Exception { public void testInvalidSourcesDirectory() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalidTestsSourcesDirectories/"), "test"); - Assert.assertNotNull(utplsqlMojo); + assertNotNull(utplsqlMojo); - MojoExecutionException exception = Assert.assertThrows(MojoExecutionException.class, () -> Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions")); + MojoExecutionException exception = assertThrows(MojoExecutionException.class, () -> Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions")); - Assert.assertEquals("Invalid in your pom.xml", exception.getMessage()); + assertEquals("Invalid in your pom.xml", exception.getMessage()); } /** - * testInvalidTestsDirectory. + * Invalid Tests Directory *

* Given : a pom.xml with invalid tests' directory * When : pom is read and buildTestsOptions is run @@ -92,15 +93,15 @@ public void testInvalidSourcesDirectory() throws Exception { public void testInvalidTestsDirectory() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalidTestsSourcesDirectories/"), "test"); - Assert.assertNotNull(utplsqlMojo); + assertNotNull(utplsqlMojo); - MojoExecutionException exception = Assert.assertThrows(MojoExecutionException.class, () -> Whitebox.invokeMethod(utplsqlMojo, "buildTestsOptions")); + MojoExecutionException exception = assertThrows(MojoExecutionException.class, () -> Whitebox.invokeMethod(utplsqlMojo, "buildTestsOptions")); - Assert.assertEquals("Invalid in your pom.xml: Invalid bar in resource. Check your pom.xml", exception.getMessage()); + assertEquals("Invalid in your pom.xml: Invalid bar in resource. Check your pom.xml", exception.getMessage()); } /** - * testSourcesTestsParameters. + * Sources Tests Parameters *

* Given : a pom.xml with sources and tests with a lot of parameters * When : pom is read and buildSourcesOptions / buildTestsOptions are run @@ -110,7 +111,7 @@ public void testInvalidTestsDirectory() throws Exception { public void testSourcesTestsParameters() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/testSourcesTestsParams/"), "test"); - Assert.assertNotNull(utplsqlMojo); + assertNotNull(utplsqlMojo); // TODO : move to another test about reporters List reporters = Whitebox.getInternalState(utplsqlMojo, "reporters"); @@ -122,9 +123,9 @@ public void testSourcesTestsParameters() throws Exception { assertEquals("srcs/foo.sql", sources.getFilePaths().get(0)); assertEquals("code_owner", sources.getObjectOwner()); assertEquals(".*/\\w+/(\\w+)/(\\w+)\\.\\w{3}", sources.getRegexPattern()); - assertEquals(new Integer(9), sources.getNameSubExpression()); - assertEquals(new Integer(1), sources.getTypeSubExpression()); - assertEquals(new Integer(4), sources.getOwnerSubExpression()); + assertEquals(Integer.valueOf(9), sources.getNameSubExpression()); + assertEquals(Integer.valueOf(1), sources.getTypeSubExpression()); + assertEquals(Integer.valueOf(4), sources.getOwnerSubExpression()); assertEquals(1, sources.getTypeMappings().size()); assertEquals("bar", sources.getTypeMappings().get(0).getKey()); assertEquals("foo", sources.getTypeMappings().get(0).getValue()); @@ -136,16 +137,16 @@ public void testSourcesTestsParameters() throws Exception { assertTrue(tests.getFilePaths().contains("te/st/spec.spc")); assertEquals("tests_owner", tests.getObjectOwner()); assertEquals(".*/\\w+/(\\w+)/(\\w+)\\.\\w{3}", tests.getRegexPattern()); - assertEquals(new Integer(54), tests.getNameSubExpression()); - assertEquals(new Integer(21), tests.getTypeSubExpression()); - assertEquals(new Integer(24), tests.getOwnerSubExpression()); + assertEquals(Integer.valueOf(54), tests.getNameSubExpression()); + assertEquals(Integer.valueOf(21), tests.getTypeSubExpression()); + assertEquals(Integer.valueOf(24), tests.getOwnerSubExpression()); assertEquals(1, tests.getTypeMappings().size()); assertEquals("def", tests.getTypeMappings().get(0).getKey()); assertEquals("abc", tests.getTypeMappings().get(0).getValue()); } /** - * testSourcesAndTestsParameterDoesNotExist. + * Sources and Tests Parameter does not exist *

* Given : a pom.xml with no sources / tests tags and default directory does not exist. * When : pom is read and buildSourcesOptions / buildTestsOptions are run @@ -155,7 +156,7 @@ public void testSourcesTestsParameters() throws Exception { public void testSourcesAndTestsParameterDoesNotExist() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule.lookupConfiguredMojo( new File("src/test/resources/unit-tests/testNoSourcesTestsParams/directoryDoesNotExist/"), "test"); - Assert.assertNotNull(utplsqlMojo); + assertNotNull(utplsqlMojo); // check sources FileMapperOptions sources = Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions"); @@ -167,7 +168,7 @@ public void testSourcesAndTestsParameterDoesNotExist() throws Exception { } /** - * testSourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists. + * Sources and Tests Parameter does not exist but Default Directory exists *

* Given : a pom.xml with no sources / tests tags but default directory exists. * When : pom is read and buildSourcesOptions / buildTestsOptions are run @@ -177,7 +178,7 @@ public void testSourcesAndTestsParameterDoesNotExist() throws Exception { public void testSourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/"), "test"); - Assert.assertNotNull(utplsqlMojo); + assertNotNull(utplsqlMojo); // check sources FileMapperOptions sources = Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions"); @@ -193,7 +194,7 @@ public void testSourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() } /** - * testSourcesAndTestsParameterHaveNotDirectoryTag. + * Sources and Tests Parameter have not Directory Tag *

* Given : a pom.xml with source and test tag not containing a directory tag. * When : pom is read and buildSourcesOptions / buildTestsOptions are run @@ -203,7 +204,7 @@ public void testSourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() public void testSourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/"), "test"); - Assert.assertNotNull(utplsqlMojo); + assertNotNull(utplsqlMojo); // check sources FileMapperOptions sources = Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions"); @@ -220,7 +221,7 @@ public void testSourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { } /** - * testSourcesAndTestsParameterHaveNotDirectoryTag. + * Sources and Tests Parameter have not Directory Tag *

* Given : a pom.xml with source and test tag not containing a directory tag. * When : pom is read and buildSourcesOptions / buildTestsOptions are run @@ -230,7 +231,7 @@ public void testSourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { public void testSourcesAndTestsParameterHaveNotIncludesTag() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/"), "test"); - Assert.assertNotNull(utplsqlMojo); + assertNotNull(utplsqlMojo); // check sources FileMapperOptions sources = Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions"); @@ -245,11 +246,14 @@ public void testSourcesAndTestsParameterHaveNotIncludesTag() throws Exception { assertTrue(tests.getFilePaths().contains("src/test/bar/f2.pkg")); } + /** + * Default Console Behaviour + */ @Test public void testDefaultConsoleBehaviour() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/defaultConsoleOutputBehaviour/"), "test"); - Assert.assertNotNull(utplsqlMojo); + assertNotNull(utplsqlMojo); List reporterList = new ArrayList<>(); when(mockReporterFactory.createReporter(anyString())).thenAnswer(invocation -> { @@ -290,11 +294,14 @@ public void testDefaultConsoleBehaviour() throws Exception { assertTrue(reporterParameter3.isFileOutput()); } + /** + * Add Default Reporter + */ @Test public void testAddDefaultReporter() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/defaultConsoleOutputBehaviour/"), "test"); - Assert.assertNotNull(utplsqlMojo); + assertNotNull(utplsqlMojo); List reporterList = new ArrayList<>(); when(mockReporterFactory.createReporter(anyString())).thenAnswer(invocation -> { @@ -314,11 +321,14 @@ public void testAddDefaultReporter() throws Exception { verify(reporterList.get(0)).init(mockConnection); } + /** + * Skip utPLSQL Tests + */ @Test public void testSkipUtplsqlTests() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/skipUtplsqlTests/"), "test"); - Assert.assertNotNull(utplsqlMojo); + assertNotNull(utplsqlMojo); final ByteArrayOutputStream console = new ByteArrayOutputStream(); System.setOut(new PrintStream(console)); @@ -327,6 +337,6 @@ public void testSkipUtplsqlTests() throws Exception { String standardOutput = console.toString(); - Assert.assertTrue(standardOutput.contains("utPLSQLTests are skipped.")); + assertTrue(standardOutput.contains("utPLSQLTests are skipped.")); } } From b8e3c9b3c26306fb3bf58faea6625a1962139146 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 10:37:28 +0100 Subject: [PATCH 048/200] Added skip IT --- .../utplsql/maven/plugin/UtPLSQLMojoIT.java | 17 ++++ src/test/resources/skip-project/pom.xml | 79 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 src/test/resources/skip-project/pom.xml diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java index e6a1f41..0b131aa 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java @@ -19,6 +19,7 @@ import java.util.stream.Stream; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -135,6 +136,22 @@ public void testTagsProject() { } } + @Test + public void testSkipUtplsqlTests() { + try { + final String PROJECT_NAME = "skip-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + + Verifier verifier = createVerifier(testProject); + verifier.executeGoal("test"); + + assertFalse(new File("target/test-classes/" + PROJECT_NAME + "/target").exists()); + } catch (Exception e) { + e.printStackTrace(); + fail("Unexpected Exception running the test of Definition " + e.getMessage()); + } + } + /** * Duration is set to 1 before comparing contents as it is always different. * Path separator is set to "/" to ensure windows / linux / mac compatibility. diff --git a/src/test/resources/skip-project/pom.xml b/src/test/resources/skip-project/pom.xml new file mode 100644 index 0000000..2eae06a --- /dev/null +++ b/src/test/resources/skip-project/pom.xml @@ -0,0 +1,79 @@ + + 4.0.0 + + org.utplsql + utplsql-maven-plugin-simple-test + 1.0.0 + pom + + utplsql-maven-plugin IT Skip Tests + + + + + + + + ${project.groupId} + utplsql-maven-plugin + ${utplsql-maven-plugin-version} + + + + test + + + true + + + + false + + + app + + + + + UT_COVERAGE_SONAR_REPORTER + utplsql/coverage-sonar-reporter.xml + true + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-reporter.xml + true + + + + + + scripts/sources + + **/*bdy + **/*spc + + + + + + + scripts/tests + + **/*bdy + **/*spc + + + + + + + + + + + + + From 729eb60c694fa66646b54f0df358ffb89c4f7655 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 11:43:10 +0100 Subject: [PATCH 049/200] Added release.yml --- .github/workflows/build.yml | 5 +--- .github/workflows/release.yml | 55 +++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 980fa25..c8d7aaf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,14 +1,11 @@ name: Build -# Controls when the workflow will run on: - # Triggers the workflow on push or pull request events but only for the develop branch push: branches: [ develop ] pull_request: branches: [ develop ] - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: jobs: @@ -53,4 +50,4 @@ jobs: ${{ runner.os }}-maven- - name: Maven verify - run: mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify + run: mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7b0a840 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,55 @@ +name: Build + +on: + push: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + services: + oracle: + image: gvenzl/oracle-xe:18.4.0-slim + env: + ORACLE_PASSWORD: oracle + ports: + - 1521:1521 + options: >- + --health-cmd healthcheck.sh + --health-interval 10s + --health-timeout 5s + --health-retries 10 + + steps: + - uses: actions/checkout@v2 + + - name: Install utPLSQL + run: sh ${{ github.workspace }}/scripts/1_install_utplsql.sh + + - name: Install demo project + run: sh ${{ github.workspace }}/scripts/2_install_demo_project.sh + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Maven deploy to Maven Central + run: mvn deploy -Prelease + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} From b57f1bae93718c5251a39ac60e548f5f0e2b0f20 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 13:14:09 +0100 Subject: [PATCH 050/200] Update versions for release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ad92810..e0c0d49 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.6-SNAPSHOT + 3.1.6RC1 maven-plugin utPLSQL Maven Plugin From e33720c4cd53540a466a5056cf42e2e20fb2b864 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 13:14:16 +0100 Subject: [PATCH 051/200] Update for next development version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e0c0d49..41ed14e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.6RC1 + 3.1.6RC2-SNAPSHOT maven-plugin utPLSQL Maven Plugin From 0e8f5aac7010ed28f6b5c138451d3ae181e7d22a Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 13:14:52 +0100 Subject: [PATCH 052/200] Updated snapshot version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 41ed14e..ad92810 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.6RC2-SNAPSHOT + 3.1.6-SNAPSHOT maven-plugin utPLSQL Maven Plugin From 8c16ff0d0b24e84909b37fd1c4149fcab5c858de Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 13:38:50 +0100 Subject: [PATCH 053/200] Added GPG support --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7b0a840..8f2314e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,6 +39,8 @@ jobs: server-id: ossrh server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE - name: Cache local Maven repository uses: actions/cache@v2 @@ -53,3 +55,4 @@ jobs: env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} From f944086163226fd77ba2625cc043c2b4fb937786 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 15:53:42 +0100 Subject: [PATCH 054/200] Added snapshot deploy --- .github/workflows/build.yml | 13 +++++++++++-- .github/workflows/release.yml | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8d7aaf..fa16702 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,6 +40,11 @@ jobs: with: java-version: '8' distribution: 'adopt' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE - name: Cache local Maven repository uses: actions/cache@v2 @@ -49,5 +54,9 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - - name: Maven verify - run: mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify + - name: Maven deploy snapshot + run: mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8f2314e..c1bab07 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,7 +50,7 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - - name: Maven deploy to Maven Central + - name: Maven deploy release run: mvn deploy -Prelease env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} From 63f4645541fa83732a1dd58453ae876e187a826d Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 16:04:28 +0100 Subject: [PATCH 055/200] Update versions for release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ad92810..42d0699 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.6-SNAPSHOT + 3.1.6.RC2 maven-plugin utPLSQL Maven Plugin From 15f7833d1bb520dec123cc40d16fad2de120775d Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 16:04:35 +0100 Subject: [PATCH 056/200] Update for next development version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 42d0699..5a3d49a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.6.RC2 + 3.1.7.RC2-SNAPSHOT maven-plugin utPLSQL Maven Plugin From 3273fa7dcaf81c6d707527ffd796361448ad771e Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 16:05:23 +0100 Subject: [PATCH 057/200] Updated snapshot version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5a3d49a..ad92810 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.7.RC2-SNAPSHOT + 3.1.6-SNAPSHOT maven-plugin utPLSQL Maven Plugin From e5cfe6ba86755509e2ab8cbad1612f821f73c56b Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 16:29:47 +0100 Subject: [PATCH 058/200] Added Sonar --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa16702..b92f79e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,3 +60,6 @@ jobs: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + + - name: Sonar + run: mvn sonar:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin From 189c2ddcdb916b0a82b515f00b52cba7be1c43fb Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 16:32:41 +0100 Subject: [PATCH 059/200] Names changed --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b92f79e..7b65606 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build +name: Build and deploy snapshot on: push: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c1bab07..dca33af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Build +name: Build and deploy release on: push: From b4ea8806483e16e8bbde99a01001482c64e943ea Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 16:37:20 +0100 Subject: [PATCH 060/200] Added tokens --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b65606..b1eb25c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,5 +61,11 @@ jobs: MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@v1.6 + - name: Sonar run: mvn sonar:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 82a6c4513ff629eb7a5dc420dd4b7840029518a5 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 16:39:33 +0100 Subject: [PATCH 061/200] Added tokens --- .github/workflows/build.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b1eb25c..4074244 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,11 +61,8 @@ jobs: MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@v1.6 - - name: Sonar - run: mvn sonar:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + run: mvn org.sonarsource.scanner.maven:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From a51c81a31efaf09ae2e3d7afe0dc74a6da33a97f Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 16:45:40 +0100 Subject: [PATCH 062/200] Added tokens --- .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 4074244..381febe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,7 @@ jobs: MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - name: Sonar - run: mvn org.sonarsource.scanner.maven:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + run: mvn sonar:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 59f52734803a89ed7bdcd34f6d7e2a75bf2ee70e Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 16:53:55 +0100 Subject: [PATCH 063/200] Added sonar properties --- .github/workflows/build.yml | 2 +- pom.xml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 381febe..4fcfa69 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,7 @@ jobs: MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - name: Sonar - run: mvn sonar:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + run: sonar:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/pom.xml b/pom.xml index ad92810..c1b691c 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,8 @@ 3.5.2 2.0.9 2.3.1 + utplsql + https://sonarcloud.io From 3407a8d2b05415b451118acf42aa10718a855379 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 16:58:44 +0100 Subject: [PATCH 064/200] Added sonar properties --- .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 4fcfa69..207003d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,7 @@ jobs: MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - name: Sonar - run: sonar:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From a29a2c5f832143437383befddbbf1804f547a90b Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 17:06:03 +0100 Subject: [PATCH 065/200] Switched to Java 11 --- .github/workflows/build.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 207003d..dd028be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,10 +35,10 @@ jobs: - name: Install demo project run: sh ${{ github.workspace }}/scripts/2_install_demo_project.sh - - name: Set up JDK 8 + - name: Set up JDK 11 uses: actions/setup-java@v2 with: - java-version: '8' + java-version: '11' distribution: 'adopt' server-id: ossrh server-username: MAVEN_USERNAME diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dca33af..389b0b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,10 +31,10 @@ jobs: - name: Install demo project run: sh ${{ github.workspace }}/scripts/2_install_demo_project.sh - - name: Set up JDK 8 + - name: Set up JDK 11 uses: actions/setup-java@v2 with: - java-version: '8' + java-version: '11' distribution: 'adopt' server-id: ossrh server-username: MAVEN_USERNAME From 9a8558c29e27732ba16533b812ec08a6a812f725 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 17:12:26 +0100 Subject: [PATCH 066/200] First verify sonar then deploy without tests --- .github/workflows/build.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd028be..7ba7a0d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,15 +54,16 @@ jobs: restore-keys: | ${{ runner.os }}-maven- + - name: Sonar + run: mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Maven deploy snapshot - run: mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy + run: mvn deploy -DskipTests env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - - name: Sonar - run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 20e49b78aca905a44ccc41570363a1b7c062cabd Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 17:21:47 +0100 Subject: [PATCH 067/200] Added Jacoco --- .github/workflows/build.yml | 2 +- pom.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ba7a0d..c980db0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,7 +55,7 @@ jobs: ${{ runner.os }}-maven- - name: Sonar - run: mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + run: mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/pom.xml b/pom.xml index c1b691c..b1d4419 100644 --- a/pom.xml +++ b/pom.xml @@ -58,6 +58,7 @@ 2.3.1 utplsql https://sonarcloud.io + ${project.basedir}/target/jacoco.exec From 00a9d5f9627911908f9c81c2edc62db6505ce83e Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 17:31:06 +0100 Subject: [PATCH 068/200] Sonar with plugin --- .github/workflows/build.yml | 2 +- pom.xml | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c980db0..5509d41 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,7 +55,7 @@ jobs: ${{ runner.os }}-maven- - name: Sonar - run: mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + run: mvn sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/pom.xml b/pom.xml index b1d4419..fa338a5 100644 --- a/pom.xml +++ b/pom.xml @@ -58,7 +58,6 @@ 2.3.1 utplsql https://sonarcloud.io - ${project.basedir}/target/jacoco.exec @@ -245,6 +244,32 @@ + + coverage + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + prepare-agent + + prepare-agent + + + + report + + report + + + + + + + release From ce86257c9470b3b4a285759d39e57949211d69cc Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 17:35:46 +0100 Subject: [PATCH 069/200] Forgot verify goal --- .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 5509d41..a695f08 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,7 +55,7 @@ jobs: ${{ runner.os }}-maven- - name: Sonar - run: mvn sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + run: mvn verify sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 45ad8d33fc5f50af0549c8ba3ddb1ce059be23a9 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 17:40:33 +0100 Subject: [PATCH 070/200] Added version to sqlplus image --- scripts/1_install_utplsql.sh | 2 +- scripts/2_install_demo_project.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/1_install_utplsql.sh b/scripts/1_install_utplsql.sh index 1f3f314..bb6577c 100644 --- a/scripts/1_install_utplsql.sh +++ b/scripts/1_install_utplsql.sh @@ -5,4 +5,4 @@ curl -Lk "${UTPLSQL_DOWNLOAD_URL}" -o utPLSQL.zip unzip -q utPLSQL.zip docker run --rm -v $(pwd)/utPLSQL:/utPLSQL -w /utPLSQL/source --network host \ - --entrypoint sqlplus truemark/sqlplus sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users + --entrypoint sqlplus truemark/sqlplus:19.8 sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users diff --git a/scripts/2_install_demo_project.sh b/scripts/2_install_demo_project.sh index 8ef285a..a4089b1 100644 --- a/scripts/2_install_demo_project.sh +++ b/scripts/2_install_demo_project.sh @@ -1,11 +1,11 @@ -docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus \ +docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \ sys/oracle@//127.0.0.1:1521/XE as sysdba @scripts/sql/create_users.sql -docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus \ +docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \ app/pass@//127.0.0.1:1521/XE @scripts/sql/create_app_objects.sql -docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus \ +docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \ code_owner/pass@//127.0.0.1:1521/XE @scripts/sql/create_source_owner_objects.sql -docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus \ +docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \ tests_owner/pass@//127.0.0.1:1521/XE @scripts/sql/create_tests_owner_objects.sql From 7cf0b920145c6eede52e2929e0e9b81d0fe24409 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 17:49:52 +0100 Subject: [PATCH 071/200] Fetch depth to avoid Sonar warning and merged two steps --- .github/workflows/build.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a695f08..132cddf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,6 +28,8 @@ jobs: steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Install utPLSQL run: sh ${{ github.workspace }}/scripts/1_install_utplsql.sh @@ -54,15 +56,11 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - - name: Sonar - run: mvn verify sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + - name: Maven deploy snapshot and run Sonar + run: mvn deploy sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - - name: Maven deploy snapshot - run: mvn deploy -DskipTests - env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} From 0663427c168ed85342a615d3d9e612712b43054a Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 17:51:50 +0100 Subject: [PATCH 072/200] Removed .travis --- .travis/.travis.yml_old | 62 --------------------- .travis/deploy_release.sh | 4 -- .travis/deploy_snapshot.sh | 4 -- .travis/install_demo_project.sh | 18 ------ .travis/install_utplsql.sh | 14 ----- .travis/maven_cfg.sh | 5 -- .travis/settings.xml | 26 --------- .travis/sql/create_app_objects.sql | 9 --- .travis/sql/create_source_owner_objects.sql | 6 -- .travis/sql/create_tests_owner_objects.sql | 7 --- .travis/sql/create_users.sql | 30 ---------- .travis/start_db.sh | 14 ----- 12 files changed, 199 deletions(-) delete mode 100644 .travis/.travis.yml_old delete mode 100755 .travis/deploy_release.sh delete mode 100755 .travis/deploy_snapshot.sh delete mode 100644 .travis/install_demo_project.sh delete mode 100644 .travis/install_utplsql.sh delete mode 100644 .travis/maven_cfg.sh delete mode 100644 .travis/settings.xml delete mode 100644 .travis/sql/create_app_objects.sql delete mode 100644 .travis/sql/create_source_owner_objects.sql delete mode 100644 .travis/sql/create_tests_owner_objects.sql delete mode 100644 .travis/sql/create_users.sql delete mode 100644 .travis/start_db.sh diff --git a/.travis/.travis.yml_old b/.travis/.travis.yml_old deleted file mode 100644 index 0591815..0000000 --- a/.travis/.travis.yml_old +++ /dev/null @@ -1,62 +0,0 @@ -sudo: required -language: java - -services: - - docker - -jdk: - - openjdk8 - -env: - global: - - DOCKER_CFG=$HOME/.docker - - DOCKER_REPO="utplsqlv3/oracledb" - - CACHE_DIR=$HOME/.cache - - MAVEN_HOME=/usr/local/maven - - MAVEN_CFG=$HOME/.m2 - - DB_URL="127.0.0.1:1521:XE" - - DB_UT3_USER=ut3 - - DB_UT3_PASS=ut3 - - ORACLE_VERSION="11g-r2-xe" - - DOCKER_OPTIONS="--shm-size=1g" - -cache: - directories: - - $DOCKER_CFG - - $CACHE_DIR - - $MAVEN_CFG - -install: - - bash .travis/maven_cfg.sh - - bash .travis/start_db.sh - - bash .travis/install_utplsql.sh - - bash .travis/install_demo_project.sh - -script: - - echo "Run Verify with Coverage" - - mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify -DdbUser="${DB_UT3_USER}" -DdbPass="${DB_UT3_PASS}" -DdbUrl="jdbc:oracle:thin:@${DB_URL}" - -before_deploy: - - echo $GPG_SECRET_KEYS | base64 --decode | ${GPG_EXECUTABLE} --import - - echo $GPG_OWNERTRUST | base64 --decode | ${GPG_EXECUTABLE} --import-ownertrust - -deploy: - - provider: script - skip_cleanup: true - script: bash .travis/deploy_snapshot.sh - on: - repo: utPLSQL/utPLSQL-maven-plugin - branch: develop - - provider: script - skip_cleanup: true - script: bash .travis/deploy_release.sh - on: - repo: utPLSQL/utPLSQL-maven-plugin - tags: true - -notifications: - slack: - rooms: - - secure: "Gz0pGOOM6xbnz8Q/B3RzOFoVr8QGXsDSHcgCloPnO3ZkEOh4JJikqWAVdZrksMxhewIBRpbdIWAZOgsNXvW+cEDXxfml3X9Clj2wg5Uon97UeI+5WEHDhLYHn7t9EYr9QvVSOuQgBIiddk6kURxY4N0eAA4VUti8BDcMRq+gPxF1w/toFJXVR/I/tkLxcHPTbWQ9X87nNWcQgMoHe2AixYpglntmtoLXJ5F8MF08fcyTX7GJQ5xjq7HbYy+/39nEhQo2ZPhHHfk2rS6gIUY0wc+MAqobxvesplgGDybdTQyrdl48VjJ/CiQDedglUbNN9VYTFjPIYMdWCUCLV1uL866aNMiBpB7CQoNhi5WS7RERE9gblVPX2k6tOda27fEWlhjha6OmdK6TQ9qTITU7U4OTSOz41dDPeVfqMHRggxo3ozlLONTiZ1y9fz/Ez9WjiJjtUDt60vgnVIo7BcQV/yDJcqAtQbfWyf0n73g5lMBvLGnO2Agm2N7hNEeCbpr+PZUoqkEM/e4SxdUCQGi8Ppi9Zp0E4v0iG7hyjzol+G4T8JN0bUGg0OOow/bfZa5J2aUsrC1qP/ZLpMA94NI6ZlL2wRHhZ9JtVSDLjtSwq9yW5XF7o7kdqBWBCslbGnYPoCoHOzfZuUvArSlRoGNu75dw/Qhoo9gFl1RG/RlChaU=" - on_success: change - on_failure: always diff --git a/.travis/deploy_release.sh b/.travis/deploy_release.sh deleted file mode 100755 index 5e41660..0000000 --- a/.travis/deploy_release.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -ev - -mvn deploy -DskipTests -U -Prelease diff --git a/.travis/deploy_snapshot.sh b/.travis/deploy_snapshot.sh deleted file mode 100755 index 5e41660..0000000 --- a/.travis/deploy_snapshot.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -ev - -mvn deploy -DskipTests -U -Prelease diff --git a/.travis/install_demo_project.sh b/.travis/install_demo_project.sh deleted file mode 100644 index af6ff00..0000000 --- a/.travis/install_demo_project.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -ev - -DB_URL="//127.0.0.1:1521/XE" -SQLPLUS_IMAGE=${DOCKER_REPO}:${ORACLE_VERSION} -VOLUME="/project" - -docker run --rm -v $(pwd):${VOLUME} -w ${VOLUME} --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \ - sys/oracle@${DB_URL} as sysdba @.travis/sql/create_users.sql - -docker run --rm -v $(pwd):${VOLUME} -w ${VOLUME} --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \ - app/pass@${DB_URL} @.travis/sql/create_app_objects.sql - -docker run --rm -v $(pwd):${VOLUME} -w ${VOLUME} --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \ - code_owner/pass@${DB_URL} @.travis/sql/create_source_owner_objects.sql - -docker run --rm -v $(pwd):${VOLUME} -w ${VOLUME} --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \ - tests_owner/pass@${DB_URL} @.travis/sql/create_tests_owner_objects.sql diff --git a/.travis/install_utplsql.sh b/.travis/install_utplsql.sh deleted file mode 100644 index b02907b..0000000 --- a/.travis/install_utplsql.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -ev -cd $(dirname $(readlink -f $0)) - -DB_URL="//127.0.0.1:1521/XE" -UTPLSQL_VERSION="v3.1.9" -UTPLSQL_DIR="utPLSQL" -SQLPLUS_IMAGE=${DOCKER_REPO}:${ORACLE_VERSION} -VOLUME="/utPLSQL" - -git clone --depth=1 --branch=${UTPLSQL_VERSION} https://github.com/utPLSQL/utPLSQL.git ${UTPLSQL_DIR} - -docker run --rm -v $(pwd)/${UTPLSQL_DIR}:${VOLUME} -w ${VOLUME}/source --network host --entrypoint sqlplus ${SQLPLUS_IMAGE} \ - sys/oracle@${DB_URL} as sysdba @install_headless.sql ${DB_UT3_USER} ${DB_UT3_PASS} users diff --git a/.travis/maven_cfg.sh b/.travis/maven_cfg.sh deleted file mode 100644 index 82661ad..0000000 --- a/.travis/maven_cfg.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -ev -cd $(dirname $(readlink -f $0)) - -cp settings.xml $MAVEN_CFG/settings.xml diff --git a/.travis/settings.xml b/.travis/settings.xml deleted file mode 100644 index 5f7d87e..0000000 --- a/.travis/settings.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - ossrh - - true - - - ${env.GPG_EXECUTABLE} - ${env.GPG_PASSPHRASE} - - - - - - - ossrh - ${env.SONATYPE_USERNAME} - ${env.SONATYPE_PASSWORD} - - - diff --git a/.travis/sql/create_app_objects.sql b/.travis/sql/create_app_objects.sql deleted file mode 100644 index 734b51e..0000000 --- a/.travis/sql/create_app_objects.sql +++ /dev/null @@ -1,9 +0,0 @@ -whenever sqlerror exit failure rollback -whenever oserror exit failure rollback - -@src/test/resources/simple-project/scripts/sources/TO_TEST_ME.tab -@src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.spc -@src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy - -@src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc -@src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy diff --git a/.travis/sql/create_source_owner_objects.sql b/.travis/sql/create_source_owner_objects.sql deleted file mode 100644 index 2d15146..0000000 --- a/.travis/sql/create_source_owner_objects.sql +++ /dev/null @@ -1,6 +0,0 @@ -whenever sqlerror exit failure rollback -whenever oserror exit failure rollback - -@src/test/resources/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab -@src/test/resources/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql -@src/test/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql diff --git a/.travis/sql/create_tests_owner_objects.sql b/.travis/sql/create_tests_owner_objects.sql deleted file mode 100644 index e2d9a7c..0000000 --- a/.travis/sql/create_tests_owner_objects.sql +++ /dev/null @@ -1,7 +0,0 @@ -whenever sqlerror exit failure rollback -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/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql -@src/test/resources/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql diff --git a/.travis/sql/create_users.sql b/.travis/sql/create_users.sql deleted file mode 100644 index fe64882..0000000 --- a/.travis/sql/create_users.sql +++ /dev/null @@ -1,30 +0,0 @@ -whenever sqlerror exit failure rollback -whenever oserror exit failure rollback -set echo off -set verify off - -define UTPLSQL_USER = 'UT3'; -define APP_USER = 'APP'; -define CODE_OWNER = 'CODE_OWNER'; -define TESTS_OWNER = 'TESTS_OWNER'; -define DB_PASS = 'pass'; - -grant execute any procedure to &UTPLSQL_USER; -grant create any procedure to &UTPLSQL_USER; -grant execute on dbms_lob to &UTPLSQL_USER; -grant execute on dbms_sql to &UTPLSQL_USER; -grant execute on dbms_xmlgen to &UTPLSQL_USER; -grant execute on dbms_lock to &UTPLSQL_USER; - -create user &APP_USER identified by &DB_PASS quota unlimited on USERS default tablespace USERS; -grant create session, create procedure, create type, create table, create sequence, create view to &APP_USER; -grant select any dictionary to &APP_USER; - -create user &CODE_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS; -grant create session, create procedure, create type, create table, create sequence, create view to &CODE_OWNER; - -create user &TESTS_OWNER identified by &DB_PASS quota unlimited on USERS default tablespace USERS; -grant create session, create procedure, create type, create table, create sequence, create view, create synonym to &TESTS_OWNER; -grant select any dictionary to &TESTS_OWNER; -grant select any table, delete any table, drop any table to &TESTS_OWNER; -grant execute any procedure to &TESTS_OWNER; diff --git a/.travis/start_db.sh b/.travis/start_db.sh deleted file mode 100644 index a5b2414..0000000 --- a/.travis/start_db.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -ev - -# If docker credentials are not cached, do the login. -if [ ! -f $DOCKER_CFG/config.json ]; then - docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" -else - echo "Using docker login from cache..." -fi - -# Pull the specified db version from docker hub. -docker pull $DOCKER_REPO:$ORACLE_VERSION -docker run -d --name $ORACLE_VERSION $DOCKER_OPTIONS -p 127.0.0.1:1521:1521 $DOCKER_REPO:$ORACLE_VERSION -docker logs -f $ORACLE_VERSION | grep -m 1 "DATABASE IS READY TO USE!" --line-buffered From 9b666b7132f9acf49c2814af1a0c608193520179 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 18:08:00 +0100 Subject: [PATCH 073/200] Removed unused class and minor code improvements --- .../org/utplsql/maven/plugin/UtPLSQLMojo.java | 20 ++++++------ .../maven/plugin/helper/ReporterDefault.java | 31 ------------------- 2 files changed, 9 insertions(+), 42 deletions(-) delete mode 100644 src/main/java/org/utplsql/maven/plugin/helper/ReporterDefault.java diff --git a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java index 8f92b81..bad3ccd 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java @@ -354,19 +354,17 @@ private void logParameters(FileMapperOptions sourceMappingOptions, FileMapperOpt Log log = getLog(); log.info("Invoking TestRunner with: " + targetDir); - if (!log.isDebugEnabled()) { - return; - } - - log.debug("Invoking TestRunner with: "); + if (log.isDebugEnabled()) { + log.debug("Invoking TestRunner with: "); - log.debug("reporters="); - reporterList.forEach((Reporter r) -> log.debug(r.getTypeName())); + log.debug("reporters="); + reporterList.forEach((Reporter r) -> log.debug(r.getTypeName())); - log.debug("sources="); - sourceMappingOptions.getFilePaths().forEach(log::debug); + log.debug("sources="); + sourceMappingOptions.getFilePaths().forEach(log::debug); - log.debug("tests="); - testMappingOptions.getFilePaths().forEach(log::debug); + log.debug("tests="); + testMappingOptions.getFilePaths().forEach(log::debug); + } } } diff --git a/src/main/java/org/utplsql/maven/plugin/helper/ReporterDefault.java b/src/main/java/org/utplsql/maven/plugin/helper/ReporterDefault.java deleted file mode 100644 index fd89c9e..0000000 --- a/src/main/java/org/utplsql/maven/plugin/helper/ReporterDefault.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.utplsql.maven.plugin.helper; - -import org.utplsql.api.reporter.Reporter; - -/** - * This class is an enumeration of all the known reporter in {@code utPLSQL}. - * Furthermore, it defines the default output file for each {@link Reporter}. - * In case the output file is set to {@code -}, it will mean the stdout of the process. - * - * @author Alberto Hernández - */ -public enum ReporterDefault { - - UT_DOCUMENTATION_REPORTER("-"), - UT_COVERAGE_HTML_REPORTER("utplsql/coverage-html-reporter.html"), - UT_TEAMCITY_REPORTER("utplsql/teamcity-reporter.txt"), - UT_XUNIT_REPORTER("utplsql/xunit-reporter.xml"), - UT_COVERALLS_REPORTER("utplsql/coveralls-reporter.json"), - UT_COVERAGE_SONAR_REPORTER("utplsql/coverage-sonar-reporter.xml"), - UT_SONAR_TEST_REPORTER("utplsql/sonar-test-reporter.xml"); - - private final String outputFile; - - ReporterDefault(String outputFile) { - this.outputFile = outputFile; - } - - public String getOutputFile() { - return outputFile; - } -} From 32b2e551d30222e991a94a0a4f2dcc9161e370d4 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 18:19:36 +0100 Subject: [PATCH 074/200] Minor code imporvements --- src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java index bad3ccd..2c68462 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java @@ -213,7 +213,7 @@ public void execute() throws MojoExecutionException { throw new MojoExecutionException(e.getMessage(), e); } finally { try { - if (null != connection) { + if (connection != null) { reporterWriter.writeReporters(connection); DBHelper.disableDBMSOutput(connection); @@ -337,7 +337,7 @@ private List initReporters(Connection connection, Version utlVersion, reporterList.add(reporter); // Turns the console output on by default if both file and console output are empty. - if (!reporterParameter.isFileOutput() && null == reporterParameter.getConsoleOutput()) { + if (!reporterParameter.isFileOutput() && reporterParameter.getConsoleOutput() == null) { reporterParameter.setConsoleOutput(true); } From 3b786a9b1fd323fc724e8dc4bd87096467f9a058 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 18:28:12 +0100 Subject: [PATCH 075/200] Added Debug Logging --- .../java/org/utplsql/maven/plugin/reporter/ReporterWriter.java | 2 ++ src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java | 1 + 2 files changed, 3 insertions(+) diff --git a/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java b/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java index 8123d07..6bfbd23 100644 --- a/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java +++ b/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java @@ -60,7 +60,9 @@ public void addReporter(ReporterParameter parameter, Reporter reporter) { * @throws MojoExecutionException if any exception happens */ public void writeReporters(Connection connection) throws MojoExecutionException { + log.debug("Write Reporters"); for (Pair pair : listReporters) { + log.debug("Write writeReports " + pair.getRight().getName()); writeReports(connection, pair.getLeft(), pair.getRight()); } } diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java index 0b131aa..575b412 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java @@ -192,6 +192,7 @@ private Verifier createVerifier(File testProject) throws VerificationException { Verifier verifier; verifier = new Verifier(testProject.getAbsolutePath()); verifier.addCliOption("-N"); + verifier.addCliOption("-X"); verifier.addCliOption("-Dutplsql-maven-plugin-version=" + pluginVersion); verifier.addCliOption("-DdbUrl=jdbc:oracle:thin:@127.0.0.1:1521:XE"); verifier.addCliOption("-DdbUser=UT3"); From b63101185bb0c14dfb59264690425a4b14302d05 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 23 Nov 2021 18:34:23 +0100 Subject: [PATCH 076/200] Swaped arguments --- src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java index b436162..8f06fdc 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java @@ -115,7 +115,7 @@ public void testSourcesTestsParameters() throws Exception { // TODO : move to another test about reporters List reporters = Whitebox.getInternalState(utplsqlMojo, "reporters"); - assertEquals(reporters.size(), 2); + assertEquals(2, reporters.size()); // check sources FileMapperOptions sources = Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions"); From b1c7d9082f70459ef048306df6ee4df36d01de29 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 07:14:52 +0100 Subject: [PATCH 077/200] Activate for all branches except main --- .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 132cddf..6fe97ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Build and deploy snapshot on: push: - branches: [ develop ] + branches-ignore: [ main ] pull_request: branches: [ develop ] From 7bc8279564df255dea48ef435dcbe02da4495ea6 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 07:20:30 +0100 Subject: [PATCH 078/200] Update versions for feature branch --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fa338a5..42ffb07 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.6-SNAPSHOT + 3.1.6-testability_improvement-SNAPSHOT maven-plugin utPLSQL Maven Plugin From 2dc889109a9345177e8799fbb2325391755b7126 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 07:27:49 +0100 Subject: [PATCH 079/200] Cleaned tests --- .../utplsql/maven/plugin/UtPLSQLMojoIT.java | 143 +++++++----------- .../utplsql/maven/plugin/UtPLSQLMojoTest.java | 20 +-- 2 files changed, 64 insertions(+), 99 deletions(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java index 575b412..ec6e878 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java @@ -43,113 +43,78 @@ public static void setUp() throws VerificationException, IOException, XmlPullPar } @Test - public void testSimpleProject() { - try { - final String PROJECT_NAME = "simple-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); - } catch (Exception e) { - e.printStackTrace(); - fail("Unexpected Exception running the test of Definition " + e.getMessage()); - } + public void simpleProject() throws IOException, VerificationException { + final String PROJECT_NAME = "simple-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + + Verifier verifier = createVerifier(testProject); + verifier.executeGoal("test"); + + checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); } @Test - public void testRegexProject() { - try { - final String PROJECT_NAME = "regex-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); - } catch (Exception e) { - e.printStackTrace(); - fail("Unexpected Exception running the test : " + e.getMessage()); - } + public void regexProject() throws IOException, VerificationException { + final String PROJECT_NAME = "regex-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + + Verifier verifier = createVerifier(testProject); + verifier.executeGoal("test"); + + checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); } @Test - public void testTypeMappingProject() { - try { - final String PROJECT_NAME = "type-mapping-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); - } catch (Exception e) { - e.printStackTrace(); - fail("Unexpected Exception running the test : " + e.getMessage()); - } + public void typeMappingProject() throws IOException, VerificationException { + final String PROJECT_NAME = "type-mapping-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + + Verifier verifier = createVerifier(testProject); + verifier.executeGoal("test"); + + checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); } @Test - public void testOwnerParameterProject() { - try { - final String PROJECT_NAME = "owner-param-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); - } catch (Exception e) { - e.printStackTrace(); - fail("Unexpected Exception running the test : " + e.getMessage()); - } + public void ownerParameterProject() throws IOException, VerificationException { + final String PROJECT_NAME = "owner-param-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + + Verifier verifier = createVerifier(testProject); + verifier.executeGoal("test"); + + checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); } @Test - public void testMinimalistProject() { - try { - final String PROJECT_NAME = "minimalist-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - } catch (Exception e) { - e.printStackTrace(); - fail("Unexpected Exception running the test : " + e.getMessage()); - } + public void minimalistProject() throws IOException, VerificationException { + final String PROJECT_NAME = "minimalist-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + + Verifier verifier = createVerifier(testProject); + verifier.executeGoal("test"); } @Test - public void testTagsProject() { - try { - final String PROJECT_NAME = "tags-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml"); - } catch (Exception e) { - e.printStackTrace(); - fail("Unexpected Exception running the test of Definition " + e.getMessage()); - } + public void tagsProject() throws IOException, VerificationException { + final String PROJECT_NAME = "tags-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + + Verifier verifier = createVerifier(testProject); + verifier.executeGoal("test"); + + checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml"); } @Test - public void testSkipUtplsqlTests() { - try { - final String PROJECT_NAME = "skip-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - - assertFalse(new File("target/test-classes/" + PROJECT_NAME + "/target").exists()); - } catch (Exception e) { - e.printStackTrace(); - fail("Unexpected Exception running the test of Definition " + e.getMessage()); - } + public void skipUtplsqlTests() throws IOException, VerificationException { + final String PROJECT_NAME = "skip-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + + Verifier verifier = createVerifier(testProject); + verifier.executeGoal("test"); + + assertFalse(new File("target/test-classes/" + PROJECT_NAME + "/target").exists()); } /** diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java index 8f06fdc..80fae38 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java @@ -72,7 +72,7 @@ public void setUp() throws Exception { * Then : it should throw a MojoExecutionException */ @Test - public void testInvalidSourcesDirectory() throws Exception { + public void invalidSourcesDirectory() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalidTestsSourcesDirectories/"), "test"); assertNotNull(utplsqlMojo); @@ -90,7 +90,7 @@ public void testInvalidSourcesDirectory() throws Exception { * Then : it should throw a MojoExecutionException */ @Test - public void testInvalidTestsDirectory() throws Exception { + public void invalidTestsDirectory() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalidTestsSourcesDirectories/"), "test"); assertNotNull(utplsqlMojo); @@ -108,7 +108,7 @@ public void testInvalidTestsDirectory() throws Exception { * Then : it should fill all parameters correctly */ @Test - public void testSourcesTestsParameters() throws Exception { + public void sourcesTestsParameters() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/testSourcesTestsParams/"), "test"); assertNotNull(utplsqlMojo); @@ -153,7 +153,7 @@ public void testSourcesTestsParameters() throws Exception { * Then : it should not find any source files */ @Test - public void testSourcesAndTestsParameterDoesNotExist() throws Exception { + public void sourcesAndTestsParameterDoesNotExist() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule.lookupConfiguredMojo( new File("src/test/resources/unit-tests/testNoSourcesTestsParams/directoryDoesNotExist/"), "test"); assertNotNull(utplsqlMojo); @@ -175,7 +175,7 @@ public void testSourcesAndTestsParameterDoesNotExist() throws Exception { * Then : it should find all sources/tests files in default directories */ @Test - public void testSourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception { + public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/"), "test"); assertNotNull(utplsqlMojo); @@ -201,7 +201,7 @@ public void testSourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() * Then : it should find all sources/tests files in default directories */ @Test - public void testSourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { + public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/"), "test"); assertNotNull(utplsqlMojo); @@ -228,7 +228,7 @@ public void testSourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { * Then : it should find all sources/tests files in default directories */ @Test - public void testSourcesAndTestsParameterHaveNotIncludesTag() throws Exception { + public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/"), "test"); assertNotNull(utplsqlMojo); @@ -250,7 +250,7 @@ public void testSourcesAndTestsParameterHaveNotIncludesTag() throws Exception { * Default Console Behaviour */ @Test - public void testDefaultConsoleBehaviour() throws Exception { + public void defaultConsoleBehaviour() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/defaultConsoleOutputBehaviour/"), "test"); assertNotNull(utplsqlMojo); @@ -298,7 +298,7 @@ public void testDefaultConsoleBehaviour() throws Exception { * Add Default Reporter */ @Test - public void testAddDefaultReporter() throws Exception { + public void addDefaultReporter() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/defaultConsoleOutputBehaviour/"), "test"); assertNotNull(utplsqlMojo); @@ -325,7 +325,7 @@ public void testAddDefaultReporter() throws Exception { * Skip utPLSQL Tests */ @Test - public void testSkipUtplsqlTests() throws Exception { + public void skipUtplsqlTests() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/skipUtplsqlTests/"), "test"); assertNotNull(utplsqlMojo); From fbb4e5839766d20ef0c32422165a895fda7268ab Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 07:50:50 +0100 Subject: [PATCH 080/200] Changed file structure --- README.md | 2 +- 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/UtPLSQLMojoIT.java | 81 +++++++++---------- .../minimalist-project/pom.xml | 0 .../utplsql/coverage-sonar-reporter.xml | 0 .../utplsql/sonar-test-reporter.xml | 0 .../owner-param-project/pom.xml | 0 .../foo/package_bodies/PKG_TEST_ME.sql | 0 .../sources/foo/packages/PKG_TEST_ME.sql | 0 .../scripts/sources/foo/tables/TO_TEST_ME.tab | 0 .../bar/package_bodies/TEST_PKG_TEST_ME.sql | 0 .../test/bar/packages/TEST_PKG_TEST_ME.sql | 0 .../utplsql/coverage-sonar-reporter.xml | 0 .../utplsql/sonar-test-reporter.xml | 0 .../regex-project/pom.xml | 0 .../sources/app/packages/PKG_TEST_ME.bdy | 0 .../sources/app/packages/PKG_TEST_ME.spc | 0 .../scripts/sources/app/tables/TO_TEST_ME.tab | 0 .../test/app/packages/TEST_PKG_TEST_ME.bdy | 0 .../test/app/packages/TEST_PKG_TEST_ME.spc | 0 .../utplsql/coverage-sonar-reporter.xml | 0 .../utplsql/sonar-test-reporter.xml | 0 .../simple-project/pom.xml | 0 .../scripts/sources/APP.PKG_TEST_ME.bdy | 0 .../scripts/sources/APP.PKG_TEST_ME.spc | 0 .../scripts/sources/TO_TEST_ME.tab | 0 .../scripts/tests/APP.TEST_PKG_TEST_ME.bdy | 0 .../scripts/tests/APP.TEST_PKG_TEST_ME.spc | 0 .../skip-project/pom.xml | 0 .../utplsql/sonar-test-reporter.xml | 0 .../tags-project/pom.xml | 0 .../scripts/tests/APP.TEST_PKG_TEST_ME.bdy | 0 .../scripts/tests/APP.TEST_PKG_TEST_ME.spc | 0 .../utplsql/coverage-sonar-reporter.xml | 0 .../utplsql/sonar-test-reporter.xml | 0 .../type-mapping-project/pom.xml | 0 .../app/package_bodies/PKG_TEST_ME.sql | 0 .../sources/app/packages/PKG_TEST_ME.sql | 0 .../scripts/sources/app/tables/TO_TEST_ME.tab | 0 .../app/package_bodies/TEST_PKG_TEST_ME.sql | 0 .../test/app/packages/TEST_PKG_TEST_ME.sql | 0 43 files changed, 49 insertions(+), 54 deletions(-) rename src/test/resources/{ => integration-tests}/minimalist-project/pom.xml (100%) rename src/test/resources/{ => integration-tests}/owner-param-project/expected-output/utplsql/coverage-sonar-reporter.xml (100%) rename src/test/resources/{ => integration-tests}/owner-param-project/expected-output/utplsql/sonar-test-reporter.xml (100%) rename src/test/resources/{ => integration-tests}/owner-param-project/pom.xml (100%) rename src/test/resources/{ => integration-tests}/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql (100%) rename src/test/resources/{ => integration-tests}/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql (100%) rename src/test/resources/{ => integration-tests}/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab (100%) rename src/test/resources/{ => integration-tests}/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql (100%) rename src/test/resources/{ => integration-tests}/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql (100%) rename src/test/resources/{ => integration-tests}/regex-project/expected-output/utplsql/coverage-sonar-reporter.xml (100%) rename src/test/resources/{ => integration-tests}/regex-project/expected-output/utplsql/sonar-test-reporter.xml (100%) rename src/test/resources/{ => integration-tests}/regex-project/pom.xml (100%) rename src/test/resources/{ => integration-tests}/regex-project/scripts/sources/app/packages/PKG_TEST_ME.bdy (100%) rename src/test/resources/{ => integration-tests}/regex-project/scripts/sources/app/packages/PKG_TEST_ME.spc (100%) rename src/test/resources/{ => integration-tests}/regex-project/scripts/sources/app/tables/TO_TEST_ME.tab (100%) rename src/test/resources/{ => integration-tests}/regex-project/scripts/test/app/packages/TEST_PKG_TEST_ME.bdy (100%) rename src/test/resources/{ => integration-tests}/regex-project/scripts/test/app/packages/TEST_PKG_TEST_ME.spc (100%) rename src/test/resources/{ => integration-tests}/simple-project/expected-output/utplsql/coverage-sonar-reporter.xml (100%) rename src/test/resources/{ => integration-tests}/simple-project/expected-output/utplsql/sonar-test-reporter.xml (100%) rename src/test/resources/{ => integration-tests}/simple-project/pom.xml (100%) rename src/test/resources/{ => integration-tests}/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy (100%) rename src/test/resources/{ => integration-tests}/simple-project/scripts/sources/APP.PKG_TEST_ME.spc (100%) rename src/test/resources/{ => integration-tests}/simple-project/scripts/sources/TO_TEST_ME.tab (100%) rename src/test/resources/{ => integration-tests}/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy (100%) rename src/test/resources/{ => integration-tests}/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc (100%) rename src/test/resources/{ => integration-tests}/skip-project/pom.xml (100%) rename src/test/resources/{ => integration-tests}/tags-project/expected-output/utplsql/sonar-test-reporter.xml (100%) rename src/test/resources/{ => integration-tests}/tags-project/pom.xml (100%) rename src/test/resources/{ => integration-tests}/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy (100%) rename src/test/resources/{ => integration-tests}/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc (100%) rename src/test/resources/{ => integration-tests}/type-mapping-project/expected-output/utplsql/coverage-sonar-reporter.xml (100%) rename src/test/resources/{ => integration-tests}/type-mapping-project/expected-output/utplsql/sonar-test-reporter.xml (100%) rename src/test/resources/{ => integration-tests}/type-mapping-project/pom.xml (100%) rename src/test/resources/{ => integration-tests}/type-mapping-project/scripts/sources/app/package_bodies/PKG_TEST_ME.sql (100%) rename src/test/resources/{ => integration-tests}/type-mapping-project/scripts/sources/app/packages/PKG_TEST_ME.sql (100%) rename src/test/resources/{ => integration-tests}/type-mapping-project/scripts/sources/app/tables/TO_TEST_ME.tab (100%) rename src/test/resources/{ => integration-tests}/type-mapping-project/scripts/test/app/package_bodies/TEST_PKG_TEST_ME.sql (100%) rename src/test/resources/{ => integration-tests}/type-mapping-project/scripts/test/app/packages/TEST_PKG_TEST_ME.sql (100%) diff --git a/README.md b/README.md index 536d11c..f4c170b 100644 --- a/README.md +++ b/README.md @@ -231,7 +231,7 @@ Please refer to the following usage example for the parameters descriptions: ``` -More project samples are available in the src/test/resources directory: +More project samples are available in the src/test/resources/integration-tests directory: * **simple-project:** Minimalist test project with standard project directory structure. * **regex-project:** Overrides project directory structure and use additional parameters (sourcesRegexExpression, testsRegexExpression, ...), to tell utPLSQL how project files should be mapped into database objects. * **type-mapping-project:** Example how to use regex and custom type parameters together. diff --git a/scripts/sql/create_app_objects.sql b/scripts/sql/create_app_objects.sql index 734b51e..c6fd782 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/simple-project/scripts/sources/TO_TEST_ME.tab -@src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.spc -@src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy +@src/test/resources/integration-tests/simple-project/scripts/sources/TO_TEST_ME.tab +@src/test/resources/integration-tests/simple-project/scripts/sources/APP.PKG_TEST_ME.spc +@src/test/resources/integration-tests/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy -@src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc -@src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy +@src/test/resources/integration-tests/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc +@src/test/resources/integration-tests/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy diff --git a/scripts/sql/create_source_owner_objects.sql b/scripts/sql/create_source_owner_objects.sql index 2d15146..bcaa9fb 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/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab -@src/test/resources/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql -@src/test/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql +@src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab +@src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql +@src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql diff --git a/scripts/sql/create_tests_owner_objects.sql b/scripts/sql/create_tests_owner_objects.sql index e2d9a7c..b6561e6 100644 --- a/scripts/sql/create_tests_owner_objects.sql +++ b/scripts/sql/create_tests_owner_objects.sql @@ -3,5 +3,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/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql -@src/test/resources/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql +@src/test/resources/integration-tests/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql +@src/test/resources/integration-tests/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java index ec6e878..da75537 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java @@ -21,7 +21,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; public class UtPLSQLMojoIT { @@ -44,52 +43,52 @@ public static void setUp() throws VerificationException, IOException, XmlPullPar @Test public void simpleProject() throws IOException, VerificationException { - final String PROJECT_NAME = "simple-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + final String testFolder = "integration-tests/simple-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); + checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); } @Test public void regexProject() throws IOException, VerificationException { - final String PROJECT_NAME = "regex-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + final String testFolder = "integration-tests/regex-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); + checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); } @Test public void typeMappingProject() throws IOException, VerificationException { - final String PROJECT_NAME = "type-mapping-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + final String testFolder = "integration-tests/type-mapping-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); + checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); } @Test public void ownerParameterProject() throws IOException, VerificationException { - final String PROJECT_NAME = "owner-param-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + final String testFolder = "integration-tests/owner-param-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); + checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); } @Test public void minimalistProject() throws IOException, VerificationException { - final String PROJECT_NAME = "minimalist-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + final String testFolder = "integration-tests/minimalist-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); @@ -97,24 +96,24 @@ public void minimalistProject() throws IOException, VerificationException { @Test public void tagsProject() throws IOException, VerificationException { - final String PROJECT_NAME = "tags-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + final String testFolder = "integration-tests/tags-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml"); + checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml"); } @Test public void skipUtplsqlTests() throws IOException, VerificationException { - final String PROJECT_NAME = "skip-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + PROJECT_NAME); + final String testFolder = "integration-tests/skip-project"; + File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - assertFalse(new File("target/test-classes/" + PROJECT_NAME + "/target").exists()); + assertFalse(new File("target/test-classes/" + testFolder + "/target").exists()); } /** @@ -122,33 +121,29 @@ public void skipUtplsqlTests() throws IOException, VerificationException { * Path separator is set to "/" to ensure windows / linux / mac compatibility. * \r and \n are removed to provide simpler comparison. * - * @param projectName Project name - * @param files Files to compare + * @param testFolder Project name + * @param files Files to compare */ - private void checkReportsGenerated(String projectName, String... files) { + private void checkReportsGenerated(String testFolder, String... files) throws IOException { for (String filename : files) { - File outputFile = new File("target/test-classes/" + projectName + "/target", filename); - File expectedOutputFile = new File("target/test-classes/" + projectName + "/expected-output", filename); + File outputFile = new File("target/test-classes/" + testFolder + "/target", filename); + File expectedOutputFile = new File("target/test-classes/" + testFolder + "/expected-output", filename); assertTrue("The reporter for " + filename + " was not generated", outputFile.exists()); - try { - try (Stream stream = Files.lines(Paths.get("target", "test-classes", projectName, "target", filename))) { - String outputContent = stream - .filter(line -> !line.contains(" line.replaceAll("(duration=\"[0-9.]*\")", "duration=\"1\"")) - .map(line -> line.replaceAll("\\\\", "/")) - .map(line -> line.replaceAll("\r", "").replaceAll("\n", "")) - .collect(Collectors.joining("\n")); - assertEquals("The files differ!", - FileUtils.readFileToString(expectedOutputFile, "utf-8") - .replace("\r", "") - .replace("\n", ""), - outputContent.replace("\n", "")); - } - } catch (IOException e) { - e.printStackTrace(); - fail("Unexpected Exception running the test : " + e.getMessage()); + try (Stream stream = Files.lines(Paths.get("target", "test-classes", testFolder, "target", filename))) { + String outputContent = stream + .filter(line -> !line.contains(" line.replaceAll("(duration=\"[0-9.]*\")", "duration=\"1\"")) + .map(line -> line.replaceAll("\\\\", "/")) + .map(line -> line.replaceAll("\r", "").replaceAll("\n", "")) + .collect(Collectors.joining("\n")); + + assertEquals("The files differ!", + FileUtils.readFileToString(expectedOutputFile, "utf-8") + .replace("\r", "") + .replace("\n", ""), + outputContent.replace("\n", "")); } } } diff --git a/src/test/resources/minimalist-project/pom.xml b/src/test/resources/integration-tests/minimalist-project/pom.xml similarity index 100% rename from src/test/resources/minimalist-project/pom.xml rename to src/test/resources/integration-tests/minimalist-project/pom.xml diff --git a/src/test/resources/owner-param-project/expected-output/utplsql/coverage-sonar-reporter.xml b/src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/coverage-sonar-reporter.xml similarity index 100% rename from src/test/resources/owner-param-project/expected-output/utplsql/coverage-sonar-reporter.xml rename to src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/coverage-sonar-reporter.xml diff --git a/src/test/resources/owner-param-project/expected-output/utplsql/sonar-test-reporter.xml b/src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/sonar-test-reporter.xml similarity index 100% rename from src/test/resources/owner-param-project/expected-output/utplsql/sonar-test-reporter.xml rename to src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/sonar-test-reporter.xml diff --git a/src/test/resources/owner-param-project/pom.xml b/src/test/resources/integration-tests/owner-param-project/pom.xml similarity index 100% rename from src/test/resources/owner-param-project/pom.xml rename to src/test/resources/integration-tests/owner-param-project/pom.xml diff --git a/src/test/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql b/src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql similarity index 100% rename from src/test/resources/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql rename to src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql diff --git a/src/test/resources/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql b/src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql similarity index 100% rename from src/test/resources/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql rename to src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql diff --git a/src/test/resources/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab b/src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab similarity index 100% rename from src/test/resources/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab rename to src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab diff --git a/src/test/resources/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql b/src/test/resources/integration-tests/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql similarity index 100% rename from src/test/resources/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql rename to src/test/resources/integration-tests/owner-param-project/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql diff --git a/src/test/resources/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql b/src/test/resources/integration-tests/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql similarity index 100% rename from src/test/resources/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql rename to src/test/resources/integration-tests/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql diff --git a/src/test/resources/regex-project/expected-output/utplsql/coverage-sonar-reporter.xml b/src/test/resources/integration-tests/regex-project/expected-output/utplsql/coverage-sonar-reporter.xml similarity index 100% rename from src/test/resources/regex-project/expected-output/utplsql/coverage-sonar-reporter.xml rename to src/test/resources/integration-tests/regex-project/expected-output/utplsql/coverage-sonar-reporter.xml diff --git a/src/test/resources/regex-project/expected-output/utplsql/sonar-test-reporter.xml b/src/test/resources/integration-tests/regex-project/expected-output/utplsql/sonar-test-reporter.xml similarity index 100% rename from src/test/resources/regex-project/expected-output/utplsql/sonar-test-reporter.xml rename to src/test/resources/integration-tests/regex-project/expected-output/utplsql/sonar-test-reporter.xml diff --git a/src/test/resources/regex-project/pom.xml b/src/test/resources/integration-tests/regex-project/pom.xml similarity index 100% rename from src/test/resources/regex-project/pom.xml rename to src/test/resources/integration-tests/regex-project/pom.xml diff --git a/src/test/resources/regex-project/scripts/sources/app/packages/PKG_TEST_ME.bdy b/src/test/resources/integration-tests/regex-project/scripts/sources/app/packages/PKG_TEST_ME.bdy similarity index 100% rename from src/test/resources/regex-project/scripts/sources/app/packages/PKG_TEST_ME.bdy rename to src/test/resources/integration-tests/regex-project/scripts/sources/app/packages/PKG_TEST_ME.bdy diff --git a/src/test/resources/regex-project/scripts/sources/app/packages/PKG_TEST_ME.spc b/src/test/resources/integration-tests/regex-project/scripts/sources/app/packages/PKG_TEST_ME.spc similarity index 100% rename from src/test/resources/regex-project/scripts/sources/app/packages/PKG_TEST_ME.spc rename to src/test/resources/integration-tests/regex-project/scripts/sources/app/packages/PKG_TEST_ME.spc diff --git a/src/test/resources/regex-project/scripts/sources/app/tables/TO_TEST_ME.tab b/src/test/resources/integration-tests/regex-project/scripts/sources/app/tables/TO_TEST_ME.tab similarity index 100% rename from src/test/resources/regex-project/scripts/sources/app/tables/TO_TEST_ME.tab rename to src/test/resources/integration-tests/regex-project/scripts/sources/app/tables/TO_TEST_ME.tab diff --git a/src/test/resources/regex-project/scripts/test/app/packages/TEST_PKG_TEST_ME.bdy b/src/test/resources/integration-tests/regex-project/scripts/test/app/packages/TEST_PKG_TEST_ME.bdy similarity index 100% rename from src/test/resources/regex-project/scripts/test/app/packages/TEST_PKG_TEST_ME.bdy rename to src/test/resources/integration-tests/regex-project/scripts/test/app/packages/TEST_PKG_TEST_ME.bdy diff --git a/src/test/resources/regex-project/scripts/test/app/packages/TEST_PKG_TEST_ME.spc b/src/test/resources/integration-tests/regex-project/scripts/test/app/packages/TEST_PKG_TEST_ME.spc similarity index 100% rename from src/test/resources/regex-project/scripts/test/app/packages/TEST_PKG_TEST_ME.spc rename to src/test/resources/integration-tests/regex-project/scripts/test/app/packages/TEST_PKG_TEST_ME.spc diff --git a/src/test/resources/simple-project/expected-output/utplsql/coverage-sonar-reporter.xml b/src/test/resources/integration-tests/simple-project/expected-output/utplsql/coverage-sonar-reporter.xml similarity index 100% rename from src/test/resources/simple-project/expected-output/utplsql/coverage-sonar-reporter.xml rename to src/test/resources/integration-tests/simple-project/expected-output/utplsql/coverage-sonar-reporter.xml diff --git a/src/test/resources/simple-project/expected-output/utplsql/sonar-test-reporter.xml b/src/test/resources/integration-tests/simple-project/expected-output/utplsql/sonar-test-reporter.xml similarity index 100% rename from src/test/resources/simple-project/expected-output/utplsql/sonar-test-reporter.xml rename to src/test/resources/integration-tests/simple-project/expected-output/utplsql/sonar-test-reporter.xml diff --git a/src/test/resources/simple-project/pom.xml b/src/test/resources/integration-tests/simple-project/pom.xml similarity index 100% rename from src/test/resources/simple-project/pom.xml rename to src/test/resources/integration-tests/simple-project/pom.xml diff --git a/src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy b/src/test/resources/integration-tests/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy similarity index 100% rename from src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy rename to src/test/resources/integration-tests/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy diff --git a/src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.spc b/src/test/resources/integration-tests/simple-project/scripts/sources/APP.PKG_TEST_ME.spc similarity index 100% rename from src/test/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.spc rename to src/test/resources/integration-tests/simple-project/scripts/sources/APP.PKG_TEST_ME.spc diff --git a/src/test/resources/simple-project/scripts/sources/TO_TEST_ME.tab b/src/test/resources/integration-tests/simple-project/scripts/sources/TO_TEST_ME.tab similarity index 100% rename from src/test/resources/simple-project/scripts/sources/TO_TEST_ME.tab rename to src/test/resources/integration-tests/simple-project/scripts/sources/TO_TEST_ME.tab diff --git a/src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy b/src/test/resources/integration-tests/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy similarity index 100% rename from src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy rename to src/test/resources/integration-tests/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy diff --git a/src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc b/src/test/resources/integration-tests/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc similarity index 100% rename from src/test/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc rename to src/test/resources/integration-tests/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc diff --git a/src/test/resources/skip-project/pom.xml b/src/test/resources/integration-tests/skip-project/pom.xml similarity index 100% rename from src/test/resources/skip-project/pom.xml rename to src/test/resources/integration-tests/skip-project/pom.xml diff --git a/src/test/resources/tags-project/expected-output/utplsql/sonar-test-reporter.xml b/src/test/resources/integration-tests/tags-project/expected-output/utplsql/sonar-test-reporter.xml similarity index 100% rename from src/test/resources/tags-project/expected-output/utplsql/sonar-test-reporter.xml rename to src/test/resources/integration-tests/tags-project/expected-output/utplsql/sonar-test-reporter.xml diff --git a/src/test/resources/tags-project/pom.xml b/src/test/resources/integration-tests/tags-project/pom.xml similarity index 100% rename from src/test/resources/tags-project/pom.xml rename to src/test/resources/integration-tests/tags-project/pom.xml diff --git a/src/test/resources/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy b/src/test/resources/integration-tests/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy similarity index 100% rename from src/test/resources/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy rename to src/test/resources/integration-tests/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy diff --git a/src/test/resources/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc b/src/test/resources/integration-tests/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc similarity index 100% rename from src/test/resources/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc rename to src/test/resources/integration-tests/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc diff --git a/src/test/resources/type-mapping-project/expected-output/utplsql/coverage-sonar-reporter.xml b/src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/coverage-sonar-reporter.xml similarity index 100% rename from src/test/resources/type-mapping-project/expected-output/utplsql/coverage-sonar-reporter.xml rename to src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/coverage-sonar-reporter.xml diff --git a/src/test/resources/type-mapping-project/expected-output/utplsql/sonar-test-reporter.xml b/src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/sonar-test-reporter.xml similarity index 100% rename from src/test/resources/type-mapping-project/expected-output/utplsql/sonar-test-reporter.xml rename to src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/sonar-test-reporter.xml diff --git a/src/test/resources/type-mapping-project/pom.xml b/src/test/resources/integration-tests/type-mapping-project/pom.xml similarity index 100% rename from src/test/resources/type-mapping-project/pom.xml rename to src/test/resources/integration-tests/type-mapping-project/pom.xml diff --git a/src/test/resources/type-mapping-project/scripts/sources/app/package_bodies/PKG_TEST_ME.sql b/src/test/resources/integration-tests/type-mapping-project/scripts/sources/app/package_bodies/PKG_TEST_ME.sql similarity index 100% rename from src/test/resources/type-mapping-project/scripts/sources/app/package_bodies/PKG_TEST_ME.sql rename to src/test/resources/integration-tests/type-mapping-project/scripts/sources/app/package_bodies/PKG_TEST_ME.sql diff --git a/src/test/resources/type-mapping-project/scripts/sources/app/packages/PKG_TEST_ME.sql b/src/test/resources/integration-tests/type-mapping-project/scripts/sources/app/packages/PKG_TEST_ME.sql similarity index 100% rename from src/test/resources/type-mapping-project/scripts/sources/app/packages/PKG_TEST_ME.sql rename to src/test/resources/integration-tests/type-mapping-project/scripts/sources/app/packages/PKG_TEST_ME.sql diff --git a/src/test/resources/type-mapping-project/scripts/sources/app/tables/TO_TEST_ME.tab b/src/test/resources/integration-tests/type-mapping-project/scripts/sources/app/tables/TO_TEST_ME.tab similarity index 100% rename from src/test/resources/type-mapping-project/scripts/sources/app/tables/TO_TEST_ME.tab rename to src/test/resources/integration-tests/type-mapping-project/scripts/sources/app/tables/TO_TEST_ME.tab diff --git a/src/test/resources/type-mapping-project/scripts/test/app/package_bodies/TEST_PKG_TEST_ME.sql b/src/test/resources/integration-tests/type-mapping-project/scripts/test/app/package_bodies/TEST_PKG_TEST_ME.sql similarity index 100% rename from src/test/resources/type-mapping-project/scripts/test/app/package_bodies/TEST_PKG_TEST_ME.sql rename to src/test/resources/integration-tests/type-mapping-project/scripts/test/app/package_bodies/TEST_PKG_TEST_ME.sql diff --git a/src/test/resources/type-mapping-project/scripts/test/app/packages/TEST_PKG_TEST_ME.sql b/src/test/resources/integration-tests/type-mapping-project/scripts/test/app/packages/TEST_PKG_TEST_ME.sql similarity index 100% rename from src/test/resources/type-mapping-project/scripts/test/app/packages/TEST_PKG_TEST_ME.sql rename to src/test/resources/integration-tests/type-mapping-project/scripts/test/app/packages/TEST_PKG_TEST_ME.sql From 2ec1d50fa1a432fab0be02cf91fd71c82624e359 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 09:14:09 +0100 Subject: [PATCH 081/200] Clean up --- .../plugin/{model => }/ReporterParameter.java | 2 +- .../org/utplsql/maven/plugin/UtPLSQLMojo.java | 20 ++++----- ...{ReporterWriter.java => ReportWriter.java} | 44 +++++++++++-------- .../utplsql/maven/plugin/UtPLSQLMojoIT.java | 14 +++--- .../utplsql/maven/plugin/UtPLSQLMojoTest.java | 7 ++- ...reporter.xml => coverage-sonar-report.xml} | 0 ...est-reporter.xml => sonar-test-report.xml} | 0 .../owner-param-project/pom.xml | 4 +- ...reporter.xml => coverage-sonar-report.xml} | 0 ...est-reporter.xml => sonar-test-report.xml} | 0 .../integration-tests/regex-project/pom.xml | 4 +- ...reporter.xml => coverage-sonar-report.xml} | 0 ...est-reporter.xml => sonar-test-report.xml} | 0 .../integration-tests/simple-project/pom.xml | 4 +- .../integration-tests/skip-project/pom.xml | 4 +- ...est-reporter.xml => sonar-test-report.xml} | 0 .../integration-tests/tags-project/pom.xml | 2 +- ...reporter.xml => coverage-sonar-report.xml} | 0 ...est-reporter.xml => sonar-test-report.xml} | 0 .../type-mapping-project/pom.xml | 4 +- .../defaultConsoleOutputBehaviour/pom.xml | 4 +- .../invalidTestsSourcesDirectories/pom.xml | 6 +-- .../missingDirectory/pom.xml | 6 +-- .../missingIncludes/pom.xml | 6 +-- .../unit-tests/skipUtplsqlTests/pom.xml | 4 +- .../directoryDoesNotExist/pom.xml | 6 +-- .../directoryExists/pom.xml | 6 +-- .../unit-tests/testSourcesTestsParams/pom.xml | 6 +-- 28 files changed, 78 insertions(+), 75 deletions(-) rename src/main/java/org/utplsql/maven/plugin/{model => }/ReporterParameter.java (98%) rename src/main/java/org/utplsql/maven/plugin/reporter/{ReporterWriter.java => ReportWriter.java} (76%) rename src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/{coverage-sonar-reporter.xml => coverage-sonar-report.xml} (100%) rename src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/{sonar-test-reporter.xml => sonar-test-report.xml} (100%) rename src/test/resources/integration-tests/regex-project/expected-output/utplsql/{coverage-sonar-reporter.xml => coverage-sonar-report.xml} (100%) rename src/test/resources/integration-tests/regex-project/expected-output/utplsql/{sonar-test-reporter.xml => sonar-test-report.xml} (100%) rename src/test/resources/integration-tests/simple-project/expected-output/utplsql/{coverage-sonar-reporter.xml => coverage-sonar-report.xml} (100%) rename src/test/resources/integration-tests/simple-project/expected-output/utplsql/{sonar-test-reporter.xml => sonar-test-report.xml} (100%) rename src/test/resources/integration-tests/tags-project/expected-output/utplsql/{sonar-test-reporter.xml => sonar-test-report.xml} (100%) rename src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/{coverage-sonar-reporter.xml => coverage-sonar-report.xml} (100%) rename src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/{sonar-test-reporter.xml => sonar-test-report.xml} (100%) diff --git a/src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java b/src/main/java/org/utplsql/maven/plugin/ReporterParameter.java similarity index 98% rename from src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java rename to src/main/java/org/utplsql/maven/plugin/ReporterParameter.java index 198ba5f..9b7065b 100644 --- a/src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java +++ b/src/main/java/org/utplsql/maven/plugin/ReporterParameter.java @@ -1,4 +1,4 @@ -package org.utplsql.maven.plugin.model; +package org.utplsql.maven.plugin; import org.codehaus.plexus.util.StringUtils; diff --git a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java index 2c68462..5db8f49 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java @@ -25,8 +25,7 @@ import org.utplsql.api.reporter.ReporterFactory; import org.utplsql.maven.plugin.helper.PluginDefault; import org.utplsql.maven.plugin.helper.SqlScannerHelper; -import org.utplsql.maven.plugin.model.ReporterParameter; -import org.utplsql.maven.plugin.reporter.ReporterWriter; +import org.utplsql.maven.plugin.reporter.ReportWriter; import java.io.File; import java.sql.Connection; @@ -35,6 +34,7 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; +import java.util.stream.Collectors; /** * This class expose the {@link TestRunner} interface to Maven. @@ -147,7 +147,7 @@ public class UtPLSQLMojo extends AbstractMojo { */ private final boolean colorConsole = MessageUtils.isColorEnabled(); - private ReporterWriter reporterWriter; + private ReportWriter reportWriter; private final DatabaseInformation databaseInformation = new DefaultDatabaseInformation(); @@ -214,7 +214,7 @@ public void execute() throws MojoExecutionException { } finally { try { if (connection != null) { - reporterWriter.writeReporters(connection); + reportWriter.writeReports(connection); DBHelper.disableDBMSOutput(connection); connection.close(); @@ -308,11 +308,9 @@ private FileMapperOptions createFileMapperOptions(List scripts, String o } if (typeMappings != null && !typeMappings.isEmpty()) { - fileMapperOptions.setTypeMappings(new ArrayList<>()); - for (CustomTypeMapping typeMapping : typeMappings) { - fileMapperOptions.getTypeMappings() - .add(new KeyValuePair(typeMapping.getCustomMapping(), typeMapping.getType())); - } + fileMapperOptions.setTypeMappings(typeMappings.stream() + .map(mapping -> new KeyValuePair(mapping.getCustomMapping(), mapping.getType())) + .collect(Collectors.toList())); } return fileMapperOptions; @@ -322,7 +320,7 @@ private List initReporters(Connection connection, Version utlVersion, throws SQLException { List reporterList = new ArrayList<>(); - reporterWriter = new ReporterWriter(targetDir, utlVersion, getLog()); + reportWriter = new ReportWriter(targetDir, utlVersion, getLog()); if (reporters.isEmpty()) { ReporterParameter reporterParameter = new ReporterParameter(); @@ -343,7 +341,7 @@ private List initReporters(Connection connection, Version utlVersion, // Only added the reporter if at least one of the output is required if (StringUtils.isNotBlank(reporterParameter.getFileOutput()) || reporterParameter.isConsoleOutput()) { - reporterWriter.addReporter(reporterParameter, reporter); + reportWriter.addReporter(reporterParameter, reporter); } } diff --git a/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java b/src/main/java/org/utplsql/maven/plugin/reporter/ReportWriter.java similarity index 76% rename from src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java rename to src/main/java/org/utplsql/maven/plugin/reporter/ReportWriter.java index 6bfbd23..12f603a 100644 --- a/src/main/java/org/utplsql/maven/plugin/reporter/ReporterWriter.java +++ b/src/main/java/org/utplsql/maven/plugin/reporter/ReportWriter.java @@ -7,19 +7,27 @@ import org.utplsql.api.outputBuffer.OutputBuffer; import org.utplsql.api.outputBuffer.OutputBufferProvider; import org.utplsql.api.reporter.Reporter; -import org.utplsql.maven.plugin.model.ReporterParameter; +import org.utplsql.maven.plugin.ReporterParameter; import java.io.File; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import java.sql.Connection; +import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import static java.lang.String.format; -public class ReporterWriter { +/** + * Writes the reports + * + * @author Alberto Hernández + * @author Simon Martinelli + */ +public class ReportWriter { private final List> listReporters; @@ -32,11 +40,11 @@ public class ReporterWriter { /** * Constructor of the reporter writer. * - * @param outputDirectory the reporter output directory - * @param databaseVersion the utPLSQL framework version + * @param outputDirectory the report output directory + * @param databaseVersion the utPLSQL framework {@link Version} * @param log the Maven log */ - public ReporterWriter(String outputDirectory, Version databaseVersion, Log log) { + public ReportWriter(String outputDirectory, Version databaseVersion, Log log) { this.listReporters = new ArrayList<>(); this.outputDirectory = outputDirectory; this.databaseVersion = databaseVersion; @@ -44,25 +52,23 @@ public ReporterWriter(String outputDirectory, Version databaseVersion, Log log) } /** - * Adds a new reporter to the writter. + * Adds a new reporter to the writer. * - * @param parameter the reporter parameter - * @param reporter the reporter Object + * @param parameter the {@link ReporterParameter} + * @param reporter the {@link Reporter} */ public void addReporter(ReporterParameter parameter, Reporter reporter) { listReporters.add(Pair.of(reporter, parameter)); } /** - * Writes the reporters to the output. + * Writes the reports to the output. * - * @param connection the database connection + * @param connection The database {@link Connection} * @throws MojoExecutionException if any exception happens */ - public void writeReporters(Connection connection) throws MojoExecutionException { - log.debug("Write Reporters"); + public void writeReports(Connection connection) throws MojoExecutionException { for (Pair pair : listReporters) { - log.debug("Write writeReports " + pair.getRight().getName()); writeReports(connection, pair.getLeft(), pair.getRight()); } } @@ -74,21 +80,19 @@ private void writeReports(Connection connection, Reporter reporter, ReporterPara List printStreams = new ArrayList<>(); if (reporterParameter.isFileOutput()) { - File file = new File(reporterParameter.getFileOutput()); if (!file.isAbsolute()) { file = new File(outputDirectory, reporterParameter.getFileOutput()); } if (!file.getParentFile().exists()) { - log.debug("Creating directory for reporter file " + file.getAbsolutePath()); + log.debug("Creating directory for report file " + file.getAbsolutePath()); file.getParentFile().mkdirs(); } fileOutputStream = new FileOutputStream(file); log.info(format("Writing report %s to %s", reporter.getTypeName(), file.getAbsolutePath())); - // Added to the Report printStreams.add(new PrintStream(fileOutputStream)); } @@ -96,15 +100,17 @@ private void writeReports(Connection connection, Reporter reporter, ReporterPara log.info(format("Writing report %s to Console", reporter.getTypeName())); printStreams.add(System.out); } + buffer.printAvailable(connection, printStreams); - } catch (Exception e) { - throw new MojoExecutionException("Unexpected error opening file ouput ", e); + + } catch (FileNotFoundException | SQLException e) { + throw new MojoExecutionException("Unexpected error opening file output ", e); } finally { if (fileOutputStream != null) { try { fileOutputStream.close(); } catch (IOException e) { - log.info(format("Failed to closing the reporting %s", reporterParameter.getClass())); + log.info(format("Failed to closing the report %s", reporterParameter.getClass())); } } } diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java index da75537..1d31943 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java @@ -49,7 +49,7 @@ public void simpleProject() throws IOException, VerificationException { Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); + checkReports(testFolder, "utplsql/sonar-test-report.xml", "utplsql/coverage-sonar-report.xml"); } @Test @@ -60,7 +60,7 @@ public void regexProject() throws IOException, VerificationException { Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); + checkReports(testFolder, "utplsql/sonar-test-report.xml", "utplsql/coverage-sonar-report.xml"); } @Test @@ -71,7 +71,7 @@ public void typeMappingProject() throws IOException, VerificationException { Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); + checkReports(testFolder, "utplsql/sonar-test-report.xml", "utplsql/coverage-sonar-report.xml"); } @Test @@ -82,7 +82,7 @@ public void ownerParameterProject() throws IOException, VerificationException { Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml", "utplsql/coverage-sonar-reporter.xml"); + checkReports(testFolder, "utplsql/sonar-test-report.xml", "utplsql/coverage-sonar-report.xml"); } @Test @@ -102,7 +102,7 @@ public void tagsProject() throws IOException, VerificationException { Verifier verifier = createVerifier(testProject); verifier.executeGoal("test"); - checkReportsGenerated(testFolder, "utplsql/sonar-test-reporter.xml"); + checkReports(testFolder, "utplsql/sonar-test-report.xml"); } @Test @@ -124,12 +124,12 @@ public void skipUtplsqlTests() throws IOException, VerificationException { * @param testFolder Project name * @param files Files to compare */ - private void checkReportsGenerated(String testFolder, String... files) throws IOException { + private void checkReports(String testFolder, String... files) throws IOException { for (String filename : files) { File outputFile = new File("target/test-classes/" + testFolder + "/target", filename); File expectedOutputFile = new File("target/test-classes/" + testFolder + "/expected-output", filename); - assertTrue("The reporter for " + filename + " was not generated", outputFile.exists()); + assertTrue("The report for " + filename + " was not generated", outputFile.exists()); try (Stream stream = Files.lines(Paths.get("target", "test-classes", testFolder, "target", filename))) { String outputContent = stream diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java index 80fae38..b459e50 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java @@ -16,8 +16,7 @@ import org.utplsql.api.Version; import org.utplsql.api.reporter.Reporter; import org.utplsql.api.reporter.ReporterFactory; -import org.utplsql.maven.plugin.model.ReporterParameter; -import org.utplsql.maven.plugin.reporter.ReporterWriter; +import org.utplsql.maven.plugin.reporter.ReportWriter; import java.io.ByteArrayOutputStream; import java.io.File; @@ -277,8 +276,8 @@ public void defaultConsoleBehaviour() throws Exception { } // Assert that we added only the necessary reporters to the writer. - ReporterWriter reporterWriter = Whitebox.getInternalState(utplsqlMojo, "reporterWriter"); - List> listReporters = Whitebox.getInternalState(reporterWriter, "listReporters"); + ReportWriter reportWriter = Whitebox.getInternalState(utplsqlMojo, "reportWriter"); + List> listReporters = Whitebox.getInternalState(reportWriter, "listReporters"); assertEquals(3, listReporters.size()); ReporterParameter reporterParameter1 = listReporters.get(0).getRight(); diff --git a/src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/coverage-sonar-reporter.xml b/src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/coverage-sonar-report.xml similarity index 100% rename from src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/coverage-sonar-reporter.xml rename to src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/coverage-sonar-report.xml diff --git a/src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/sonar-test-reporter.xml b/src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/sonar-test-report.xml similarity index 100% rename from src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/sonar-test-reporter.xml rename to src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/sonar-test-report.xml diff --git a/src/test/resources/integration-tests/owner-param-project/pom.xml b/src/test/resources/integration-tests/owner-param-project/pom.xml index 1cf170c..c33e51d 100644 --- a/src/test/resources/integration-tests/owner-param-project/pom.xml +++ b/src/test/resources/integration-tests/owner-param-project/pom.xml @@ -37,12 +37,12 @@ UT_COVERAGE_SONAR_REPORTER - utplsql/coverage-sonar-reporter.xml + utplsql/coverage-sonar-report.xml true UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true diff --git a/src/test/resources/integration-tests/regex-project/expected-output/utplsql/coverage-sonar-reporter.xml b/src/test/resources/integration-tests/regex-project/expected-output/utplsql/coverage-sonar-report.xml similarity index 100% rename from src/test/resources/integration-tests/regex-project/expected-output/utplsql/coverage-sonar-reporter.xml rename to src/test/resources/integration-tests/regex-project/expected-output/utplsql/coverage-sonar-report.xml diff --git a/src/test/resources/integration-tests/regex-project/expected-output/utplsql/sonar-test-reporter.xml b/src/test/resources/integration-tests/regex-project/expected-output/utplsql/sonar-test-report.xml similarity index 100% rename from src/test/resources/integration-tests/regex-project/expected-output/utplsql/sonar-test-reporter.xml rename to src/test/resources/integration-tests/regex-project/expected-output/utplsql/sonar-test-report.xml diff --git a/src/test/resources/integration-tests/regex-project/pom.xml b/src/test/resources/integration-tests/regex-project/pom.xml index 0f1a41c..b04ff07 100644 --- a/src/test/resources/integration-tests/regex-project/pom.xml +++ b/src/test/resources/integration-tests/regex-project/pom.xml @@ -36,12 +36,12 @@ UT_COVERAGE_SONAR_REPORTER - utplsql/coverage-sonar-reporter.xml + utplsql/coverage-sonar-report.xml true UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true diff --git a/src/test/resources/integration-tests/simple-project/expected-output/utplsql/coverage-sonar-reporter.xml b/src/test/resources/integration-tests/simple-project/expected-output/utplsql/coverage-sonar-report.xml similarity index 100% rename from src/test/resources/integration-tests/simple-project/expected-output/utplsql/coverage-sonar-reporter.xml rename to src/test/resources/integration-tests/simple-project/expected-output/utplsql/coverage-sonar-report.xml diff --git a/src/test/resources/integration-tests/simple-project/expected-output/utplsql/sonar-test-reporter.xml b/src/test/resources/integration-tests/simple-project/expected-output/utplsql/sonar-test-report.xml similarity index 100% rename from src/test/resources/integration-tests/simple-project/expected-output/utplsql/sonar-test-reporter.xml rename to src/test/resources/integration-tests/simple-project/expected-output/utplsql/sonar-test-report.xml diff --git a/src/test/resources/integration-tests/simple-project/pom.xml b/src/test/resources/integration-tests/simple-project/pom.xml index ee05b0b..0be54b9 100644 --- a/src/test/resources/integration-tests/simple-project/pom.xml +++ b/src/test/resources/integration-tests/simple-project/pom.xml @@ -36,12 +36,12 @@ UT_COVERAGE_SONAR_REPORTER - utplsql/coverage-sonar-reporter.xml + utplsql/coverage-sonar-report.xml true UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true diff --git a/src/test/resources/integration-tests/skip-project/pom.xml b/src/test/resources/integration-tests/skip-project/pom.xml index 2eae06a..9ee47c1 100644 --- a/src/test/resources/integration-tests/skip-project/pom.xml +++ b/src/test/resources/integration-tests/skip-project/pom.xml @@ -38,12 +38,12 @@ UT_COVERAGE_SONAR_REPORTER - utplsql/coverage-sonar-reporter.xml + utplsql/coverage-sonar-report.xml true UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true diff --git a/src/test/resources/integration-tests/tags-project/expected-output/utplsql/sonar-test-reporter.xml b/src/test/resources/integration-tests/tags-project/expected-output/utplsql/sonar-test-report.xml similarity index 100% rename from src/test/resources/integration-tests/tags-project/expected-output/utplsql/sonar-test-reporter.xml rename to src/test/resources/integration-tests/tags-project/expected-output/utplsql/sonar-test-report.xml diff --git a/src/test/resources/integration-tests/tags-project/pom.xml b/src/test/resources/integration-tests/tags-project/pom.xml index 5974258..06fdb55 100644 --- a/src/test/resources/integration-tests/tags-project/pom.xml +++ b/src/test/resources/integration-tests/tags-project/pom.xml @@ -41,7 +41,7 @@ UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true diff --git a/src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/coverage-sonar-reporter.xml b/src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/coverage-sonar-report.xml similarity index 100% rename from src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/coverage-sonar-reporter.xml rename to src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/coverage-sonar-report.xml diff --git a/src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/sonar-test-reporter.xml b/src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/sonar-test-report.xml similarity index 100% rename from src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/sonar-test-reporter.xml rename to src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/sonar-test-report.xml diff --git a/src/test/resources/integration-tests/type-mapping-project/pom.xml b/src/test/resources/integration-tests/type-mapping-project/pom.xml index a4d3dde..55772f8 100644 --- a/src/test/resources/integration-tests/type-mapping-project/pom.xml +++ b/src/test/resources/integration-tests/type-mapping-project/pom.xml @@ -37,12 +37,12 @@ UT_COVERAGE_SONAR_REPORTER - utplsql/coverage-sonar-reporter.xml + utplsql/coverage-sonar-report.xml true UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true diff --git a/src/test/resources/unit-tests/defaultConsoleOutputBehaviour/pom.xml b/src/test/resources/unit-tests/defaultConsoleOutputBehaviour/pom.xml index 2f23eba..9907d2a 100644 --- a/src/test/resources/unit-tests/defaultConsoleOutputBehaviour/pom.xml +++ b/src/test/resources/unit-tests/defaultConsoleOutputBehaviour/pom.xml @@ -50,11 +50,11 @@ UT_COVERAGE_SONAR_REPORTER - coverage-sonar-reporter.xml + coverage-sonar-report.xml UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true diff --git a/src/test/resources/unit-tests/invalidTestsSourcesDirectories/pom.xml b/src/test/resources/unit-tests/invalidTestsSourcesDirectories/pom.xml index 5993111..2302b15 100644 --- a/src/test/resources/unit-tests/invalidTestsSourcesDirectories/pom.xml +++ b/src/test/resources/unit-tests/invalidTestsSourcesDirectories/pom.xml @@ -44,12 +44,12 @@ UT_COVERAGE_SONAR_REPORTER - utplsql/coverage-sonar-reporter.xml + utplsql/coverage-sonar-report.xml true UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true @@ -76,4 +76,4 @@ - \ No newline at end of file + diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/pom.xml b/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/pom.xml index 06184eb..0b6d640 100644 --- a/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/pom.xml +++ b/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/pom.xml @@ -43,12 +43,12 @@ UT_COVERAGE_SONAR_REPORTER - utplsql/coverage-sonar-reporter.xml + utplsql/coverage-sonar-report.xml true UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true @@ -78,4 +78,4 @@ - \ No newline at end of file + diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/pom.xml b/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/pom.xml index 3f41158..d85eafd 100644 --- a/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/pom.xml +++ b/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/pom.xml @@ -43,12 +43,12 @@ UT_COVERAGE_SONAR_REPORTER - utplsql/coverage-sonar-reporter.xml + utplsql/coverage-sonar-report.xml true UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true @@ -68,4 +68,4 @@ - \ No newline at end of file + diff --git a/src/test/resources/unit-tests/skipUtplsqlTests/pom.xml b/src/test/resources/unit-tests/skipUtplsqlTests/pom.xml index 237a449..966539d 100644 --- a/src/test/resources/unit-tests/skipUtplsqlTests/pom.xml +++ b/src/test/resources/unit-tests/skipUtplsqlTests/pom.xml @@ -52,11 +52,11 @@ UT_COVERAGE_SONAR_REPORTER - coverage-sonar-reporter.xml + coverage-sonar-report.xml UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true diff --git a/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryDoesNotExist/pom.xml b/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryDoesNotExist/pom.xml index 75234c4..da6bb30 100644 --- a/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryDoesNotExist/pom.xml +++ b/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryDoesNotExist/pom.xml @@ -44,12 +44,12 @@ UT_COVERAGE_SONAR_REPORTER - utplsql/coverage-sonar-reporter.xml + utplsql/coverage-sonar-report.xml true UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true @@ -57,4 +57,4 @@ - \ No newline at end of file + diff --git a/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/pom.xml b/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/pom.xml index ba12beb..e95ae18 100644 --- a/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/pom.xml +++ b/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/pom.xml @@ -43,12 +43,12 @@ UT_COVERAGE_SONAR_REPORTER - utplsql/coverage-sonar-reporter.xml + utplsql/coverage-sonar-report.xml true UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true @@ -56,4 +56,4 @@ - \ No newline at end of file + diff --git a/src/test/resources/unit-tests/testSourcesTestsParams/pom.xml b/src/test/resources/unit-tests/testSourcesTestsParams/pom.xml index 609a8a4..ef2be8f 100644 --- a/src/test/resources/unit-tests/testSourcesTestsParams/pom.xml +++ b/src/test/resources/unit-tests/testSourcesTestsParams/pom.xml @@ -44,12 +44,12 @@ UT_COVERAGE_SONAR_REPORTER - utplsql/coverage-sonar-reporter.xml + utplsql/coverage-sonar-report.xml true UT_SONAR_TEST_REPORTER - utplsql/sonar-test-reporter.xml + utplsql/sonar-test-report.xml true @@ -100,4 +100,4 @@ - \ No newline at end of file + From 0c259af0be6fca352c1831879e370561e6d52a8a Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 09:57:17 +0100 Subject: [PATCH 082/200] Removed Whitebox --- .../org/utplsql/maven/plugin/UtPLSQLMojo.java | 209 +++++++++--------- .../maven/plugin/helper/PluginDefault.java | 61 ----- .../plugin/{reporter => io}/ReportWriter.java | 16 +- .../SqlFileScanner.java} | 35 ++- .../plugin/{ => model}/CustomTypeMapping.java | 2 +- .../plugin/{ => model}/ReporterParameter.java | 2 +- ...UtPLSQLMojoTest.java => MojoRuleTest.java} | 72 +++--- .../{UtPLSQLMojoIT.java => VerifierIT.java} | 2 +- .../pom.xml | 0 .../invalid-sources-directories/pom.xml | 69 ++++++ .../pom.xml | 9 - .../missing-directory}/pom.xml | 0 .../missing-directory}/src/main/plsql/f1.sql | 0 .../src/main/plsql/foo/f2.sql | 0 .../missing-directory}/src/test/plsql/f2.pkg | 0 .../src/test/plsql/foo/f1.pkg | 0 .../src/test/plsql/foo/f1.sql | 0 .../missing-includes}/pom.xml | 0 .../missing-includes}/src/main/foo/f1.sql | 0 .../missing-includes}/src/main/foo/foo/f2.sql | 0 .../missing-includes}/src/test/bar/f2.pkg | 0 .../missing-includes}/src/test/bar/foo/f1.pkg | 0 .../missing-includes}/src/test/bar/foo/f1.sql | 0 .../pom.xml | 0 .../directory-does-not-exist}/pom.xml | 0 .../directory-exists}/pom.xml | 0 .../directory-exists}/src/main/plsql/f1.sql | 0 .../directory-exists}/src/main/plsql/f2.sql | 0 .../directory-exists}/src/test/plsql/f2.pkg | 0 .../src/test/plsql/foo/f1.pkg | 0 .../src/test/plsql/foo/f1.sql | 0 .../pom.xml | 0 .../srcs/file.bdy | 0 .../srcs/foo.sql | 0 .../srcs/spec.spc | 0 .../te/st/file.bdy | 0 .../te/st/foo.sql | 0 .../te/st/spec.spc | 0 38 files changed, 237 insertions(+), 240 deletions(-) delete mode 100644 src/main/java/org/utplsql/maven/plugin/helper/PluginDefault.java rename src/main/java/org/utplsql/maven/plugin/{reporter => io}/ReportWriter.java (89%) rename src/main/java/org/utplsql/maven/plugin/{helper/SqlScannerHelper.java => io/SqlFileScanner.java} (57%) rename src/main/java/org/utplsql/maven/plugin/{ => model}/CustomTypeMapping.java (96%) rename src/main/java/org/utplsql/maven/plugin/{ => model}/ReporterParameter.java (98%) rename src/test/java/org/utplsql/maven/plugin/{UtPLSQLMojoTest.java => MojoRuleTest.java} (81%) rename src/test/java/org/utplsql/maven/plugin/{UtPLSQLMojoIT.java => VerifierIT.java} (99%) rename src/test/resources/unit-tests/{defaultConsoleOutputBehaviour => default-console-output-behaviour}/pom.xml (100%) create mode 100644 src/test/resources/unit-tests/invalid-sources-directories/pom.xml rename src/test/resources/unit-tests/{invalidTestsSourcesDirectories => invalid-tests-sources-directories}/pom.xml (87%) rename src/test/resources/unit-tests/{partialSourceAndTestTag/missingDirectory => partial-source-and-test-tag/missing-directory}/pom.xml (100%) rename src/test/resources/unit-tests/{partialSourceAndTestTag/missingDirectory => partial-source-and-test-tag/missing-directory}/src/main/plsql/f1.sql (100%) rename src/test/resources/unit-tests/{partialSourceAndTestTag/missingDirectory => partial-source-and-test-tag/missing-directory}/src/main/plsql/foo/f2.sql (100%) rename src/test/resources/unit-tests/{partialSourceAndTestTag/missingDirectory => partial-source-and-test-tag/missing-directory}/src/test/plsql/f2.pkg (100%) rename src/test/resources/unit-tests/{partialSourceAndTestTag/missingDirectory => partial-source-and-test-tag/missing-directory}/src/test/plsql/foo/f1.pkg (100%) rename src/test/resources/unit-tests/{partialSourceAndTestTag/missingDirectory => partial-source-and-test-tag/missing-directory}/src/test/plsql/foo/f1.sql (100%) rename src/test/resources/unit-tests/{partialSourceAndTestTag/missingIncludes => partial-source-and-test-tag/missing-includes}/pom.xml (100%) rename src/test/resources/unit-tests/{partialSourceAndTestTag/missingIncludes => partial-source-and-test-tag/missing-includes}/src/main/foo/f1.sql (100%) rename src/test/resources/unit-tests/{partialSourceAndTestTag/missingIncludes => partial-source-and-test-tag/missing-includes}/src/main/foo/foo/f2.sql (100%) rename src/test/resources/unit-tests/{partialSourceAndTestTag/missingIncludes => partial-source-and-test-tag/missing-includes}/src/test/bar/f2.pkg (100%) rename src/test/resources/unit-tests/{partialSourceAndTestTag/missingIncludes => partial-source-and-test-tag/missing-includes}/src/test/bar/foo/f1.pkg (100%) rename src/test/resources/unit-tests/{partialSourceAndTestTag/missingIncludes => partial-source-and-test-tag/missing-includes}/src/test/bar/foo/f1.sql (100%) rename src/test/resources/unit-tests/{skipUtplsqlTests => skip-utplsql-tests}/pom.xml (100%) rename src/test/resources/unit-tests/{testNoSourcesTestsParams/directoryDoesNotExist => test-no-sources-tests-params/directory-does-not-exist}/pom.xml (100%) rename src/test/resources/unit-tests/{testNoSourcesTestsParams/directoryExists => test-no-sources-tests-params/directory-exists}/pom.xml (100%) rename src/test/resources/unit-tests/{testNoSourcesTestsParams/directoryExists => test-no-sources-tests-params/directory-exists}/src/main/plsql/f1.sql (100%) rename src/test/resources/unit-tests/{testNoSourcesTestsParams/directoryExists => test-no-sources-tests-params/directory-exists}/src/main/plsql/f2.sql (100%) rename src/test/resources/unit-tests/{testNoSourcesTestsParams/directoryExists => test-no-sources-tests-params/directory-exists}/src/test/plsql/f2.pkg (100%) rename src/test/resources/unit-tests/{testNoSourcesTestsParams/directoryExists => test-no-sources-tests-params/directory-exists}/src/test/plsql/foo/f1.pkg (100%) rename src/test/resources/unit-tests/{testNoSourcesTestsParams/directoryExists => test-no-sources-tests-params/directory-exists}/src/test/plsql/foo/f1.sql (100%) rename src/test/resources/unit-tests/{testSourcesTestsParams => test-sources-tests-params}/pom.xml (100%) rename src/test/resources/unit-tests/{testSourcesTestsParams => test-sources-tests-params}/srcs/file.bdy (100%) rename src/test/resources/unit-tests/{testSourcesTestsParams => test-sources-tests-params}/srcs/foo.sql (100%) rename src/test/resources/unit-tests/{testSourcesTestsParams => test-sources-tests-params}/srcs/spec.spc (100%) rename src/test/resources/unit-tests/{testSourcesTestsParams => test-sources-tests-params}/te/st/file.bdy (100%) rename src/test/resources/unit-tests/{testSourcesTestsParams => test-sources-tests-params}/te/st/foo.sql (100%) rename src/test/resources/unit-tests/{testSourcesTestsParams => test-sources-tests-params}/te/st/spec.spc (100%) diff --git a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java index 5db8f49..51f6f0f 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java @@ -17,20 +17,21 @@ import org.utplsql.api.KeyValuePair; import org.utplsql.api.TestRunner; import org.utplsql.api.Version; -import org.utplsql.api.db.DatabaseInformation; import org.utplsql.api.db.DefaultDatabaseInformation; import org.utplsql.api.exception.SomeTestsFailedException; import org.utplsql.api.reporter.CoreReporters; import org.utplsql.api.reporter.Reporter; import org.utplsql.api.reporter.ReporterFactory; -import org.utplsql.maven.plugin.helper.PluginDefault; -import org.utplsql.maven.plugin.helper.SqlScannerHelper; -import org.utplsql.maven.plugin.reporter.ReportWriter; +import org.utplsql.maven.plugin.model.CustomTypeMapping; +import org.utplsql.maven.plugin.model.ReporterParameter; +import org.utplsql.maven.plugin.io.SqlFileScanner; +import org.utplsql.maven.plugin.io.ReportWriter; import java.io.File; import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; @@ -46,136 +47,108 @@ public class UtPLSQLMojo extends AbstractMojo { @Parameter(readonly = true, defaultValue = "${project}") - private MavenProject project; + MavenProject project; @Parameter(property = "dbUrl") - protected String url; - + String url; @Parameter(property = "dbUser") - protected String user; - + String user; @Parameter(property = "dbPass") - protected String password; + String password; @Parameter - protected String includeObject; - + String includeObject; @Parameter - protected String excludeObject; + String excludeObject; @Parameter(defaultValue = "false") - protected boolean skipCompatibilityCheck; + boolean skipCompatibilityCheck; @Parameter - protected final List reporters = new ArrayList<>(); + final List reporters = new ArrayList<>(); @Parameter - protected final List paths = new ArrayList<>(); - - /** - * Sources Configuration - */ + final List paths = new ArrayList<>(); @Parameter - protected final List sources = new ArrayList<>(); - + final List sources = new ArrayList<>(); @Parameter - private String sourcesOwner; - + String sourcesOwner; @Parameter - private String sourcesRegexExpression; - + String sourcesRegexExpression; @Parameter - private Integer sourcesOwnerSubexpression; - + Integer sourcesOwnerSubexpression; @Parameter - private Integer sourcesNameSubexpression; - + Integer sourcesNameSubexpression; @Parameter - private Integer sourcesTypeSubexpression; - + Integer sourcesTypeSubexpression; @Parameter - private List sourcesCustomTypeMapping; + List sourcesCustomTypeMapping; - /** - * Tests Configuration - */ @Parameter - protected final List tests = new ArrayList<>(); - + final List tests = new ArrayList<>(); @Parameter - private String testsOwner; - + String testsOwner; @Parameter - private String testsRegexExpression; - + String testsRegexExpression; @Parameter - private Integer testsOwnerSubexpression; - + Integer testsOwnerSubexpression; @Parameter - private Integer testsNameSubexpression; - + Integer testsNameSubexpression; @Parameter - private Integer testsTypeSubexpression; - + Integer testsTypeSubexpression; @Parameter - private List testsCustomTypeMapping; + List testsCustomTypeMapping; @Parameter - private final Set tags = new LinkedHashSet<>(); + final Set tags = new LinkedHashSet<>(); @Parameter - private boolean randomTestOrder; + boolean randomTestOrder; @Parameter - private Integer randomTestOrderSeed; + Integer randomTestOrderSeed; @Parameter(defaultValue = "${project.build.directory}", readonly = true) - protected String targetDir; + String targetDir; @Parameter(defaultValue = "${maven.test.failure.ignore}") - protected boolean ignoreFailure; + boolean ignoreFailure; @Parameter(property = "skipUtplsqlTests", defaultValue = "false") - protected boolean skipUtplsqlTests; + boolean skipUtplsqlTests; @Parameter - protected boolean dbmsOutput; + boolean dbmsOutput; - /** - * Color in the console, bases on Maven logging configuration. - */ - private final boolean colorConsole = MessageUtils.isColorEnabled(); - - private ReportWriter reportWriter; - - private final DatabaseInformation databaseInformation = new DefaultDatabaseInformation(); + private final SqlFileScanner sqlFileScanner = new SqlFileScanner(); - /** - * Executes the plugin. - */ @Override public void execute() throws MojoExecutionException { if (skipUtplsqlTests) { getLog().info("utPLSQLTests are skipped."); } else { - getLog().debug("Java Api Version = " + JavaApiVersionInfo.getVersion()); - loadConfFromEnvironment(); + getLog().debug("Java API Version = " + JavaApiVersionInfo.getVersion()); Connection connection = null; + ReportWriter reportWriter = null; try { FileMapperOptions sourceMappingOptions = buildSourcesOptions(); FileMapperOptions testMappingOptions = buildTestsOptions(); + setDbConfiguration(); + OracleDataSource ds = new OracleDataSource(); ds.setURL(url); ds.setUser(user); ds.setPassword(password); connection = ds.getConnection(); - Version utlVersion = this.databaseInformation.getUtPlsqlFrameworkVersion(connection); + Version utlVersion = new DefaultDatabaseInformation().getUtPlsqlFrameworkVersion(connection); getLog().info("utPLSQL Version = " + utlVersion); - List reporterList = initReporters(connection, utlVersion, ReporterFactory.createEmpty()); + reportWriter = new ReportWriter(targetDir, utlVersion, getLog()); + + List reporterList = initReporters(connection, reportWriter, ReporterFactory.createEmpty()); logParameters(sourceMappingOptions, testMappingOptions, reporterList); @@ -190,7 +163,7 @@ public void execute() throws MojoExecutionException { .sourceMappingOptions(sourceMappingOptions) .testMappingOptions(testMappingOptions) .skipCompatibilityCheck(skipCompatibilityCheck) - .colorConsole(colorConsole) + .colorConsole(MessageUtils.isColorEnabled()) .addTags(tags) .randomTestOrder(randomTestOrder) .randomTestOrderSeed(randomTestOrderSeed) @@ -199,11 +172,12 @@ public void execute() throws MojoExecutionException { if (StringUtils.isNotBlank(excludeObject)) { runner.excludeObject(excludeObject); } - if (StringUtils.isNotBlank(includeObject)) { + { runner.includeObject(includeObject); } + if (StringUtils.isNotBlank(includeObject)) - runner.run(connection); + runner.run(connection); } catch (SomeTestsFailedException e) { if (!this.ignoreFailure) { @@ -214,19 +188,20 @@ public void execute() throws MojoExecutionException { } finally { try { if (connection != null) { - reportWriter.writeReports(connection); - + if (reportWriter != null) { + reportWriter.writeReports(connection); + } DBHelper.disableDBMSOutput(connection); connection.close(); } - } catch (Exception e) { + } catch (SQLException e) { getLog().error(e.getMessage(), e); } } } } - private void loadConfFromEnvironment() { + private void setDbConfiguration() { if (StringUtils.isEmpty(url)) { url = System.getProperty("dbUrl"); } @@ -238,48 +213,46 @@ private void loadConfFromEnvironment() { } } - private FileMapperOptions buildSourcesOptions() throws MojoExecutionException { + FileMapperOptions buildSourcesOptions() throws MojoExecutionException { try { if (sources.isEmpty()) { - File defaultSourceDirectory = new File(project.getBasedir(), PluginDefault.SOURCE_DIRECTORY); + File defaultSourceDirectory = new File(project.getBasedir(), Defaults.SOURCE_DIRECTORY); if (defaultSourceDirectory.exists()) { - sources.add(PluginDefault.buildDefaultSource()); + sources.add(Defaults.buildDefaultSource()); } else { return new FileMapperOptions(new ArrayList<>()); } } - List scripts = SqlScannerHelper.findSqlScripts(project.getBasedir(), sources, - PluginDefault.SOURCE_DIRECTORY, PluginDefault.SOURCE_FILE_PATTERN); + List scripts = sqlFileScanner.findSqlScripts(project.getBasedir(), sources, + Defaults.SOURCE_DIRECTORY, Defaults.SOURCE_FILE_PATTERN); return createFileMapperOptions(scripts, sourcesOwner, sourcesRegexExpression, sourcesOwnerSubexpression, sourcesNameSubexpression, sourcesTypeSubexpression, sourcesCustomTypeMapping); } catch (Exception e) { throw new MojoExecutionException("Invalid in your pom.xml", e); } - } - private FileMapperOptions buildTestsOptions() throws MojoExecutionException { + FileMapperOptions buildTestsOptions() throws MojoExecutionException { try { if (tests.isEmpty()) { - File defaultTestDirectory = new File(project.getBasedir(), PluginDefault.TEST_DIRECTORY); + File defaultTestDirectory = new File(project.getBasedir(), Defaults.TEST_DIRECTORY); if (defaultTestDirectory.exists()) { - tests.add(PluginDefault.buildDefaultTest()); + tests.add(Defaults.buildDefaultTest()); } else { return new FileMapperOptions(new ArrayList<>()); } } - List scripts = SqlScannerHelper.findSqlScripts(project.getBasedir(), tests, PluginDefault.TEST_DIRECTORY, - PluginDefault.TEST_FILE_PATTERN); + List scripts = sqlFileScanner.findSqlScripts(project.getBasedir(), tests, Defaults.TEST_DIRECTORY, + Defaults.TEST_FILE_PATTERN); return createFileMapperOptions(scripts, testsOwner, testsRegexExpression, testsOwnerSubexpression, testsNameSubexpression, testsTypeSubexpression, testsCustomTypeMapping); } catch (Exception e) { throw new MojoExecutionException("Invalid in your pom.xml: " + e.getMessage()); } - } private FileMapperOptions createFileMapperOptions(List scripts, String objectOwner, String regexPattern, @@ -290,45 +263,34 @@ private FileMapperOptions createFileMapperOptions(List scripts, String o if (StringUtils.isNotEmpty(objectOwner)) { fileMapperOptions.setObjectOwner(objectOwner); } - if (StringUtils.isNotEmpty(regexPattern)) { fileMapperOptions.setRegexPattern(regexPattern); } - if (ownerSubExpression != null) { fileMapperOptions.setOwnerSubExpression(ownerSubExpression); } - if (nameSubExpression != null) { fileMapperOptions.setNameSubExpression(nameSubExpression); } - if (typeSubExpression != null) { fileMapperOptions.setTypeSubExpression(typeSubExpression); } - if (typeMappings != null && !typeMappings.isEmpty()) { fileMapperOptions.setTypeMappings(typeMappings.stream() .map(mapping -> new KeyValuePair(mapping.getCustomMapping(), mapping.getType())) .collect(Collectors.toList())); } - return fileMapperOptions; } - private List initReporters(Connection connection, Version utlVersion, ReporterFactory reporterFactory) - throws SQLException { - + List initReporters(Connection connection, ReportWriter reportWriter, ReporterFactory reporterFactory) throws SQLException { List reporterList = new ArrayList<>(); - reportWriter = new ReportWriter(targetDir, utlVersion, getLog()); - if (reporters.isEmpty()) { ReporterParameter reporterParameter = new ReporterParameter(); reporterParameter.setConsoleOutput(true); reporterParameter.setName(CoreReporters.UT_DOCUMENTATION_REPORTER.name()); reporters.add(reporterParameter); } - for (ReporterParameter reporterParameter : reporters) { Reporter reporter = reporterFactory.createReporter(reporterParameter.getName()); reporter.init(connection); @@ -344,7 +306,6 @@ private List initReporters(Connection connection, Version utlVersion, reportWriter.addReporter(reporterParameter, reporter); } } - return reporterList; } @@ -365,4 +326,46 @@ private void logParameters(FileMapperOptions sourceMappingOptions, FileMapperOpt testMappingOptions.getFilePaths().forEach(log::debug); } } + + /** + * This class provides methods to retrieve the list of resources in the default {@literal and } directories. + * + * @author Alberto Hernández + * @author Simon Martinelli + */ + private static class Defaults { + + public static final String SOURCE_DIRECTORY = "src/main/plsql"; + public static final String TEST_DIRECTORY = "src/test/plsql"; + public static final String SOURCE_FILE_PATTERN = "**/*.*"; + public static final String TEST_FILE_PATTERN = "**/*.pkg"; + + private Defaults() { + } + + /** + * This method returns {@link Resource} for the default {@code source} directory + * + * @return a {@link Resource} + */ + public static Resource buildDefaultSource() { + return buildDirectory(SOURCE_DIRECTORY, SOURCE_FILE_PATTERN); + } + + /** + * This method returns {@link Resource} for the default {@code test} directory + * + * @return a {@link Resource} + */ + public static Resource buildDefaultTest() { + return buildDirectory(TEST_DIRECTORY, TEST_FILE_PATTERN); + } + + private static Resource buildDirectory(String directory, String includes) { + Resource resource = new Resource(); + resource.setDirectory(directory); + resource.setIncludes(Collections.singletonList(includes)); + return resource; + } + } } diff --git a/src/main/java/org/utplsql/maven/plugin/helper/PluginDefault.java b/src/main/java/org/utplsql/maven/plugin/helper/PluginDefault.java deleted file mode 100644 index 430a694..0000000 --- a/src/main/java/org/utplsql/maven/plugin/helper/PluginDefault.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.utplsql.maven.plugin.helper; - -import org.apache.maven.model.Resource; - -import java.util.Collections; - -/** - * This class provides methods to retrieve the list of resources in the default {@literal and } directories. - * - * @author Alberto Hernández - */ -public class PluginDefault { - - /** - * Source directory. - */ - public static final String SOURCE_DIRECTORY = "src/main/plsql"; - - /** - * Test directory. - */ - public static final String TEST_DIRECTORY = "src/test/plsql"; - - /** - * Default source file pattern. - */ - public static final String SOURCE_FILE_PATTERN = "**/*.*"; - - /** - * Default test file pattern. - */ - public static final String TEST_FILE_PATTERN = "**/*.pkg"; - - private PluginDefault() { - } - - /** - * This method returns {@link Resource} for the default {@code source} directory - * - * @return a {@link Resource} - */ - public static Resource buildDefaultSource() { - return buildDirectory(SOURCE_DIRECTORY, SOURCE_FILE_PATTERN); - } - - /** - * This method returns {@link Resource} for the default {@code test} directory - * - * @return a {@link Resource} - */ - public static Resource buildDefaultTest() { - return buildDirectory(TEST_DIRECTORY, TEST_FILE_PATTERN); - } - - private static Resource buildDirectory(String directory, String includes) { - Resource resource = new Resource(); - resource.setDirectory(directory); - resource.setIncludes(Collections.singletonList(includes)); - return resource; - } -} diff --git a/src/main/java/org/utplsql/maven/plugin/reporter/ReportWriter.java b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java similarity index 89% rename from src/main/java/org/utplsql/maven/plugin/reporter/ReportWriter.java rename to src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java index 12f603a..3bd78e9 100644 --- a/src/main/java/org/utplsql/maven/plugin/reporter/ReportWriter.java +++ b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java @@ -1,4 +1,4 @@ -package org.utplsql.maven.plugin.reporter; +package org.utplsql.maven.plugin.io; import org.apache.commons.lang3.tuple.Pair; import org.apache.maven.plugin.MojoExecutionException; @@ -7,7 +7,7 @@ import org.utplsql.api.outputBuffer.OutputBuffer; import org.utplsql.api.outputBuffer.OutputBufferProvider; import org.utplsql.api.reporter.Reporter; -import org.utplsql.maven.plugin.ReporterParameter; +import org.utplsql.maven.plugin.model.ReporterParameter; import java.io.File; import java.io.FileNotFoundException; @@ -29,7 +29,7 @@ */ public class ReportWriter { - private final List> listReporters; + private final List> reporters; private final String outputDirectory; @@ -45,7 +45,7 @@ public class ReportWriter { * @param log the Maven log */ public ReportWriter(String outputDirectory, Version databaseVersion, Log log) { - this.listReporters = new ArrayList<>(); + this.reporters = new ArrayList<>(); this.outputDirectory = outputDirectory; this.databaseVersion = databaseVersion; this.log = log; @@ -58,7 +58,7 @@ public ReportWriter(String outputDirectory, Version databaseVersion, Log log) { * @param reporter the {@link Reporter} */ public void addReporter(ReporterParameter parameter, Reporter reporter) { - listReporters.add(Pair.of(reporter, parameter)); + reporters.add(Pair.of(reporter, parameter)); } /** @@ -68,11 +68,15 @@ public void addReporter(ReporterParameter parameter, Reporter reporter) { * @throws MojoExecutionException if any exception happens */ public void writeReports(Connection connection) throws MojoExecutionException { - for (Pair pair : listReporters) { + for (Pair pair : reporters) { writeReports(connection, pair.getLeft(), pair.getRight()); } } + public List> getReporters() { + return reporters; + } + private void writeReports(Connection connection, Reporter reporter, ReporterParameter reporterParameter) throws MojoExecutionException { FileOutputStream fileOutputStream = null; try { diff --git a/src/main/java/org/utplsql/maven/plugin/helper/SqlScannerHelper.java b/src/main/java/org/utplsql/maven/plugin/io/SqlFileScanner.java similarity index 57% rename from src/main/java/org/utplsql/maven/plugin/helper/SqlScannerHelper.java rename to src/main/java/org/utplsql/maven/plugin/io/SqlFileScanner.java index dfe1cd6..7178d1a 100644 --- a/src/main/java/org/utplsql/maven/plugin/helper/SqlScannerHelper.java +++ b/src/main/java/org/utplsql/maven/plugin/io/SqlFileScanner.java @@ -1,4 +1,4 @@ -package org.utplsql.maven.plugin.helper; +package org.utplsql.maven.plugin.io; import org.apache.maven.model.Resource; import org.codehaus.plexus.util.DirectoryScanner; @@ -14,11 +14,9 @@ * Utility to scan all resources * * @author Alberto Hernández + * @author Simon Martinelli */ -public class SqlScannerHelper { - - private SqlScannerHelper() { - } +public class SqlFileScanner { /** * Scans a directory looking for the matching patterns. @@ -29,11 +27,10 @@ private SqlScannerHelper() { * @param defaultFilePattern the default file pattern * @return a list of the files found */ - public static List findSqlScripts(File baseDir, List resources, String defaultDirectory, String defaultFilePattern) { + public List findSqlScripts(File baseDir, List resources, String defaultDirectory, String defaultFilePattern) { List founds = new ArrayList<>(); for (Resource resource : resources) { - if (resource.getDirectory() == null) { resource.setDirectory(defaultDirectory); } @@ -48,28 +45,22 @@ public static List findSqlScripts(File baseDir, List resources for (String basename : scanner.getIncludedFiles()) { founds.add(baseDir.toURI().relativize(new File(scanner.getBasedir(), basename).toURI()).getPath()); } - founds.addAll(Collections.emptyList()); } return founds; } - private static DirectoryScanner buildScanner(String baseDir, Resource resource) { - - if (resource != null) { - File fileBaseDir = new File(baseDir, resource.getDirectory()); - if (!fileBaseDir.exists() || !fileBaseDir.isDirectory() || !fileBaseDir.canRead()) { - throw new IllegalArgumentException(format("Invalid %s in resource. Check your pom.xml", resource.getDirectory())); - } - - DirectoryScanner scanner = new DirectoryScanner(); - scanner.setBasedir(fileBaseDir.getPath()); - scanner.setIncludes(resource.getIncludes().toArray(new String[0])); - scanner.setExcludes(resource.getExcludes().toArray(new String[0])); - return scanner; + private DirectoryScanner buildScanner(String baseDir, Resource resource) { + File fileBaseDir = new File(baseDir, resource.getDirectory()); + if (!fileBaseDir.exists() || !fileBaseDir.isDirectory() || !fileBaseDir.canRead()) { + throw new IllegalArgumentException(format("Invalid %s in resource. Check your pom.xml", resource.getDirectory())); } - throw new IllegalArgumentException(); + DirectoryScanner scanner = new DirectoryScanner(); + scanner.setBasedir(fileBaseDir.getPath()); + scanner.setIncludes(resource.getIncludes().toArray(new String[0])); + scanner.setExcludes(resource.getExcludes().toArray(new String[0])); + return scanner; } } diff --git a/src/main/java/org/utplsql/maven/plugin/CustomTypeMapping.java b/src/main/java/org/utplsql/maven/plugin/model/CustomTypeMapping.java similarity index 96% rename from src/main/java/org/utplsql/maven/plugin/CustomTypeMapping.java rename to src/main/java/org/utplsql/maven/plugin/model/CustomTypeMapping.java index 48328bf..16616b0 100644 --- a/src/main/java/org/utplsql/maven/plugin/CustomTypeMapping.java +++ b/src/main/java/org/utplsql/maven/plugin/model/CustomTypeMapping.java @@ -1,4 +1,4 @@ -package org.utplsql.maven.plugin; +package org.utplsql.maven.plugin.model; /** * Bean used by Maven to populate its model. diff --git a/src/main/java/org/utplsql/maven/plugin/ReporterParameter.java b/src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java similarity index 98% rename from src/main/java/org/utplsql/maven/plugin/ReporterParameter.java rename to src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java index 9b7065b..198ba5f 100644 --- a/src/main/java/org/utplsql/maven/plugin/ReporterParameter.java +++ b/src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java @@ -1,4 +1,4 @@ -package org.utplsql.maven.plugin; +package org.utplsql.maven.plugin.model; import org.codehaus.plexus.util.StringUtils; diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java b/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java similarity index 81% rename from src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java rename to src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java index b459e50..eeada1b 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java @@ -10,13 +10,13 @@ import org.mockito.Mock; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.reflect.Whitebox; import org.utplsql.api.DBHelper; import org.utplsql.api.FileMapperOptions; import org.utplsql.api.Version; import org.utplsql.api.reporter.Reporter; import org.utplsql.api.reporter.ReporterFactory; -import org.utplsql.maven.plugin.reporter.ReportWriter; +import org.utplsql.maven.plugin.io.ReportWriter; +import org.utplsql.maven.plugin.model.ReporterParameter; import java.io.ByteArrayOutputStream; import java.io.File; @@ -40,7 +40,7 @@ @RunWith(PowerMockRunner.class) @PrepareForTest({DBHelper.class, ReporterFactory.class}) -public class UtPLSQLMojoTest { +public class MojoRuleTest { @Rule public final MojoRule rule = new MojoRule(); @@ -73,10 +73,10 @@ public void setUp() throws Exception { @Test public void invalidSourcesDirectory() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalidTestsSourcesDirectories/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-sources-directories/"), "test"); assertNotNull(utplsqlMojo); - MojoExecutionException exception = assertThrows(MojoExecutionException.class, () -> Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions")); + MojoExecutionException exception = assertThrows(MojoExecutionException.class, utplsqlMojo::execute); assertEquals("Invalid in your pom.xml", exception.getMessage()); } @@ -91,10 +91,10 @@ public void invalidSourcesDirectory() throws Exception { @Test public void invalidTestsDirectory() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalidTestsSourcesDirectories/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-tests-sources-directories/"), "test"); assertNotNull(utplsqlMojo); - MojoExecutionException exception = assertThrows(MojoExecutionException.class, () -> Whitebox.invokeMethod(utplsqlMojo, "buildTestsOptions")); + MojoExecutionException exception = assertThrows(MojoExecutionException.class, utplsqlMojo::execute); assertEquals("Invalid in your pom.xml: Invalid bar in resource. Check your pom.xml", exception.getMessage()); } @@ -109,15 +109,14 @@ public void invalidTestsDirectory() throws Exception { @Test public void sourcesTestsParameters() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/testSourcesTestsParams/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-sources-tests-params/"), "test"); assertNotNull(utplsqlMojo); // TODO : move to another test about reporters - List reporters = Whitebox.getInternalState(utplsqlMojo, "reporters"); - assertEquals(2, reporters.size()); + assertEquals(2, utplsqlMojo.reporters.size()); // check sources - FileMapperOptions sources = Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions"); + FileMapperOptions sources = utplsqlMojo.buildSourcesOptions(); assertEquals(1, sources.getFilePaths().size()); assertEquals("srcs/foo.sql", sources.getFilePaths().get(0)); assertEquals("code_owner", sources.getObjectOwner()); @@ -130,7 +129,7 @@ public void sourcesTestsParameters() throws Exception { assertEquals("foo", sources.getTypeMappings().get(0).getValue()); // check tests - FileMapperOptions tests = Whitebox.invokeMethod(utplsqlMojo, "buildTestsOptions"); + 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")); @@ -154,15 +153,15 @@ public void sourcesTestsParameters() throws Exception { @Test public void sourcesAndTestsParameterDoesNotExist() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule.lookupConfiguredMojo( - new File("src/test/resources/unit-tests/testNoSourcesTestsParams/directoryDoesNotExist/"), "test"); + new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/"), "test"); assertNotNull(utplsqlMojo); // check sources - FileMapperOptions sources = Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions"); + FileMapperOptions sources = utplsqlMojo.buildSourcesOptions(); assertEquals(0, sources.getFilePaths().size()); // check tests - FileMapperOptions tests = Whitebox.invokeMethod(utplsqlMojo, "buildTestsOptions"); + FileMapperOptions tests = utplsqlMojo.buildTestsOptions(); assertEquals(0, tests.getFilePaths().size()); } @@ -176,17 +175,17 @@ public void sourcesAndTestsParameterDoesNotExist() throws Exception { @Test public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/"), "test"); assertNotNull(utplsqlMojo); // check sources - FileMapperOptions sources = Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions"); + FileMapperOptions sources = utplsqlMojo.buildSourcesOptions(); assertEquals(2, sources.getFilePaths().size()); assertTrue(sources.getFilePaths().contains("src/main/plsql/f1.sql")); assertTrue(sources.getFilePaths().contains("src/main/plsql/f2.sql")); // check tests - FileMapperOptions tests = Whitebox.invokeMethod(utplsqlMojo, "buildTestsOptions"); + FileMapperOptions tests = utplsqlMojo.buildTestsOptions(); assertEquals(2, tests.getFilePaths().size()); assertTrue(tests.getFilePaths().contains("src/test/plsql/foo/f1.pkg")); assertTrue(tests.getFilePaths().contains("src/test/plsql/f2.pkg")); @@ -202,17 +201,17 @@ public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() thro @Test public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/"), "test"); assertNotNull(utplsqlMojo); // check sources - FileMapperOptions sources = Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions"); + FileMapperOptions sources = utplsqlMojo.buildSourcesOptions(); assertEquals(2, sources.getFilePaths().size()); assertTrue(sources.getFilePaths().contains("src/main/plsql/f1.sql")); assertTrue(sources.getFilePaths().contains("src/main/plsql/foo/f2.sql")); // check tests - FileMapperOptions tests = Whitebox.invokeMethod(utplsqlMojo, "buildTestsOptions"); + FileMapperOptions tests = utplsqlMojo.buildTestsOptions(); assertEquals(3, tests.getFilePaths().size()); assertTrue(tests.getFilePaths().contains("src/test/plsql/foo/f1.pkg")); assertTrue(tests.getFilePaths().contains("src/test/plsql/f2.pkg")); @@ -229,17 +228,17 @@ public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { @Test public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/"), "test"); assertNotNull(utplsqlMojo); // check sources - FileMapperOptions sources = Whitebox.invokeMethod(utplsqlMojo, "buildSourcesOptions"); + FileMapperOptions sources = utplsqlMojo.buildSourcesOptions(); assertEquals(2, sources.getFilePaths().size()); assertTrue(sources.getFilePaths().contains("src/main/foo/f1.sql")); assertTrue(sources.getFilePaths().contains("src/main/foo/foo/f2.sql")); // check tests - FileMapperOptions tests = Whitebox.invokeMethod(utplsqlMojo, "buildTestsOptions"); + FileMapperOptions tests = utplsqlMojo.buildTestsOptions(); assertEquals(2, tests.getFilePaths().size()); assertTrue(tests.getFilePaths().contains("src/test/bar/foo/f1.pkg")); assertTrue(tests.getFilePaths().contains("src/test/bar/f2.pkg")); @@ -251,7 +250,7 @@ public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { @Test public void defaultConsoleBehaviour() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/defaultConsoleOutputBehaviour/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-console-output-behaviour/"), "test"); assertNotNull(utplsqlMojo); List reporterList = new ArrayList<>(); @@ -261,7 +260,8 @@ public void defaultConsoleBehaviour() throws Exception { return mockReporter; }); - Whitebox.invokeMethod(utplsqlMojo, "initReporters", mockConnection, mockVersion, mockReporterFactory); + ReportWriter reportWriter = new ReportWriter(utplsqlMojo.targetDir, mockVersion, utplsqlMojo.getLog()); + utplsqlMojo.initReporters(mockConnection, reportWriter, mockReporterFactory); // Assert that we called the creation reporter with the correct parameters. verify(mockReporterFactory, times(2)).createReporter("UT_DOCUMENTATION_REPORTER"); @@ -276,19 +276,18 @@ public void defaultConsoleBehaviour() throws Exception { } // Assert that we added only the necessary reporters to the writer. - ReportWriter reportWriter = Whitebox.getInternalState(utplsqlMojo, "reportWriter"); - List> listReporters = Whitebox.getInternalState(reportWriter, "listReporters"); - assertEquals(3, listReporters.size()); + List> reporters = reportWriter.getReporters(); + assertEquals(3, reporters.size()); - ReporterParameter reporterParameter1 = listReporters.get(0).getRight(); + ReporterParameter reporterParameter1 = reporters.get(0).getRight(); assertTrue(reporterParameter1.isConsoleOutput()); assertFalse(reporterParameter1.isFileOutput()); - ReporterParameter reporterParameter2 = listReporters.get(1).getRight(); + ReporterParameter reporterParameter2 = reporters.get(1).getRight(); assertFalse(reporterParameter2.isConsoleOutput()); assertTrue(reporterParameter2.isFileOutput()); - ReporterParameter reporterParameter3 = listReporters.get(2).getRight(); + ReporterParameter reporterParameter3 = reporters.get(2).getRight(); assertTrue(reporterParameter3.isConsoleOutput()); assertTrue(reporterParameter3.isFileOutput()); } @@ -299,7 +298,7 @@ public void defaultConsoleBehaviour() throws Exception { @Test public void addDefaultReporter() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/defaultConsoleOutputBehaviour/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-console-output-behaviour/"), "test"); assertNotNull(utplsqlMojo); List reporterList = new ArrayList<>(); @@ -310,10 +309,11 @@ public void addDefaultReporter() throws Exception { return mockReporter; }); - List reporterParameters = Whitebox.getInternalState(utplsqlMojo, "reporters"); + List reporterParameters = utplsqlMojo.reporters; reporterParameters.clear(); - Whitebox.invokeMethod(utplsqlMojo, "initReporters", mockConnection, mockVersion, mockReporterFactory); + ReportWriter reportWriter = new ReportWriter(utplsqlMojo.targetDir, mockVersion, utplsqlMojo.getLog()); + utplsqlMojo.initReporters(mockConnection, reportWriter, mockReporterFactory); assertEquals(1, reporterList.size()); assertEquals("UT_DOCUMENTATION_REPORTER", reporterList.get(0).getTypeName()); @@ -326,7 +326,7 @@ public void addDefaultReporter() throws Exception { @Test public void skipUtplsqlTests() throws Exception { UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/skipUtplsqlTests/"), "test"); + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/skip-utplsql-tests/"), "test"); assertNotNull(utplsqlMojo); final ByteArrayOutputStream console = new ByteArrayOutputStream(); diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/VerifierIT.java similarity index 99% rename from src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java rename to src/test/java/org/utplsql/maven/plugin/VerifierIT.java index 1d31943..cf092ab 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/VerifierIT.java @@ -22,7 +22,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -public class UtPLSQLMojoIT { +public class VerifierIT { private static String pluginVersion = null; diff --git a/src/test/resources/unit-tests/defaultConsoleOutputBehaviour/pom.xml b/src/test/resources/unit-tests/default-console-output-behaviour/pom.xml similarity index 100% rename from src/test/resources/unit-tests/defaultConsoleOutputBehaviour/pom.xml rename to src/test/resources/unit-tests/default-console-output-behaviour/pom.xml diff --git a/src/test/resources/unit-tests/invalid-sources-directories/pom.xml b/src/test/resources/unit-tests/invalid-sources-directories/pom.xml new file mode 100644 index 0000000..7af279b --- /dev/null +++ b/src/test/resources/unit-tests/invalid-sources-directories/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + + org.utplsql + utplsql-maven-plugin-test + 3.1.0-SNAPSHOT + + pom + + utplsql-maven-plugin Maven Plugin Test + + http://utplsql.org + + + jdbc:oracle:thin:@180.129.3.101:1521:xe + ut3 + XNtxj8eEgA6X6b6f + + + + + ../../../target/ + + + + org.utplsql + utplsql-maven-plugin + {project.version} + + + test + + + + + false + + + :plsql + + + + + UT_COVERAGE_SONAR_REPORTER + utplsql/coverage-sonar-report.xml + true + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + + + + foo + + **/*sql + + + + + + + + diff --git a/src/test/resources/unit-tests/invalidTestsSourcesDirectories/pom.xml b/src/test/resources/unit-tests/invalid-tests-sources-directories/pom.xml similarity index 87% rename from src/test/resources/unit-tests/invalidTestsSourcesDirectories/pom.xml rename to src/test/resources/unit-tests/invalid-tests-sources-directories/pom.xml index 2302b15..1de382b 100644 --- a/src/test/resources/unit-tests/invalidTestsSourcesDirectories/pom.xml +++ b/src/test/resources/unit-tests/invalid-tests-sources-directories/pom.xml @@ -54,15 +54,6 @@ - - - foo - - **/*sql - - - - bar diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/pom.xml b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/pom.xml similarity index 100% rename from src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/pom.xml rename to src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/pom.xml diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/main/plsql/f1.sql b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/main/plsql/f1.sql similarity index 100% rename from src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/main/plsql/f1.sql rename to src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/main/plsql/f1.sql diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/main/plsql/foo/f2.sql b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/main/plsql/foo/f2.sql similarity index 100% rename from src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/main/plsql/foo/f2.sql rename to src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/main/plsql/foo/f2.sql diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/test/plsql/f2.pkg b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/test/plsql/f2.pkg similarity index 100% rename from src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/test/plsql/f2.pkg rename to src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/test/plsql/f2.pkg diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.pkg b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/test/plsql/foo/f1.pkg similarity index 100% rename from src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.pkg rename to src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/test/plsql/foo/f1.pkg diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.sql b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/test/plsql/foo/f1.sql similarity index 100% rename from src/test/resources/unit-tests/partialSourceAndTestTag/missingDirectory/src/test/plsql/foo/f1.sql rename to src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/test/plsql/foo/f1.sql diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/pom.xml b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/pom.xml similarity index 100% rename from src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/pom.xml rename to src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/pom.xml diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/main/foo/f1.sql b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/main/foo/f1.sql similarity index 100% rename from src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/main/foo/f1.sql rename to src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/main/foo/f1.sql diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/main/foo/foo/f2.sql b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/main/foo/foo/f2.sql similarity index 100% rename from src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/main/foo/foo/f2.sql rename to src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/main/foo/foo/f2.sql diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/test/bar/f2.pkg b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/test/bar/f2.pkg similarity index 100% rename from src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/test/bar/f2.pkg rename to src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/test/bar/f2.pkg diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.pkg b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/test/bar/foo/f1.pkg similarity index 100% rename from src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.pkg rename to src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/test/bar/foo/f1.pkg diff --git a/src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.sql b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/test/bar/foo/f1.sql similarity index 100% rename from src/test/resources/unit-tests/partialSourceAndTestTag/missingIncludes/src/test/bar/foo/f1.sql rename to src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/test/bar/foo/f1.sql diff --git a/src/test/resources/unit-tests/skipUtplsqlTests/pom.xml b/src/test/resources/unit-tests/skip-utplsql-tests/pom.xml similarity index 100% rename from src/test/resources/unit-tests/skipUtplsqlTests/pom.xml rename to src/test/resources/unit-tests/skip-utplsql-tests/pom.xml diff --git a/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryDoesNotExist/pom.xml b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/pom.xml similarity index 100% rename from src/test/resources/unit-tests/testNoSourcesTestsParams/directoryDoesNotExist/pom.xml rename to src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/pom.xml diff --git a/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/pom.xml b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/pom.xml similarity index 100% rename from src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/pom.xml rename to src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/pom.xml diff --git a/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/main/plsql/f1.sql b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/main/plsql/f1.sql similarity index 100% rename from src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/main/plsql/f1.sql rename to src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/main/plsql/f1.sql diff --git a/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/main/plsql/f2.sql b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/main/plsql/f2.sql similarity index 100% rename from src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/main/plsql/f2.sql rename to src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/main/plsql/f2.sql diff --git a/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/test/plsql/f2.pkg b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/test/plsql/f2.pkg similarity index 100% rename from src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/test/plsql/f2.pkg rename to src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/test/plsql/f2.pkg diff --git a/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.pkg b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/test/plsql/foo/f1.pkg similarity index 100% rename from src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.pkg rename to src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/test/plsql/foo/f1.pkg diff --git a/src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.sql b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/test/plsql/foo/f1.sql similarity index 100% rename from src/test/resources/unit-tests/testNoSourcesTestsParams/directoryExists/src/test/plsql/foo/f1.sql rename to src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/test/plsql/foo/f1.sql diff --git a/src/test/resources/unit-tests/testSourcesTestsParams/pom.xml b/src/test/resources/unit-tests/test-sources-tests-params/pom.xml similarity index 100% rename from src/test/resources/unit-tests/testSourcesTestsParams/pom.xml rename to src/test/resources/unit-tests/test-sources-tests-params/pom.xml diff --git a/src/test/resources/unit-tests/testSourcesTestsParams/srcs/file.bdy b/src/test/resources/unit-tests/test-sources-tests-params/srcs/file.bdy similarity index 100% rename from src/test/resources/unit-tests/testSourcesTestsParams/srcs/file.bdy rename to src/test/resources/unit-tests/test-sources-tests-params/srcs/file.bdy diff --git a/src/test/resources/unit-tests/testSourcesTestsParams/srcs/foo.sql b/src/test/resources/unit-tests/test-sources-tests-params/srcs/foo.sql similarity index 100% rename from src/test/resources/unit-tests/testSourcesTestsParams/srcs/foo.sql rename to src/test/resources/unit-tests/test-sources-tests-params/srcs/foo.sql diff --git a/src/test/resources/unit-tests/testSourcesTestsParams/srcs/spec.spc b/src/test/resources/unit-tests/test-sources-tests-params/srcs/spec.spc similarity index 100% rename from src/test/resources/unit-tests/testSourcesTestsParams/srcs/spec.spc rename to src/test/resources/unit-tests/test-sources-tests-params/srcs/spec.spc diff --git a/src/test/resources/unit-tests/testSourcesTestsParams/te/st/file.bdy b/src/test/resources/unit-tests/test-sources-tests-params/te/st/file.bdy similarity index 100% rename from src/test/resources/unit-tests/testSourcesTestsParams/te/st/file.bdy rename to src/test/resources/unit-tests/test-sources-tests-params/te/st/file.bdy diff --git a/src/test/resources/unit-tests/testSourcesTestsParams/te/st/foo.sql b/src/test/resources/unit-tests/test-sources-tests-params/te/st/foo.sql similarity index 100% rename from src/test/resources/unit-tests/testSourcesTestsParams/te/st/foo.sql rename to src/test/resources/unit-tests/test-sources-tests-params/te/st/foo.sql diff --git a/src/test/resources/unit-tests/testSourcesTestsParams/te/st/spec.spc b/src/test/resources/unit-tests/test-sources-tests-params/te/st/spec.spc similarity index 100% rename from src/test/resources/unit-tests/testSourcesTestsParams/te/st/spec.spc rename to src/test/resources/unit-tests/test-sources-tests-params/te/st/spec.spc From 6af044e56a36964fb0c633cbfe1f01cf48a556e5 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 10:13:37 +0100 Subject: [PATCH 083/200] verify and deploy separated to not run deploy if verify is unsuccessful --- .github/workflows/build.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6fe97ec..c3fc409 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,12 +56,15 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - - name: Maven deploy snapshot and run Sonar - run: mvn deploy sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + - name: Maven verify and sonar + run: mvn verify sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + - name: Maven deploy snapshot + run: mvn deploy -DskipTests + env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - From b2abf7d5a1ab03620c35d3626611abf424a797e3 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 10:30:46 +0100 Subject: [PATCH 084/200] Fixed wrong expression --- src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java | 5 ++--- src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java index 51f6f0f..d8f7a5d 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java @@ -172,12 +172,11 @@ public void execute() throws MojoExecutionException { if (StringUtils.isNotBlank(excludeObject)) { runner.excludeObject(excludeObject); } - { + if (StringUtils.isNotBlank(includeObject)) { runner.includeObject(includeObject); } - if (StringUtils.isNotBlank(includeObject)) - runner.run(connection); + runner.run(connection); } catch (SomeTestsFailedException e) { if (!this.ignoreFailure) { diff --git a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java index 3bd78e9..6ed11b3 100644 --- a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java +++ b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java @@ -108,7 +108,7 @@ private void writeReports(Connection connection, Reporter reporter, ReporterPara buffer.printAvailable(connection, printStreams); } catch (FileNotFoundException | SQLException e) { - throw new MojoExecutionException("Unexpected error opening file output ", e); + throw new MojoExecutionException(e.getMessage(), e); } finally { if (fileOutputStream != null) { try { From 28038074a8e9a7416caf2de160c51a2b79404829 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 10:44:19 +0100 Subject: [PATCH 085/200] Added UtPlsqlMojoIT --- pom.xml | 2 +- .../{UtPLSQLMojo.java => UtPlsqlMojo.java} | 62 ++++++++----------- .../utplsql/maven/plugin/MojoRuleTest.java | 21 +++---- .../utplsql/maven/plugin/UtPlsqlMojoIT.java | 20 ++++++ 4 files changed, 57 insertions(+), 48 deletions(-) rename src/main/java/org/utplsql/maven/plugin/{UtPLSQLMojo.java => UtPlsqlMojo.java} (86%) create mode 100644 src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java diff --git a/pom.xml b/pom.xml index 42ffb07..bb4c05e 100644 --- a/pom.xml +++ b/pom.xml @@ -54,8 +54,8 @@ 1.8 UTF-8 3.5.2 - 2.0.9 2.3.1 + 2.0.9 utplsql https://sonarcloud.io diff --git a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java similarity index 86% rename from src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java rename to src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java index d8f7a5d..6b80d3c 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java @@ -22,10 +22,10 @@ import org.utplsql.api.reporter.CoreReporters; import org.utplsql.api.reporter.Reporter; import org.utplsql.api.reporter.ReporterFactory; +import org.utplsql.maven.plugin.io.ReportWriter; +import org.utplsql.maven.plugin.io.SqlFileScanner; import org.utplsql.maven.plugin.model.CustomTypeMapping; import org.utplsql.maven.plugin.model.ReporterParameter; -import org.utplsql.maven.plugin.io.SqlFileScanner; -import org.utplsql.maven.plugin.io.ReportWriter; import java.io.File; import java.sql.Connection; @@ -44,7 +44,7 @@ * @author Simon Martinelli */ @Mojo(name = "test", defaultPhase = LifecyclePhase.TEST) -public class UtPLSQLMojo extends AbstractMojo { +public class UtPlsqlMojo extends AbstractMojo { @Parameter(readonly = true, defaultValue = "${project}") MavenProject project; @@ -212,46 +212,36 @@ private void setDbConfiguration() { } } - FileMapperOptions buildSourcesOptions() throws MojoExecutionException { - try { - if (sources.isEmpty()) { - File defaultSourceDirectory = new File(project.getBasedir(), Defaults.SOURCE_DIRECTORY); - if (defaultSourceDirectory.exists()) { - sources.add(Defaults.buildDefaultSource()); - } else { - return new FileMapperOptions(new ArrayList<>()); - } + FileMapperOptions buildSourcesOptions() { + if (sources.isEmpty()) { + File defaultSourceDirectory = new File(project.getBasedir(), Defaults.SOURCE_DIRECTORY); + if (defaultSourceDirectory.exists()) { + sources.add(Defaults.buildDefaultSource()); + } else { + return new FileMapperOptions(new ArrayList<>()); } - - List scripts = sqlFileScanner.findSqlScripts(project.getBasedir(), sources, - Defaults.SOURCE_DIRECTORY, Defaults.SOURCE_FILE_PATTERN); - return createFileMapperOptions(scripts, sourcesOwner, sourcesRegexExpression, sourcesOwnerSubexpression, - sourcesNameSubexpression, sourcesTypeSubexpression, sourcesCustomTypeMapping); - - } catch (Exception e) { - throw new MojoExecutionException("Invalid in your pom.xml", e); } + + List scripts = sqlFileScanner.findSqlScripts(project.getBasedir(), sources, + Defaults.SOURCE_DIRECTORY, Defaults.SOURCE_FILE_PATTERN); + return createFileMapperOptions(scripts, sourcesOwner, sourcesRegexExpression, sourcesOwnerSubexpression, + sourcesNameSubexpression, sourcesTypeSubexpression, sourcesCustomTypeMapping); } FileMapperOptions buildTestsOptions() throws MojoExecutionException { - try { - if (tests.isEmpty()) { - File defaultTestDirectory = new File(project.getBasedir(), Defaults.TEST_DIRECTORY); - if (defaultTestDirectory.exists()) { - tests.add(Defaults.buildDefaultTest()); - } else { - return new FileMapperOptions(new ArrayList<>()); - } + if (tests.isEmpty()) { + File defaultTestDirectory = new File(project.getBasedir(), Defaults.TEST_DIRECTORY); + if (defaultTestDirectory.exists()) { + tests.add(Defaults.buildDefaultTest()); + } else { + return new FileMapperOptions(new ArrayList<>()); } - - List scripts = sqlFileScanner.findSqlScripts(project.getBasedir(), tests, Defaults.TEST_DIRECTORY, - Defaults.TEST_FILE_PATTERN); - return createFileMapperOptions(scripts, testsOwner, testsRegexExpression, testsOwnerSubexpression, - testsNameSubexpression, testsTypeSubexpression, testsCustomTypeMapping); - - } catch (Exception e) { - throw new MojoExecutionException("Invalid in your pom.xml: " + e.getMessage()); } + + List scripts = sqlFileScanner.findSqlScripts(project.getBasedir(), tests, Defaults.TEST_DIRECTORY, + Defaults.TEST_FILE_PATTERN); + return createFileMapperOptions(scripts, testsOwner, testsRegexExpression, testsOwnerSubexpression, + testsNameSubexpression, testsTypeSubexpression, testsCustomTypeMapping); } private FileMapperOptions createFileMapperOptions(List scripts, String objectOwner, String regexPattern, diff --git a/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java b/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java index eeada1b..3766dbb 100644 --- a/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java +++ b/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java @@ -72,7 +72,7 @@ public void setUp() throws Exception { */ @Test public void invalidSourcesDirectory() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-sources-directories/"), "test"); assertNotNull(utplsqlMojo); @@ -90,7 +90,7 @@ public void invalidSourcesDirectory() throws Exception { */ @Test public void invalidTestsDirectory() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-tests-sources-directories/"), "test"); assertNotNull(utplsqlMojo); @@ -108,11 +108,10 @@ public void invalidTestsDirectory() throws Exception { */ @Test public void sourcesTestsParameters() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-sources-tests-params/"), "test"); assertNotNull(utplsqlMojo); - // TODO : move to another test about reporters assertEquals(2, utplsqlMojo.reporters.size()); // check sources @@ -152,7 +151,7 @@ public void sourcesTestsParameters() throws Exception { */ @Test public void sourcesAndTestsParameterDoesNotExist() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule.lookupConfiguredMojo( + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule.lookupConfiguredMojo( new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/"), "test"); assertNotNull(utplsqlMojo); @@ -174,7 +173,7 @@ public void sourcesAndTestsParameterDoesNotExist() throws Exception { */ @Test public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/"), "test"); assertNotNull(utplsqlMojo); @@ -200,7 +199,7 @@ public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() thro */ @Test public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/"), "test"); assertNotNull(utplsqlMojo); @@ -227,7 +226,7 @@ public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { */ @Test public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/"), "test"); assertNotNull(utplsqlMojo); @@ -249,7 +248,7 @@ public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { */ @Test public void defaultConsoleBehaviour() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-console-output-behaviour/"), "test"); assertNotNull(utplsqlMojo); @@ -297,7 +296,7 @@ public void defaultConsoleBehaviour() throws Exception { */ @Test public void addDefaultReporter() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-console-output-behaviour/"), "test"); assertNotNull(utplsqlMojo); @@ -325,7 +324,7 @@ public void addDefaultReporter() throws Exception { */ @Test public void skipUtplsqlTests() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/skip-utplsql-tests/"), "test"); assertNotNull(utplsqlMojo); diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java new file mode 100644 index 0000000..154c7fc --- /dev/null +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java @@ -0,0 +1,20 @@ +package org.utplsql.maven.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.project.MavenProject; +import org.junit.Test; +import org.mockito.Mock; + +public class UtPlsqlMojoIT { + + @Test + public void execute() throws MojoExecutionException { + UtPlsqlMojo utPLSQLMojo = new UtPlsqlMojo(); + utPLSQLMojo.project = new MavenProject(); + utPLSQLMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; + utPLSQLMojo.user = "UT3"; + utPLSQLMojo.password = "UT3"; + + utPLSQLMojo.execute(); + } +} From c705aa3dccdd9b997b77cf71a15bdb42a27de0fa Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 11:07:49 +0100 Subject: [PATCH 086/200] Improved error message --- src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java | 2 +- .../java/org/utplsql/maven/plugin/io/SqlFileScanner.java | 7 ++++--- src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java index 6b80d3c..0307b6a 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java @@ -212,7 +212,7 @@ private void setDbConfiguration() { } } - FileMapperOptions buildSourcesOptions() { + FileMapperOptions buildSourcesOptions() throws MojoExecutionException { if (sources.isEmpty()) { File defaultSourceDirectory = new File(project.getBasedir(), Defaults.SOURCE_DIRECTORY); if (defaultSourceDirectory.exists()) { diff --git a/src/main/java/org/utplsql/maven/plugin/io/SqlFileScanner.java b/src/main/java/org/utplsql/maven/plugin/io/SqlFileScanner.java index 7178d1a..eda305a 100644 --- a/src/main/java/org/utplsql/maven/plugin/io/SqlFileScanner.java +++ b/src/main/java/org/utplsql/maven/plugin/io/SqlFileScanner.java @@ -1,6 +1,7 @@ package org.utplsql.maven.plugin.io; import org.apache.maven.model.Resource; +import org.apache.maven.plugin.MojoExecutionException; import org.codehaus.plexus.util.DirectoryScanner; import java.io.File; @@ -27,7 +28,7 @@ public class SqlFileScanner { * @param defaultFilePattern the default file pattern * @return a list of the files found */ - public List findSqlScripts(File baseDir, List resources, String defaultDirectory, String defaultFilePattern) { + public List findSqlScripts(File baseDir, List resources, String defaultDirectory, String defaultFilePattern) throws MojoExecutionException { List founds = new ArrayList<>(); for (Resource resource : resources) { @@ -51,10 +52,10 @@ public List findSqlScripts(File baseDir, List resources, Strin return founds; } - private DirectoryScanner buildScanner(String baseDir, Resource resource) { + private DirectoryScanner buildScanner(String baseDir, Resource resource) throws MojoExecutionException { File fileBaseDir = new File(baseDir, resource.getDirectory()); if (!fileBaseDir.exists() || !fileBaseDir.isDirectory() || !fileBaseDir.canRead()) { - throw new IllegalArgumentException(format("Invalid %s in resource. Check your pom.xml", resource.getDirectory())); + throw new MojoExecutionException(format("Directory %s does not exist!", resource.getDirectory())); } DirectoryScanner scanner = new DirectoryScanner(); diff --git a/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java b/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java index 3766dbb..902f8ff 100644 --- a/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java +++ b/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java @@ -78,7 +78,7 @@ public void invalidSourcesDirectory() throws Exception { MojoExecutionException exception = assertThrows(MojoExecutionException.class, utplsqlMojo::execute); - assertEquals("Invalid in your pom.xml", exception.getMessage()); + assertEquals("Directory foo does not exist!", exception.getMessage()); } /** @@ -96,7 +96,7 @@ public void invalidTestsDirectory() throws Exception { MojoExecutionException exception = assertThrows(MojoExecutionException.class, utplsqlMojo::execute); - assertEquals("Invalid in your pom.xml: Invalid bar in resource. Check your pom.xml", exception.getMessage()); + assertEquals("Directory bar does not exist!", exception.getMessage()); } /** From 0d9171a1eda0b0373c72f5fd97a4dd6b59128f98 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 11:16:02 +0100 Subject: [PATCH 087/200] Rename --- .../java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java index 154c7fc..8e215ce 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java @@ -9,12 +9,12 @@ public class UtPlsqlMojoIT { @Test public void execute() throws MojoExecutionException { - UtPlsqlMojo utPLSQLMojo = new UtPlsqlMojo(); - utPLSQLMojo.project = new MavenProject(); - utPLSQLMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; - utPLSQLMojo.user = "UT3"; - utPLSQLMojo.password = "UT3"; + UtPlsqlMojo utPlsqlMojo = new UtPlsqlMojo(); + utPlsqlMojo.project = new MavenProject(); + utPlsqlMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; + utPlsqlMojo.user = "UT3"; + utPlsqlMojo.password = "UT3"; - utPLSQLMojo.execute(); + utPlsqlMojo.execute(); } } From 51f8ce6b8e3bb66330a9f50f9d15cf6b83ba305c Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 11:17:22 +0100 Subject: [PATCH 088/200] Renamed to uppercase --- .../{UtPlsqlMojo.java => UtPLSQLMojo.java} | 2 +- .../utplsql/maven/plugin/MojoRuleTest.java | 20 +++++++++---------- ...{UtPlsqlMojoIT.java => UtPLSQLMojoIT.java} | 5 ++--- 3 files changed, 13 insertions(+), 14 deletions(-) rename src/main/java/org/utplsql/maven/plugin/{UtPlsqlMojo.java => UtPLSQLMojo.java} (99%) rename src/test/java/org/utplsql/maven/plugin/{UtPlsqlMojoIT.java => UtPLSQLMojoIT.java} (80%) diff --git a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java similarity index 99% rename from src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java rename to src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java index 0307b6a..a0d8c02 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java @@ -44,7 +44,7 @@ * @author Simon Martinelli */ @Mojo(name = "test", defaultPhase = LifecyclePhase.TEST) -public class UtPlsqlMojo extends AbstractMojo { +public class UtPLSQLMojo extends AbstractMojo { @Parameter(readonly = true, defaultValue = "${project}") MavenProject project; diff --git a/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java b/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java index 902f8ff..0ddcf2a 100644 --- a/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java +++ b/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java @@ -72,7 +72,7 @@ public void setUp() throws Exception { */ @Test public void invalidSourcesDirectory() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-sources-directories/"), "test"); assertNotNull(utplsqlMojo); @@ -90,7 +90,7 @@ public void invalidSourcesDirectory() throws Exception { */ @Test public void invalidTestsDirectory() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-tests-sources-directories/"), "test"); assertNotNull(utplsqlMojo); @@ -108,7 +108,7 @@ public void invalidTestsDirectory() throws Exception { */ @Test public void sourcesTestsParameters() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-sources-tests-params/"), "test"); assertNotNull(utplsqlMojo); @@ -151,7 +151,7 @@ public void sourcesTestsParameters() throws Exception { */ @Test public void sourcesAndTestsParameterDoesNotExist() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule.lookupConfiguredMojo( + UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule.lookupConfiguredMojo( new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/"), "test"); assertNotNull(utplsqlMojo); @@ -173,7 +173,7 @@ public void sourcesAndTestsParameterDoesNotExist() throws Exception { */ @Test public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/"), "test"); assertNotNull(utplsqlMojo); @@ -199,7 +199,7 @@ public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() thro */ @Test public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/"), "test"); assertNotNull(utplsqlMojo); @@ -226,7 +226,7 @@ public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { */ @Test public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/"), "test"); assertNotNull(utplsqlMojo); @@ -248,7 +248,7 @@ public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { */ @Test public void defaultConsoleBehaviour() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-console-output-behaviour/"), "test"); assertNotNull(utplsqlMojo); @@ -296,7 +296,7 @@ public void defaultConsoleBehaviour() throws Exception { */ @Test public void addDefaultReporter() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-console-output-behaviour/"), "test"); assertNotNull(utplsqlMojo); @@ -324,7 +324,7 @@ public void addDefaultReporter() throws Exception { */ @Test public void skipUtplsqlTests() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/skip-utplsql-tests/"), "test"); assertNotNull(utplsqlMojo); diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java similarity index 80% rename from src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java rename to src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java index 8e215ce..e0e3f20 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java @@ -3,13 +3,12 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.junit.Test; -import org.mockito.Mock; -public class UtPlsqlMojoIT { +public class UtPLSQLMojoIT { @Test public void execute() throws MojoExecutionException { - UtPlsqlMojo utPlsqlMojo = new UtPlsqlMojo(); + UtPLSQLMojo utPlsqlMojo = new UtPLSQLMojo(); utPlsqlMojo.project = new MavenProject(); utPlsqlMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; utPlsqlMojo.user = "UT3"; From 6f074652cb6eee4eb8d029d6472e700bcc22d736 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 11:30:55 +0100 Subject: [PATCH 089/200] Rename --- .../java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java index e0e3f20..885f39c 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java @@ -8,12 +8,12 @@ public class UtPLSQLMojoIT { @Test public void execute() throws MojoExecutionException { - UtPLSQLMojo utPlsqlMojo = new UtPLSQLMojo(); - utPlsqlMojo.project = new MavenProject(); - utPlsqlMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; - utPlsqlMojo.user = "UT3"; - utPlsqlMojo.password = "UT3"; + UtPLSQLMojo utPLSQLMojo = new UtPLSQLMojo(); + utPLSQLMojo.project = new MavenProject(); + utPLSQLMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; + utPLSQLMojo.user = "UT3"; + utPLSQLMojo.password = "UT3"; - utPlsqlMojo.execute(); + utPLSQLMojo.execute(); } } From a973c026539a608cde3af73c5cc8edb3d2df9b2b Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 11:31:21 +0100 Subject: [PATCH 090/200] added clean --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c3fc409..de4caff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,7 +57,7 @@ jobs: ${{ runner.os }}-maven- - name: Maven verify and sonar - run: mvn verify sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + run: mvn clean verify sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 389b0b2..725f974 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,7 @@ jobs: ${{ runner.os }}-maven- - name: Maven deploy release - run: mvn deploy -Prelease + run: mvn clean deploy -Prelease env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} From 516d26f2f1e82cebcb2abae585f5d5aaf53af542 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 11:37:13 +0100 Subject: [PATCH 091/200] Removed IT --- .../utplsql/maven/plugin/UtPLSQLMojoIT.java | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java deleted file mode 100644 index 885f39c..0000000 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.utplsql.maven.plugin; - -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.project.MavenProject; -import org.junit.Test; - -public class UtPLSQLMojoIT { - - @Test - public void execute() throws MojoExecutionException { - UtPLSQLMojo utPLSQLMojo = new UtPLSQLMojo(); - utPLSQLMojo.project = new MavenProject(); - utPLSQLMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; - utPLSQLMojo.user = "UT3"; - utPLSQLMojo.password = "UT3"; - - utPLSQLMojo.execute(); - } -} From 2fefc10bec0779271486cdc337485759e39d7d14 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 11:38:33 +0100 Subject: [PATCH 092/200] Readded IT --- .../utplsql/maven/plugin/UtPLSQLMojoIT.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java new file mode 100644 index 0000000..885f39c --- /dev/null +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java @@ -0,0 +1,19 @@ +package org.utplsql.maven.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.project.MavenProject; +import org.junit.Test; + +public class UtPLSQLMojoIT { + + @Test + public void execute() throws MojoExecutionException { + UtPLSQLMojo utPLSQLMojo = new UtPLSQLMojo(); + utPLSQLMojo.project = new MavenProject(); + utPLSQLMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; + utPLSQLMojo.user = "UT3"; + utPLSQLMojo.password = "UT3"; + + utPLSQLMojo.execute(); + } +} From 3ea6c06a9d047366e0d9934e42bb5f574977bfe2 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 11:50:47 +0100 Subject: [PATCH 093/200] Test instead of IT --- .../maven/plugin/{UtPLSQLMojoIT.java => UtPLSQLMojoTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/test/java/org/utplsql/maven/plugin/{UtPLSQLMojoIT.java => UtPLSQLMojoTest.java} (94%) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java similarity index 94% rename from src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java rename to src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java index 885f39c..0969db5 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java @@ -4,7 +4,7 @@ import org.apache.maven.project.MavenProject; import org.junit.Test; -public class UtPLSQLMojoIT { +public class UtPLSQLMojoTest { @Test public void execute() throws MojoExecutionException { From 260603cb77c60c27db14699e17f73aa54fc4a578 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 11:55:58 +0100 Subject: [PATCH 094/200] Back to IT --- .../maven/plugin/{UtPLSQLMojoTest.java => UtPLSQLMojoIT.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/test/java/org/utplsql/maven/plugin/{UtPLSQLMojoTest.java => UtPLSQLMojoIT.java} (94%) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java similarity index 94% rename from src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java rename to src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java index 0969db5..885f39c 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java @@ -4,7 +4,7 @@ import org.apache.maven.project.MavenProject; import org.junit.Test; -public class UtPLSQLMojoTest { +public class UtPLSQLMojoIT { @Test public void execute() throws MojoExecutionException { From 4df068f6c96098c2e5d3a3f155730c04bc2c337e Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 13:05:56 +0100 Subject: [PATCH 095/200] Added file reporter --- .../{UtPLSQLMojoIT.java => UtPLSQLMojoTest.java} | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) rename src/test/java/org/utplsql/maven/plugin/{UtPLSQLMojoIT.java => UtPLSQLMojoTest.java} (51%) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java similarity index 51% rename from src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java rename to src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java index 885f39c..6d46d39 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java @@ -3,17 +3,27 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.junit.Test; +import org.utplsql.api.reporter.CoreReporters; +import org.utplsql.maven.plugin.model.ReporterParameter; -public class UtPLSQLMojoIT { +public class UtPLSQLMojoTest { @Test public void execute() throws MojoExecutionException { UtPLSQLMojo utPLSQLMojo = new UtPLSQLMojo(); utPLSQLMojo.project = new MavenProject(); + utPLSQLMojo.targetDir = "target"; + utPLSQLMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; utPLSQLMojo.user = "UT3"; utPLSQLMojo.password = "UT3"; + ReporterParameter junitReporter = new ReporterParameter(); + junitReporter.setConsoleOutput(true); + junitReporter.setFileOutput("junit-report.xml"); + junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); + utPLSQLMojo.reporters.add(junitReporter); + utPLSQLMojo.execute(); } } From e13c1925a16a046e1f8534a8b96cde1c5c192266 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 13:09:40 +0100 Subject: [PATCH 096/200] Added assertion --- .../utplsql/maven/plugin/UtPLSQLMojoTest.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java index 6d46d39..1820685 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java @@ -2,22 +2,32 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; +import org.junit.BeforeClass; import org.junit.Test; import org.utplsql.api.reporter.CoreReporters; import org.utplsql.maven.plugin.model.ReporterParameter; +import java.io.File; + +import static org.junit.Assert.assertTrue; + public class UtPLSQLMojoTest { - @Test - public void execute() throws MojoExecutionException { - UtPLSQLMojo utPLSQLMojo = new UtPLSQLMojo(); + private static UtPLSQLMojo utPLSQLMojo; + + @BeforeClass + public static void setUp() { + utPLSQLMojo = new UtPLSQLMojo(); utPLSQLMojo.project = new MavenProject(); utPLSQLMojo.targetDir = "target"; utPLSQLMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; utPLSQLMojo.user = "UT3"; utPLSQLMojo.password = "UT3"; + } + @Test + public void junitReporter() throws MojoExecutionException { ReporterParameter junitReporter = new ReporterParameter(); junitReporter.setConsoleOutput(true); junitReporter.setFileOutput("junit-report.xml"); @@ -25,5 +35,7 @@ public void execute() throws MojoExecutionException { utPLSQLMojo.reporters.add(junitReporter); utPLSQLMojo.execute(); + + assertTrue(new File("target/junit-report.xml").exists()); } } From 0c36e59a8cb3e5f71444d175fa07d4c99d486ea1 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 13:30:37 +0100 Subject: [PATCH 097/200] Added absolut path test --- .../utplsql/maven/plugin/io/ReportWriter.java | 2 +- .../utplsql/maven/plugin/UtPLSQLMojoTest.java | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java index 6ed11b3..a44aa30 100644 --- a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java +++ b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java @@ -114,7 +114,7 @@ private void writeReports(Connection connection, Reporter reporter, ReporterPara try { fileOutputStream.close(); } catch (IOException e) { - log.info(format("Failed to closing the report %s", reporterParameter.getClass())); + log.error(format("Couldn't close the output stream %s", reporterParameter.getClass())); } } } diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java index 1820685..4536f4f 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java @@ -38,4 +38,39 @@ public void junitReporter() throws MojoExecutionException { assertTrue(new File("target/junit-report.xml").exists()); } + + @Test + public void absolutPath() throws MojoExecutionException { + ReporterParameter junitReporter = new ReporterParameter(); + junitReporter.setConsoleOutput(true); + + String os = System.getProperty("os.name"); + if (os.contains("Windows")) { + junitReporter.setFileOutput("c:/tmp/junit-report.xml"); + } else { + junitReporter.setFileOutput("/tmp/junit-report.xml"); + } + junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); + utPLSQLMojo.reporters.add(junitReporter); + + utPLSQLMojo.execute(); + if (os.contains("Windows")) { + assertTrue(new File("c:/tmp/junit-report.xml").exists()); + } else { + assertTrue(new File("/tmp/junit-report.xml").exists()); + } + } + + @Test + public void parentDoesNotExist() throws MojoExecutionException { + ReporterParameter junitReporter = new ReporterParameter(); + junitReporter.setConsoleOutput(true); + junitReporter.setFileOutput("not-exist/junit-report.xml"); + junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); + utPLSQLMojo.reporters.add(junitReporter); + + utPLSQLMojo.execute(); + + assertTrue(new File("target/not-exist/junit-report.xml").exists()); + } } From bd7798c9a211823f8e7d8f72db16396055e22835 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 13:39:10 +0100 Subject: [PATCH 098/200] Renamed test --- ...SQLMojoTest.java => ReportWriterTest.java} | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) rename src/test/java/org/utplsql/maven/plugin/{UtPLSQLMojoTest.java => ReportWriterTest.java} (72%) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java b/src/test/java/org/utplsql/maven/plugin/ReportWriterTest.java similarity index 72% rename from src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java rename to src/test/java/org/utplsql/maven/plugin/ReportWriterTest.java index 4536f4f..c106e4c 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPLSQLMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/ReportWriterTest.java @@ -11,7 +11,7 @@ import static org.junit.Assert.assertTrue; -public class UtPLSQLMojoTest { +public class ReportWriterTest { private static UtPLSQLMojo utPLSQLMojo; @@ -73,4 +73,30 @@ public void parentDoesNotExist() throws MojoExecutionException { assertTrue(new File("target/not-exist/junit-report.xml").exists()); } + + @Test + public void onlyConsoleOutput() throws MojoExecutionException { + ReporterParameter junitReporter = new ReporterParameter(); + junitReporter.setConsoleOutput(true); + junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); + utPLSQLMojo.reporters.add(junitReporter); + + utPLSQLMojo.execute(); + + assertTrue(new File("target/not-exist/junit-report.xml").exists()); + } + + @Test + public void onlyFileOutput() throws MojoExecutionException { + ReporterParameter junitReporter = new ReporterParameter(); + junitReporter.setConsoleOutput(false); + junitReporter.setFileOutput("not-exist/junit-report.xml"); + junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); + utPLSQLMojo.reporters.add(junitReporter); + + utPLSQLMojo.execute(); + + assertTrue(new File("target/not-exist/junit-report.xml").exists()); + } + } From 578ceec82ea1cbd1d11a72f2bdf6ea862d30ac97 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 14:23:59 +0100 Subject: [PATCH 099/200] Updated tests --- pom.xml | 13 -- .../{UtPLSQLMojo.java => UtPlsqlMojo.java} | 2 +- .../utplsql/maven/plugin/MojoRuleTest.java | 117 ++++-------------- ...rtWriterTest.java => UtPlsqlMojoTest.java} | 6 +- .../default-console-output-behaviour/pom.xml | 32 +---- .../unit-tests/default-reporter/pom.xml | 52 ++++++++ .../invalid-sources-directories/pom.xml | 6 +- .../invalid-tests-sources-directories/pom.xml | 6 +- .../missing-directory/pom.xml | 7 +- .../missing-includes/pom.xml | 7 +- .../unit-tests/skip-utplsql-tests/pom.xml | 6 +- .../directory-does-not-exist/pom.xml | 6 +- .../directory-exists/pom.xml | 7 +- .../test-sources-tests-params/pom.xml | 6 +- 14 files changed, 107 insertions(+), 166 deletions(-) rename src/main/java/org/utplsql/maven/plugin/{UtPLSQLMojo.java => UtPlsqlMojo.java} (99%) rename src/test/java/org/utplsql/maven/plugin/{ReportWriterTest.java => UtPlsqlMojoTest.java} (96%) create mode 100644 src/test/resources/unit-tests/default-reporter/pom.xml diff --git a/pom.xml b/pom.xml index bb4c05e..b7869b7 100644 --- a/pom.xml +++ b/pom.xml @@ -144,19 +144,6 @@ test - - org.powermock - powermock-module-junit4 - ${powermock.version} - test - - - org.powermock - powermock-api-mockito2 - ${powermock.version} - test - - commons-io commons-io diff --git a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java similarity index 99% rename from src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java rename to src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java index a0d8c02..0307b6a 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java @@ -44,7 +44,7 @@ * @author Simon Martinelli */ @Mojo(name = "test", defaultPhase = LifecyclePhase.TEST) -public class UtPLSQLMojo extends AbstractMojo { +public class UtPlsqlMojo extends AbstractMojo { @Parameter(readonly = true, defaultValue = "${project}") MavenProject project; diff --git a/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java b/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java index 0ddcf2a..e1db9c0 100644 --- a/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java +++ b/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java @@ -1,28 +1,15 @@ package org.utplsql.maven.plugin; -import org.apache.commons.lang3.tuple.Pair; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.testing.MojoRule; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import org.utplsql.api.DBHelper; import org.utplsql.api.FileMapperOptions; -import org.utplsql.api.Version; -import org.utplsql.api.reporter.Reporter; -import org.utplsql.api.reporter.ReporterFactory; -import org.utplsql.maven.plugin.io.ReportWriter; import org.utplsql.maven.plugin.model.ReporterParameter; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.PrintStream; -import java.sql.Connection; -import java.util.ArrayList; import java.util.List; import static org.junit.Assert.assertEquals; @@ -30,39 +17,12 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.powermock.api.mockito.PowerMockito.mockStatic; -import static org.powermock.api.mockito.PowerMockito.when; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({DBHelper.class, ReporterFactory.class}) + public class MojoRuleTest { @Rule public final MojoRule rule = new MojoRule(); - @Mock - public Connection mockConnection; - - @Mock - public Version mockVersion; - - @Mock - public ReporterFactory mockReporterFactory; - - @Before - public void setUp() throws Exception { - mockStatic(DBHelper.class); - when(DBHelper.getDatabaseFrameworkVersion(mockConnection)).thenReturn(mockVersion); - - mockStatic(ReporterFactory.class); - when(ReporterFactory.createEmpty()).thenReturn(mockReporterFactory); - } - /** * Invalid Sources Directory *

@@ -72,7 +32,7 @@ public void setUp() throws Exception { */ @Test public void invalidSourcesDirectory() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-sources-directories/"), "test"); assertNotNull(utplsqlMojo); @@ -90,7 +50,7 @@ public void invalidSourcesDirectory() throws Exception { */ @Test public void invalidTestsDirectory() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-tests-sources-directories/"), "test"); assertNotNull(utplsqlMojo); @@ -108,7 +68,7 @@ public void invalidTestsDirectory() throws Exception { */ @Test public void sourcesTestsParameters() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-sources-tests-params/"), "test"); assertNotNull(utplsqlMojo); @@ -151,7 +111,7 @@ public void sourcesTestsParameters() throws Exception { */ @Test public void sourcesAndTestsParameterDoesNotExist() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule.lookupConfiguredMojo( + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule.lookupConfiguredMojo( new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/"), "test"); assertNotNull(utplsqlMojo); @@ -173,7 +133,7 @@ public void sourcesAndTestsParameterDoesNotExist() throws Exception { */ @Test public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/"), "test"); assertNotNull(utplsqlMojo); @@ -199,7 +159,7 @@ public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() thro */ @Test public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/"), "test"); assertNotNull(utplsqlMojo); @@ -226,7 +186,7 @@ public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { */ @Test public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/"), "test"); assertNotNull(utplsqlMojo); @@ -248,75 +208,42 @@ public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { */ @Test public void defaultConsoleBehaviour() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-console-output-behaviour/"), "test"); assertNotNull(utplsqlMojo); - List reporterList = new ArrayList<>(); - when(mockReporterFactory.createReporter(anyString())).thenAnswer(invocation -> { - Reporter mockReporter = mock(Reporter.class); - reporterList.add(mockReporter); - return mockReporter; - }); - - ReportWriter reportWriter = new ReportWriter(utplsqlMojo.targetDir, mockVersion, utplsqlMojo.getLog()); - utplsqlMojo.initReporters(mockConnection, reportWriter, mockReporterFactory); - - // Assert that we called the creation reporter with the correct parameters. - verify(mockReporterFactory, times(2)).createReporter("UT_DOCUMENTATION_REPORTER"); - verify(mockReporterFactory).createReporter("UT_COVERAGE_SONAR_REPORTER"); - verify(mockReporterFactory).createReporter("UT_SONAR_TEST_REPORTER"); - verifyNoMoreInteractions(mockReporterFactory); - - // Assert that all reporters have been initialized. - for (Reporter mockReporter : reporterList) { - verify(mockReporter).init(mockConnection); - verifyNoMoreInteractions(mockReporter); - } + utplsqlMojo.execute(); // Assert that we added only the necessary reporters to the writer. - List> reporters = reportWriter.getReporters(); + List reporters = utplsqlMojo.reporters; assertEquals(3, reporters.size()); - ReporterParameter reporterParameter1 = reporters.get(0).getRight(); + ReporterParameter reporterParameter1 = reporters.get(0); assertTrue(reporterParameter1.isConsoleOutput()); assertFalse(reporterParameter1.isFileOutput()); - ReporterParameter reporterParameter2 = reporters.get(1).getRight(); + ReporterParameter reporterParameter2 = reporters.get(1); assertFalse(reporterParameter2.isConsoleOutput()); assertTrue(reporterParameter2.isFileOutput()); - ReporterParameter reporterParameter3 = reporters.get(2).getRight(); + ReporterParameter reporterParameter3 = reporters.get(2); assertTrue(reporterParameter3.isConsoleOutput()); assertTrue(reporterParameter3.isFileOutput()); } /** - * Add Default Reporter + * Default Reporter */ @Test - public void addDefaultReporter() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-console-output-behaviour/"), "test"); + public void defaultReporter() throws Exception { + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-reporter/"), "test"); assertNotNull(utplsqlMojo); - List reporterList = new ArrayList<>(); - when(mockReporterFactory.createReporter(anyString())).thenAnswer(invocation -> { - Reporter mockReporter = mock(Reporter.class); - when(mockReporter.getTypeName()).thenReturn(invocation.getArgument(0)); - reporterList.add(mockReporter); - return mockReporter; - }); - - List reporterParameters = utplsqlMojo.reporters; - reporterParameters.clear(); - - ReportWriter reportWriter = new ReportWriter(utplsqlMojo.targetDir, mockVersion, utplsqlMojo.getLog()); - utplsqlMojo.initReporters(mockConnection, reportWriter, mockReporterFactory); + utplsqlMojo.execute(); - assertEquals(1, reporterList.size()); - assertEquals("UT_DOCUMENTATION_REPORTER", reporterList.get(0).getTypeName()); - verify(reporterList.get(0)).init(mockConnection); + assertEquals(1, utplsqlMojo.reporters.size()); + assertEquals("UT_DOCUMENTATION_REPORTER", utplsqlMojo.reporters.get(0).getName()); } /** @@ -324,7 +251,7 @@ public void addDefaultReporter() throws Exception { */ @Test public void skipUtplsqlTests() throws Exception { - UtPLSQLMojo utplsqlMojo = (UtPLSQLMojo) rule + UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/skip-utplsql-tests/"), "test"); assertNotNull(utplsqlMojo); diff --git a/src/test/java/org/utplsql/maven/plugin/ReportWriterTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java similarity index 96% rename from src/test/java/org/utplsql/maven/plugin/ReportWriterTest.java rename to src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index c106e4c..e27ef4f 100644 --- a/src/test/java/org/utplsql/maven/plugin/ReportWriterTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -11,13 +11,13 @@ import static org.junit.Assert.assertTrue; -public class ReportWriterTest { +public class UtPlsqlMojoTest { - private static UtPLSQLMojo utPLSQLMojo; + private static UtPlsqlMojo utPLSQLMojo; @BeforeClass public static void setUp() { - utPLSQLMojo = new UtPLSQLMojo(); + utPLSQLMojo = new UtPlsqlMojo(); utPLSQLMojo.project = new MavenProject(); utPLSQLMojo.targetDir = "target"; diff --git a/src/test/resources/unit-tests/default-console-output-behaviour/pom.xml b/src/test/resources/unit-tests/default-console-output-behaviour/pom.xml index 9907d2a..8893527 100644 --- a/src/test/resources/unit-tests/default-console-output-behaviour/pom.xml +++ b/src/test/resources/unit-tests/default-console-output-behaviour/pom.xml @@ -14,9 +14,9 @@ http://utplsql.org - jdbc:oracle:thin:@180.129.3.101:1521:xe - ut3 - XNtxj8eEgA6X6b6f + jdbc:oracle:thin:@127.0.0.1:1521:xe + UT3 + UT3 @@ -37,20 +37,17 @@ false - :plsql + app UT_DOCUMENTATION_REPORTER - - UT_DOCUMENTATION_REPORTER - false - UT_COVERAGE_SONAR_REPORTER coverage-sonar-report.xml + false UT_SONAR_TEST_REPORTER @@ -58,25 +55,6 @@ true - - - - foo - - **/*sql - - - - - - - bar - - **/*.spc - **/*.bdy - - - diff --git a/src/test/resources/unit-tests/default-reporter/pom.xml b/src/test/resources/unit-tests/default-reporter/pom.xml new file mode 100644 index 0000000..bf87881 --- /dev/null +++ b/src/test/resources/unit-tests/default-reporter/pom.xml @@ -0,0 +1,52 @@ + + 4.0.0 + + org.utplsql + utplsql-maven-plugin-test + 3.1.0-SNAPSHOT + + pom + + utplsql-maven-plugin Maven Plugin Test + + http://utplsql.org + + + jdbc:oracle:thin:@127.0.0.1:1521:xe + UT3 + UT3 + + + + + ../../../target/ + + + + org.utplsql + utplsql-maven-plugin + {project.version} + + + test + + + + false + + + app + + + + + UT_DOCUMENTATION_REPORTER + + + + + + + diff --git a/src/test/resources/unit-tests/invalid-sources-directories/pom.xml b/src/test/resources/unit-tests/invalid-sources-directories/pom.xml index 7af279b..cc08c4f 100644 --- a/src/test/resources/unit-tests/invalid-sources-directories/pom.xml +++ b/src/test/resources/unit-tests/invalid-sources-directories/pom.xml @@ -14,9 +14,9 @@ http://utplsql.org - jdbc:oracle:thin:@180.129.3.101:1521:xe - ut3 - XNtxj8eEgA6X6b6f + jdbc:oracle:thin:@127.0.0.1:1521:xe + UT3 + UT3 diff --git a/src/test/resources/unit-tests/invalid-tests-sources-directories/pom.xml b/src/test/resources/unit-tests/invalid-tests-sources-directories/pom.xml index 1de382b..a595503 100644 --- a/src/test/resources/unit-tests/invalid-tests-sources-directories/pom.xml +++ b/src/test/resources/unit-tests/invalid-tests-sources-directories/pom.xml @@ -14,9 +14,9 @@ http://utplsql.org - jdbc:oracle:thin:@180.129.3.101:1521:xe - ut3 - XNtxj8eEgA6X6b6f + jdbc:oracle:thin:@127.0.0.1:1521:xe + UT3 + UT3 diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/pom.xml b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/pom.xml index 0b6d640..ff0504e 100644 --- a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/pom.xml +++ b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/pom.xml @@ -14,10 +14,9 @@ http://utplsql.org - jdbc:oracle:thin:@180.129.3.101:1521:xe - ut3 - XNtxj8eEgA6X6b6f - / + jdbc:oracle:thin:@127.0.0.1:1521:xe + UT3 + UT3 diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/pom.xml b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/pom.xml index d85eafd..880d589 100644 --- a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/pom.xml +++ b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/pom.xml @@ -14,10 +14,9 @@ http://utplsql.org - jdbc:oracle:thin:@180.129.3.101:1521:xe - ut3 - XNtxj8eEgA6X6b6f - / + jdbc:oracle:thin:@127.0.0.1:1521:xe + UT3 + UT3 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 966539d..9928d09 100644 --- a/src/test/resources/unit-tests/skip-utplsql-tests/pom.xml +++ b/src/test/resources/unit-tests/skip-utplsql-tests/pom.xml @@ -14,9 +14,9 @@ http://utplsql.org - jdbc:oracle:thin:@180.129.3.101:1521:xe - ut3 - XNtxj8eEgA6X6b6f + jdbc:oracle:thin:@127.0.0.1:1521:xe + UT3 + UT3 diff --git a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/pom.xml b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/pom.xml index da6bb30..7d4179f 100644 --- a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/pom.xml +++ b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/pom.xml @@ -14,9 +14,9 @@ http://utplsql.org - jdbc:oracle:thin:@180.129.3.101:1521:xe - ut3 - XNtxj8eEgA6X6b6f + jdbc:oracle:thin:@127.0.0.1:1521:xe + UT3 + UT3 diff --git a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/pom.xml b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/pom.xml index e95ae18..281763f 100644 --- a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/pom.xml +++ b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/pom.xml @@ -14,10 +14,9 @@ http://utplsql.org - jdbc:oracle:thin:@180.129.3.101:1521:xe - ut3 - XNtxj8eEgA6X6b6f - / + jdbc:oracle:thin:@127.0.0.1:1521:xe + UT3 + UT3 diff --git a/src/test/resources/unit-tests/test-sources-tests-params/pom.xml b/src/test/resources/unit-tests/test-sources-tests-params/pom.xml index ef2be8f..dcacf3e 100644 --- a/src/test/resources/unit-tests/test-sources-tests-params/pom.xml +++ b/src/test/resources/unit-tests/test-sources-tests-params/pom.xml @@ -14,9 +14,9 @@ http://utplsql.org - jdbc:oracle:thin:@180.129.3.101:1521:xe - ut3 - XNtxj8eEgA6X6b6f + jdbc:oracle:thin:@127.0.0.1:1521:xe + UT3 + UT3 From 269209032468e1c4bc213e5daeae02631d0340d0 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 14:38:38 +0100 Subject: [PATCH 100/200] Added dbms_output Test --- .../utplsql/maven/plugin/MojoRuleTest.java | 91 +++++++++++-------- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 16 ++++ .../resources/unit-tests/dbms-output/pom.xml | 67 ++++++++++++++ 3 files changed, 135 insertions(+), 39 deletions(-) create mode 100644 src/test/resources/unit-tests/dbms-output/pom.xml diff --git a/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java b/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java index e1db9c0..ea9b96a 100644 --- a/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java +++ b/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java @@ -32,11 +32,11 @@ public class MojoRuleTest { */ @Test public void invalidSourcesDirectory() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-sources-directories/"), "test"); - assertNotNull(utplsqlMojo); + assertNotNull(utPlsqlMojo); - MojoExecutionException exception = assertThrows(MojoExecutionException.class, utplsqlMojo::execute); + MojoExecutionException exception = assertThrows(MojoExecutionException.class, utPlsqlMojo::execute); assertEquals("Directory foo does not exist!", exception.getMessage()); } @@ -50,11 +50,11 @@ public void invalidSourcesDirectory() throws Exception { */ @Test public void invalidTestsDirectory() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-tests-sources-directories/"), "test"); - assertNotNull(utplsqlMojo); + assertNotNull(utPlsqlMojo); - MojoExecutionException exception = assertThrows(MojoExecutionException.class, utplsqlMojo::execute); + MojoExecutionException exception = assertThrows(MojoExecutionException.class, utPlsqlMojo::execute); assertEquals("Directory bar does not exist!", exception.getMessage()); } @@ -68,14 +68,14 @@ public void invalidTestsDirectory() throws Exception { */ @Test public void sourcesTestsParameters() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-sources-tests-params/"), "test"); - assertNotNull(utplsqlMojo); + assertNotNull(utPlsqlMojo); - assertEquals(2, utplsqlMojo.reporters.size()); + assertEquals(2, utPlsqlMojo.reporters.size()); // check sources - FileMapperOptions sources = utplsqlMojo.buildSourcesOptions(); + FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); assertEquals(1, sources.getFilePaths().size()); assertEquals("srcs/foo.sql", sources.getFilePaths().get(0)); assertEquals("code_owner", sources.getObjectOwner()); @@ -88,7 +88,7 @@ public void sourcesTestsParameters() throws Exception { assertEquals("foo", sources.getTypeMappings().get(0).getValue()); // check tests - FileMapperOptions tests = utplsqlMojo.buildTestsOptions(); + 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")); @@ -111,16 +111,16 @@ public void sourcesTestsParameters() throws Exception { */ @Test public void sourcesAndTestsParameterDoesNotExist() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule.lookupConfiguredMojo( + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule.lookupConfiguredMojo( new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/"), "test"); - assertNotNull(utplsqlMojo); + assertNotNull(utPlsqlMojo); // check sources - FileMapperOptions sources = utplsqlMojo.buildSourcesOptions(); + FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); assertEquals(0, sources.getFilePaths().size()); // check tests - FileMapperOptions tests = utplsqlMojo.buildTestsOptions(); + FileMapperOptions tests = utPlsqlMojo.buildTestsOptions(); assertEquals(0, tests.getFilePaths().size()); } @@ -133,18 +133,18 @@ public void sourcesAndTestsParameterDoesNotExist() throws Exception { */ @Test public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/"), "test"); - assertNotNull(utplsqlMojo); + assertNotNull(utPlsqlMojo); // check sources - FileMapperOptions sources = utplsqlMojo.buildSourcesOptions(); + FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); assertEquals(2, sources.getFilePaths().size()); assertTrue(sources.getFilePaths().contains("src/main/plsql/f1.sql")); assertTrue(sources.getFilePaths().contains("src/main/plsql/f2.sql")); // check tests - FileMapperOptions tests = utplsqlMojo.buildTestsOptions(); + FileMapperOptions tests = utPlsqlMojo.buildTestsOptions(); assertEquals(2, tests.getFilePaths().size()); assertTrue(tests.getFilePaths().contains("src/test/plsql/foo/f1.pkg")); assertTrue(tests.getFilePaths().contains("src/test/plsql/f2.pkg")); @@ -159,18 +159,18 @@ public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() thro */ @Test public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/"), "test"); - assertNotNull(utplsqlMojo); + assertNotNull(utPlsqlMojo); // check sources - FileMapperOptions sources = utplsqlMojo.buildSourcesOptions(); + FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); assertEquals(2, sources.getFilePaths().size()); assertTrue(sources.getFilePaths().contains("src/main/plsql/f1.sql")); assertTrue(sources.getFilePaths().contains("src/main/plsql/foo/f2.sql")); // check tests - FileMapperOptions tests = utplsqlMojo.buildTestsOptions(); + FileMapperOptions tests = utPlsqlMojo.buildTestsOptions(); assertEquals(3, tests.getFilePaths().size()); assertTrue(tests.getFilePaths().contains("src/test/plsql/foo/f1.pkg")); assertTrue(tests.getFilePaths().contains("src/test/plsql/f2.pkg")); @@ -186,18 +186,18 @@ public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { */ @Test public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/"), "test"); - assertNotNull(utplsqlMojo); + assertNotNull(utPlsqlMojo); // check sources - FileMapperOptions sources = utplsqlMojo.buildSourcesOptions(); + FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); assertEquals(2, sources.getFilePaths().size()); assertTrue(sources.getFilePaths().contains("src/main/foo/f1.sql")); assertTrue(sources.getFilePaths().contains("src/main/foo/foo/f2.sql")); // check tests - FileMapperOptions tests = utplsqlMojo.buildTestsOptions(); + FileMapperOptions tests = utPlsqlMojo.buildTestsOptions(); assertEquals(2, tests.getFilePaths().size()); assertTrue(tests.getFilePaths().contains("src/test/bar/foo/f1.pkg")); assertTrue(tests.getFilePaths().contains("src/test/bar/f2.pkg")); @@ -208,14 +208,14 @@ public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { */ @Test public void defaultConsoleBehaviour() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-console-output-behaviour/"), "test"); - assertNotNull(utplsqlMojo); + assertNotNull(utPlsqlMojo); - utplsqlMojo.execute(); + utPlsqlMojo.execute(); // Assert that we added only the necessary reporters to the writer. - List reporters = utplsqlMojo.reporters; + List reporters = utPlsqlMojo.reporters; assertEquals(3, reporters.size()); ReporterParameter reporterParameter1 = reporters.get(0); @@ -236,14 +236,14 @@ public void defaultConsoleBehaviour() throws Exception { */ @Test public void defaultReporter() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-reporter/"), "test"); - assertNotNull(utplsqlMojo); + assertNotNull(utPlsqlMojo); - utplsqlMojo.execute(); + utPlsqlMojo.execute(); - assertEquals(1, utplsqlMojo.reporters.size()); - assertEquals("UT_DOCUMENTATION_REPORTER", utplsqlMojo.reporters.get(0).getName()); + assertEquals(1, utPlsqlMojo.reporters.size()); + assertEquals("UT_DOCUMENTATION_REPORTER", utPlsqlMojo.reporters.get(0).getName()); } /** @@ -251,17 +251,30 @@ public void defaultReporter() throws Exception { */ @Test public void skipUtplsqlTests() throws Exception { - UtPlsqlMojo utplsqlMojo = (UtPlsqlMojo) rule + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule .lookupConfiguredMojo(new File("src/test/resources/unit-tests/skip-utplsql-tests/"), "test"); - assertNotNull(utplsqlMojo); + assertNotNull(utPlsqlMojo); final ByteArrayOutputStream console = new ByteArrayOutputStream(); System.setOut(new PrintStream(console)); - utplsqlMojo.execute(); + utPlsqlMojo.execute(); String standardOutput = console.toString(); assertTrue(standardOutput.contains("utPLSQLTests are skipped.")); } + + /** + * DBMS_OUTPUT + */ + @Test + public void dbmsOutput() throws Exception { + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/dbms-output/"), "test"); + assertNotNull(utPlsqlMojo); + + utPlsqlMojo.execute(); + } + } diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index e27ef4f..5550a07 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -7,7 +7,9 @@ import org.utplsql.api.reporter.CoreReporters; import org.utplsql.maven.plugin.model.ReporterParameter; +import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.PrintStream; import static org.junit.Assert.assertTrue; @@ -99,4 +101,18 @@ public void onlyFileOutput() throws MojoExecutionException { assertTrue(new File("target/not-exist/junit-report.xml").exists()); } + @Test + public void skipUtplsqlTests() throws MojoExecutionException { + utPLSQLMojo.skipUtplsqlTests = true; + + final ByteArrayOutputStream console = new ByteArrayOutputStream(); + System.setOut(new PrintStream(console)); + + utPLSQLMojo.execute(); + + String standardOutput = console.toString(); + + assertTrue(standardOutput.contains("utPLSQLTests are skipped.")); + } + } diff --git a/src/test/resources/unit-tests/dbms-output/pom.xml b/src/test/resources/unit-tests/dbms-output/pom.xml new file mode 100644 index 0000000..1686790 --- /dev/null +++ b/src/test/resources/unit-tests/dbms-output/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + org.utplsql + utplsql-maven-plugin-test + 3.1.0-SNAPSHOT + + pom + + utplsql-maven-plugin Maven Plugin Test + + http://utplsql.org + + + jdbc:oracle:thin:@127.0.0.1:1521:xe + UT3 + UT3 + + + + + ../../../target/ + + + + org.utplsql + utplsql-maven-plugin + {project.version} + + + test + + + + true + + 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 4fb9b29c9d58dc7728b695d15532b9400ff668be Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 14:57:28 +0100 Subject: [PATCH 101/200] Added default report test --- .../org/utplsql/maven/plugin/UtPlsqlMojoTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 5550a07..72df083 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -115,4 +115,18 @@ public void skipUtplsqlTests() throws MojoExecutionException { assertTrue(standardOutput.contains("utPLSQLTests are skipped.")); } + @Test + public void defaultReport() throws MojoExecutionException { + utPLSQLMojo.execute(); + + final ByteArrayOutputStream console = new ByteArrayOutputStream(); + System.setOut(new PrintStream(console)); + + utPLSQLMojo.execute(); + + String standardOutput = console.toString(); + + assertTrue(standardOutput.contains("Finished")); + } + } From 7206ec8daf765e8c576759420e91ba61bc1621c5 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 15:02:22 +0100 Subject: [PATCH 102/200] Added default report test --- src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 72df083..024566a 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -117,8 +117,6 @@ public void skipUtplsqlTests() throws MojoExecutionException { @Test public void defaultReport() throws MojoExecutionException { - utPLSQLMojo.execute(); - final ByteArrayOutputStream console = new ByteArrayOutputStream(); System.setOut(new PrintStream(console)); From 101c7bef9d4086ef0f52edcab7f11437faff3808 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 15:05:59 +0100 Subject: [PATCH 103/200] Added default report test --- .../java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 024566a..3847ebd 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -117,14 +117,7 @@ public void skipUtplsqlTests() throws MojoExecutionException { @Test public void defaultReport() throws MojoExecutionException { - final ByteArrayOutputStream console = new ByteArrayOutputStream(); - System.setOut(new PrintStream(console)); - utPLSQLMojo.execute(); - - String standardOutput = console.toString(); - - assertTrue(standardOutput.contains("Finished")); } } From aeab5c68a8f3cb93011e8cce867bad56267ed625 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 15:11:10 +0100 Subject: [PATCH 104/200] Removed unused method --- src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java index a44aa30..ecdfaa0 100644 --- a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java +++ b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java @@ -73,10 +73,6 @@ public void writeReports(Connection connection) throws MojoExecutionException { } } - public List> getReporters() { - return reporters; - } - private void writeReports(Connection connection, Reporter reporter, ReporterParameter reporterParameter) throws MojoExecutionException { FileOutputStream fileOutputStream = null; try { From b93daedd8289521b2561ad097c255a7d611ef79c Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 15:17:43 +0100 Subject: [PATCH 105/200] Update versions for development branch --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b7869b7..2f7cce4 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.6-testability_improvement-SNAPSHOT + 3.1.6-SNAPSHOT maven-plugin utPLSQL Maven Plugin From dc2f2b5f9fcd2c0d4f76eceeae4e809577385abf Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 15:27:52 +0100 Subject: [PATCH 106/200] Change exception handling in ReportWriter --- .../org/utplsql/maven/plugin/UtPlsqlMojo.java | 3 ++- .../org/utplsql/maven/plugin/io/ReportWriter.java | 15 +++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java index 0307b6a..3c0da8f 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java @@ -28,6 +28,7 @@ import org.utplsql.maven.plugin.model.ReporterParameter; import java.io.File; +import java.io.IOException; import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; @@ -193,7 +194,7 @@ public void execute() throws MojoExecutionException { DBHelper.disableDBMSOutput(connection); connection.close(); } - } catch (SQLException e) { + } catch (SQLException | IOException e) { getLog().error(e.getMessage(), e); } } diff --git a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java index ecdfaa0..4ae926b 100644 --- a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java +++ b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java @@ -65,15 +65,16 @@ public void addReporter(ReporterParameter parameter, Reporter reporter) { * Writes the reports to the output. * * @param connection The database {@link Connection} - * @throws MojoExecutionException if any exception happens + * @throws SQLException if database access fails + * @throws IOException if files can't be written */ - public void writeReports(Connection connection) throws MojoExecutionException { + public void writeReports(Connection connection) throws SQLException, IOException { for (Pair pair : reporters) { writeReports(connection, pair.getLeft(), pair.getRight()); } } - private void writeReports(Connection connection, Reporter reporter, ReporterParameter reporterParameter) throws MojoExecutionException { + private void writeReports(Connection connection, Reporter reporter, ReporterParameter reporterParameter) throws IOException, SQLException { FileOutputStream fileOutputStream = null; try { OutputBuffer buffer = OutputBufferProvider.getCompatibleOutputBuffer(databaseVersion, reporter, connection); @@ -103,15 +104,9 @@ private void writeReports(Connection connection, Reporter reporter, ReporterPara buffer.printAvailable(connection, printStreams); - } catch (FileNotFoundException | SQLException e) { - throw new MojoExecutionException(e.getMessage(), e); } finally { if (fileOutputStream != null) { - try { - fileOutputStream.close(); - } catch (IOException e) { - log.error(format("Couldn't close the output stream %s", reporterParameter.getClass())); - } + fileOutputStream.close(); } } } From 3cc3f316edc4e9c00b9bffce0eb2c4efe63f351e Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 15:33:51 +0100 Subject: [PATCH 107/200] Removed unused imports --- src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java index 4ae926b..2fae4e3 100644 --- a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java +++ b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java @@ -1,7 +1,6 @@ package org.utplsql.maven.plugin.io; import org.apache.commons.lang3.tuple.Pair; -import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.utplsql.api.Version; import org.utplsql.api.outputBuffer.OutputBuffer; @@ -10,7 +9,6 @@ import org.utplsql.maven.plugin.model.ReporterParameter; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; From b44e90492652afd85aff60e6c43f5bd0c10862bc Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 15:41:27 +0100 Subject: [PATCH 108/200] execute method structured --- .../org/utplsql/maven/plugin/UtPlsqlMojo.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java index 3c0da8f..abeb7f3 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java @@ -134,15 +134,7 @@ public void execute() throws MojoExecutionException { Connection connection = null; ReportWriter reportWriter = null; try { - FileMapperOptions sourceMappingOptions = buildSourcesOptions(); - FileMapperOptions testMappingOptions = buildTestsOptions(); - setDbConfiguration(); - - OracleDataSource ds = new OracleDataSource(); - ds.setURL(url); - ds.setUser(user); - ds.setPassword(password); - connection = ds.getConnection(); + connection = createConnection(); Version utlVersion = new DefaultDatabaseInformation().getUtPlsqlFrameworkVersion(connection); getLog().info("utPLSQL Version = " + utlVersion); @@ -150,14 +142,11 @@ public void execute() throws MojoExecutionException { reportWriter = new ReportWriter(targetDir, utlVersion, getLog()); List reporterList = initReporters(connection, reportWriter, ReporterFactory.createEmpty()); + FileMapperOptions sourceMappingOptions = buildSourcesOptions(); + FileMapperOptions testMappingOptions = buildTestsOptions(); logParameters(sourceMappingOptions, testMappingOptions, reporterList); - if (dbmsOutput) { - DBHelper.enableDBMSOutput(connection); - getLog().info("Enabled dbms_output."); - } - TestRunner runner = new TestRunner() .addPathList(paths) .addReporterList(reporterList) @@ -180,7 +169,7 @@ public void execute() throws MojoExecutionException { runner.run(connection); } catch (SomeTestsFailedException e) { - if (!this.ignoreFailure) { + if (!ignoreFailure) { throw new MojoExecutionException(e.getMessage(), e); } } catch (SQLException e) { @@ -201,7 +190,8 @@ public void execute() throws MojoExecutionException { } } - private void setDbConfiguration() { + + private Connection createConnection() throws SQLException { if (StringUtils.isEmpty(url)) { url = System.getProperty("dbUrl"); } @@ -211,6 +201,18 @@ private void setDbConfiguration() { if (StringUtils.isEmpty(password)) { password = System.getProperty("dbPass"); } + + OracleDataSource ds = new OracleDataSource(); + ds.setURL(url); + ds.setUser(user); + ds.setPassword(password); + + Connection connection = ds.getConnection(); + if (dbmsOutput) { + DBHelper.enableDBMSOutput(connection); + getLog().info("Enabled dbms_output."); + } + return connection; } FileMapperOptions buildSourcesOptions() throws MojoExecutionException { From efe03cbb783e6af0fba368746e10910667423147 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 24 Nov 2021 15:57:38 +0100 Subject: [PATCH 109/200] Fixe method execution order --- .../java/org/utplsql/maven/plugin/UtPlsqlMojo.java | 12 ++++++------ .../org/utplsql/maven/plugin/io/SqlFileScanner.java | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java index abeb7f3..6250ae7 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java @@ -139,12 +139,12 @@ public void execute() throws MojoExecutionException { Version utlVersion = new DefaultDatabaseInformation().getUtPlsqlFrameworkVersion(connection); getLog().info("utPLSQL Version = " + utlVersion); - reportWriter = new ReportWriter(targetDir, utlVersion, getLog()); - - List reporterList = initReporters(connection, reportWriter, ReporterFactory.createEmpty()); FileMapperOptions sourceMappingOptions = buildSourcesOptions(); FileMapperOptions testMappingOptions = buildTestsOptions(); + reportWriter = new ReportWriter(targetDir, utlVersion, getLog()); + List reporterList = initReporters(connection, reportWriter, ReporterFactory.createEmpty()); + logParameters(sourceMappingOptions, testMappingOptions, reporterList); TestRunner runner = new TestRunner() @@ -172,7 +172,7 @@ public void execute() throws MojoExecutionException { if (!ignoreFailure) { throw new MojoExecutionException(e.getMessage(), e); } - } catch (SQLException e) { + } catch (SQLException | IOException e) { throw new MojoExecutionException(e.getMessage(), e); } finally { try { @@ -215,7 +215,7 @@ private Connection createConnection() throws SQLException { return connection; } - FileMapperOptions buildSourcesOptions() throws MojoExecutionException { + FileMapperOptions buildSourcesOptions() throws IOException { if (sources.isEmpty()) { File defaultSourceDirectory = new File(project.getBasedir(), Defaults.SOURCE_DIRECTORY); if (defaultSourceDirectory.exists()) { @@ -231,7 +231,7 @@ FileMapperOptions buildSourcesOptions() throws MojoExecutionException { sourcesNameSubexpression, sourcesTypeSubexpression, sourcesCustomTypeMapping); } - FileMapperOptions buildTestsOptions() throws MojoExecutionException { + FileMapperOptions buildTestsOptions() throws IOException { if (tests.isEmpty()) { File defaultTestDirectory = new File(project.getBasedir(), Defaults.TEST_DIRECTORY); if (defaultTestDirectory.exists()) { diff --git a/src/main/java/org/utplsql/maven/plugin/io/SqlFileScanner.java b/src/main/java/org/utplsql/maven/plugin/io/SqlFileScanner.java index eda305a..f126769 100644 --- a/src/main/java/org/utplsql/maven/plugin/io/SqlFileScanner.java +++ b/src/main/java/org/utplsql/maven/plugin/io/SqlFileScanner.java @@ -1,10 +1,10 @@ package org.utplsql.maven.plugin.io; import org.apache.maven.model.Resource; -import org.apache.maven.plugin.MojoExecutionException; import org.codehaus.plexus.util.DirectoryScanner; import java.io.File; +import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -28,7 +28,7 @@ public class SqlFileScanner { * @param defaultFilePattern the default file pattern * @return a list of the files found */ - public List findSqlScripts(File baseDir, List resources, String defaultDirectory, String defaultFilePattern) throws MojoExecutionException { + public List findSqlScripts(File baseDir, List resources, String defaultDirectory, String defaultFilePattern) throws IOException { List founds = new ArrayList<>(); for (Resource resource : resources) { @@ -52,10 +52,10 @@ public List findSqlScripts(File baseDir, List resources, Strin return founds; } - private DirectoryScanner buildScanner(String baseDir, Resource resource) throws MojoExecutionException { + private DirectoryScanner buildScanner(String baseDir, Resource resource) throws IOException { File fileBaseDir = new File(baseDir, resource.getDirectory()); if (!fileBaseDir.exists() || !fileBaseDir.isDirectory() || !fileBaseDir.canRead()) { - throw new MojoExecutionException(format("Directory %s does not exist!", resource.getDirectory())); + throw new IOException(format("Directory %s does not exist!", resource.getDirectory())); } DirectoryScanner scanner = new DirectoryScanner(); From 1d4cc73a81589524d9f45557b82b7041f8551b88 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Thu, 25 Nov 2021 08:08:17 +0100 Subject: [PATCH 110/200] Removed UtPlsqlMojoTest to test coverage --- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 123 ------------------ 1 file changed, 123 deletions(-) delete mode 100644 src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java deleted file mode 100644 index 3847ebd..0000000 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.utplsql.maven.plugin; - -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.project.MavenProject; -import org.junit.BeforeClass; -import org.junit.Test; -import org.utplsql.api.reporter.CoreReporters; -import org.utplsql.maven.plugin.model.ReporterParameter; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.PrintStream; - -import static org.junit.Assert.assertTrue; - -public class UtPlsqlMojoTest { - - private static UtPlsqlMojo utPLSQLMojo; - - @BeforeClass - public static void setUp() { - utPLSQLMojo = new UtPlsqlMojo(); - utPLSQLMojo.project = new MavenProject(); - utPLSQLMojo.targetDir = "target"; - - utPLSQLMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; - utPLSQLMojo.user = "UT3"; - utPLSQLMojo.password = "UT3"; - } - - @Test - public void junitReporter() throws MojoExecutionException { - ReporterParameter junitReporter = new ReporterParameter(); - junitReporter.setConsoleOutput(true); - junitReporter.setFileOutput("junit-report.xml"); - junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPLSQLMojo.reporters.add(junitReporter); - - utPLSQLMojo.execute(); - - assertTrue(new File("target/junit-report.xml").exists()); - } - - @Test - public void absolutPath() throws MojoExecutionException { - ReporterParameter junitReporter = new ReporterParameter(); - junitReporter.setConsoleOutput(true); - - String os = System.getProperty("os.name"); - if (os.contains("Windows")) { - junitReporter.setFileOutput("c:/tmp/junit-report.xml"); - } else { - junitReporter.setFileOutput("/tmp/junit-report.xml"); - } - junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPLSQLMojo.reporters.add(junitReporter); - - utPLSQLMojo.execute(); - if (os.contains("Windows")) { - assertTrue(new File("c:/tmp/junit-report.xml").exists()); - } else { - assertTrue(new File("/tmp/junit-report.xml").exists()); - } - } - - @Test - public void parentDoesNotExist() throws MojoExecutionException { - ReporterParameter junitReporter = new ReporterParameter(); - junitReporter.setConsoleOutput(true); - junitReporter.setFileOutput("not-exist/junit-report.xml"); - junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPLSQLMojo.reporters.add(junitReporter); - - utPLSQLMojo.execute(); - - assertTrue(new File("target/not-exist/junit-report.xml").exists()); - } - - @Test - public void onlyConsoleOutput() throws MojoExecutionException { - ReporterParameter junitReporter = new ReporterParameter(); - junitReporter.setConsoleOutput(true); - junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPLSQLMojo.reporters.add(junitReporter); - - utPLSQLMojo.execute(); - - assertTrue(new File("target/not-exist/junit-report.xml").exists()); - } - - @Test - public void onlyFileOutput() throws MojoExecutionException { - ReporterParameter junitReporter = new ReporterParameter(); - junitReporter.setConsoleOutput(false); - junitReporter.setFileOutput("not-exist/junit-report.xml"); - junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPLSQLMojo.reporters.add(junitReporter); - - utPLSQLMojo.execute(); - - assertTrue(new File("target/not-exist/junit-report.xml").exists()); - } - - @Test - public void skipUtplsqlTests() throws MojoExecutionException { - utPLSQLMojo.skipUtplsqlTests = true; - - final ByteArrayOutputStream console = new ByteArrayOutputStream(); - System.setOut(new PrintStream(console)); - - utPLSQLMojo.execute(); - - String standardOutput = console.toString(); - - assertTrue(standardOutput.contains("utPLSQLTests are skipped.")); - } - - @Test - public void defaultReport() throws MojoExecutionException { - utPLSQLMojo.execute(); - } - -} From b9dfb47777bf817526a641357968ceb5ae6a6239 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Thu, 25 Nov 2021 08:08:36 +0100 Subject: [PATCH 111/200] Revert "Removed UtPlsqlMojoTest to test coverage" This reverts commit 1d4cc73a81589524d9f45557b82b7041f8551b88. --- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java new file mode 100644 index 0000000..3847ebd --- /dev/null +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -0,0 +1,123 @@ +package org.utplsql.maven.plugin; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.project.MavenProject; +import org.junit.BeforeClass; +import org.junit.Test; +import org.utplsql.api.reporter.CoreReporters; +import org.utplsql.maven.plugin.model.ReporterParameter; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.PrintStream; + +import static org.junit.Assert.assertTrue; + +public class UtPlsqlMojoTest { + + private static UtPlsqlMojo utPLSQLMojo; + + @BeforeClass + public static void setUp() { + utPLSQLMojo = new UtPlsqlMojo(); + utPLSQLMojo.project = new MavenProject(); + utPLSQLMojo.targetDir = "target"; + + utPLSQLMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; + utPLSQLMojo.user = "UT3"; + utPLSQLMojo.password = "UT3"; + } + + @Test + public void junitReporter() throws MojoExecutionException { + ReporterParameter junitReporter = new ReporterParameter(); + junitReporter.setConsoleOutput(true); + junitReporter.setFileOutput("junit-report.xml"); + junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); + utPLSQLMojo.reporters.add(junitReporter); + + utPLSQLMojo.execute(); + + assertTrue(new File("target/junit-report.xml").exists()); + } + + @Test + public void absolutPath() throws MojoExecutionException { + ReporterParameter junitReporter = new ReporterParameter(); + junitReporter.setConsoleOutput(true); + + String os = System.getProperty("os.name"); + if (os.contains("Windows")) { + junitReporter.setFileOutput("c:/tmp/junit-report.xml"); + } else { + junitReporter.setFileOutput("/tmp/junit-report.xml"); + } + junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); + utPLSQLMojo.reporters.add(junitReporter); + + utPLSQLMojo.execute(); + if (os.contains("Windows")) { + assertTrue(new File("c:/tmp/junit-report.xml").exists()); + } else { + assertTrue(new File("/tmp/junit-report.xml").exists()); + } + } + + @Test + public void parentDoesNotExist() throws MojoExecutionException { + ReporterParameter junitReporter = new ReporterParameter(); + junitReporter.setConsoleOutput(true); + junitReporter.setFileOutput("not-exist/junit-report.xml"); + junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); + utPLSQLMojo.reporters.add(junitReporter); + + utPLSQLMojo.execute(); + + assertTrue(new File("target/not-exist/junit-report.xml").exists()); + } + + @Test + public void onlyConsoleOutput() throws MojoExecutionException { + ReporterParameter junitReporter = new ReporterParameter(); + junitReporter.setConsoleOutput(true); + junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); + utPLSQLMojo.reporters.add(junitReporter); + + utPLSQLMojo.execute(); + + assertTrue(new File("target/not-exist/junit-report.xml").exists()); + } + + @Test + public void onlyFileOutput() throws MojoExecutionException { + ReporterParameter junitReporter = new ReporterParameter(); + junitReporter.setConsoleOutput(false); + junitReporter.setFileOutput("not-exist/junit-report.xml"); + junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); + utPLSQLMojo.reporters.add(junitReporter); + + utPLSQLMojo.execute(); + + assertTrue(new File("target/not-exist/junit-report.xml").exists()); + } + + @Test + public void skipUtplsqlTests() throws MojoExecutionException { + utPLSQLMojo.skipUtplsqlTests = true; + + final ByteArrayOutputStream console = new ByteArrayOutputStream(); + System.setOut(new PrintStream(console)); + + utPLSQLMojo.execute(); + + String standardOutput = console.toString(); + + assertTrue(standardOutput.contains("utPLSQLTests are skipped.")); + } + + @Test + public void defaultReport() throws MojoExecutionException { + utPLSQLMojo.execute(); + } + +} From 9bb239f4c76a98decb3a848f7cc0d3ed5a26beae Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Thu, 25 Nov 2021 08:17:29 +0100 Subject: [PATCH 112/200] Test for include and exclude --- src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 3847ebd..6b2670a 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -116,7 +116,10 @@ public void skipUtplsqlTests() throws MojoExecutionException { } @Test - public void defaultReport() throws MojoExecutionException { + public void defaultReportAndExcludes() throws MojoExecutionException { + utPLSQLMojo.excludeObject = "abc"; + utPLSQLMojo.includeObject = "xyz"; + utPLSQLMojo.execute(); } From 76d3d75df3c102098e6d1915bac3f67e89658811 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Thu, 25 Nov 2021 10:02:09 +0100 Subject: [PATCH 113/200] UtPlsqlMojo per test method --- .../org/utplsql/maven/plugin/UtPlsqlMojo.java | 22 +++---- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 64 +++++++++++-------- 2 files changed, 50 insertions(+), 36 deletions(-) diff --git a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java index 6250ae7..476a55e 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java @@ -5,7 +5,6 @@ import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -278,6 +277,8 @@ private FileMapperOptions createFileMapperOptions(List scripts, String o List initReporters(Connection connection, ReportWriter reportWriter, ReporterFactory reporterFactory) throws SQLException { List reporterList = new ArrayList<>(); if (reporters.isEmpty()) { + getLog().debug("No reporters configured using default"); + ReporterParameter reporterParameter = new ReporterParameter(); reporterParameter.setConsoleOutput(true); reporterParameter.setName(CoreReporters.UT_DOCUMENTATION_REPORTER.name()); @@ -302,20 +303,19 @@ List initReporters(Connection connection, ReportWriter reportWriter, R } private void logParameters(FileMapperOptions sourceMappingOptions, FileMapperOptions testMappingOptions, List reporterList) { - Log log = getLog(); - log.info("Invoking TestRunner with: " + targetDir); + getLog().info("Invoking TestRunner with: " + targetDir); - if (log.isDebugEnabled()) { - log.debug("Invoking TestRunner with: "); + if (getLog().isDebugEnabled()) { + getLog().debug("Invoking TestRunner with: "); - log.debug("reporters="); - reporterList.forEach((Reporter r) -> log.debug(r.getTypeName())); + getLog().debug("reporters="); + reporterList.forEach((Reporter r) -> getLog().debug(r.getTypeName())); - log.debug("sources="); - sourceMappingOptions.getFilePaths().forEach(log::debug); + getLog().debug("sources="); + sourceMappingOptions.getFilePaths().forEach(getLog()::debug); - log.debug("tests="); - testMappingOptions.getFilePaths().forEach(log::debug); + getLog().debug("tests="); + testMappingOptions.getFilePaths().forEach(getLog()::debug); } } diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 6b2670a..20a0ce7 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -2,7 +2,6 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; -import org.junit.BeforeClass; import org.junit.Test; import org.utplsql.api.reporter.CoreReporters; import org.utplsql.maven.plugin.model.ReporterParameter; @@ -15,34 +14,39 @@ public class UtPlsqlMojoTest { - private static UtPlsqlMojo utPLSQLMojo; + private UtPlsqlMojo createUtPlsqlMojo() { + System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "debug"); - @BeforeClass - public static void setUp() { - utPLSQLMojo = new UtPlsqlMojo(); - utPLSQLMojo.project = new MavenProject(); - utPLSQLMojo.targetDir = "target"; + UtPlsqlMojo utPlsqlMojo = new UtPlsqlMojo(); + utPlsqlMojo.project = new MavenProject(); + utPlsqlMojo.targetDir = "target"; - utPLSQLMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; - utPLSQLMojo.user = "UT3"; - utPLSQLMojo.password = "UT3"; + utPlsqlMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; + utPlsqlMojo.user = "UT3"; + utPlsqlMojo.password = "UT3"; + + return utPlsqlMojo; } @Test public void junitReporter() throws MojoExecutionException { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); + ReporterParameter junitReporter = new ReporterParameter(); junitReporter.setConsoleOutput(true); junitReporter.setFileOutput("junit-report.xml"); junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPLSQLMojo.reporters.add(junitReporter); + utPlsqlMojo.reporters.add(junitReporter); - utPLSQLMojo.execute(); + utPlsqlMojo.execute(); assertTrue(new File("target/junit-report.xml").exists()); } @Test public void absolutPath() throws MojoExecutionException { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); + ReporterParameter junitReporter = new ReporterParameter(); junitReporter.setConsoleOutput(true); @@ -53,9 +57,9 @@ public void absolutPath() throws MojoExecutionException { junitReporter.setFileOutput("/tmp/junit-report.xml"); } junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPLSQLMojo.reporters.add(junitReporter); + utPlsqlMojo.reporters.add(junitReporter); - utPLSQLMojo.execute(); + utPlsqlMojo.execute(); if (os.contains("Windows")) { assertTrue(new File("c:/tmp/junit-report.xml").exists()); } else { @@ -65,50 +69,58 @@ public void absolutPath() throws MojoExecutionException { @Test public void parentDoesNotExist() throws MojoExecutionException { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); + ReporterParameter junitReporter = new ReporterParameter(); junitReporter.setConsoleOutput(true); junitReporter.setFileOutput("not-exist/junit-report.xml"); junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPLSQLMojo.reporters.add(junitReporter); + utPlsqlMojo.reporters.add(junitReporter); - utPLSQLMojo.execute(); + utPlsqlMojo.execute(); assertTrue(new File("target/not-exist/junit-report.xml").exists()); } @Test public void onlyConsoleOutput() throws MojoExecutionException { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); + ReporterParameter junitReporter = new ReporterParameter(); junitReporter.setConsoleOutput(true); junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPLSQLMojo.reporters.add(junitReporter); + utPlsqlMojo.reporters.add(junitReporter); - utPLSQLMojo.execute(); + utPlsqlMojo.execute(); assertTrue(new File("target/not-exist/junit-report.xml").exists()); } @Test public void onlyFileOutput() throws MojoExecutionException { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); + ReporterParameter junitReporter = new ReporterParameter(); junitReporter.setConsoleOutput(false); junitReporter.setFileOutput("not-exist/junit-report.xml"); junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPLSQLMojo.reporters.add(junitReporter); + utPlsqlMojo.reporters.add(junitReporter); - utPLSQLMojo.execute(); + utPlsqlMojo.execute(); assertTrue(new File("target/not-exist/junit-report.xml").exists()); } @Test public void skipUtplsqlTests() throws MojoExecutionException { - utPLSQLMojo.skipUtplsqlTests = true; + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); + + utPlsqlMojo.skipUtplsqlTests = true; final ByteArrayOutputStream console = new ByteArrayOutputStream(); System.setOut(new PrintStream(console)); - utPLSQLMojo.execute(); + utPlsqlMojo.execute(); String standardOutput = console.toString(); @@ -117,10 +129,12 @@ public void skipUtplsqlTests() throws MojoExecutionException { @Test public void defaultReportAndExcludes() throws MojoExecutionException { - utPLSQLMojo.excludeObject = "abc"; - utPLSQLMojo.includeObject = "xyz"; + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); + + utPlsqlMojo.excludeObject = "abc"; + utPlsqlMojo.includeObject = "xyz"; - utPLSQLMojo.execute(); + utPlsqlMojo.execute(); } } From 4d0b557050e48a1284c9a81bb07016b746302b64 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Thu, 25 Nov 2021 16:27:40 +0100 Subject: [PATCH 114/200] Update versions for feature branch --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2f7cce4..eada957 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.6-SNAPSHOT + 3.1.6-maven-it-extension-SNAPSHOT maven-plugin utPLSQL Maven Plugin From 7c82511a77fefcfaba7cebc547fc825b75dc5451 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Thu, 25 Nov 2021 17:57:09 +0100 Subject: [PATCH 115/200] Replaced VerifierIT with UtPlsqlMojoIT that uses maven-it-extension --- pom.xml | 47 ++++- .../utplsql/maven/plugin/ReportChecker.java | 67 +++++++ .../utplsql/maven/plugin/UtPlsqlMojoIT.java | 63 +++++++ .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 4 +- .../org/utplsql/maven/plugin/VerifierIT.java | 163 ------------------ .../plugin/UtPlsqlMojoIT/minimalist}/pom.xml | 14 +- .../utplsql/coverage-sonar-report.xml | 0 .../utplsql/sonar-test-report.xml | 0 .../plugin/UtPlsqlMojoIT/owner_param}/pom.xml | 20 +-- .../foo/package_bodies/PKG_TEST_ME.sql | 0 .../sources/foo/packages/PKG_TEST_ME.sql | 0 .../scripts/sources/foo/tables/TO_TEST_ME.tab | 0 .../bar/package_bodies/TEST_PKG_TEST_ME.sql | 0 .../test/bar/packages/TEST_PKG_TEST_ME.sql | 0 .../utplsql/coverage-sonar-report.xml | 0 .../utplsql/sonar-test-report.xml | 0 .../maven/plugin/UtPlsqlMojoIT/regex}/pom.xml | 23 +-- .../sources/app/packages/PKG_TEST_ME.bdy | 0 .../sources/app/packages/PKG_TEST_ME.spc | 0 .../scripts/sources/app/tables/TO_TEST_ME.tab | 0 .../test/app/packages/TEST_PKG_TEST_ME.bdy | 0 .../test/app/packages/TEST_PKG_TEST_ME.spc | 0 .../utplsql/coverage-sonar-report.xml | 0 .../utplsql/sonar-test-report.xml | 0 .../plugin/UtPlsqlMojoIT/simple}/pom.xml | 22 +-- .../scripts/sources/APP.PKG_TEST_ME.bdy | 0 .../scripts/sources/APP.PKG_TEST_ME.spc | 0 .../simple}/scripts/sources/TO_TEST_ME.tab | 0 .../scripts/tests/APP.TEST_PKG_TEST_ME.bdy | 0 .../scripts/tests/APP.TEST_PKG_TEST_ME.spc | 0 .../maven/plugin/UtPlsqlMojoIT/skip}/pom.xml | 23 +-- .../utplsql/sonar-test-report.xml | 0 .../maven/plugin/UtPlsqlMojoIT/tags}/pom.xml | 19 +- .../scripts/tests/APP.TEST_PKG_TEST_ME.bdy | 0 .../scripts/tests/APP.TEST_PKG_TEST_ME.spc | 0 .../utplsql/coverage-sonar-report.xml | 0 .../utplsql/sonar-test-report.xml | 0 .../UtPlsqlMojoIT/type_mapping}/pom.xml | 16 +- .../app/package_bodies/PKG_TEST_ME.sql | 0 .../sources/app/packages/PKG_TEST_ME.sql | 0 .../scripts/sources/app/tables/TO_TEST_ME.tab | 0 .../app/package_bodies/TEST_PKG_TEST_ME.sql | 0 .../test/app/packages/TEST_PKG_TEST_ME.sql | 0 43 files changed, 227 insertions(+), 254 deletions(-) create mode 100644 src/test/java/org/utplsql/maven/plugin/ReportChecker.java create mode 100644 src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java delete mode 100644 src/test/java/org/utplsql/maven/plugin/VerifierIT.java rename src/test/{resources/integration-tests/minimalist-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist}/pom.xml (61%) rename src/test/{resources/integration-tests/owner-param-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param}/expected-output/utplsql/coverage-sonar-report.xml (100%) rename src/test/{resources/integration-tests/owner-param-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param}/expected-output/utplsql/sonar-test-report.xml (100%) rename src/test/{resources/integration-tests/owner-param-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param}/pom.xml (88%) rename src/test/{resources/integration-tests/owner-param-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param}/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql (100%) rename src/test/{resources/integration-tests/owner-param-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param}/scripts/sources/foo/packages/PKG_TEST_ME.sql (100%) rename src/test/{resources/integration-tests/owner-param-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param}/scripts/sources/foo/tables/TO_TEST_ME.tab (100%) rename src/test/{resources/integration-tests/owner-param-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param}/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql (100%) rename src/test/{resources/integration-tests/owner-param-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param}/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql (100%) rename src/test/{resources/integration-tests/regex-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex}/expected-output/utplsql/coverage-sonar-report.xml (100%) rename src/test/{resources/integration-tests/regex-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex}/expected-output/utplsql/sonar-test-report.xml (100%) rename src/test/{resources/integration-tests/regex-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex}/pom.xml (86%) rename src/test/{resources/integration-tests/regex-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex}/scripts/sources/app/packages/PKG_TEST_ME.bdy (100%) rename src/test/{resources/integration-tests/regex-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex}/scripts/sources/app/packages/PKG_TEST_ME.spc (100%) rename src/test/{resources/integration-tests/regex-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex}/scripts/sources/app/tables/TO_TEST_ME.tab (100%) rename src/test/{resources/integration-tests/regex-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex}/scripts/test/app/packages/TEST_PKG_TEST_ME.bdy (100%) rename src/test/{resources/integration-tests/regex-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex}/scripts/test/app/packages/TEST_PKG_TEST_ME.spc (100%) rename src/test/{resources/integration-tests/simple-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple}/expected-output/utplsql/coverage-sonar-report.xml (100%) rename src/test/{resources/integration-tests/simple-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple}/expected-output/utplsql/sonar-test-report.xml (100%) rename src/test/{resources/integration-tests/simple-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple}/pom.xml (84%) rename src/test/{resources/integration-tests/simple-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple}/scripts/sources/APP.PKG_TEST_ME.bdy (100%) rename src/test/{resources/integration-tests/simple-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple}/scripts/sources/APP.PKG_TEST_ME.spc (100%) rename src/test/{resources/integration-tests/simple-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple}/scripts/sources/TO_TEST_ME.tab (100%) rename src/test/{resources/integration-tests/simple-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple}/scripts/tests/APP.TEST_PKG_TEST_ME.bdy (100%) rename src/test/{resources/integration-tests/simple-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple}/scripts/tests/APP.TEST_PKG_TEST_ME.spc (100%) rename src/test/{resources/integration-tests/skip-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/skip}/pom.xml (84%) rename src/test/{resources/integration-tests/tags-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags}/expected-output/utplsql/sonar-test-report.xml (100%) rename src/test/{resources/integration-tests/tags-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags}/pom.xml (80%) rename src/test/{resources/integration-tests/tags-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags}/scripts/tests/APP.TEST_PKG_TEST_ME.bdy (100%) rename src/test/{resources/integration-tests/tags-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags}/scripts/tests/APP.TEST_PKG_TEST_ME.spc (100%) rename src/test/{resources/integration-tests/type-mapping-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping}/expected-output/utplsql/coverage-sonar-report.xml (100%) rename src/test/{resources/integration-tests/type-mapping-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping}/expected-output/utplsql/sonar-test-report.xml (100%) rename src/test/{resources/integration-tests/type-mapping-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping}/pom.xml (89%) rename src/test/{resources/integration-tests/type-mapping-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping}/scripts/sources/app/package_bodies/PKG_TEST_ME.sql (100%) rename src/test/{resources/integration-tests/type-mapping-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping}/scripts/sources/app/packages/PKG_TEST_ME.sql (100%) rename src/test/{resources/integration-tests/type-mapping-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping}/scripts/sources/app/tables/TO_TEST_ME.tab (100%) rename src/test/{resources/integration-tests/type-mapping-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping}/scripts/test/app/package_bodies/TEST_PKG_TEST_ME.sql (100%) rename src/test/{resources/integration-tests/type-mapping-project => resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping}/scripts/test/app/packages/TEST_PKG_TEST_ME.sql (100%) diff --git a/pom.xml b/pom.xml index eada957..ddf7451 100644 --- a/pom.xml +++ b/pom.xml @@ -55,11 +55,23 @@ UTF-8 3.5.2 2.3.1 - 2.0.9 + 0.11.0 utplsql https://sonarcloud.io + + + + org.junit + junit-bom + 5.8.1 + pom + import + + + + com.sun.xml.bind @@ -130,10 +142,22 @@ 3.3.0 test + + + org.junit.jupiter + junit-jupiter-engine + test + + + com.soebes.itf.jupiter.extension + itf-jupiter-extension + ${itf.version} + test + - org.apache.maven.shared - maven-verifier - 1.6 + com.soebes.itf.jupiter.extension + itf-assertj + ${itf.version} test @@ -173,6 +197,21 @@ + + com.soebes.itf.jupiter.extension + itf-maven-plugin + ${itf.version} + + + installing + pre-integration-test + + install + resources-its + + + + org.apache.maven.plugins maven-shade-plugin diff --git a/src/test/java/org/utplsql/maven/plugin/ReportChecker.java b/src/test/java/org/utplsql/maven/plugin/ReportChecker.java new file mode 100644 index 0000000..e58b35c --- /dev/null +++ b/src/test/java/org/utplsql/maven/plugin/ReportChecker.java @@ -0,0 +1,67 @@ +package org.utplsql.maven.plugin; + +import org.apache.commons.io.FileUtils; +import org.junit.jupiter.api.Assertions; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ReportChecker { + + private ReportChecker() { + } + + /** + * Duration is set to 1 before comparing contents as it is always different. + * Path separator is set to "/" to ensure windows / linux / mac compatibility. + * \r and \n are removed to provide simpler comparison. + * + * @param testClass Class under test + * @param testFolder Folder name + * @param files Files to compare + */ + public static void checkReports(Class testClass, String testFolder, String... files) throws IOException { + String fullyQualifiedClassNameDirectory = testClass.getName().replace(".", "/"); + + for (String filename : files) { + File expectedOutputFile = new File("target/maven-it/" + fullyQualifiedClassNameDirectory + "/" + testFolder + "/project/expected-output/utplsql", filename); + File outputFile = new File("target/maven-it/" + fullyQualifiedClassNameDirectory + "/" + testFolder + "/project/target/utplsql", filename); + assertTrue(outputFile.exists(), "The report " + outputFile.getPath() + " was not generated"); + + try (Stream stream = Files.lines(outputFile.toPath())) { + String outputContent = stream + .filter(line -> !line.contains(" line.replaceAll("(duration=\"[0-9.]*\")", "duration=\"1\"")) + .map(line -> line.replaceAll("\\\\", "/")) + .map(line -> line.replaceAll("\r", "").replaceAll("\n", "")) + .collect(Collectors.joining("\n")); + + Assertions.assertEquals( + FileUtils.readFileToString(expectedOutputFile, "utf-8") + .replace("\r", "") + .replace("\n", ""), + outputContent.replace("\n", ""), "The files differ!"); + } + } + } + + /** + * Check if a report file exits + * + * @param testClass Class under test + * @param testFolder Folder name + * @param filename File Name + * @return true or false + */ + public static boolean reportExists(Class testClass, String testFolder, String filename) { + String fullyQualifiedClassNameDirectory = testClass.getName().replace(".", "/"); + + File outputFile = new File("target/maven-it/" + fullyQualifiedClassNameDirectory + "/" + testFolder + "/project/target/utplsql", filename); + return outputFile.exists(); + } +} diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java new file mode 100644 index 0000000..35f77e6 --- /dev/null +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java @@ -0,0 +1,63 @@ +package org.utplsql.maven.plugin; + +import com.soebes.itf.jupiter.extension.MavenJupiterExtension; +import com.soebes.itf.jupiter.extension.MavenTest; +import com.soebes.itf.jupiter.maven.MavenExecutionResult; + +import java.io.IOException; + +import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.utplsql.maven.plugin.ReportChecker.checkReports; +import static org.utplsql.maven.plugin.ReportChecker.reportExists; + +@MavenJupiterExtension +public class UtPlsqlMojoIT { + + @MavenTest + void minimalist(MavenExecutionResult result) { + assertThat(result).isSuccessful(); + } + + @MavenTest + void owner_param(MavenExecutionResult result) throws IOException { + assertThat(result).isSuccessful(); + + checkReports(this.getClass(), "owner_param", "sonar-test-report.xml", "coverage-sonar-report.xml"); + } + + @MavenTest + void regex(MavenExecutionResult result) throws IOException { + assertThat(result).isSuccessful(); + + checkReports(this.getClass(), "regex", "sonar-test-report.xml", "coverage-sonar-report.xml"); + } + + @MavenTest + void simple(MavenExecutionResult result) throws IOException { + assertThat(result).isSuccessful(); + + checkReports(this.getClass(), "simple", "sonar-test-report.xml", "coverage-sonar-report.xml"); + } + + @MavenTest + void skip(MavenExecutionResult result) throws IOException { + assertThat(result).isSuccessful(); + + assertFalse(reportExists(this.getClass(), "skip", "sonar-test-report.xml")); + } + + @MavenTest + void tags(MavenExecutionResult result) throws IOException { + assertThat(result).isSuccessful(); + + checkReports(this.getClass(), "tags", "sonar-test-report.xml"); + } + + @MavenTest + void type_mapping(MavenExecutionResult result) throws IOException { + assertThat(result).isSuccessful(); + + checkReports(this.getClass(), "type_mapping", "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 20a0ce7..10998fe 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -2,7 +2,7 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.utplsql.api.reporter.CoreReporters; import org.utplsql.maven.plugin.model.ReporterParameter; @@ -10,7 +10,7 @@ import java.io.File; import java.io.PrintStream; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; public class UtPlsqlMojoTest { diff --git a/src/test/java/org/utplsql/maven/plugin/VerifierIT.java b/src/test/java/org/utplsql/maven/plugin/VerifierIT.java deleted file mode 100644 index cf092ab..0000000 --- a/src/test/java/org/utplsql/maven/plugin/VerifierIT.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.utplsql.maven.plugin; - -import org.apache.commons.io.FileUtils; -import org.apache.maven.it.VerificationException; -import org.apache.maven.it.Verifier; -import org.apache.maven.it.util.ResourceExtractor; -import org.apache.maven.model.Model; -import org.apache.maven.model.io.xpp3.MavenXpp3Reader; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class VerifierIT { - - private static String pluginVersion = null; - - @BeforeClass - public static void setUp() throws VerificationException, IOException, XmlPullParserException { - MavenXpp3Reader reader = new MavenXpp3Reader(); - Model model = reader.read(new FileReader("pom.xml")); - - Verifier verifier = new Verifier(new File("").getAbsolutePath()); - - // Install Plugin - verifier.setAutoclean(false); - verifier.addCliOption("-DskipTests"); - verifier.executeGoal("install"); - - pluginVersion = model.getVersion(); - } - - @Test - public void simpleProject() throws IOException, VerificationException { - final String testFolder = "integration-tests/simple-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - - checkReports(testFolder, "utplsql/sonar-test-report.xml", "utplsql/coverage-sonar-report.xml"); - } - - @Test - public void regexProject() throws IOException, VerificationException { - final String testFolder = "integration-tests/regex-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - - checkReports(testFolder, "utplsql/sonar-test-report.xml", "utplsql/coverage-sonar-report.xml"); - } - - @Test - public void typeMappingProject() throws IOException, VerificationException { - final String testFolder = "integration-tests/type-mapping-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - - checkReports(testFolder, "utplsql/sonar-test-report.xml", "utplsql/coverage-sonar-report.xml"); - } - - @Test - public void ownerParameterProject() throws IOException, VerificationException { - final String testFolder = "integration-tests/owner-param-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - - checkReports(testFolder, "utplsql/sonar-test-report.xml", "utplsql/coverage-sonar-report.xml"); - } - - @Test - public void minimalistProject() throws IOException, VerificationException { - final String testFolder = "integration-tests/minimalist-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - } - - @Test - public void tagsProject() throws IOException, VerificationException { - final String testFolder = "integration-tests/tags-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - - checkReports(testFolder, "utplsql/sonar-test-report.xml"); - } - - @Test - public void skipUtplsqlTests() throws IOException, VerificationException { - final String testFolder = "integration-tests/skip-project"; - File testProject = ResourceExtractor.simpleExtractResources(getClass(), "/" + testFolder); - - Verifier verifier = createVerifier(testProject); - verifier.executeGoal("test"); - - assertFalse(new File("target/test-classes/" + testFolder + "/target").exists()); - } - - /** - * Duration is set to 1 before comparing contents as it is always different. - * Path separator is set to "/" to ensure windows / linux / mac compatibility. - * \r and \n are removed to provide simpler comparison. - * - * @param testFolder Project name - * @param files Files to compare - */ - private void checkReports(String testFolder, String... files) throws IOException { - for (String filename : files) { - File outputFile = new File("target/test-classes/" + testFolder + "/target", filename); - File expectedOutputFile = new File("target/test-classes/" + testFolder + "/expected-output", filename); - - assertTrue("The report for " + filename + " was not generated", outputFile.exists()); - - try (Stream stream = Files.lines(Paths.get("target", "test-classes", testFolder, "target", filename))) { - String outputContent = stream - .filter(line -> !line.contains(" line.replaceAll("(duration=\"[0-9.]*\")", "duration=\"1\"")) - .map(line -> line.replaceAll("\\\\", "/")) - .map(line -> line.replaceAll("\r", "").replaceAll("\n", "")) - .collect(Collectors.joining("\n")); - - assertEquals("The files differ!", - FileUtils.readFileToString(expectedOutputFile, "utf-8") - .replace("\r", "") - .replace("\n", ""), - outputContent.replace("\n", "")); - } - } - } - - private Verifier createVerifier(File testProject) throws VerificationException { - Verifier verifier; - verifier = new Verifier(testProject.getAbsolutePath()); - verifier.addCliOption("-N"); - verifier.addCliOption("-X"); - verifier.addCliOption("-Dutplsql-maven-plugin-version=" + pluginVersion); - verifier.addCliOption("-DdbUrl=jdbc:oracle:thin:@127.0.0.1:1521:XE"); - verifier.addCliOption("-DdbUser=UT3"); - verifier.addCliOption("-DdbPass=UT3"); - return verifier; - } - -} diff --git a/src/test/resources/integration-tests/minimalist-project/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml similarity index 61% rename from src/test/resources/integration-tests/minimalist-project/pom.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml index 2f80480..74e6893 100644 --- a/src/test/resources/integration-tests/minimalist-project/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml @@ -1,16 +1,17 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql - utplsql-maven-plugin-minimalist-test + minimalist 1.0.0 pom - utplsql-maven-plugin IT Minimalist - + jdbc:oracle:thin:@localhost:1521:xe + UT3 + UT3 @@ -18,7 +19,7 @@ ${project.groupId} utplsql-maven-plugin - ${utplsql-maven-plugin-version} + @project.version@ @@ -26,7 +27,6 @@ - diff --git a/src/test/resources/integration-tests/owner-param-project/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 similarity index 100% rename from src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/coverage-sonar-report.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/expected-output/utplsql/coverage-sonar-report.xml diff --git a/src/test/resources/integration-tests/owner-param-project/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 similarity index 100% rename from src/test/resources/integration-tests/owner-param-project/expected-output/utplsql/sonar-test-report.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/expected-output/utplsql/sonar-test-report.xml diff --git a/src/test/resources/integration-tests/owner-param-project/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/pom.xml similarity index 88% rename from src/test/resources/integration-tests/owner-param-project/pom.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/pom.xml index c33e51d..58fc29e 100644 --- a/src/test/resources/integration-tests/owner-param-project/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/pom.xml @@ -1,39 +1,35 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql - utplsql-maven-plugin-owner-parameter-test + owner-param 1.0.0 pom - utplsql-maven-plugin IT Owner Parameter - + jdbc:oracle:thin:@localhost:1521:xe + UT3 + UT3 - ${project.groupId} utplsql-maven-plugin - ${utplsql-maven-plugin-version} + @project.version@ test - - false - tests_owner - UT_COVERAGE_SONAR_REPORTER @@ -46,7 +42,6 @@ true - scripts/sources @@ -65,7 +60,6 @@ package_bodies - scripts/test diff --git a/src/test/resources/integration-tests/owner-param-project/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 similarity index 100% rename from src/test/resources/integration-tests/owner-param-project/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.sql diff --git a/src/test/resources/integration-tests/owner-param-project/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 similarity index 100% rename from src/test/resources/integration-tests/owner-param-project/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.sql diff --git a/src/test/resources/integration-tests/owner-param-project/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.tab similarity index 100% rename from src/test/resources/integration-tests/owner-param-project/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.tab diff --git a/src/test/resources/integration-tests/owner-param-project/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 similarity index 100% rename from src/test/resources/integration-tests/owner-param-project/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.sql diff --git a/src/test/resources/integration-tests/owner-param-project/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 similarity index 100% rename from src/test/resources/integration-tests/owner-param-project/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.sql diff --git a/src/test/resources/integration-tests/regex-project/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 similarity index 100% rename from src/test/resources/integration-tests/regex-project/expected-output/utplsql/coverage-sonar-report.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/expected-output/utplsql/coverage-sonar-report.xml diff --git a/src/test/resources/integration-tests/regex-project/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 similarity index 100% rename from src/test/resources/integration-tests/regex-project/expected-output/utplsql/sonar-test-report.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/expected-output/utplsql/sonar-test-report.xml diff --git a/src/test/resources/integration-tests/regex-project/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/pom.xml similarity index 86% rename from src/test/resources/integration-tests/regex-project/pom.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/pom.xml index b04ff07..913e14c 100644 --- a/src/test/resources/integration-tests/regex-project/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/pom.xml @@ -1,16 +1,17 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql - utplsql-maven-plugin-regex-test + regex 1.0.0 pom - utplsql-maven-plugin IT regex - + jdbc:oracle:thin:@localhost:1521:xe + UT3 + UT3 @@ -18,21 +19,17 @@ ${project.groupId} utplsql-maven-plugin - ${utplsql-maven-plugin-version} + @project.version@ test - - false - app - UT_COVERAGE_SONAR_REPORTER @@ -45,7 +42,6 @@ true - scripts/sources @@ -55,11 +51,11 @@ - .*(\\|\/)(\w+)(\\|\/)(\w+)(\\|\/)(\w+).(\w{3}) + .*(\\|\/)(\w+)(\\|\/)(\w+)(\\|\/)(\w+).(\w{3}) + 2 6 7 - scripts/test @@ -73,7 +69,6 @@ 2 6 7 - diff --git a/src/test/resources/integration-tests/regex-project/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.bdy similarity index 100% rename from src/test/resources/integration-tests/regex-project/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.bdy diff --git a/src/test/resources/integration-tests/regex-project/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.spc similarity index 100% rename from src/test/resources/integration-tests/regex-project/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.spc diff --git a/src/test/resources/integration-tests/regex-project/scripts/sources/app/tables/TO_TEST_ME.tab b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/tables/TO_TEST_ME.tab similarity index 100% rename from src/test/resources/integration-tests/regex-project/scripts/sources/app/tables/TO_TEST_ME.tab rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/scripts/sources/app/tables/TO_TEST_ME.tab diff --git a/src/test/resources/integration-tests/regex-project/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.bdy similarity index 100% rename from src/test/resources/integration-tests/regex-project/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.bdy diff --git a/src/test/resources/integration-tests/regex-project/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.spc similarity index 100% rename from src/test/resources/integration-tests/regex-project/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.spc diff --git a/src/test/resources/integration-tests/simple-project/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 similarity index 100% rename from src/test/resources/integration-tests/simple-project/expected-output/utplsql/coverage-sonar-report.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/expected-output/utplsql/coverage-sonar-report.xml diff --git a/src/test/resources/integration-tests/simple-project/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 similarity index 100% rename from src/test/resources/integration-tests/simple-project/expected-output/utplsql/sonar-test-report.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/expected-output/utplsql/sonar-test-report.xml diff --git a/src/test/resources/integration-tests/simple-project/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/pom.xml similarity index 84% rename from src/test/resources/integration-tests/simple-project/pom.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/pom.xml index 0be54b9..a0ad975 100644 --- a/src/test/resources/integration-tests/simple-project/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/pom.xml @@ -1,16 +1,17 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql - utplsql-maven-plugin-simple-test + simple 1.0.0 pom - utplsql-maven-plugin IT Simple - + jdbc:oracle:thin:@localhost:1521:xe + UT3 + UT3 @@ -18,21 +19,17 @@ ${project.groupId} utplsql-maven-plugin - ${utplsql-maven-plugin-version} + @project.version@ test - - false - app - UT_COVERAGE_SONAR_REPORTER @@ -45,7 +42,6 @@ true - scripts/sources @@ -55,7 +51,6 @@ - scripts/tests @@ -65,12 +60,9 @@ - - - diff --git a/src/test/resources/integration-tests/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.bdy similarity index 100% rename from src/test/resources/integration-tests/simple-project/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.bdy diff --git a/src/test/resources/integration-tests/simple-project/scripts/sources/APP.PKG_TEST_ME.spc b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/APP.PKG_TEST_ME.spc similarity index 100% rename from src/test/resources/integration-tests/simple-project/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.spc diff --git a/src/test/resources/integration-tests/simple-project/scripts/sources/TO_TEST_ME.tab b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/TO_TEST_ME.tab similarity index 100% rename from src/test/resources/integration-tests/simple-project/scripts/sources/TO_TEST_ME.tab rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/sources/TO_TEST_ME.tab diff --git a/src/test/resources/integration-tests/simple-project/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.bdy similarity index 100% rename from src/test/resources/integration-tests/simple-project/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.bdy diff --git a/src/test/resources/integration-tests/simple-project/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.spc similarity index 100% rename from src/test/resources/integration-tests/simple-project/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.spc diff --git a/src/test/resources/integration-tests/skip-project/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/skip/pom.xml similarity index 84% rename from src/test/resources/integration-tests/skip-project/pom.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/skip/pom.xml index 9ee47c1..9736703 100644 --- a/src/test/resources/integration-tests/skip-project/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/skip/pom.xml @@ -1,16 +1,17 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql - utplsql-maven-plugin-simple-test + skip 1.0.0 pom - utplsql-maven-plugin IT Skip Tests - + jdbc:oracle:thin:@localhost:1521:xe + UT3 + UT3 @@ -18,7 +19,7 @@ ${project.groupId} utplsql-maven-plugin - ${utplsql-maven-plugin-version} + @project.version@ @@ -26,15 +27,10 @@ true - - - false - app - UT_COVERAGE_SONAR_REPORTER @@ -47,7 +43,6 @@ true - scripts/sources @@ -57,7 +52,6 @@ - scripts/tests @@ -67,12 +61,9 @@ - - - diff --git a/src/test/resources/integration-tests/tags-project/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 similarity index 100% rename from src/test/resources/integration-tests/tags-project/expected-output/utplsql/sonar-test-report.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/expected-output/utplsql/sonar-test-report.xml diff --git a/src/test/resources/integration-tests/tags-project/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/pom.xml similarity index 80% rename from src/test/resources/integration-tests/tags-project/pom.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/pom.xml index 06fdb55..7e3eaef 100644 --- a/src/test/resources/integration-tests/tags-project/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/pom.xml @@ -1,16 +1,17 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql - utplsql-maven-plugin-tags + tags 1.0.0 pom - utplsql-maven-plugin IT Tags - + jdbc:oracle:thin:@localhost:1521:xe + UT3 + UT3 @@ -18,26 +19,21 @@ ${project.groupId} utplsql-maven-plugin - ${utplsql-maven-plugin-version} + @project.version@ test - - false - app - exists cursor - UT_SONAR_TEST_REPORTER @@ -45,7 +41,6 @@ true - scripts/tests diff --git a/src/test/resources/integration-tests/tags-project/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.bdy similarity index 100% rename from src/test/resources/integration-tests/tags-project/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.bdy diff --git a/src/test/resources/integration-tests/tags-project/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.spc similarity index 100% rename from src/test/resources/integration-tests/tags-project/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.spc diff --git a/src/test/resources/integration-tests/type-mapping-project/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 similarity index 100% rename from src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/coverage-sonar-report.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/expected-output/utplsql/coverage-sonar-report.xml diff --git a/src/test/resources/integration-tests/type-mapping-project/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 similarity index 100% rename from src/test/resources/integration-tests/type-mapping-project/expected-output/utplsql/sonar-test-report.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/expected-output/utplsql/sonar-test-report.xml diff --git a/src/test/resources/integration-tests/type-mapping-project/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/pom.xml similarity index 89% rename from src/test/resources/integration-tests/type-mapping-project/pom.xml rename to src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/pom.xml index 55772f8..e50c729 100644 --- a/src/test/resources/integration-tests/type-mapping-project/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/pom.xml @@ -1,17 +1,17 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql - utplsql-maven-plugin-type-mapping-test + type-mapping 1.0.0 - pom - utplsql-maven-plugin IT Type Mapping - + jdbc:oracle:thin:@localhost:1521:xe + UT3 + UT3 @@ -19,14 +19,14 @@ ${project.groupId} utplsql-maven-plugin - ${utplsql-maven-plugin-version} + @project.version@ test - + false diff --git a/src/test/resources/integration-tests/type-mapping-project/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.sql similarity index 100% rename from src/test/resources/integration-tests/type-mapping-project/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.sql diff --git a/src/test/resources/integration-tests/type-mapping-project/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.sql similarity index 100% rename from src/test/resources/integration-tests/type-mapping-project/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.sql diff --git a/src/test/resources/integration-tests/type-mapping-project/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 similarity index 100% rename from src/test/resources/integration-tests/type-mapping-project/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.tab diff --git a/src/test/resources/integration-tests/type-mapping-project/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.sql similarity index 100% rename from src/test/resources/integration-tests/type-mapping-project/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.sql diff --git a/src/test/resources/integration-tests/type-mapping-project/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.sql similarity index 100% rename from src/test/resources/integration-tests/type-mapping-project/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.sql From 3db52a8d8808955ff28839eb6501723d4f701d65 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Thu, 25 Nov 2021 18:02:18 +0100 Subject: [PATCH 116/200] Set MavenGoal --- src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java index 35f77e6..57f7c41 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java @@ -1,5 +1,6 @@ package org.utplsql.maven.plugin; +import com.soebes.itf.jupiter.extension.MavenGoal; import com.soebes.itf.jupiter.extension.MavenJupiterExtension; import com.soebes.itf.jupiter.extension.MavenTest; import com.soebes.itf.jupiter.maven.MavenExecutionResult; @@ -11,6 +12,7 @@ import static org.utplsql.maven.plugin.ReportChecker.checkReports; import static org.utplsql.maven.plugin.ReportChecker.reportExists; +@MavenGoal("test") @MavenJupiterExtension public class UtPlsqlMojoIT { From 606173ed5161d0f615f8ec9a48f7efb5e8edcd82 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Thu, 25 Nov 2021 18:07:29 +0100 Subject: [PATCH 117/200] Fixed paths --- README.md | 43 +++++++++++++-------- scripts/sql/create_app_objects.sql | 10 ++--- scripts/sql/create_source_owner_objects.sql | 6 +-- scripts/sql/create_tests_owner_objects.sql | 5 ++- 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index f4c170b..1d3d0a3 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,21 @@ [![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=org.utplsql%3Autplsql-maven-plugin&metric=alert_status)](https://sonarcloud.io/dashboard?id=org.utplsql%3Autplsql-maven-plugin) # utPLSQL-maven-plugin + A maven plugin for running Unit Tests with utPLSQL v3+. ## Compatibility + This plugin is compatible with utPLSQL 3.1.0+. ## Prerequisites + * Java SE Runtime Environment 8 * Maven Version 3.5+ -* Oracle JDBC driver +* Oracle JDBC driver ```xml + com.oracle.database.jdbc ojdbc8 @@ -27,6 +31,7 @@ This plugin is compatible with utPLSQL 3.1.0+. To skip running the tests for a particular project, set the **skipUtplsqlTests** property to true. ```xml + true @@ -38,9 +43,11 @@ You can also skip the tests via the command line by executing the following comm #### Skipping by Default -If you want to skip tests by default but want the ability to re-enable tests from the command line, you need to go via a properties section in the pom: +If you want to skip tests by default but want the ability to re-enable tests from the command line, you need to go via a +properties section in the pom: ```xml + true @@ -55,9 +62,10 @@ This will allow you to run with all tests disabled by default and to run them wi Please refer to the following usage example for the parameters descriptions: ```xml + + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.my_org @@ -90,7 +98,7 @@ Please refer to the following usage example for the parameters descriptions: - + @@ -115,7 +123,7 @@ Please refer to the following usage example for the parameters descriptions: - + src/test/resources/scripts/test @@ -125,13 +133,13 @@ Please refer to the following usage example for the parameters descriptions: - + - + false - + false @@ -153,17 +161,17 @@ Please refer to the following usage example for the parameters descriptions: true 5 - + app.test1,app.test2 - + app.test1,app.test2 - + @@ -194,7 +202,7 @@ Please refer to the following usage example for the parameters descriptions: UT_TEAMCITY_REPORTER - + code_owner @@ -208,7 +216,7 @@ Please refer to the following usage example for the parameters descriptions: package_bodies - + tests_owner @@ -231,9 +239,12 @@ Please refer to the following usage example for the parameters descriptions: ``` -More project samples are available in the src/test/resources/integration-tests directory: +More project samples are available in the `src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT` +directory: + * **simple-project:** Minimalist test project with standard project directory structure. -* **regex-project:** Overrides project directory structure and use additional parameters (sourcesRegexExpression, testsRegexExpression, ...), to tell utPLSQL how project files should be mapped into database objects. +* **regex-project:** Overrides project directory structure and use additional parameters (sourcesRegexExpression, + testsRegexExpression, ...), to tell utPLSQL how project files should be mapped into database objects. * **type-mapping-project:** Example how to use regex and custom type parameters together. * **owner-param-project:** Demonstrates how to use sourcesOwner and testsOwner parameters. diff --git a/scripts/sql/create_app_objects.sql b/scripts/sql/create_app_objects.sql index c6fd782..7c889cc 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/integration-tests/simple-project/scripts/sources/TO_TEST_ME.tab -@src/test/resources/integration-tests/simple-project/scripts/sources/APP.PKG_TEST_ME.spc -@src/test/resources/integration-tests/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy +@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/integration-tests/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc -@src/test/resources/integration-tests/simple-project/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.spc +@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/scripts/tests/APP.TEST_PKG_TEST_ME.bdy diff --git a/scripts/sql/create_source_owner_objects.sql b/scripts/sql/create_source_owner_objects.sql index bcaa9fb..d2cebe6 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/integration-tests/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab -@src/test/resources/integration-tests/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql -@src/test/resources/integration-tests/owner-param-project/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.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 diff --git a/scripts/sql/create_tests_owner_objects.sql b/scripts/sql/create_tests_owner_objects.sql index b6561e6..3fbcb1b 100644 --- a/scripts/sql/create_tests_owner_objects.sql +++ b/scripts/sql/create_tests_owner_objects.sql @@ -3,5 +3,6 @@ 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/integration-tests/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql -@src/test/resources/integration-tests/owner-param-project/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.sql +@src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql From f29d94b0a97e13f0236a88e0f0d37cfe9cc5eb40 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 08:03:24 +0100 Subject: [PATCH 118/200] Run only unit tests with sonar --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de4caff..b38b655 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,12 +56,15 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - - name: Maven verify and sonar + - name: Run unit tests with sonar run: mvn clean verify sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Run integration tests + run: mvn verify -Dskip.surefire.tests + - name: Maven deploy snapshot run: mvn deploy -DskipTests env: From 6ebd670d227a3242ae1fab4bd3de9a57a50de014 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 08:13:36 +0100 Subject: [PATCH 119/200] Run only unit tests with sonar --- .github/workflows/build.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b38b655..27be139 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,15 +56,12 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - - name: Run unit tests with sonar - run: mvn clean verify sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + - name: Maven test with sonar + run: mvn clean test sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - name: Run integration tests - run: mvn verify -Dskip.surefire.tests - - name: Maven deploy snapshot run: mvn deploy -DskipTests env: From a0c1d6d87d4fae71da2a4da0c26f6704b4e2c306 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 08:22:27 +0100 Subject: [PATCH 120/200] Removed public modifier on JUnit5 test methods --- .../org/utplsql/maven/plugin/UtPlsqlMojoTest.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 10998fe..ae9d63a 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -29,7 +29,7 @@ private UtPlsqlMojo createUtPlsqlMojo() { } @Test - public void junitReporter() throws MojoExecutionException { + void junitReporter() throws MojoExecutionException { UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); ReporterParameter junitReporter = new ReporterParameter(); @@ -44,7 +44,7 @@ public void junitReporter() throws MojoExecutionException { } @Test - public void absolutPath() throws MojoExecutionException { + void absolutPath() throws MojoExecutionException { UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); ReporterParameter junitReporter = new ReporterParameter(); @@ -68,7 +68,7 @@ public void absolutPath() throws MojoExecutionException { } @Test - public void parentDoesNotExist() throws MojoExecutionException { + void parentDoesNotExist() throws MojoExecutionException { UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); ReporterParameter junitReporter = new ReporterParameter(); @@ -83,7 +83,7 @@ public void parentDoesNotExist() throws MojoExecutionException { } @Test - public void onlyConsoleOutput() throws MojoExecutionException { + void onlyConsoleOutput() throws MojoExecutionException { UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); ReporterParameter junitReporter = new ReporterParameter(); @@ -97,7 +97,7 @@ public void onlyConsoleOutput() throws MojoExecutionException { } @Test - public void onlyFileOutput() throws MojoExecutionException { + void onlyFileOutput() throws MojoExecutionException { UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); ReporterParameter junitReporter = new ReporterParameter(); @@ -112,7 +112,7 @@ public void onlyFileOutput() throws MojoExecutionException { } @Test - public void skipUtplsqlTests() throws MojoExecutionException { + void skipUtplsqlTests() throws MojoExecutionException { UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); utPlsqlMojo.skipUtplsqlTests = true; @@ -128,7 +128,7 @@ public void skipUtplsqlTests() throws MojoExecutionException { } @Test - public void defaultReportAndExcludes() throws MojoExecutionException { + void defaultReportAndExcludes() throws MojoExecutionException { UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); utPlsqlMojo.excludeObject = "abc"; From 37ecacc50bdec23221a9ace8bc71d996591e60e9 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 08:28:08 +0100 Subject: [PATCH 121/200] Removed public modifier on JUnit5 test classes --- src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java | 2 +- src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java index 57f7c41..0b94af7 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java @@ -14,7 +14,7 @@ @MavenGoal("test") @MavenJupiterExtension -public class UtPlsqlMojoIT { +class UtPlsqlMojoIT { @MavenTest void minimalist(MavenExecutionResult result) { diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index ae9d63a..d0edcd0 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -12,7 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; -public class UtPlsqlMojoTest { +class UtPlsqlMojoTest { private UtPlsqlMojo createUtPlsqlMojo() { System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "debug"); From 8765679c5de504a96003c60ac339776440e38d1f Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 08:34:20 +0100 Subject: [PATCH 122/200] Reactivated verify --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27be139..53382c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,8 +56,8 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - - name: Maven test with sonar - run: mvn clean test sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin + - name: Maven unit and integration tests with sonar + run: mvn clean verify sonar:sonar -Pcoverage -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 3c27728a46e58c0bd870fc2e426943b990efe24e Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 08:36:17 +0100 Subject: [PATCH 123/200] Updated jacoco version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ddf7451..4a71c6d 100644 --- a/pom.xml +++ b/pom.xml @@ -277,7 +277,7 @@ org.jacoco jacoco-maven-plugin - 0.8.5 + 0.8.7 prepare-agent From d2057a17022f75460698e0dc33102d305a114e4d Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 08:42:54 +0100 Subject: [PATCH 124/200] Added Jacoco properties --- pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pom.xml b/pom.xml index 4a71c6d..c72e194 100644 --- a/pom.xml +++ b/pom.xml @@ -53,11 +53,18 @@ 1.8 1.8 UTF-8 + 3.5.2 2.3.1 0.11.0 + utplsql https://sonarcloud.io + + jacoco + reuseReports + ${project.basedir}/../target/jacoco.exec + java From 08253ea3dec8d6fe2bf30665f7f7234adadfa284 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 09:00:50 +0100 Subject: [PATCH 125/200] Unit test POM clean up --- pom.xml | 5 - .../utplsql/maven/plugin/MojoRuleTest.java | 280 ---------------- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 306 +++++++++++++----- .../plugin/UtPlsqlMojoIT/minimalist/pom.xml | 2 +- .../plugin/UtPlsqlMojoIT/owner_param/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/regex/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/simple/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/skip/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/tags/pom.xml | 2 +- .../plugin/UtPlsqlMojoIT/type_mapping/pom.xml | 2 +- .../resources/unit-tests/dbms-output/pom.xml | 15 +- .../default-console-output-behaviour/pom.xml | 18 +- .../unit-tests/default-reporter/pom.xml | 14 +- .../invalid-sources-directories/pom.xml | 19 +- .../invalid-tests-sources-directories/pom.xml | 16 +- .../missing-directory/pom.xml | 20 +- .../missing-includes/pom.xml | 14 +- .../unit-tests/skip-utplsql-tests/pom.xml | 21 +- .../directory-does-not-exist/pom.xml | 19 +- .../directory-exists/pom.xml | 17 +- .../test-sources-tests-params/pom.xml | 23 +- 21 files changed, 255 insertions(+), 546 deletions(-) delete mode 100644 src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java diff --git a/pom.xml b/pom.xml index c72e194..f248621 100644 --- a/pom.xml +++ b/pom.xml @@ -60,11 +60,6 @@ utplsql https://sonarcloud.io - - jacoco - reuseReports - ${project.basedir}/../target/jacoco.exec - java diff --git a/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java b/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java deleted file mode 100644 index ea9b96a..0000000 --- a/src/test/java/org/utplsql/maven/plugin/MojoRuleTest.java +++ /dev/null @@ -1,280 +0,0 @@ -package org.utplsql.maven.plugin; - -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.testing.MojoRule; -import org.junit.Rule; -import org.junit.Test; -import org.utplsql.api.FileMapperOptions; -import org.utplsql.maven.plugin.model.ReporterParameter; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.PrintStream; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; - -public class MojoRuleTest { - - @Rule - public final MojoRule rule = new MojoRule(); - - /** - * Invalid Sources Directory - *

- * Given : a pom.xml with invalid sources' directory - * When : pom is read and buildSourcesOptions is run - * Then : it should throw a MojoExecutionException - */ - @Test - public void invalidSourcesDirectory() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-sources-directories/"), "test"); - assertNotNull(utPlsqlMojo); - - MojoExecutionException exception = assertThrows(MojoExecutionException.class, utPlsqlMojo::execute); - - assertEquals("Directory foo does not exist!", exception.getMessage()); - } - - /** - * Invalid Tests Directory - *

- * Given : a pom.xml with invalid tests' directory - * When : pom is read and buildTestsOptions is run - * Then : it should throw a MojoExecutionException - */ - @Test - public void invalidTestsDirectory() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-tests-sources-directories/"), "test"); - assertNotNull(utPlsqlMojo); - - MojoExecutionException exception = assertThrows(MojoExecutionException.class, utPlsqlMojo::execute); - - assertEquals("Directory bar does not exist!", exception.getMessage()); - } - - /** - * Sources Tests Parameters - *

- * Given : a pom.xml with sources and tests with a lot of parameters - * When : pom is read and buildSourcesOptions / buildTestsOptions are run - * Then : it should fill all parameters correctly - */ - @Test - public void sourcesTestsParameters() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-sources-tests-params/"), "test"); - assertNotNull(utPlsqlMojo); - - assertEquals(2, utPlsqlMojo.reporters.size()); - - // check sources - FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); - assertEquals(1, sources.getFilePaths().size()); - assertEquals("srcs/foo.sql", sources.getFilePaths().get(0)); - assertEquals("code_owner", sources.getObjectOwner()); - assertEquals(".*/\\w+/(\\w+)/(\\w+)\\.\\w{3}", sources.getRegexPattern()); - assertEquals(Integer.valueOf(9), sources.getNameSubExpression()); - assertEquals(Integer.valueOf(1), sources.getTypeSubExpression()); - assertEquals(Integer.valueOf(4), sources.getOwnerSubExpression()); - assertEquals(1, sources.getTypeMappings().size()); - assertEquals("bar", sources.getTypeMappings().get(0).getKey()); - assertEquals("foo", sources.getTypeMappings().get(0).getValue()); - - // 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")); - assertEquals("tests_owner", tests.getObjectOwner()); - assertEquals(".*/\\w+/(\\w+)/(\\w+)\\.\\w{3}", tests.getRegexPattern()); - assertEquals(Integer.valueOf(54), tests.getNameSubExpression()); - assertEquals(Integer.valueOf(21), tests.getTypeSubExpression()); - assertEquals(Integer.valueOf(24), tests.getOwnerSubExpression()); - assertEquals(1, tests.getTypeMappings().size()); - assertEquals("def", tests.getTypeMappings().get(0).getKey()); - assertEquals("abc", tests.getTypeMappings().get(0).getValue()); - } - - /** - * Sources and Tests Parameter does not exist - *

- * Given : a pom.xml with no sources / tests tags and default directory does not exist. - * When : pom is read and buildSourcesOptions / buildTestsOptions are run - * Then : it should not find any source files - */ - @Test - public void sourcesAndTestsParameterDoesNotExist() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule.lookupConfiguredMojo( - new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/"), "test"); - assertNotNull(utPlsqlMojo); - - // check sources - FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); - assertEquals(0, sources.getFilePaths().size()); - - // check tests - FileMapperOptions tests = utPlsqlMojo.buildTestsOptions(); - assertEquals(0, tests.getFilePaths().size()); - } - - /** - * Sources and Tests Parameter does not exist but Default Directory exists - *

- * Given : a pom.xml with no sources / tests tags but default directory exists. - * When : pom is read and buildSourcesOptions / buildTestsOptions are run - * Then : it should find all sources/tests files in default directories - */ - @Test - public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/"), "test"); - assertNotNull(utPlsqlMojo); - - // check sources - FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); - assertEquals(2, sources.getFilePaths().size()); - assertTrue(sources.getFilePaths().contains("src/main/plsql/f1.sql")); - assertTrue(sources.getFilePaths().contains("src/main/plsql/f2.sql")); - - // check tests - FileMapperOptions tests = utPlsqlMojo.buildTestsOptions(); - assertEquals(2, tests.getFilePaths().size()); - assertTrue(tests.getFilePaths().contains("src/test/plsql/foo/f1.pkg")); - assertTrue(tests.getFilePaths().contains("src/test/plsql/f2.pkg")); - } - - /** - * Sources and Tests Parameter have not Directory Tag - *

- * Given : a pom.xml with source and test tag not containing a directory tag. - * When : pom is read and buildSourcesOptions / buildTestsOptions are run - * Then : it should find all sources/tests files in default directories - */ - @Test - public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/"), "test"); - assertNotNull(utPlsqlMojo); - - // check sources - FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); - assertEquals(2, sources.getFilePaths().size()); - assertTrue(sources.getFilePaths().contains("src/main/plsql/f1.sql")); - assertTrue(sources.getFilePaths().contains("src/main/plsql/foo/f2.sql")); - - // check tests - FileMapperOptions tests = utPlsqlMojo.buildTestsOptions(); - assertEquals(3, tests.getFilePaths().size()); - assertTrue(tests.getFilePaths().contains("src/test/plsql/foo/f1.pkg")); - assertTrue(tests.getFilePaths().contains("src/test/plsql/f2.pkg")); - assertTrue(tests.getFilePaths().contains("src/test/plsql/foo/f1.sql")); - } - - /** - * Sources and Tests Parameter have not Directory Tag - *

- * Given : a pom.xml with source and test tag not containing a directory tag. - * When : pom is read and buildSourcesOptions / buildTestsOptions are run - * Then : it should find all sources/tests files in default directories - */ - @Test - public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/"), "test"); - assertNotNull(utPlsqlMojo); - - // check sources - FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); - assertEquals(2, sources.getFilePaths().size()); - assertTrue(sources.getFilePaths().contains("src/main/foo/f1.sql")); - assertTrue(sources.getFilePaths().contains("src/main/foo/foo/f2.sql")); - - // check tests - FileMapperOptions tests = utPlsqlMojo.buildTestsOptions(); - assertEquals(2, tests.getFilePaths().size()); - assertTrue(tests.getFilePaths().contains("src/test/bar/foo/f1.pkg")); - assertTrue(tests.getFilePaths().contains("src/test/bar/f2.pkg")); - } - - /** - * Default Console Behaviour - */ - @Test - public void defaultConsoleBehaviour() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-console-output-behaviour/"), "test"); - assertNotNull(utPlsqlMojo); - - utPlsqlMojo.execute(); - - // Assert that we added only the necessary reporters to the writer. - List reporters = utPlsqlMojo.reporters; - assertEquals(3, reporters.size()); - - ReporterParameter reporterParameter1 = reporters.get(0); - assertTrue(reporterParameter1.isConsoleOutput()); - assertFalse(reporterParameter1.isFileOutput()); - - ReporterParameter reporterParameter2 = reporters.get(1); - assertFalse(reporterParameter2.isConsoleOutput()); - assertTrue(reporterParameter2.isFileOutput()); - - ReporterParameter reporterParameter3 = reporters.get(2); - assertTrue(reporterParameter3.isConsoleOutput()); - assertTrue(reporterParameter3.isFileOutput()); - } - - /** - * Default Reporter - */ - @Test - public void defaultReporter() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-reporter/"), "test"); - assertNotNull(utPlsqlMojo); - - utPlsqlMojo.execute(); - - assertEquals(1, utPlsqlMojo.reporters.size()); - assertEquals("UT_DOCUMENTATION_REPORTER", utPlsqlMojo.reporters.get(0).getName()); - } - - /** - * Skip utPLSQL Tests - */ - @Test - public void skipUtplsqlTests() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/skip-utplsql-tests/"), "test"); - assertNotNull(utPlsqlMojo); - - final ByteArrayOutputStream console = new ByteArrayOutputStream(); - System.setOut(new PrintStream(console)); - - utPlsqlMojo.execute(); - - String standardOutput = console.toString(); - - assertTrue(standardOutput.contains("utPLSQLTests are skipped.")); - } - - /** - * DBMS_OUTPUT - */ - @Test - public void dbmsOutput() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/dbms-output/"), "test"); - assertNotNull(utPlsqlMojo); - - utPlsqlMojo.execute(); - } - -} diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index d0edcd0..a3a2c22 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -1,121 +1,259 @@ package org.utplsql.maven.plugin; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.project.MavenProject; -import org.junit.jupiter.api.Test; -import org.utplsql.api.reporter.CoreReporters; +import org.apache.maven.plugin.testing.MojoRule; +import org.junit.Rule; +import org.junit.Test; +import org.utplsql.api.FileMapperOptions; import org.utplsql.maven.plugin.model.ReporterParameter; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.PrintStream; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; + +public class UtPlsqlMojoTest { + + @Rule + public final MojoRule rule = new MojoRule(); + + /** + * Invalid Sources Directory + *

+ * Given : a pom.xml with invalid sources' directory + * When : pom is read and buildSourcesOptions is run + * Then : it should throw a MojoExecutionException + */ + @Test + public void invalidSourcesDirectory() throws Exception { + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-sources-directories/"), "test"); + assertNotNull(utPlsqlMojo); -import static org.junit.jupiter.api.Assertions.assertTrue; - -class UtPlsqlMojoTest { - - private UtPlsqlMojo createUtPlsqlMojo() { - System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "debug"); - - UtPlsqlMojo utPlsqlMojo = new UtPlsqlMojo(); - utPlsqlMojo.project = new MavenProject(); - utPlsqlMojo.targetDir = "target"; - - utPlsqlMojo.url = "jdbc:oracle:thin:@127.0.0.1:1521:XE"; - utPlsqlMojo.user = "UT3"; - utPlsqlMojo.password = "UT3"; + MojoExecutionException exception = assertThrows(MojoExecutionException.class, utPlsqlMojo::execute); - return utPlsqlMojo; + assertEquals("Directory foo does not exist!", exception.getMessage()); } + /** + * Invalid Tests Directory + *

+ * Given : a pom.xml with invalid tests' directory + * When : pom is read and buildTestsOptions is run + * Then : it should throw a MojoExecutionException + */ @Test - void junitReporter() throws MojoExecutionException { - UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); - - ReporterParameter junitReporter = new ReporterParameter(); - junitReporter.setConsoleOutput(true); - junitReporter.setFileOutput("junit-report.xml"); - junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPlsqlMojo.reporters.add(junitReporter); + public void invalidTestsDirectory() throws Exception { + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-tests-sources-directories/"), "test"); + assertNotNull(utPlsqlMojo); - utPlsqlMojo.execute(); + MojoExecutionException exception = assertThrows(MojoExecutionException.class, utPlsqlMojo::execute); - assertTrue(new File("target/junit-report.xml").exists()); + assertEquals("Directory bar does not exist!", exception.getMessage()); } + /** + * Sources Tests Parameters + *

+ * Given : a pom.xml with sources and tests with a lot of parameters + * When : pom is read and buildSourcesOptions / buildTestsOptions are run + * Then : it should fill all parameters correctly + */ @Test - void absolutPath() throws MojoExecutionException { - UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); + public void sourcesTestsParameters() throws Exception { + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-sources-tests-params/"), "test"); + assertNotNull(utPlsqlMojo); + + assertEquals(2, utPlsqlMojo.reporters.size()); + + // check sources + FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); + assertEquals(1, sources.getFilePaths().size()); + assertEquals("srcs/foo.sql", sources.getFilePaths().get(0)); + assertEquals("code_owner", sources.getObjectOwner()); + assertEquals(".*/\\w+/(\\w+)/(\\w+)\\.\\w{3}", sources.getRegexPattern()); + assertEquals(Integer.valueOf(9), sources.getNameSubExpression()); + assertEquals(Integer.valueOf(1), sources.getTypeSubExpression()); + assertEquals(Integer.valueOf(4), sources.getOwnerSubExpression()); + assertEquals(1, sources.getTypeMappings().size()); + assertEquals("bar", sources.getTypeMappings().get(0).getKey()); + assertEquals("foo", sources.getTypeMappings().get(0).getValue()); + + // 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")); + assertEquals("tests_owner", tests.getObjectOwner()); + assertEquals(".*/\\w+/(\\w+)/(\\w+)\\.\\w{3}", tests.getRegexPattern()); + assertEquals(Integer.valueOf(54), tests.getNameSubExpression()); + assertEquals(Integer.valueOf(21), tests.getTypeSubExpression()); + assertEquals(Integer.valueOf(24), tests.getOwnerSubExpression()); + assertEquals(1, tests.getTypeMappings().size()); + assertEquals("def", tests.getTypeMappings().get(0).getKey()); + assertEquals("abc", tests.getTypeMappings().get(0).getValue()); + } - ReporterParameter junitReporter = new ReporterParameter(); - junitReporter.setConsoleOutput(true); + /** + * Sources and Tests Parameter does not exist + *

+ * Given : a pom.xml with no sources / tests tags and default directory does not exist. + * When : pom is read and buildSourcesOptions / buildTestsOptions are run + * Then : it should not find any source files + */ + @Test + public void sourcesAndTestsParameterDoesNotExist() throws Exception { + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule.lookupConfiguredMojo( + new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/"), "test"); + assertNotNull(utPlsqlMojo); + + // check sources + FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); + assertEquals(0, sources.getFilePaths().size()); + + // check tests + FileMapperOptions tests = utPlsqlMojo.buildTestsOptions(); + assertEquals(0, tests.getFilePaths().size()); + } - String os = System.getProperty("os.name"); - if (os.contains("Windows")) { - junitReporter.setFileOutput("c:/tmp/junit-report.xml"); - } else { - junitReporter.setFileOutput("/tmp/junit-report.xml"); - } - junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPlsqlMojo.reporters.add(junitReporter); + /** + * Sources and Tests Parameter does not exist but Default Directory exists + *

+ * Given : a pom.xml with no sources / tests tags but default directory exists. + * When : pom is read and buildSourcesOptions / buildTestsOptions are run + * Then : it should find all sources/tests files in default directories + */ + @Test + public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception { + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/"), "test"); + assertNotNull(utPlsqlMojo); + + // check sources + FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); + assertEquals(2, sources.getFilePaths().size()); + assertTrue(sources.getFilePaths().contains("src/main/plsql/f1.sql")); + assertTrue(sources.getFilePaths().contains("src/main/plsql/f2.sql")); + + // check tests + FileMapperOptions tests = utPlsqlMojo.buildTestsOptions(); + assertEquals(2, tests.getFilePaths().size()); + assertTrue(tests.getFilePaths().contains("src/test/plsql/foo/f1.pkg")); + assertTrue(tests.getFilePaths().contains("src/test/plsql/f2.pkg")); + } - utPlsqlMojo.execute(); - if (os.contains("Windows")) { - assertTrue(new File("c:/tmp/junit-report.xml").exists()); - } else { - assertTrue(new File("/tmp/junit-report.xml").exists()); - } + /** + * Sources and Tests Parameter have not Directory Tag + *

+ * Given : a pom.xml with source and test tag not containing a directory tag. + * When : pom is read and buildSourcesOptions / buildTestsOptions are run + * Then : it should find all sources/tests files in default directories + */ + @Test + public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/"), "test"); + assertNotNull(utPlsqlMojo); + + // check sources + FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); + assertEquals(2, sources.getFilePaths().size()); + assertTrue(sources.getFilePaths().contains("src/main/plsql/f1.sql")); + assertTrue(sources.getFilePaths().contains("src/main/plsql/foo/f2.sql")); + + // check tests + FileMapperOptions tests = utPlsqlMojo.buildTestsOptions(); + assertEquals(3, tests.getFilePaths().size()); + assertTrue(tests.getFilePaths().contains("src/test/plsql/foo/f1.pkg")); + assertTrue(tests.getFilePaths().contains("src/test/plsql/f2.pkg")); + assertTrue(tests.getFilePaths().contains("src/test/plsql/foo/f1.sql")); } + /** + * Sources and Tests Parameter have not Directory Tag + *

+ * Given : a pom.xml with source and test tag not containing a directory tag. + * When : pom is read and buildSourcesOptions / buildTestsOptions are run + * Then : it should find all sources/tests files in default directories + */ @Test - void parentDoesNotExist() throws MojoExecutionException { - UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); + public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/"), "test"); + assertNotNull(utPlsqlMojo); + + // check sources + FileMapperOptions sources = utPlsqlMojo.buildSourcesOptions(); + assertEquals(2, sources.getFilePaths().size()); + assertTrue(sources.getFilePaths().contains("src/main/foo/f1.sql")); + assertTrue(sources.getFilePaths().contains("src/main/foo/foo/f2.sql")); + + // check tests + FileMapperOptions tests = utPlsqlMojo.buildTestsOptions(); + assertEquals(2, tests.getFilePaths().size()); + assertTrue(tests.getFilePaths().contains("src/test/bar/foo/f1.pkg")); + assertTrue(tests.getFilePaths().contains("src/test/bar/f2.pkg")); + } - ReporterParameter junitReporter = new ReporterParameter(); - junitReporter.setConsoleOutput(true); - junitReporter.setFileOutput("not-exist/junit-report.xml"); - junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPlsqlMojo.reporters.add(junitReporter); + /** + * Default Console Behaviour + */ + @Test + public void defaultConsoleBehaviour() throws Exception { + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-console-output-behaviour/"), "test"); + assertNotNull(utPlsqlMojo); utPlsqlMojo.execute(); - assertTrue(new File("target/not-exist/junit-report.xml").exists()); - } + // Assert that we added only the necessary reporters to the writer. + List reporters = utPlsqlMojo.reporters; + assertEquals(3, reporters.size()); - @Test - void onlyConsoleOutput() throws MojoExecutionException { - UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); + ReporterParameter reporterParameter1 = reporters.get(0); + assertTrue(reporterParameter1.isConsoleOutput()); + assertFalse(reporterParameter1.isFileOutput()); - ReporterParameter junitReporter = new ReporterParameter(); - junitReporter.setConsoleOutput(true); - junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPlsqlMojo.reporters.add(junitReporter); + ReporterParameter reporterParameter2 = reporters.get(1); + assertFalse(reporterParameter2.isConsoleOutput()); + assertTrue(reporterParameter2.isFileOutput()); - utPlsqlMojo.execute(); - - assertTrue(new File("target/not-exist/junit-report.xml").exists()); + ReporterParameter reporterParameter3 = reporters.get(2); + assertTrue(reporterParameter3.isConsoleOutput()); + assertTrue(reporterParameter3.isFileOutput()); } + /** + * Default Reporter + */ @Test - void onlyFileOutput() throws MojoExecutionException { - UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); - - ReporterParameter junitReporter = new ReporterParameter(); - junitReporter.setConsoleOutput(false); - junitReporter.setFileOutput("not-exist/junit-report.xml"); - junitReporter.setName(CoreReporters.UT_JUNIT_REPORTER.name()); - utPlsqlMojo.reporters.add(junitReporter); + public void defaultReporter() throws Exception { + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-reporter/"), "test"); + assertNotNull(utPlsqlMojo); utPlsqlMojo.execute(); - assertTrue(new File("target/not-exist/junit-report.xml").exists()); + assertEquals(1, utPlsqlMojo.reporters.size()); + assertEquals("UT_DOCUMENTATION_REPORTER", utPlsqlMojo.reporters.get(0).getName()); } + /** + * Skip utPLSQL Tests + */ @Test - void skipUtplsqlTests() throws MojoExecutionException { - UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); - - utPlsqlMojo.skipUtplsqlTests = true; + public void skipUtplsqlTests() throws Exception { + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/skip-utplsql-tests/"), "test"); + assertNotNull(utPlsqlMojo); final ByteArrayOutputStream console = new ByteArrayOutputStream(); System.setOut(new PrintStream(console)); @@ -127,12 +265,14 @@ void skipUtplsqlTests() throws MojoExecutionException { assertTrue(standardOutput.contains("utPLSQLTests are skipped.")); } + /** + * DBMS_OUTPUT + */ @Test - void defaultReportAndExcludes() throws MojoExecutionException { - UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo(); - - utPlsqlMojo.excludeObject = "abc"; - utPlsqlMojo.includeObject = "xyz"; + public void dbmsOutput() throws Exception { + UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule + .lookupConfiguredMojo(new File("src/test/resources/unit-tests/dbms-output/"), "test"); + assertNotNull(utPlsqlMojo); utPlsqlMojo.execute(); } diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml index 74e6893..40759d2 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml @@ -17,7 +17,7 @@ - ${project.groupId} + org.utplsql utplsql-maven-plugin @project.version@ 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 58fc29e..c523eab 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 @@ -17,7 +17,7 @@ - ${project.groupId} + org.utplsql utplsql-maven-plugin @project.version@ 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 913e14c..036785a 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 @@ -17,7 +17,7 @@ - ${project.groupId} + org.utplsql utplsql-maven-plugin @project.version@ 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 a0ad975..be0d8b6 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 @@ -17,7 +17,7 @@ - ${project.groupId} + org.utplsql utplsql-maven-plugin @project.version@ 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 9736703..57911d0 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 @@ -17,7 +17,7 @@ - ${project.groupId} + org.utplsql utplsql-maven-plugin @project.version@ 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 7e3eaef..433d2c0 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 @@ -17,7 +17,7 @@ - ${project.groupId} + org.utplsql utplsql-maven-plugin @project.version@ 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 e50c729..e50ba96 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 @@ -17,7 +17,7 @@ - ${project.groupId} + org.utplsql utplsql-maven-plugin @project.version@ diff --git a/src/test/resources/unit-tests/dbms-output/pom.xml b/src/test/resources/unit-tests/dbms-output/pom.xml index 1686790..03ad1fa 100644 --- a/src/test/resources/unit-tests/dbms-output/pom.xml +++ b/src/test/resources/unit-tests/dbms-output/pom.xml @@ -6,13 +6,8 @@ org.utplsql utplsql-maven-plugin-test 3.1.0-SNAPSHOT - pom - utplsql-maven-plugin Maven Plugin Test - - http://utplsql.org - jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 @@ -20,28 +15,20 @@ - - ../../../target/ - org.utplsql utplsql-maven-plugin - {project.version} - + @proj test - true - false - app - UT_DOCUMENTATION_REPORTER diff --git a/src/test/resources/unit-tests/default-console-output-behaviour/pom.xml b/src/test/resources/unit-tests/default-console-output-behaviour/pom.xml index 8893527..1e9a727 100644 --- a/src/test/resources/unit-tests/default-console-output-behaviour/pom.xml +++ b/src/test/resources/unit-tests/default-console-output-behaviour/pom.xml @@ -1,18 +1,13 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql utplsql-maven-plugin-test 3.1.0-SNAPSHOT - pom - utplsql-maven-plugin Maven Plugin Test - - http://utplsql.org - jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 @@ -20,26 +15,19 @@ - - ../../../target/ - org.utplsql utplsql-maven-plugin - {project.version} - + @project.version@ test - false - app - UT_DOCUMENTATION_REPORTER diff --git a/src/test/resources/unit-tests/default-reporter/pom.xml b/src/test/resources/unit-tests/default-reporter/pom.xml index bf87881..d795551 100644 --- a/src/test/resources/unit-tests/default-reporter/pom.xml +++ b/src/test/resources/unit-tests/default-reporter/pom.xml @@ -6,13 +6,8 @@ org.utplsql utplsql-maven-plugin-test 3.1.0-SNAPSHOT - pom - utplsql-maven-plugin Maven Plugin Test - - http://utplsql.org - jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 @@ -20,26 +15,19 @@ - - ../../../target/ - org.utplsql utplsql-maven-plugin - {project.version} - + @project.version@ test - false - app - UT_DOCUMENTATION_REPORTER diff --git a/src/test/resources/unit-tests/invalid-sources-directories/pom.xml b/src/test/resources/unit-tests/invalid-sources-directories/pom.xml index cc08c4f..166bbd0 100644 --- a/src/test/resources/unit-tests/invalid-sources-directories/pom.xml +++ b/src/test/resources/unit-tests/invalid-sources-directories/pom.xml @@ -1,18 +1,13 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql utplsql-maven-plugin-test 3.1.0-SNAPSHOT - pom - utplsql-maven-plugin Maven Plugin Test - - http://utplsql.org - jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 @@ -20,27 +15,20 @@ - ../../../target/ - org.utplsql utplsql-maven-plugin - {project.version} - + @project.version@ test - - false - :plsql - UT_COVERAGE_SONAR_REPORTER @@ -53,7 +41,6 @@ true - foo diff --git a/src/test/resources/unit-tests/invalid-tests-sources-directories/pom.xml b/src/test/resources/unit-tests/invalid-tests-sources-directories/pom.xml index a595503..fe13c52 100644 --- a/src/test/resources/unit-tests/invalid-tests-sources-directories/pom.xml +++ b/src/test/resources/unit-tests/invalid-tests-sources-directories/pom.xml @@ -6,13 +6,8 @@ org.utplsql utplsql-maven-plugin-test 3.1.0-SNAPSHOT - pom - utplsql-maven-plugin Maven Plugin Test - - http://utplsql.org - jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 @@ -20,27 +15,19 @@ - - ../../../target/ - org.utplsql utplsql-maven-plugin - {project.version} - + @project.version@ test - - false - :plsql - UT_COVERAGE_SONAR_REPORTER @@ -53,7 +40,6 @@ true - bar diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/pom.xml b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/pom.xml index ff0504e..d585276 100644 --- a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/pom.xml +++ b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/pom.xml @@ -1,18 +1,13 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql utplsql-maven-plugin-test 3.1.0-SNAPSHOT - pom - utplsql-maven-plugin Maven Plugin Test - - http://utplsql.org - jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 @@ -20,25 +15,19 @@ - org.utplsql utplsql-maven-plugin - {project.version} - + @project.version@ test - - false - :plsql - UT_COVERAGE_SONAR_REPORTER @@ -51,7 +40,6 @@ true - @@ -59,12 +47,10 @@ - **/*sql - diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/pom.xml b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/pom.xml index 880d589..fe6eddc 100644 --- a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/pom.xml +++ b/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/pom.xml @@ -9,10 +9,6 @@ pom - utplsql-maven-plugin Maven Plugin Test - - http://utplsql.org - jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 @@ -20,25 +16,19 @@ - org.utplsql utplsql-maven-plugin - {project.version} - + @project.version@ test - - false - :plsql - UT_COVERAGE_SONAR_REPORTER @@ -51,13 +41,11 @@ true - src/main/foo - src/test/bar 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 9928d09..9d8d409 100644 --- a/src/test/resources/unit-tests/skip-utplsql-tests/pom.xml +++ b/src/test/resources/unit-tests/skip-utplsql-tests/pom.xml @@ -1,18 +1,13 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql utplsql-maven-plugin-test 3.1.0-SNAPSHOT - pom - utplsql-maven-plugin Maven Plugin Test - - http://utplsql.org - jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 @@ -20,28 +15,20 @@ - - ../../../target/ - org.utplsql utplsql-maven-plugin - {project.version} - + @project.version@ test - true - false - :plsql - UT_DOCUMENTATION_REPORTER @@ -60,7 +47,6 @@ true - foo @@ -69,7 +55,6 @@ - bar diff --git a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/pom.xml b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/pom.xml index 7d4179f..016631d 100644 --- a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/pom.xml +++ b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/pom.xml @@ -1,18 +1,13 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql utplsql-maven-plugin-test 3.1.0-SNAPSHOT - pom - utplsql-maven-plugin Maven Plugin Test - - http://utplsql.org - jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 @@ -20,27 +15,19 @@ - - ../../../target/ - org.utplsql utplsql-maven-plugin - {project.version} - + @project.version@ test - - false - :plsql - UT_COVERAGE_SONAR_REPORTER diff --git a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/pom.xml b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/pom.xml index 281763f..016631d 100644 --- a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/pom.xml +++ b/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/pom.xml @@ -1,18 +1,13 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql utplsql-maven-plugin-test 3.1.0-SNAPSHOT - pom - utplsql-maven-plugin Maven Plugin Test - - http://utplsql.org - jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 @@ -20,25 +15,19 @@ - org.utplsql utplsql-maven-plugin - {project.version} - + @project.version@ test - - false - :plsql - UT_COVERAGE_SONAR_REPORTER diff --git a/src/test/resources/unit-tests/test-sources-tests-params/pom.xml b/src/test/resources/unit-tests/test-sources-tests-params/pom.xml index dcacf3e..d552f9c 100644 --- a/src/test/resources/unit-tests/test-sources-tests-params/pom.xml +++ b/src/test/resources/unit-tests/test-sources-tests-params/pom.xml @@ -1,18 +1,13 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql utplsql-maven-plugin-test 3.1.0-SNAPSHOT - pom - utplsql-maven-plugin Maven Plugin Test - - http://utplsql.org - jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 @@ -20,27 +15,19 @@ - - ../../../target/ - org.utplsql utplsql-maven-plugin - {project.version} - + @project.version@ test - - false - :plsql - UT_COVERAGE_SONAR_REPORTER @@ -53,7 +40,6 @@ true - srcs @@ -62,7 +48,6 @@ - code_owner .*/\w+/(\w+)/(\w+)\.\w{3} 9 @@ -74,7 +59,6 @@ bar - te/st @@ -84,7 +68,6 @@ - tests_owner .*/\w+/(\w+)/(\w+)\.\w{3} 24 From c388d2210f45484584afb06766203c9d7317c681 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 09:09:13 +0100 Subject: [PATCH 126/200] Migrated to Junit5 using vintage-engine --- pom.xml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index f248621..a8bbac6 100644 --- a/pom.xml +++ b/pom.xml @@ -150,6 +150,11 @@ junit-jupiter-engine test + + org.junit.vintage + junit-vintage-engine + + com.soebes.itf.jupiter.extension itf-jupiter-extension @@ -163,13 +168,6 @@ test - - junit - junit - 4.13.2 - test - - commons-io commons-io From 55fa91942c5fff0499d260245dd51b6e802ccb3f Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 09:16:32 +0100 Subject: [PATCH 127/200] Update versions for development branch --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a8bbac6..951fe54 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.6-maven-it-extension-SNAPSHOT + 3.1.6-SNAPSHOT maven-plugin utPLSQL Maven Plugin From dfdd18c90e713cbc5f2555ff9081d47bed0fd21a Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 09:50:45 +0100 Subject: [PATCH 128/200] Rearanged tests --- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 103 ++++++++++++------ .../{dbms-output => dbms_output}/pom.xml | 0 .../pom.xml | 0 .../pom.xml | 0 .../pom.xml | 0 .../pom.xml | 0 .../pom.xml | 0 .../pom.xml | 0 .../pom.xml | 0 .../src/main/plsql/f1.sql | 0 .../src/main/plsql}/f2.sql | 0 .../src/test/plsql/f2.pkg | 0 .../src/test/plsql/foo/f1.pkg | 0 .../src/test/plsql/foo/f1.sql | 0 .../pom.xml | 0 .../src/main/plsql}/f1.sql | 0 .../src/main/plsql}/foo/f2.sql | 0 .../src/test/plsql}/f2.pkg | 0 .../src/test/plsql}/foo/f1.pkg | 0 .../src/test/plsql}/foo/f1.sql | 0 .../pom.xml | 0 .../src/main/foo}/f1.sql | 0 .../src/main/foo/foo}/f2.sql | 0 .../src/test/bar}/f2.pkg | 0 .../src/test/bar}/foo/f1.pkg | 0 .../src/test/bar}/foo/f1.sql | 0 .../pom.xml | 0 .../srcs/file.bdy | 0 .../srcs/foo.sql | 0 .../srcs/spec.spc | 0 .../te/st/file.bdy | 0 .../te/st/foo.sql | 0 .../te/st/spec.spc | 0 33 files changed, 68 insertions(+), 35 deletions(-) rename src/test/resources/unit-tests/{dbms-output => dbms_output}/pom.xml (100%) rename src/test/resources/unit-tests/{default-console-output-behaviour => default_console_output_behaviour}/pom.xml (100%) rename src/test/resources/unit-tests/{default-reporter => default_reporter}/pom.xml (100%) rename src/test/resources/unit-tests/{invalid-sources-directories => invalid_sources_directory}/pom.xml (100%) rename src/test/resources/unit-tests/{invalid-tests-sources-directories => invalid_tests_directory}/pom.xml (100%) rename src/test/resources/unit-tests/{skip-utplsql-tests => skip_utplsql_tests}/pom.xml (100%) rename src/test/resources/unit-tests/{test-no-sources-tests-params/directory-does-not-exist => sources_and_tests_parameter_does_not_exist}/pom.xml (100%) rename src/test/resources/unit-tests/{test-no-sources-tests-params/directory-exists => sources_and_tests_parameter_does_not_exist_but_default_directory_exists}/pom.xml (100%) rename src/test/resources/unit-tests/{partial-source-and-test-tag/missing-directory => sources_and_tests_parameter_does_not_exist_but_default_directory_exists}/src/main/plsql/f1.sql (100%) rename src/test/resources/unit-tests/{partial-source-and-test-tag/missing-directory/src/main/plsql/foo => sources_and_tests_parameter_does_not_exist_but_default_directory_exists/src/main/plsql}/f2.sql (100%) rename src/test/resources/unit-tests/{partial-source-and-test-tag/missing-directory => sources_and_tests_parameter_does_not_exist_but_default_directory_exists}/src/test/plsql/f2.pkg (100%) rename src/test/resources/unit-tests/{partial-source-and-test-tag/missing-directory => sources_and_tests_parameter_does_not_exist_but_default_directory_exists}/src/test/plsql/foo/f1.pkg (100%) rename src/test/resources/unit-tests/{partial-source-and-test-tag/missing-directory => sources_and_tests_parameter_does_not_exist_but_default_directory_exists}/src/test/plsql/foo/f1.sql (100%) rename src/test/resources/unit-tests/{partial-source-and-test-tag/missing-directory => sources_and_tests_parameter_have_not_directory_tag}/pom.xml (100%) rename src/test/resources/unit-tests/{partial-source-and-test-tag/missing-includes/src/main/foo => sources_and_tests_parameter_have_not_directory_tag/src/main/plsql}/f1.sql (100%) rename src/test/resources/unit-tests/{partial-source-and-test-tag/missing-includes/src/main/foo => sources_and_tests_parameter_have_not_directory_tag/src/main/plsql}/foo/f2.sql (100%) rename src/test/resources/unit-tests/{partial-source-and-test-tag/missing-includes/src/test/bar => sources_and_tests_parameter_have_not_directory_tag/src/test/plsql}/f2.pkg (100%) rename src/test/resources/unit-tests/{partial-source-and-test-tag/missing-includes/src/test/bar => sources_and_tests_parameter_have_not_directory_tag/src/test/plsql}/foo/f1.pkg (100%) rename src/test/resources/unit-tests/{partial-source-and-test-tag/missing-includes/src/test/bar => sources_and_tests_parameter_have_not_directory_tag/src/test/plsql}/foo/f1.sql (100%) rename src/test/resources/unit-tests/{partial-source-and-test-tag/missing-includes => sources_and_tests_parameter_have_not_includes_tag}/pom.xml (100%) rename src/test/resources/unit-tests/{test-no-sources-tests-params/directory-exists/src/main/plsql => sources_and_tests_parameter_have_not_includes_tag/src/main/foo}/f1.sql (100%) rename src/test/resources/unit-tests/{test-no-sources-tests-params/directory-exists/src/main/plsql => sources_and_tests_parameter_have_not_includes_tag/src/main/foo/foo}/f2.sql (100%) rename src/test/resources/unit-tests/{test-no-sources-tests-params/directory-exists/src/test/plsql => sources_and_tests_parameter_have_not_includes_tag/src/test/bar}/f2.pkg (100%) rename src/test/resources/unit-tests/{test-no-sources-tests-params/directory-exists/src/test/plsql => sources_and_tests_parameter_have_not_includes_tag/src/test/bar}/foo/f1.pkg (100%) rename src/test/resources/unit-tests/{test-no-sources-tests-params/directory-exists/src/test/plsql => sources_and_tests_parameter_have_not_includes_tag/src/test/bar}/foo/f1.sql (100%) rename src/test/resources/unit-tests/{test-sources-tests-params => sources_tests_parameters}/pom.xml (100%) rename src/test/resources/unit-tests/{test-sources-tests-params => sources_tests_parameters}/srcs/file.bdy (100%) rename src/test/resources/unit-tests/{test-sources-tests-params => sources_tests_parameters}/srcs/foo.sql (100%) rename src/test/resources/unit-tests/{test-sources-tests-params => sources_tests_parameters}/srcs/spec.spc (100%) rename src/test/resources/unit-tests/{test-sources-tests-params => sources_tests_parameters}/te/st/file.bdy (100%) rename src/test/resources/unit-tests/{test-sources-tests-params => sources_tests_parameters}/te/st/foo.sql (100%) rename src/test/resources/unit-tests/{test-sources-tests-params => sources_tests_parameters}/te/st/spec.spc (100%) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index a3a2c22..451701b 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -31,9 +31,8 @@ public class UtPlsqlMojoTest { * Then : it should throw a MojoExecutionException */ @Test - public void invalidSourcesDirectory() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-sources-directories/"), "test"); + public void invalid_sources_directory() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("invalid_sources_directory"); assertNotNull(utPlsqlMojo); MojoExecutionException exception = assertThrows(MojoExecutionException.class, utPlsqlMojo::execute); @@ -49,9 +48,8 @@ public void invalidSourcesDirectory() throws Exception { * Then : it should throw a MojoExecutionException */ @Test - public void invalidTestsDirectory() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/invalid-tests-sources-directories/"), "test"); + public void invalid_tests_directory() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("invalid_tests_directory"); assertNotNull(utPlsqlMojo); MojoExecutionException exception = assertThrows(MojoExecutionException.class, utPlsqlMojo::execute); @@ -67,9 +65,8 @@ public void invalidTestsDirectory() throws Exception { * Then : it should fill all parameters correctly */ @Test - public void sourcesTestsParameters() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-sources-tests-params/"), "test"); + public void sources_tests_parameters() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("sources_tests_parameters"); assertNotNull(utPlsqlMojo); assertEquals(2, utPlsqlMojo.reporters.size()); @@ -110,9 +107,8 @@ public void sourcesTestsParameters() throws Exception { * Then : it should not find any source files */ @Test - public void sourcesAndTestsParameterDoesNotExist() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule.lookupConfiguredMojo( - new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/"), "test"); + public void sources_and_tests_parameter_does_not_exist() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("sources_and_tests_parameter_does_not_exist"); assertNotNull(utPlsqlMojo); // check sources @@ -132,9 +128,8 @@ public void sourcesAndTestsParameterDoesNotExist() throws Exception { * Then : it should find all sources/tests files in default directories */ @Test - public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/"), "test"); + public void sources_and_tests_parameter_does_not_exist_but_default_directory_exists() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("sources_and_tests_parameter_does_not_exist_but_default_directory_exists"); assertNotNull(utPlsqlMojo); // check sources @@ -158,9 +153,8 @@ public void sourcesAndTestsParameterDoesNotExistButDefaultDirectoryExists() thro * Then : it should find all sources/tests files in default directories */ @Test - public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/"), "test"); + public void sources_and_tests_parameter_have_not_directory_tag() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("sources_and_tests_parameter_have_not_directory_tag"); assertNotNull(utPlsqlMojo); // check sources @@ -185,9 +179,8 @@ public void sourcesAndTestsParameterHaveNotDirectoryTag() throws Exception { * Then : it should find all sources/tests files in default directories */ @Test - public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/"), "test"); + public void sources_and_tests_parameter_have_not_includes_tag() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("sources_and_tests_parameter_have_not_includes_tag"); assertNotNull(utPlsqlMojo); // check sources @@ -205,11 +198,14 @@ public void sourcesAndTestsParameterHaveNotIncludesTag() throws Exception { /** * Default Console Behaviour + *

+ * Given : a pom.xml with file and console output + * When : pom is read + * Then : it should set the correct output channels */ @Test - public void defaultConsoleBehaviour() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-console-output-behaviour/"), "test"); + public void default_console_output_behaviour() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("default_console_output_behaviour"); assertNotNull(utPlsqlMojo); utPlsqlMojo.execute(); @@ -233,11 +229,14 @@ public void defaultConsoleBehaviour() throws Exception { /** * Default Reporter + *

+ * Given : a pom.xml without reporters + * When : pom is read + * Then : it should set the default reporter */ @Test - public void defaultReporter() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/default-reporter/"), "test"); + public void default_reporter() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("default_reporter"); assertNotNull(utPlsqlMojo); utPlsqlMojo.execute(); @@ -247,12 +246,15 @@ public void defaultReporter() throws Exception { } /** - * Skip utPLSQL Tests + * Default Reporter + *

+ * Given : a pom.xml with skipUtplsqlTests=true + * When : pom is read + * Then : Tests are skipped */ @Test - public void skipUtplsqlTests() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/skip-utplsql-tests/"), "test"); + public void skip_utplsql_tests() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("skip_utplsql_tests"); assertNotNull(utPlsqlMojo); final ByteArrayOutputStream console = new ByteArrayOutputStream(); @@ -266,15 +268,46 @@ public void skipUtplsqlTests() throws Exception { } /** - * DBMS_OUTPUT + * Enable DBMS_OUTPUT + *

+ * Given : a pom.xml with dbmsOutput=true + * When : pom is read + * Then : DBMS_OUTPUT is enabled */ @Test - public void dbmsOutput() throws Exception { - UtPlsqlMojo utPlsqlMojo = (UtPlsqlMojo) rule - .lookupConfiguredMojo(new File("src/test/resources/unit-tests/dbms-output/"), "test"); + public void dbms_output() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("dbms_output"); assertNotNull(utPlsqlMojo); utPlsqlMojo.execute(); } + /** + * DB configuration from System Properties + *

+ * Given : a pom.xml without dbUrl, dbUser and dbPass configured + * When : pom is read + * Then : System Properties must be used to configure database + */ + @Test + public void db_config_using_system_properties() throws Exception { + System.setProperty("dbUrl", "jdbc:oracle:thin:@localhost:1521:xe"); + System.setProperty("dbUser", "UT3"); + System.setProperty("dbPass", "UT3"); + + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("dbms_output"); + assertNotNull(utPlsqlMojo); + + utPlsqlMojo.execute(); + + System.setProperty("dbUrl", ""); + System.setProperty("dbUser", ""); + System.setProperty("dbPass", ""); + + } + + private UtPlsqlMojo createUtPlsqlMojo(String directory) throws Exception { + return (UtPlsqlMojo) rule.lookupConfiguredMojo(new File("src/test/resources/unit-tests/" + directory), "test"); + } + } diff --git a/src/test/resources/unit-tests/dbms-output/pom.xml b/src/test/resources/unit-tests/dbms_output/pom.xml similarity index 100% rename from src/test/resources/unit-tests/dbms-output/pom.xml rename to src/test/resources/unit-tests/dbms_output/pom.xml diff --git a/src/test/resources/unit-tests/default-console-output-behaviour/pom.xml b/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml similarity index 100% rename from src/test/resources/unit-tests/default-console-output-behaviour/pom.xml rename to src/test/resources/unit-tests/default_console_output_behaviour/pom.xml diff --git a/src/test/resources/unit-tests/default-reporter/pom.xml b/src/test/resources/unit-tests/default_reporter/pom.xml similarity index 100% rename from src/test/resources/unit-tests/default-reporter/pom.xml rename to src/test/resources/unit-tests/default_reporter/pom.xml diff --git a/src/test/resources/unit-tests/invalid-sources-directories/pom.xml b/src/test/resources/unit-tests/invalid_sources_directory/pom.xml similarity index 100% rename from src/test/resources/unit-tests/invalid-sources-directories/pom.xml rename to src/test/resources/unit-tests/invalid_sources_directory/pom.xml diff --git a/src/test/resources/unit-tests/invalid-tests-sources-directories/pom.xml b/src/test/resources/unit-tests/invalid_tests_directory/pom.xml similarity index 100% rename from src/test/resources/unit-tests/invalid-tests-sources-directories/pom.xml rename to src/test/resources/unit-tests/invalid_tests_directory/pom.xml diff --git a/src/test/resources/unit-tests/skip-utplsql-tests/pom.xml b/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml similarity index 100% rename from src/test/resources/unit-tests/skip-utplsql-tests/pom.xml rename to src/test/resources/unit-tests/skip_utplsql_tests/pom.xml diff --git a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml similarity index 100% rename from src/test/resources/unit-tests/test-no-sources-tests-params/directory-does-not-exist/pom.xml rename to src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml diff --git a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml similarity index 100% rename from src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/pom.xml rename to src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/main/plsql/f1.sql b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/src/main/plsql/f1.sql similarity index 100% rename from src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/main/plsql/f1.sql rename to src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/src/main/plsql/f1.sql diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/main/plsql/foo/f2.sql b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/src/main/plsql/f2.sql similarity index 100% rename from src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/main/plsql/foo/f2.sql rename to src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/src/main/plsql/f2.sql diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/test/plsql/f2.pkg b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/src/test/plsql/f2.pkg similarity index 100% rename from src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/test/plsql/f2.pkg rename to src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/src/test/plsql/f2.pkg diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/test/plsql/foo/f1.pkg b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/src/test/plsql/foo/f1.pkg similarity index 100% rename from src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/test/plsql/foo/f1.pkg rename to src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/src/test/plsql/foo/f1.pkg diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/test/plsql/foo/f1.sql b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/src/test/plsql/foo/f1.sql similarity index 100% rename from src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/src/test/plsql/foo/f1.sql rename to src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/src/test/plsql/foo/f1.sql diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml similarity index 100% rename from src/test/resources/unit-tests/partial-source-and-test-tag/missing-directory/pom.xml rename to src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/main/foo/f1.sql b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/src/main/plsql/f1.sql similarity index 100% rename from src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/main/foo/f1.sql rename to src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/src/main/plsql/f1.sql diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/main/foo/foo/f2.sql b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/src/main/plsql/foo/f2.sql similarity index 100% rename from src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/main/foo/foo/f2.sql rename to src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/src/main/plsql/foo/f2.sql diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/test/bar/f2.pkg b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/src/test/plsql/f2.pkg similarity index 100% rename from src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/test/bar/f2.pkg rename to src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/src/test/plsql/f2.pkg diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/test/bar/foo/f1.pkg b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/src/test/plsql/foo/f1.pkg similarity index 100% rename from src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/test/bar/foo/f1.pkg rename to src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/src/test/plsql/foo/f1.pkg diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/test/bar/foo/f1.sql b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/src/test/plsql/foo/f1.sql similarity index 100% rename from src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/src/test/bar/foo/f1.sql rename to src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/src/test/plsql/foo/f1.sql diff --git a/src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml similarity index 100% rename from src/test/resources/unit-tests/partial-source-and-test-tag/missing-includes/pom.xml rename to src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml diff --git a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/main/plsql/f1.sql b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/src/main/foo/f1.sql similarity index 100% rename from src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/main/plsql/f1.sql rename to src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/src/main/foo/f1.sql diff --git a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/main/plsql/f2.sql b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/src/main/foo/foo/f2.sql similarity index 100% rename from src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/main/plsql/f2.sql rename to src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/src/main/foo/foo/f2.sql diff --git a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/test/plsql/f2.pkg b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/src/test/bar/f2.pkg similarity index 100% rename from src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/test/plsql/f2.pkg rename to src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/src/test/bar/f2.pkg diff --git a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/test/plsql/foo/f1.pkg b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/src/test/bar/foo/f1.pkg similarity index 100% rename from src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/test/plsql/foo/f1.pkg rename to src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/src/test/bar/foo/f1.pkg diff --git a/src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/test/plsql/foo/f1.sql b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/src/test/bar/foo/f1.sql similarity index 100% rename from src/test/resources/unit-tests/test-no-sources-tests-params/directory-exists/src/test/plsql/foo/f1.sql rename to src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/src/test/bar/foo/f1.sql diff --git a/src/test/resources/unit-tests/test-sources-tests-params/pom.xml b/src/test/resources/unit-tests/sources_tests_parameters/pom.xml similarity index 100% rename from src/test/resources/unit-tests/test-sources-tests-params/pom.xml rename to src/test/resources/unit-tests/sources_tests_parameters/pom.xml diff --git a/src/test/resources/unit-tests/test-sources-tests-params/srcs/file.bdy b/src/test/resources/unit-tests/sources_tests_parameters/srcs/file.bdy similarity index 100% rename from src/test/resources/unit-tests/test-sources-tests-params/srcs/file.bdy rename to src/test/resources/unit-tests/sources_tests_parameters/srcs/file.bdy diff --git a/src/test/resources/unit-tests/test-sources-tests-params/srcs/foo.sql b/src/test/resources/unit-tests/sources_tests_parameters/srcs/foo.sql similarity index 100% rename from src/test/resources/unit-tests/test-sources-tests-params/srcs/foo.sql rename to src/test/resources/unit-tests/sources_tests_parameters/srcs/foo.sql diff --git a/src/test/resources/unit-tests/test-sources-tests-params/srcs/spec.spc b/src/test/resources/unit-tests/sources_tests_parameters/srcs/spec.spc similarity index 100% rename from src/test/resources/unit-tests/test-sources-tests-params/srcs/spec.spc rename to src/test/resources/unit-tests/sources_tests_parameters/srcs/spec.spc diff --git a/src/test/resources/unit-tests/test-sources-tests-params/te/st/file.bdy b/src/test/resources/unit-tests/sources_tests_parameters/te/st/file.bdy similarity index 100% rename from src/test/resources/unit-tests/test-sources-tests-params/te/st/file.bdy rename to src/test/resources/unit-tests/sources_tests_parameters/te/st/file.bdy diff --git a/src/test/resources/unit-tests/test-sources-tests-params/te/st/foo.sql b/src/test/resources/unit-tests/sources_tests_parameters/te/st/foo.sql similarity index 100% rename from src/test/resources/unit-tests/test-sources-tests-params/te/st/foo.sql rename to src/test/resources/unit-tests/sources_tests_parameters/te/st/foo.sql diff --git a/src/test/resources/unit-tests/test-sources-tests-params/te/st/spec.spc b/src/test/resources/unit-tests/sources_tests_parameters/te/st/spec.spc similarity index 100% rename from src/test/resources/unit-tests/test-sources-tests-params/te/st/spec.spc rename to src/test/resources/unit-tests/sources_tests_parameters/te/st/spec.spc From 9a0115cb2f3a1944fecd7b6b73a0727e3d63d158 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 09:58:00 +0100 Subject: [PATCH 129/200] Fixed wrong directory --- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 2 +- .../db_config_using_system_properties/pom.xml | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/unit-tests/db_config_using_system_properties/pom.xml diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 451701b..b8810f9 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -295,7 +295,7 @@ public void db_config_using_system_properties() throws Exception { System.setProperty("dbUser", "UT3"); System.setProperty("dbPass", "UT3"); - UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("dbms_output"); + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("db_config_using_system_properties"); assertNotNull(utPlsqlMojo); utPlsqlMojo.execute(); diff --git a/src/test/resources/unit-tests/db_config_using_system_properties/pom.xml b/src/test/resources/unit-tests/db_config_using_system_properties/pom.xml new file mode 100644 index 0000000..7df49b7 --- /dev/null +++ b/src/test/resources/unit-tests/db_config_using_system_properties/pom.xml @@ -0,0 +1,48 @@ + + 4.0.0 + + org.utplsql + utplsql-maven-plugin-test + 3.1.0-SNAPSHOT + pom + + + + + org.utplsql + utplsql-maven-plugin + @proj + + test + + + true + 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 c3409e724f982a42730ede7504884762f78502ad Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 10:06:21 +0100 Subject: [PATCH 130/200] Fixed wrong pom.xml --- src/test/resources/unit-tests/default_reporter/pom.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/test/resources/unit-tests/default_reporter/pom.xml b/src/test/resources/unit-tests/default_reporter/pom.xml index d795551..ac08798 100644 --- a/src/test/resources/unit-tests/default_reporter/pom.xml +++ b/src/test/resources/unit-tests/default_reporter/pom.xml @@ -28,11 +28,6 @@ app - - - UT_DOCUMENTATION_REPORTER - - From eda0d5bffe7725486b5d2f96fe2d544aae8c4fb8 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 10:11:48 +0100 Subject: [PATCH 131/200] Fixed build directory to avoid target in resources directory --- .../unit-tests/db_config_using_system_properties/pom.xml | 5 +++-- src/test/resources/unit-tests/dbms_output/pom.xml | 1 + .../unit-tests/default_console_output_behaviour/pom.xml | 1 + src/test/resources/unit-tests/default_reporter/pom.xml | 1 + .../resources/unit-tests/invalid_sources_directory/pom.xml | 2 +- .../resources/unit-tests/invalid_tests_directory/pom.xml | 1 + src/test/resources/unit-tests/skip_utplsql_tests/pom.xml | 1 + .../sources_and_tests_parameter_does_not_exist/pom.xml | 1 + .../pom.xml | 1 + .../pom.xml | 1 + .../pom.xml | 1 + .../resources/unit-tests/sources_tests_parameters/pom.xml | 1 + 12 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/test/resources/unit-tests/db_config_using_system_properties/pom.xml b/src/test/resources/unit-tests/db_config_using_system_properties/pom.xml index 7df49b7..814c181 100644 --- a/src/test/resources/unit-tests/db_config_using_system_properties/pom.xml +++ b/src/test/resources/unit-tests/db_config_using_system_properties/pom.xml @@ -1,6 +1,6 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.utplsql @@ -9,6 +9,7 @@ pom + ../../../target org.utplsql diff --git a/src/test/resources/unit-tests/dbms_output/pom.xml b/src/test/resources/unit-tests/dbms_output/pom.xml index 03ad1fa..4f45635 100644 --- a/src/test/resources/unit-tests/dbms_output/pom.xml +++ b/src/test/resources/unit-tests/dbms_output/pom.xml @@ -15,6 +15,7 @@ + ../../../target org.utplsql diff --git a/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml b/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml index 1e9a727..ac6b14c 100644 --- a/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml +++ b/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml @@ -15,6 +15,7 @@ + ../../../target org.utplsql diff --git a/src/test/resources/unit-tests/default_reporter/pom.xml b/src/test/resources/unit-tests/default_reporter/pom.xml index ac08798..8f03e25 100644 --- a/src/test/resources/unit-tests/default_reporter/pom.xml +++ b/src/test/resources/unit-tests/default_reporter/pom.xml @@ -15,6 +15,7 @@ + ../../../target org.utplsql diff --git a/src/test/resources/unit-tests/invalid_sources_directory/pom.xml b/src/test/resources/unit-tests/invalid_sources_directory/pom.xml index 166bbd0..af6643d 100644 --- a/src/test/resources/unit-tests/invalid_sources_directory/pom.xml +++ b/src/test/resources/unit-tests/invalid_sources_directory/pom.xml @@ -15,7 +15,7 @@ - ../../../target/ + ../../../target org.utplsql 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 fe13c52..15a85ce 100644 --- a/src/test/resources/unit-tests/invalid_tests_directory/pom.xml +++ b/src/test/resources/unit-tests/invalid_tests_directory/pom.xml @@ -15,6 +15,7 @@ + ../../../target org.utplsql 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 9d8d409..0f723cc 100644 --- a/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml +++ b/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml @@ -15,6 +15,7 @@ + ../../../target org.utplsql diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml index 016631d..a556a7e 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml @@ -15,6 +15,7 @@ + ../../../target org.utplsql diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml index 016631d..a556a7e 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml @@ -15,6 +15,7 @@ + ../../../target org.utplsql diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml index d585276..d5382b4 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml @@ -15,6 +15,7 @@ + ../../../target org.utplsql diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml index fe6eddc..d33e917 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml @@ -16,6 +16,7 @@ + ../../../target org.utplsql 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 d552f9c..2ef33aa 100644 --- a/src/test/resources/unit-tests/sources_tests_parameters/pom.xml +++ b/src/test/resources/unit-tests/sources_tests_parameters/pom.xml @@ -15,6 +15,7 @@ + ../../../target org.utplsql From c858c317c700ae94ab9339f3bf863bc8f175eb4c Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 10:24:10 +0100 Subject: [PATCH 132/200] add include and exclude test --- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 17 +++++++++ .../include_and_exclude_objects/pom.xml | 38 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 src/test/resources/unit-tests/include_and_exclude_objects/pom.xml diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index b8810f9..fbeae89 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -303,7 +303,24 @@ public void db_config_using_system_properties() throws Exception { System.setProperty("dbUrl", ""); System.setProperty("dbUser", ""); System.setProperty("dbPass", ""); + } + + /** + * DB configuration from System Properties + *

+ * Given : a pom.xml without dbUrl, dbUser and dbPass configured + * When : pom is read + * Then : System Properties must be used to configure database + */ + @Test + public void include_and_exclude_objects() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("include_and_exclude_objects"); + assertNotNull(utPlsqlMojo); + + utPlsqlMojo.execute(); + assertEquals("abc", utPlsqlMojo.includeObject); + assertEquals("xyz", utPlsqlMojo.excludeObject); } private UtPlsqlMojo createUtPlsqlMojo(String directory) throws Exception { diff --git a/src/test/resources/unit-tests/include_and_exclude_objects/pom.xml b/src/test/resources/unit-tests/include_and_exclude_objects/pom.xml new file mode 100644 index 0000000..b456712 --- /dev/null +++ b/src/test/resources/unit-tests/include_and_exclude_objects/pom.xml @@ -0,0 +1,38 @@ + + 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 + + + false + + app + + abc + xyz + + + + + From 933190ffeb42756213ba335a7abe0cfc20e4d0ae Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 10:33:50 +0100 Subject: [PATCH 133/200] Publish unit test results --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 53382c8..27fa83c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,3 +68,6 @@ jobs: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + + - name: Publish unit test results + uses: EnricoMi/publish-unit-test-result-action@v1.24 From e5c678b5feb60d27cf9becdbc1bf80f91192b18d Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 10:46:31 +0100 Subject: [PATCH 134/200] Added files --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27fa83c..702246d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,3 +71,5 @@ jobs: - name: Publish unit test results uses: EnricoMi/publish-unit-test-result-action@v1.24 + with: + files: target/**/TEST**.xml From c6c1f30729df69877d85f9ec5be7f85a242b38f6 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 15:00:05 +0100 Subject: [PATCH 135/200] Trying other Junit reporter --- .github/workflows/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 702246d..a740919 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,7 +69,8 @@ jobs: MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - - name: Publish unit test results - uses: EnricoMi/publish-unit-test-result-action@v1.24 + - name: Publish Test Report + uses: mikepenz/action-junit-report@v2 + if: always() # always run even if the previous step fails with: - files: target/**/TEST**.xml + report_paths: 'target/**/TEST**.xml' From a7eff57b2379700340d6318398dade8f55547a94 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 15:47:19 +0100 Subject: [PATCH 136/200] Reverted back to other plugin --- .github/workflows/build.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a740919..702246d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,8 +69,7 @@ jobs: MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - - name: Publish Test Report - uses: mikepenz/action-junit-report@v2 - if: always() # always run even if the previous step fails + - name: Publish unit test results + uses: EnricoMi/publish-unit-test-result-action@v1.24 with: - report_paths: 'target/**/TEST**.xml' + files: target/**/TEST**.xml From f5defe990644daa494fdaad52fecdcdf80a86e5c Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 16:24:43 +0100 Subject: [PATCH 137/200] Used Maven IT extension assertions --- .../utplsql/maven/plugin/io/ReportWriter.java | 1 + .../utplsql/maven/plugin/ReportChecker.java | 41 +++++++++---------- .../utplsql/maven/plugin/UtPlsqlMojoIT.java | 31 +++++++------- src/test/resources/junit-platform.properties | 1 + 4 files changed, 36 insertions(+), 38 deletions(-) create mode 100644 src/test/resources/junit-platform.properties diff --git a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java index 2fae4e3..b4bd604 100644 --- a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java +++ b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java @@ -86,6 +86,7 @@ private void writeReports(Connection connection, Reporter reporter, ReporterPara if (!file.getParentFile().exists()) { log.debug("Creating directory for report file " + file.getAbsolutePath()); + //noinspection ResultOfMethodCallIgnored file.getParentFile().mkdirs(); } diff --git a/src/test/java/org/utplsql/maven/plugin/ReportChecker.java b/src/test/java/org/utplsql/maven/plugin/ReportChecker.java index e58b35c..3818674 100644 --- a/src/test/java/org/utplsql/maven/plugin/ReportChecker.java +++ b/src/test/java/org/utplsql/maven/plugin/ReportChecker.java @@ -1,7 +1,7 @@ package org.utplsql.maven.plugin; +import com.soebes.itf.jupiter.maven.MavenExecutionResult; import org.apache.commons.io.FileUtils; -import org.junit.jupiter.api.Assertions; import java.io.File; import java.io.IOException; @@ -9,7 +9,9 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static com.soebes.itf.extension.assertj.MavenProjectResultAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; public class ReportChecker { @@ -21,17 +23,15 @@ private ReportChecker() { * Path separator is set to "/" to ensure windows / linux / mac compatibility. * \r and \n are removed to provide simpler comparison. * - * @param testClass Class under test - * @param testFolder Folder name - * @param files Files to compare + * @param result {@link MavenExecutionResult} + * @param files Files to compare */ - public static void checkReports(Class testClass, String testFolder, String... files) throws IOException { - String fullyQualifiedClassNameDirectory = testClass.getName().replace(".", "/"); - + public static void assertThatReportsAreGeneratedAsExpected(MavenExecutionResult result, String... files) { for (String filename : files) { - File expectedOutputFile = new File("target/maven-it/" + fullyQualifiedClassNameDirectory + "/" + testFolder + "/project/expected-output/utplsql", filename); - File outputFile = new File("target/maven-it/" + fullyQualifiedClassNameDirectory + "/" + testFolder + "/project/target/utplsql", filename); - assertTrue(outputFile.exists(), "The report " + outputFile.getPath() + " was not generated"); + File expectedOutputFile = new File(result.getMavenProjectResult().getTargetProjectDirectory(), "/expected-output/utplsql/" + filename); + File outputFile = new File(result.getMavenProjectResult().getTargetProjectDirectory(), "/target/utplsql/" + filename); + + assertThat(result.getMavenProjectResult()).withFile("/utplsql/" + filename).exists(); try (Stream stream = Files.lines(outputFile.toPath())) { String outputContent = stream @@ -41,27 +41,26 @@ public static void checkReports(Class testClass, String testFolder, String... .map(line -> line.replaceAll("\r", "").replaceAll("\n", "")) .collect(Collectors.joining("\n")); - Assertions.assertEquals( + assertEquals( FileUtils.readFileToString(expectedOutputFile, "utf-8") .replace("\r", "") .replace("\n", ""), outputContent.replace("\n", ""), "The files differ!"); + } catch (IOException e) { + fail(e); } } } /** - * Check if a report file exits + * Check if the report was generated * - * @param testClass Class under test - * @param testFolder Folder name - * @param filename File Name - * @return true or false + * @param result {@link MavenExecutionResult} + * @param filename File Name + * @return if report exits */ - public static boolean reportExists(Class testClass, String testFolder, String filename) { - String fullyQualifiedClassNameDirectory = testClass.getName().replace(".", "/"); - - File outputFile = new File("target/maven-it/" + fullyQualifiedClassNameDirectory + "/" + testFolder + "/project/target/utplsql", filename); + public static boolean reportWasGenerated(MavenExecutionResult result, String filename) { + File outputFile = new File(result.getMavenProjectResult().getTargetProjectDirectory(), "/target/utplsql/" + filename); return outputFile.exists(); } } diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java index 0b94af7..2464fd9 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java @@ -5,12 +5,9 @@ import com.soebes.itf.jupiter.extension.MavenTest; import com.soebes.itf.jupiter.maven.MavenExecutionResult; -import java.io.IOException; - import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.utplsql.maven.plugin.ReportChecker.checkReports; -import static org.utplsql.maven.plugin.ReportChecker.reportExists; +import static org.utplsql.maven.plugin.ReportChecker.assertThatReportsAreGeneratedAsExpected; +import static org.utplsql.maven.plugin.ReportChecker.reportWasGenerated; @MavenGoal("test") @MavenJupiterExtension @@ -22,44 +19,44 @@ void minimalist(MavenExecutionResult result) { } @MavenTest - void owner_param(MavenExecutionResult result) throws IOException { + void owner_param(MavenExecutionResult result) { assertThat(result).isSuccessful(); - checkReports(this.getClass(), "owner_param", "sonar-test-report.xml", "coverage-sonar-report.xml"); + assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); } @MavenTest - void regex(MavenExecutionResult result) throws IOException { + void regex(MavenExecutionResult result) { assertThat(result).isSuccessful(); - checkReports(this.getClass(), "regex", "sonar-test-report.xml", "coverage-sonar-report.xml"); + assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); } @MavenTest - void simple(MavenExecutionResult result) throws IOException { + void simple(MavenExecutionResult result) { assertThat(result).isSuccessful(); - checkReports(this.getClass(), "simple", "sonar-test-report.xml", "coverage-sonar-report.xml"); + assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); } @MavenTest - void skip(MavenExecutionResult result) throws IOException { + void skip(MavenExecutionResult result) { assertThat(result).isSuccessful(); - assertFalse(reportExists(this.getClass(), "skip", "sonar-test-report.xml")); + assertThat(reportWasGenerated(result, "sonar-test-report.xml")).isFalse(); } @MavenTest - void tags(MavenExecutionResult result) throws IOException { + void tags(MavenExecutionResult result) { assertThat(result).isSuccessful(); - checkReports(this.getClass(), "tags", "sonar-test-report.xml"); + assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml"); } @MavenTest - void type_mapping(MavenExecutionResult result) throws IOException { + void type_mapping(MavenExecutionResult result) { assertThat(result).isSuccessful(); - checkReports(this.getClass(), "type_mapping", "sonar-test-report.xml", "coverage-sonar-report.xml"); + assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); } } diff --git a/src/test/resources/junit-platform.properties b/src/test/resources/junit-platform.properties new file mode 100644 index 0000000..f0ee14f --- /dev/null +++ b/src/test/resources/junit-platform.properties @@ -0,0 +1 @@ +junit.jupiter.displayname.generator.default=org.junit.jupiter.api.DisplayNameGenerator$ReplaceUnderscores From 992e53aa545d83e58d52ab13f1478eee3307767a Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 17:26:57 +0100 Subject: [PATCH 138/200] Reduced dependencies --- pom.xml | 57 +++++-------------- .../org/utplsql/maven/plugin/UtPlsqlMojo.java | 22 +++---- .../utplsql/maven/plugin/io/ReportWriter.java | 9 ++- .../io/ReporterAndReporterParameter.java | 23 ++++++++ .../maven/plugin/model/ReporterParameter.java | 4 +- .../utplsql/maven/plugin/util/StringUtil.java | 31 ++++++++++ 6 files changed, 87 insertions(+), 59 deletions(-) create mode 100644 src/main/java/org/utplsql/maven/plugin/io/ReporterAndReporterParameter.java create mode 100644 src/main/java/org/utplsql/maven/plugin/util/StringUtil.java diff --git a/pom.xml b/pom.xml index 951fe54..9c20908 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,6 @@ UTF-8 3.5.2 - 2.3.1 0.11.0 utplsql @@ -76,25 +75,21 @@ - com.sun.xml.bind - jaxb-core - 3.0.1 + org.apache.maven + maven-core + ${maven.version} + provided - javax.xml.bind - jaxb-api - ${jaxb.version} + org.apache.maven.plugin-tools + maven-plugin-annotations + ${maven.version} + provided - com.sun.xml.bind - jaxb-impl - ${jaxb.version} - - - - com.oracle.database.jdbc - ojdbc8 - 21.3.0.0 + org.apache.maven.shared + maven-shared-utils + 3.1.0 @@ -104,31 +99,15 @@ - org.apache.maven - maven-core - ${maven.version} - - - org.apache.maven - maven-model - ${maven.version} - - - org.apache.maven - maven-plugin-api - ${maven.version} - - - org.apache.maven.plugin-tools - maven-plugin-annotations - ${maven.version} - provided + com.oracle.database.jdbc + ojdbc8 + 21.3.0.0 org.codehaus.plexus plexus-utils - 3.4.1 + 3.1.0 @@ -168,12 +147,6 @@ test - - commons-io - commons-io - 2.6 - test - org.slf4j slf4j-simple diff --git a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java index 476a55e..887c930 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java @@ -1,7 +1,6 @@ package org.utplsql.maven.plugin; import oracle.jdbc.pool.OracleDataSource; -import org.apache.commons.lang3.StringUtils; import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -37,6 +36,10 @@ import java.util.Set; import java.util.stream.Collectors; +import static org.utplsql.maven.plugin.util.StringUtil.isEmpty; +import static org.utplsql.maven.plugin.util.StringUtil.isNotBlank; +import static org.utplsql.maven.plugin.util.StringUtil.isNotEmpty; + /** * This class expose the {@link TestRunner} interface to Maven. * @@ -158,10 +161,10 @@ public void execute() throws MojoExecutionException { .randomTestOrderSeed(randomTestOrderSeed) .failOnErrors(!ignoreFailure); - if (StringUtils.isNotBlank(excludeObject)) { + if (isNotBlank(excludeObject)) { runner.excludeObject(excludeObject); } - if (StringUtils.isNotBlank(includeObject)) { + if (isNotBlank(includeObject)) { runner.includeObject(includeObject); } @@ -189,15 +192,14 @@ public void execute() throws MojoExecutionException { } } - private Connection createConnection() throws SQLException { - if (StringUtils.isEmpty(url)) { + if (isEmpty(url)) { url = System.getProperty("dbUrl"); } - if (StringUtils.isEmpty(user)) { + if (isEmpty(user)) { user = System.getProperty("dbUser"); } - if (StringUtils.isEmpty(password)) { + if (isEmpty(password)) { password = System.getProperty("dbPass"); } @@ -251,10 +253,10 @@ private FileMapperOptions createFileMapperOptions(List scripts, String o Integer typeSubExpression, List typeMappings) { FileMapperOptions fileMapperOptions = new FileMapperOptions(scripts); - if (StringUtils.isNotEmpty(objectOwner)) { + if (isNotEmpty(objectOwner)) { fileMapperOptions.setObjectOwner(objectOwner); } - if (StringUtils.isNotEmpty(regexPattern)) { + if (isNotEmpty(regexPattern)) { fileMapperOptions.setRegexPattern(regexPattern); } if (ownerSubExpression != null) { @@ -295,7 +297,7 @@ List initReporters(Connection connection, ReportWriter reportWriter, R } // Only added the reporter if at least one of the output is required - if (StringUtils.isNotBlank(reporterParameter.getFileOutput()) || reporterParameter.isConsoleOutput()) { + if (isNotBlank(reporterParameter.getFileOutput()) || reporterParameter.isConsoleOutput()) { reportWriter.addReporter(reporterParameter, reporter); } } diff --git a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java index b4bd604..e70f635 100644 --- a/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java +++ b/src/main/java/org/utplsql/maven/plugin/io/ReportWriter.java @@ -1,6 +1,5 @@ package org.utplsql.maven.plugin.io; -import org.apache.commons.lang3.tuple.Pair; import org.apache.maven.plugin.logging.Log; import org.utplsql.api.Version; import org.utplsql.api.outputBuffer.OutputBuffer; @@ -27,7 +26,7 @@ */ public class ReportWriter { - private final List> reporters; + private final List reporters; private final String outputDirectory; @@ -56,7 +55,7 @@ public ReportWriter(String outputDirectory, Version databaseVersion, Log log) { * @param reporter the {@link Reporter} */ public void addReporter(ReporterParameter parameter, Reporter reporter) { - reporters.add(Pair.of(reporter, parameter)); + reporters.add(new ReporterAndReporterParameter(reporter, parameter)); } /** @@ -67,8 +66,8 @@ public void addReporter(ReporterParameter parameter, Reporter reporter) { * @throws IOException if files can't be written */ public void writeReports(Connection connection) throws SQLException, IOException { - for (Pair pair : reporters) { - writeReports(connection, pair.getLeft(), pair.getRight()); + for (ReporterAndReporterParameter pair : reporters) { + writeReports(connection, pair.getReporter(), pair.getReporterParameter()); } } diff --git a/src/main/java/org/utplsql/maven/plugin/io/ReporterAndReporterParameter.java b/src/main/java/org/utplsql/maven/plugin/io/ReporterAndReporterParameter.java new file mode 100644 index 0000000..07b72d9 --- /dev/null +++ b/src/main/java/org/utplsql/maven/plugin/io/ReporterAndReporterParameter.java @@ -0,0 +1,23 @@ +package org.utplsql.maven.plugin.io; + +import org.utplsql.api.reporter.Reporter; +import org.utplsql.maven.plugin.model.ReporterParameter; + +public class ReporterAndReporterParameter { + + private final Reporter reporter; + private final ReporterParameter reporterParameter; + + public ReporterAndReporterParameter(Reporter reporter, ReporterParameter reporterParameter) { + this.reporter = reporter; + this.reporterParameter = reporterParameter; + } + + public Reporter getReporter() { + return reporter; + } + + public ReporterParameter getReporterParameter() { + return reporterParameter; + } +} diff --git a/src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java b/src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java index 198ba5f..c37aa5e 100644 --- a/src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java +++ b/src/main/java/org/utplsql/maven/plugin/model/ReporterParameter.java @@ -1,6 +1,6 @@ package org.utplsql.maven.plugin.model; -import org.codehaus.plexus.util.StringUtils; +import static org.utplsql.maven.plugin.util.StringUtil.isNotBlank; /** * Represents a reporter parameter in the pom file. @@ -54,7 +54,7 @@ public String getFileOutput() { * @return true if the file output is enabled, false otherwise */ public boolean isFileOutput() { - return StringUtils.isNotBlank(fileOutput); + return isNotBlank(fileOutput); } /** diff --git a/src/main/java/org/utplsql/maven/plugin/util/StringUtil.java b/src/main/java/org/utplsql/maven/plugin/util/StringUtil.java new file mode 100644 index 0000000..0ef4536 --- /dev/null +++ b/src/main/java/org/utplsql/maven/plugin/util/StringUtil.java @@ -0,0 +1,31 @@ +package org.utplsql.maven.plugin.util; + +public class StringUtil { + + private StringUtil() { + } + + public static boolean isEmpty(CharSequence cs) { + return cs == null || cs.length() == 0; + } + + public static boolean isNotEmpty(CharSequence cs) { + return !isEmpty(cs); + } + + public static boolean isBlank(CharSequence cs) { + int strLen; + if (cs != null && (strLen = cs.length()) != 0) { + for (int i = 0; i < strLen; ++i) { + if (!Character.isWhitespace(cs.charAt(i))) { + return false; + } + } + } + return true; + } + + public static boolean isNotBlank(CharSequence cs) { + return !isBlank(cs); + } +} From 8e801904a491db9a0b60f8b511efa53d61fe6ad3 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 17:37:03 +0100 Subject: [PATCH 139/200] Added info log assertion --- pom.xml | 16 ++++------------ .../org/utplsql/maven/plugin/UtPlsqlMojoIT.java | 2 ++ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 9c20908..0c2375e 100644 --- a/pom.xml +++ b/pom.xml @@ -56,23 +56,12 @@ 3.5.2 0.11.0 + 5.8.1 utplsql https://sonarcloud.io - - - - org.junit - junit-bom - 5.8.1 - pom - import - - - - org.apache.maven @@ -127,11 +116,14 @@ org.junit.jupiter junit-jupiter-engine + ${junit.version} test org.junit.vintage junit-vintage-engine + ${junit.version} + test diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java index 2464fd9..422093f 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java @@ -43,6 +43,8 @@ void simple(MavenExecutionResult result) { void skip(MavenExecutionResult result) { assertThat(result).isSuccessful(); + assertThat(result.getMavenLog()).info().contains("utPLSQLTests are skipped."); + assertThat(reportWasGenerated(result, "sonar-test-report.xml")).isFalse(); } From b7830c6d9aa11549f3133de9b88df47742fc4194 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 26 Nov 2021 17:44:20 +0100 Subject: [PATCH 140/200] Added if: always() to run it even if the tests fail --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 702246d..1b1ec0b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,5 +71,6 @@ jobs: - name: Publish unit test results uses: EnricoMi/publish-unit-test-result-action@v1.24 + if: always() with: files: target/**/TEST**.xml From 681bb09e107a9d79e164504e49b8186c3373b043 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 27 Nov 2021 10:44:15 +0100 Subject: [PATCH 141/200] Update versions for release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0c2375e..aac1d5e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.6-SNAPSHOT + 3.1.6 maven-plugin utPLSQL Maven Plugin From 7c32df2afe4e511f5b60c5f606613c3a14753dba Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 27 Nov 2021 10:44:21 +0100 Subject: [PATCH 142/200] Update for next development version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index aac1d5e..85d9662 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.6 + 3.1.7-SNAPSHOT maven-plugin utPLSQL Maven Plugin From adbb3755077143a50c1e5ffb3e20e8739822a5ac Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 27 Nov 2021 11:01:29 +0100 Subject: [PATCH 143/200] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d3d0a3..320ec8a 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.5 + 3.1.6 From 9b4a3148ef404bb793351d1a94890ea2a6f825c7 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 27 Nov 2021 11:02:00 +0100 Subject: [PATCH 144/200] New version in example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d3d0a3..fc0f34f 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.5 + 3.1.7 From b2bf380d5ba03ae4bcb9f90252daac38ba7e43f1 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Thu, 2 Dec 2021 15:26:08 +0100 Subject: [PATCH 145/200] Use Oracle XE 21 --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b1ec0b..6a4a716 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: services: oracle: - image: gvenzl/oracle-xe:18.4.0-slim + image: gvenzl/oracle-xe:21-slim env: ORACLE_PASSWORD: oracle ports: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 725f974..475a3e6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: services: oracle: - image: gvenzl/oracle-xe:18.4.0-slim + image: gvenzl/oracle-xe:21-slim env: ORACLE_PASSWORD: oracle ports: From 7c96e0ac116032b811a73a04751f6afa70203453 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Thu, 2 Dec 2021 15:29:48 +0100 Subject: [PATCH 146/200] Use Oracle XE 21 also in local scripts --- scripts/0_start_db.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/0_start_db.sh b/scripts/0_start_db.sh index c5a8d7f..d319407 100644 --- a/scripts/0_start_db.sh +++ b/scripts/0_start_db.sh @@ -1 +1 @@ -docker run -d --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle gvenzl/oracle-xe:18.4.0-slim +docker run -d --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle gvenzl/oracle-xe:21-slim From e39f17791f05e219632d128c03935f64a9f4aedc Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 3 Dec 2021 08:51:21 +0100 Subject: [PATCH 147/200] #62 excludeObject and includeObject doesn't work for multiple values --- .../org/utplsql/maven/plugin/UtPlsqlMojo.java | 16 ++- .../utplsql/maven/plugin/UtPlsqlMojoIT.java | 7 + .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 7 +- .../utplsql/coverage-sonar-report.xml | 2 + .../utplsql/sonar-test-report.xml | 11 ++ .../UtPlsqlMojoIT/exclude_object/pom.xml | 52 ++++++++ .../foo/package_bodies/PKG_TEST_ME.sql | 27 ++++ .../sources/foo/packages/PKG_TEST_ME.sql | 8 ++ .../scripts/sources/foo/tables/TO_TEST_ME.tab | 8 ++ .../bar/package_bodies/TEST_PKG_TEST_ME.sql | 126 ++++++++++++++++++ .../test/bar/packages/TEST_PKG_TEST_ME.sql | 86 ++++++++++++ .../pom.xml | 18 ++- 12 files changed, 360 insertions(+), 8 deletions(-) create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/expected-output/utplsql/coverage-sonar-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/expected-output/utplsql/sonar-test-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/packages/PKG_TEST_ME.sql create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/tables/TO_TEST_ME.tab create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql rename src/test/resources/unit-tests/{include_and_exclude_objects => exclude_object}/pom.xml (58%) diff --git a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java index 887c930..acd3281 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java @@ -30,6 +30,7 @@ import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; @@ -162,10 +163,21 @@ public void execute() throws MojoExecutionException { .failOnErrors(!ignoreFailure); if (isNotBlank(excludeObject)) { - runner.excludeObject(excludeObject); + if (excludeObject.contains(",")) { + String[] excludes = excludeObject.split(","); + runner.excludeObjects(Arrays.asList(excludes)); + } else { + runner.excludeObject(excludeObject); + } + } if (isNotBlank(includeObject)) { - runner.includeObject(includeObject); + if (includeObject.contains(",")) { + String[] includes = includeObject.split(","); + runner.excludeObjects(Arrays.asList(includes)); + } else { + runner.excludeObject(includeObject); + } } runner.run(connection); diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java index 422093f..510d896 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java @@ -61,4 +61,11 @@ void type_mapping(MavenExecutionResult result) { assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); } + + @MavenTest + void exclude_object(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 fbeae89..1ff082e 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -313,14 +313,13 @@ public void db_config_using_system_properties() throws Exception { * Then : System Properties must be used to configure database */ @Test - public void include_and_exclude_objects() throws Exception { - UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("include_and_exclude_objects"); + public void exclude_object() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("exclude_object"); assertNotNull(utPlsqlMojo); utPlsqlMojo.execute(); - assertEquals("abc", utPlsqlMojo.includeObject); - assertEquals("xyz", utPlsqlMojo.excludeObject); + assertEquals("app.pkg_test_me,app.test_pkg_test_me", utPlsqlMojo.excludeObject); } private UtPlsqlMojo createUtPlsqlMojo(String directory) throws Exception { diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/expected-output/utplsql/coverage-sonar-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/expected-output/utplsql/coverage-sonar-report.xml new file mode 100644 index 0000000..cf7a48f --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/expected-output/utplsql/coverage-sonar-report.xml @@ -0,0 +1,2 @@ + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/expected-output/utplsql/sonar-test-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/expected-output/utplsql/sonar-test-report.xml new file mode 100644 index 0000000..04708f1 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/expected-output/utplsql/sonar-test-report.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml new file mode 100644 index 0000000..d693636 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml @@ -0,0 +1,52 @@ + + 4.0.0 + + org.utplsql + owner-param + 1.0.0 + pom + + + jdbc:oracle:thin:@localhost:1521:xe + UT3 + UT3 + + + + + + org.utplsql + utplsql-maven-plugin + @project.version@ + + + + test + + + false + + TESTS_OWNER + + + + UT_COVERAGE_SONAR_REPORTER + utplsql/coverage-sonar-report.xml + true + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + tests_owner.test_pkg_test_me + + + + + + + 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/exclude_object/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql new file mode 100644 index 0000000..d6846b2 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql @@ -0,0 +1,27 @@ +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/exclude_object/scripts/sources/foo/packages/PKG_TEST_ME.sql new file mode 100644 index 0000000..959b122 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/packages/PKG_TEST_ME.sql @@ -0,0 +1,8 @@ +-- +-- 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/exclude_object/scripts/sources/foo/tables/TO_TEST_ME.tab new file mode 100644 index 0000000..b2e90d9 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/tables/TO_TEST_ME.tab @@ -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/exclude_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql new file mode 100644 index 0000000..1b34f08 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql @@ -0,0 +1,126 @@ +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/exclude_object/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql new file mode 100644 index 0000000..b0cdf54 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql @@ -0,0 +1,86 @@ +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/unit-tests/include_and_exclude_objects/pom.xml b/src/test/resources/unit-tests/exclude_object/pom.xml similarity index 58% rename from src/test/resources/unit-tests/include_and_exclude_objects/pom.xml rename to src/test/resources/unit-tests/exclude_object/pom.xml index b456712..d65fde3 100644 --- a/src/test/resources/unit-tests/include_and_exclude_objects/pom.xml +++ b/src/test/resources/unit-tests/exclude_object/pom.xml @@ -29,8 +29,22 @@ app - abc - xyz + + + UT_DOCUMENTATION_REPORTER + + + UT_COVERAGE_SONAR_REPORTER + coverage-sonar-report.xml + false + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + app.pkg_test_me,app.test_pkg_test_me From 9cf77ea28f4a5d7bcd70f0560d3df1b268d571ee Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 3 Dec 2021 09:07:43 +0100 Subject: [PATCH 148/200] #63 Fixed documentation inaccuracy --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fc0f34f..6a0487d 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ Please refer to the following usage example for the parameters descriptions: user - + password @@ -207,7 +207,7 @@ Please refer to the following usage example for the parameters descriptions: code_owner .*/\w+/(\w+)/(\w+)\.\w{3} - app + 3 2 1 From e5ae1198c94df2dbced38d7382846911bfada0ea Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 3 Dec 2021 09:09:00 +0100 Subject: [PATCH 149/200] #63 Also testOwnerSubexpression only allows numbers --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a0487d..0b8c2e0 100644 --- a/README.md +++ b/README.md @@ -221,7 +221,7 @@ Please refer to the following usage example for the parameters descriptions: tests_owner .*/\w+/(\w+)/(\w+)\.\w{3} - test + 3 2 1 From c2f33ad43a25aa5b42f8822146cb2bd170f690af Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 3 Dec 2021 09:17:44 +0100 Subject: [PATCH 150/200] Update versions for release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 85d9662..177d5c2 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.7-SNAPSHOT + 3.1.7 maven-plugin utPLSQL Maven Plugin From 20d1890015717346ab3f05b0752d91a53a3b3bc3 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 3 Dec 2021 09:19:18 +0100 Subject: [PATCH 151/200] Update for next development version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 177d5c2..8f9542f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.7 + 3.1.8-SNAPSHOT maven-plugin utPLSQL Maven Plugin From d4a29fa6119314d9cd36935c91ef18d4a57aa1d3 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 3 Dec 2021 09:20:38 +0100 Subject: [PATCH 152/200] Updated version in example pom.xml --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 685d929..a243536 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.6 + 3.1.7 From 694afd2e0eb3ce6fc1e3c43e8cf950ba543c2928 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 3 Dec 2021 15:42:22 +0100 Subject: [PATCH 153/200] Added StringUtilTest and includeObject test --- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 23 ++++++-- .../maven/plugin/util/StringUtilTest.java | 32 ++++++++++++ .../unit-tests/include_object/pom.xml | 52 +++++++++++++++++++ 3 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java create mode 100644 src/test/resources/unit-tests/include_object/pom.xml diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 1ff082e..9364ab3 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -306,11 +306,11 @@ public void db_config_using_system_properties() throws Exception { } /** - * DB configuration from System Properties + * Exclude object from coverage report *

- * Given : a pom.xml without dbUrl, dbUser and dbPass configured + * Given : a pom.xml with excludeObject set * When : pom is read - * Then : System Properties must be used to configure database + * Then : excludeObject is present */ @Test public void exclude_object() throws Exception { @@ -322,6 +322,23 @@ public void exclude_object() throws Exception { 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"); } diff --git a/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java b/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java new file mode 100644 index 0000000..f52b376 --- /dev/null +++ b/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java @@ -0,0 +1,32 @@ +package org.utplsql.maven.plugin.util; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.utplsql.maven.plugin.util.StringUtil.isBlank; +import static org.utplsql.maven.plugin.util.StringUtil.isEmpty; +import static org.utplsql.maven.plugin.util.StringUtil.isNotBlank; +import static org.utplsql.maven.plugin.util.StringUtil.isNotEmpty; + +class StringUtilTest { + + @Test + void is_empty() { + assertTrue(isEmpty("")); + } + + @Test + void is_not_empty() { + assertTrue(isNotEmpty("abc")); + } + + @Test + void is_blank() { + assertTrue(isBlank(" ")); + } + + @Test + void is_not_blank() { + assertTrue(isNotBlank("abc")); + } +} diff --git a/src/test/resources/unit-tests/include_object/pom.xml b/src/test/resources/unit-tests/include_object/pom.xml new file mode 100644 index 0000000..f031df5 --- /dev/null +++ b/src/test/resources/unit-tests/include_object/pom.xml @@ -0,0 +1,52 @@ + + 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 + + + false + + app + + + + UT_DOCUMENTATION_REPORTER + + + UT_COVERAGE_SONAR_REPORTER + coverage-sonar-report.xml + false + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + app.pkg_test_me,app.test_pkg_test_me + + + + + From 0638b9d20eb8b53687414f2354d1faff6d7d8cb4 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 3 Dec 2021 15:44:17 +0100 Subject: [PATCH 154/200] Revert "Added StringUtilTest and includeObject test" This reverts commit 694afd2e0eb3ce6fc1e3c43e8cf950ba543c2928. --- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 23 ++------ .../maven/plugin/util/StringUtilTest.java | 32 ------------ .../unit-tests/include_object/pom.xml | 52 ------------------- 3 files changed, 3 insertions(+), 104 deletions(-) delete mode 100644 src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java delete mode 100644 src/test/resources/unit-tests/include_object/pom.xml diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 9364ab3..1ff082e 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -306,11 +306,11 @@ public void db_config_using_system_properties() throws Exception { } /** - * Exclude object from coverage report + * DB configuration from System Properties *

- * Given : a pom.xml with excludeObject set + * Given : a pom.xml without dbUrl, dbUser and dbPass configured * When : pom is read - * Then : excludeObject is present + * Then : System Properties must be used to configure database */ @Test public void exclude_object() throws Exception { @@ -322,23 +322,6 @@ public void exclude_object() throws Exception { 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"); } diff --git a/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java b/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java deleted file mode 100644 index f52b376..0000000 --- a/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.utplsql.maven.plugin.util; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.utplsql.maven.plugin.util.StringUtil.isBlank; -import static org.utplsql.maven.plugin.util.StringUtil.isEmpty; -import static org.utplsql.maven.plugin.util.StringUtil.isNotBlank; -import static org.utplsql.maven.plugin.util.StringUtil.isNotEmpty; - -class StringUtilTest { - - @Test - void is_empty() { - assertTrue(isEmpty("")); - } - - @Test - void is_not_empty() { - assertTrue(isNotEmpty("abc")); - } - - @Test - void is_blank() { - assertTrue(isBlank(" ")); - } - - @Test - void is_not_blank() { - assertTrue(isNotBlank("abc")); - } -} diff --git a/src/test/resources/unit-tests/include_object/pom.xml b/src/test/resources/unit-tests/include_object/pom.xml deleted file mode 100644 index f031df5..0000000 --- a/src/test/resources/unit-tests/include_object/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 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 - - - false - - app - - - - UT_DOCUMENTATION_REPORTER - - - UT_COVERAGE_SONAR_REPORTER - coverage-sonar-report.xml - false - - - UT_SONAR_TEST_REPORTER - utplsql/sonar-test-report.xml - true - - - app.pkg_test_me,app.test_pkg_test_me - - - - - From a6b4e4d692d74b855872db6fb7028ab02eda0f97 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 3 Dec 2021 15:51:12 +0100 Subject: [PATCH 155/200] Added false tests --- .../maven/plugin/util/StringUtilTest.java | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java b/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java index f52b376..598ef25 100644 --- a/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java +++ b/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java @@ -2,6 +2,7 @@ import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.utplsql.maven.plugin.util.StringUtil.isBlank; import static org.utplsql.maven.plugin.util.StringUtil.isEmpty; @@ -11,22 +12,42 @@ class StringUtilTest { @Test - void is_empty() { + void is_empty_true() { assertTrue(isEmpty("")); } @Test - void is_not_empty() { + void is_empty_false() { + assertFalse(isEmpty("abc")); + } + + @Test + void is_not_empty_true() { assertTrue(isNotEmpty("abc")); } @Test - void is_blank() { + void is_not_empty_false() { + assertFalse(isNotEmpty("")); + } + + @Test + void is_blank_true() { assertTrue(isBlank(" ")); } @Test - void is_not_blank() { + void is_blank_false() { + assertFalse(isBlank("abc")); + } + + @Test + void is_not_blank_true() { assertTrue(isNotBlank("abc")); } + + @Test + void is_not_blank_false() { + assertFalse(isNotBlank("")); + } } From 5514bd2585e8a39cd93251a7b1492e85224f3b6c Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 3 Dec 2021 16:04:40 +0100 Subject: [PATCH 156/200] Null tests --- .../org/utplsql/maven/plugin/util/StringUtilTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java b/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java index 598ef25..083484c 100644 --- a/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java +++ b/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java @@ -16,6 +16,11 @@ void is_empty_true() { assertTrue(isEmpty("")); } + @Test + void is_empty_null_true() { + assertTrue(isEmpty(null)); + } + @Test void is_empty_false() { assertFalse(isEmpty("abc")); @@ -36,6 +41,11 @@ void is_blank_true() { assertTrue(isBlank(" ")); } + @Test + void is_blank_null_true() { + assertTrue(isBlank(null)); + } + @Test void is_blank_false() { assertFalse(isBlank("abc")); From 51dc47d3e3d0df7ef7f3b833c4b4d1135d3d22d3 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 3 Dec 2021 16:41:03 +0100 Subject: [PATCH 157/200] Renamed test methods --- .../maven/plugin/util/StringUtilTest.java | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java b/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java index 083484c..22c60be 100644 --- a/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java +++ b/src/test/java/org/utplsql/maven/plugin/util/StringUtilTest.java @@ -12,52 +12,62 @@ class StringUtilTest { @Test - void is_empty_true() { + void isEmpty_with_empty() { assertTrue(isEmpty("")); } @Test - void is_empty_null_true() { + void isEmpty_with_null() { assertTrue(isEmpty(null)); } @Test - void is_empty_false() { + void isEmpty_with_string() { assertFalse(isEmpty("abc")); } @Test - void is_not_empty_true() { + void isNotEmpty_with_string() { assertTrue(isNotEmpty("abc")); } @Test - void is_not_empty_false() { + void isNotEmpty_with_empty() { assertFalse(isNotEmpty("")); } @Test - void is_blank_true() { + void isNotEmpty_with_blank() { + assertTrue(isNotEmpty(" ")); + } + + @Test + void isBlank_with_blank() { assertTrue(isBlank(" ")); } @Test - void is_blank_null_true() { + void isBlank_with_null() { assertTrue(isBlank(null)); } @Test - void is_blank_false() { + void isBlank_with_string() { assertFalse(isBlank("abc")); } @Test - void is_not_blank_true() { + void isBlank_with_whitespaces_before_string() { + assertFalse(isBlank(" abc")); + } + + @Test + void isNotBlank_with_string() { assertTrue(isNotBlank("abc")); } @Test - void is_not_blank_false() { + void isNotBlank_with_empty() { assertFalse(isNotBlank("")); } } From 6330d042f9c674bab390874a7e168758ac1935c5 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 8 Dec 2021 07:39:59 +0100 Subject: [PATCH 158/200] Change code to find Jacoco problem with coverage --- .../utplsql/maven/plugin/util/StringUtil.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/utplsql/maven/plugin/util/StringUtil.java b/src/main/java/org/utplsql/maven/plugin/util/StringUtil.java index 0ef4536..f95f8f6 100644 --- a/src/main/java/org/utplsql/maven/plugin/util/StringUtil.java +++ b/src/main/java/org/utplsql/maven/plugin/util/StringUtil.java @@ -6,7 +6,13 @@ private StringUtil() { } public static boolean isEmpty(CharSequence cs) { - return cs == null || cs.length() == 0; + if (cs == null) { + return true; + } + if (cs.length() == 0) { + return true; + } + return false; } public static boolean isNotEmpty(CharSequence cs) { @@ -15,10 +21,12 @@ public static boolean isNotEmpty(CharSequence cs) { public static boolean isBlank(CharSequence cs) { int strLen; - if (cs != null && (strLen = cs.length()) != 0) { - for (int i = 0; i < strLen; ++i) { - if (!Character.isWhitespace(cs.charAt(i))) { - return false; + if (cs != null) { + if ((strLen = cs.length()) != 0) { + for (int i = 0; i < strLen; ++i) { + if (!Character.isWhitespace(cs.charAt(i))) { + return false; + } } } } From 3a8eddb3032678800f5822b05eaa9381be12aa6a Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Thu, 9 Dec 2021 19:58:18 +0100 Subject: [PATCH 159/200] Use surefire plugin in newest version --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 8f9542f..6a95aca 100644 --- a/pom.xml +++ b/pom.xml @@ -149,6 +149,11 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + org.apache.maven.plugins maven-failsafe-plugin From 7d4596d5dd30f16cf89ef59cf9067ae863cce956 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Thu, 9 Dec 2021 20:09:23 +0100 Subject: [PATCH 160/200] Merged if statements --- .../utplsql/maven/plugin/util/StringUtil.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/utplsql/maven/plugin/util/StringUtil.java b/src/main/java/org/utplsql/maven/plugin/util/StringUtil.java index f95f8f6..c351ca7 100644 --- a/src/main/java/org/utplsql/maven/plugin/util/StringUtil.java +++ b/src/main/java/org/utplsql/maven/plugin/util/StringUtil.java @@ -6,13 +6,7 @@ private StringUtil() { } public static boolean isEmpty(CharSequence cs) { - if (cs == null) { - return true; - } - if (cs.length() == 0) { - return true; - } - return false; + return cs == null || cs.length() == 0; } public static boolean isNotEmpty(CharSequence cs) { @@ -20,13 +14,10 @@ public static boolean isNotEmpty(CharSequence cs) { } public static boolean isBlank(CharSequence cs) { - int strLen; - if (cs != null) { - if ((strLen = cs.length()) != 0) { - for (int i = 0; i < strLen; ++i) { - if (!Character.isWhitespace(cs.charAt(i))) { - return false; - } + if (cs != null && cs.length() > 0) { + for (int i = 0; i < cs.length(); ++i) { + if (!Character.isWhitespace(cs.charAt(i))) { + return false; } } } From 15ce395a2305498a9e8e2e6d4387921ecea5086d Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 14 Dec 2021 15:56:21 +0100 Subject: [PATCH 161/200] Fix for includeObject is set to runner.excludeObject/s #64 including test case --- README.md | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojo.java | 4 +- .../utplsql/maven/plugin/UtPlsqlMojoIT.java | 7 + .../utplsql/coverage-sonar-report.xml | 1 + .../utplsql/sonar-test-report.xml | 11 ++ .../UtPlsqlMojoIT/include_object/pom.xml | 52 ++++++++ .../foo/package_bodies/PKG_TEST_ME.sql | 27 ++++ .../sources/foo/packages/PKG_TEST_ME.sql | 8 ++ .../scripts/sources/foo/tables/TO_TEST_ME.tab | 8 ++ .../bar/package_bodies/TEST_PKG_TEST_ME.sql | 126 ++++++++++++++++++ .../test/bar/packages/TEST_PKG_TEST_ME.sql | 86 ++++++++++++ 11 files changed, 329 insertions(+), 3 deletions(-) create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/expected-output/utplsql/coverage-sonar-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/expected-output/utplsql/sonar-test-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/packages/PKG_TEST_ME.sql create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/tables/TO_TEST_ME.tab create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql diff --git a/README.md b/README.md index a243536..b3a03bd 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.7 + 3.1.8 diff --git a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java index acd3281..5aa52b6 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java @@ -174,9 +174,9 @@ public void execute() throws MojoExecutionException { if (isNotBlank(includeObject)) { if (includeObject.contains(",")) { String[] includes = includeObject.split(","); - runner.excludeObjects(Arrays.asList(includes)); + runner.includeObjects(Arrays.asList(includes)); } else { - runner.excludeObject(includeObject); + runner.includeObject(includeObject); } } diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java index 510d896..7057b7f 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java @@ -68,4 +68,11 @@ void exclude_object(MavenExecutionResult result) { assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); } + + @MavenTest + void include_object(MavenExecutionResult result) { + assertThat(result).isSuccessful(); + + assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); + } } diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/expected-output/utplsql/coverage-sonar-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/expected-output/utplsql/coverage-sonar-report.xml new file mode 100644 index 0000000..8dfb777 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/expected-output/utplsql/coverage-sonar-report.xml @@ -0,0 +1 @@ + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/expected-output/utplsql/sonar-test-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/expected-output/utplsql/sonar-test-report.xml new file mode 100644 index 0000000..04708f1 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/expected-output/utplsql/sonar-test-report.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml new file mode 100644 index 0000000..4ea345e --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml @@ -0,0 +1,52 @@ + + 4.0.0 + + org.utplsql + owner-param + 1.0.0 + pom + + + jdbc:oracle:thin:@localhost:1521:xe + UT3 + UT3 + + + + + + org.utplsql + utplsql-maven-plugin + @project.version@ + + + + test + + + false + + TESTS_OWNER + + + + UT_COVERAGE_SONAR_REPORTER + utplsql/coverage-sonar-report.xml + true + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + tests_owner.test_pkg_test_me + + + + + + + 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 new file mode 100644 index 0000000..d6846b2 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql @@ -0,0 +1,27 @@ +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 new file mode 100644 index 0000000..959b122 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/packages/PKG_TEST_ME.sql @@ -0,0 +1,8 @@ +-- +-- 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/sources/foo/tables/TO_TEST_ME.tab b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/tables/TO_TEST_ME.tab new file mode 100644 index 0000000..b2e90d9 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/sources/foo/tables/TO_TEST_ME.tab @@ -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/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 new file mode 100644 index 0000000..1b34f08 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql @@ -0,0 +1,126 @@ +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 new file mode 100644 index 0000000..b0cdf54 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql @@ -0,0 +1,86 @@ +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; +/ From 7d9c0fb19be781ec7ba88da4fc88c25ec27e8a63 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 14 Dec 2021 16:16:03 +0100 Subject: [PATCH 162/200] Update versions for release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6a95aca..42a4909 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.8-SNAPSHOT + 3.1.8 maven-plugin utPLSQL Maven Plugin From 0b30d4db034b5cbd445cf0be1121330da34133db Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 14 Dec 2021 16:19:14 +0100 Subject: [PATCH 163/200] Update for next development version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 42a4909..f2b3d0c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.8 + 3.1.9-SNAPSHOT maven-plugin utPLSQL Maven Plugin From 84798fe18e86f99bbea3c3804463378d9f971c87 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 14 Dec 2021 16:47:47 +0100 Subject: [PATCH 164/200] Version update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3a03bd..e9b0f9b 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.8 + 3.1.9 From 971a15abf730d460a5a03724421bf34ccaad52ca Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 14 Dec 2021 16:48:32 +0100 Subject: [PATCH 165/200] Update versions for release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f2b3d0c..b27f7ce 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.9-SNAPSHOT + 3.1.9 maven-plugin utPLSQL Maven Plugin From 54fcc10a36c68985df9e792d25b58e4e0fb4284b Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 14 Dec 2021 16:48:35 +0100 Subject: [PATCH 166/200] 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 167/200] 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 168/200] 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 169/200] 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 170/200] 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 50706adeb962e26de7f59188ffb82ab856826f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Sun, 9 Jan 2022 01:04:34 +0000 Subject: [PATCH 171/200] Update build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a4a716..f320d51 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,7 @@ on: branches: [ develop ] workflow_dispatch: + type: [utPLSQL-build] jobs: build: From 9632f152909654ff151f5c5e6ab05e4d9a7b8e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Sun, 9 Jan 2022 01:19:35 +0000 Subject: [PATCH 172/200] Update build.yml --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f320d51..35331fc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,8 @@ on: branches: [ develop ] workflow_dispatch: + + repository_dispatch: type: [utPLSQL-build] jobs: From 963b92049f1c3c2a6308f052c25916cb07c3dd2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Sun, 9 Jan 2022 01:25:12 +0000 Subject: [PATCH 173/200] Update build.yml --- .github/workflows/build.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35331fc..094d959 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -77,3 +77,19 @@ jobs: if: always() with: files: target/**/TEST**.xml + + slack-workflow-status: + if: always() + name: Post Workflow Status To Slack + needs: [ build ] + runs-on: ubuntu-latest + steps: + - name: Slack Workflow Notification + uses: Gamesight/slack-workflow-status@master + with: + # Required Input + repo_token: ${{secrets.GITHUB_TOKEN}} + slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} + # Optional Input + name: 'Github Actions[bot]' + icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' From a191427525b0403f4ed9c60960f9a7b0f250c272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Sun, 9 Jan 2022 01:25:42 +0000 Subject: [PATCH 174/200] Update release.yml --- .github/workflows/release.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 475a3e6..4825e34 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,3 +56,19 @@ jobs: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + + slack-workflow-status: + if: always() + name: Post Workflow Status To Slack + needs: [ build ] + runs-on: ubuntu-latest + steps: + - name: Slack Workflow Notification + uses: Gamesight/slack-workflow-status@master + with: + # Required Input + repo_token: ${{secrets.GITHUB_TOKEN}} + slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}} + # Optional Input + name: 'Github Actions[bot]' + icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png' From d40f1864140990d1688c3dea6b031b749b68f7cd Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Wed, 23 Feb 2022 02:06:37 +0200 Subject: [PATCH 175/200] 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 176/200] #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 177/200] 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 From 73775597f56bdeb25e47381ff6f877006eaeca75 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 10 Jun 2022 09:31:10 +0200 Subject: [PATCH 178/200] Update for next development version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5a97c58..f4bd2f0 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.10 + 3.1.11-SNAPSHOT maven-plugin utPLSQL Maven Plugin From 27b3f1f582014b2716a5aeac61ba0f7b276e162e Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Fri, 10 Jun 2022 10:32:05 +0200 Subject: [PATCH 179/200] Added include test --- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 23 ++++++-- .../unit-tests/include_object/pom.xml | 52 +++++++++++++++++++ 2 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 src/test/resources/unit-tests/include_object/pom.xml diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 3e8fb3c..33be92c 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -322,11 +322,11 @@ public void db_config_using_system_properties() throws Exception { } /** - * DB configuration from System Properties + * Exclude a list of objects *

- * Given : a pom.xml without dbUrl, dbUser and dbPass configured + * Given : a pom.xml with a list of objects to exclude * When : pom is read - * Then : System Properties must be used to configure database + * Then : Objects are excluded */ @Test public void exclude_object() throws Exception { @@ -338,6 +338,23 @@ public void exclude_object() throws Exception { assertEquals("app.pkg_test_me,app.test_pkg_test_me", utPlsqlMojo.excludeObject); } + /** + * Include a list of objects + *

+ * Given : a pom.xml with a list of objects to include + * When : pom is read + * Then : Objects are included + */ + @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"); } diff --git a/src/test/resources/unit-tests/include_object/pom.xml b/src/test/resources/unit-tests/include_object/pom.xml new file mode 100644 index 0000000..f031df5 --- /dev/null +++ b/src/test/resources/unit-tests/include_object/pom.xml @@ -0,0 +1,52 @@ + + 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 + + + false + + app + + + + UT_DOCUMENTATION_REPORTER + + + UT_COVERAGE_SONAR_REPORTER + coverage-sonar-report.xml + false + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + app.pkg_test_me,app.test_pkg_test_me + + + + + From 1c6aa234e6961bab756734ca00df20a4e45d5a30 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 15 Jun 2022 09:11:47 +0200 Subject: [PATCH 180/200] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6385883..8470463 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ Please refer to the following usage example for the parameters descriptions: - 0 + 0 From ae96de92c83e66a6e848baccd236d29be3b0c9ee Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 15 Jun 2022 09:12:36 +0200 Subject: [PATCH 181/200] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6385883..8470463 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ Please refer to the following usage example for the parameters descriptions: - 0 + 0 From a5408c56757613aa9d3319df10dfe99ab34728b3 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 15 Jun 2022 10:32:30 +0200 Subject: [PATCH 182/200] Improved oraStuckTimeout test --- .../java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java | 7 ++++--- src/test/resources/unit-tests/ora_stuck_timeout/pom.xml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 33be92c..27760b7 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -268,9 +268,9 @@ public void skip_utplsql_tests() throws Exception { } /** - * Enable DBMS_OUTPUT + * Set ORA Stuck Timeout *

- * Given : a pom.xml with dbmsOutput=true + * Given : a pom.xml with oraStuckTimeout=0 * When : pom is read * Then : Property is set */ @@ -280,8 +280,9 @@ public void ora_stuck_timeout() throws Exception { assertNotNull(utPlsqlMojo); utPlsqlMojo.execute(); - } + assertEquals(Integer.valueOf(5), utPlsqlMojo.oraStuckTimeout); + } /** * Ora Stuck Timeout diff --git a/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml b/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml index 08824f7..f04825c 100644 --- a/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml +++ b/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml @@ -25,7 +25,7 @@ test - 0 + 5 false app From 82ebf09cfb6ed0b4b8b647c18888f837d99486f6 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Wed, 15 Jun 2022 10:45:11 +0200 Subject: [PATCH 183/200] Use primitive int --- src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 27760b7..782a1ef 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -281,7 +281,7 @@ public void ora_stuck_timeout() throws Exception { utPlsqlMojo.execute(); - assertEquals(Integer.valueOf(5), utPlsqlMojo.oraStuckTimeout); + assertEquals(5, (int) utPlsqlMojo.oraStuckTimeout); } /** From 825b30ec75949bf2aac9cadfbd848133a3523422 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 11 Jul 2023 14:15:10 +0200 Subject: [PATCH 184/200] Added new parameter include/excludeSchemaExpr and include/excludeObjectExpr --- pom.xml | 17 ++------------ .../org/utplsql/maven/plugin/UtPlsqlMojo.java | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 5a97c58..52be329 100644 --- a/pom.xml +++ b/pom.xml @@ -83,8 +83,8 @@ org.utplsql - java-api - 3.1.9 + utplsql-java-api + 3.1.15 @@ -320,17 +320,4 @@ - - - - utplsql-java-api - https://packagecloud.io/utplsql/utplsql-java-api/maven2 - - true - - - true - - - diff --git a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java index 86dd27d..c0ba4be 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPlsqlMojo.java @@ -65,6 +65,15 @@ public class UtPlsqlMojo extends AbstractMojo { @Parameter String excludeObject; + @Parameter + String includeSchemaExpr; + @Parameter + String excludeSchemaExpr; + @Parameter + String includeObjectExpr; + @Parameter + String excludeObjectExpr; + @Parameter(defaultValue = "false") boolean skipCompatibilityCheck; @@ -184,6 +193,20 @@ public void execute() throws MojoExecutionException { } } + if (isNotBlank(excludeSchemaExpr)) { + runner.excludeSchemaExpr(excludeSchemaExpr); + } + if (isNotBlank(includeSchemaExpr)) { + runner.includeSchemaExpr(includeSchemaExpr); + } + + if (isNotBlank(excludeObjectExpr)) { + runner.excludeObjectExpr(excludeObjectExpr); + } + if (isNotBlank(includeObjectExpr)) { + runner.includeObjectExpr(includeObjectExpr); + } + runner.run(connection); } catch (SomeTestsFailedException e) { From 4208922fb2a051aeb219178aaba89c8b53afcb54 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 11 Jul 2023 14:26:02 +0200 Subject: [PATCH 185/200] Update README.md with expression based include/exclude --- README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8470463..d57328f 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.10 + 3.1.11 @@ -100,7 +100,7 @@ Please refer to the following usage example for the parameters descriptions: - + @@ -152,7 +152,7 @@ Please refer to the following usage example for the parameters descriptions: false - + 0 @@ -177,6 +177,18 @@ Please refer to the following usage example for the parameters descriptions: app.test1,app.test2 + + app.test1,app.test2 + + + app.test1,app.test2 + + + app.test1,app.test2 + + + app.test1,app.test2 + From 0790904b93808f450d57962ae4e83577dee95339 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 11 Jul 2023 15:16:26 +0200 Subject: [PATCH 186/200] Fixed wrong test configuration --- .../utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml | 2 +- .../expected-output/utplsql/coverage-sonar-report.xml | 2 +- .../utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml index d693636..15411c2 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml @@ -42,7 +42,7 @@ true - tests_owner.test_pkg_test_me + app.pkg_test_me,app.test_pkg_test_me diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/expected-output/utplsql/coverage-sonar-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/expected-output/utplsql/coverage-sonar-report.xml index 8dfb777..0700c46 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/expected-output/utplsql/coverage-sonar-report.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/expected-output/utplsql/coverage-sonar-report.xml @@ -1 +1 @@ - + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml index 4ea345e..ee6d13f 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml @@ -42,7 +42,7 @@ true - tests_owner.test_pkg_test_me + app.pkg_test_me From 1b68462ae131e0c93ecf008562a67c188576b570 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 11 Jul 2023 16:00:19 +0200 Subject: [PATCH 187/200] Added unit tests for include/exclude by expression --- .../utplsql/maven/plugin/UtPlsqlMojoTest.java | 69 +++++++++++++++++++ .../unit-tests/exclude_object_expr/pom.xml | 52 ++++++++++++++ .../unit-tests/exclude_schema_expr/pom.xml | 52 ++++++++++++++ .../unit-tests/include_object_expr/pom.xml | 52 ++++++++++++++ .../unit-tests/include_schema_expr/pom.xml | 52 ++++++++++++++ 5 files changed, 277 insertions(+) create mode 100644 src/test/resources/unit-tests/exclude_object_expr/pom.xml create mode 100644 src/test/resources/unit-tests/exclude_schema_expr/pom.xml create mode 100644 src/test/resources/unit-tests/include_object_expr/pom.xml create mode 100644 src/test/resources/unit-tests/include_schema_expr/pom.xml diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 782a1ef..6315072 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -356,6 +356,75 @@ public void include_object() throws Exception { assertEquals("app.pkg_test_me,app.test_pkg_test_me", utPlsqlMojo.includeObject); } + /** + * Include an object by regex + *

+ * Given : a pom.xml with a regex to include + * When : pom is read + * Then : Objects are included + */ + @Test + public void include_object_expr() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("include_object_expr"); + assertNotNull(utPlsqlMojo); + + utPlsqlMojo.execute(); + + assertEquals("*", utPlsqlMojo.includeObjectExpr); + } + + /** + * Exclude an object by regex + *

+ * Given : a pom.xml with a regex to exclude + * When : pom is read + * Then : Objects are included + */ + @Test + public void exclude_object_expr() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("exclude_object_expr"); + assertNotNull(utPlsqlMojo); + + utPlsqlMojo.execute(); + + assertEquals("*", utPlsqlMojo.excludeObjectExpr); + } + + + /** + * Include a schema by regex + *

+ * Given : a pom.xml with a regex to include + * When : pom is read + * Then : Objects are included + */ + @Test + public void include_schema_expr() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("include_schema_expr"); + assertNotNull(utPlsqlMojo); + + utPlsqlMojo.execute(); + + assertEquals("*", utPlsqlMojo.includeSchemaExpr); + } + + /** + * Exclude a schema by regex + *

+ * Given : a pom.xml with a regex to exclude + * When : pom is read + * Then : Objects are included + */ + @Test + public void exclude_schema_expr() throws Exception { + UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("exclude_schema_expr"); + assertNotNull(utPlsqlMojo); + + utPlsqlMojo.execute(); + + assertEquals("*", utPlsqlMojo.excludeSchemaExpr); + } + private UtPlsqlMojo createUtPlsqlMojo(String directory) throws Exception { return (UtPlsqlMojo) rule.lookupConfiguredMojo(new File("src/test/resources/unit-tests/" + directory), "test"); } diff --git a/src/test/resources/unit-tests/exclude_object_expr/pom.xml b/src/test/resources/unit-tests/exclude_object_expr/pom.xml new file mode 100644 index 0000000..7993e05 --- /dev/null +++ b/src/test/resources/unit-tests/exclude_object_expr/pom.xml @@ -0,0 +1,52 @@ + + 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 + + + false + + app + + + + UT_DOCUMENTATION_REPORTER + + + UT_COVERAGE_SONAR_REPORTER + coverage-sonar-report.xml + false + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + * + + + + + diff --git a/src/test/resources/unit-tests/exclude_schema_expr/pom.xml b/src/test/resources/unit-tests/exclude_schema_expr/pom.xml new file mode 100644 index 0000000..28df05e --- /dev/null +++ b/src/test/resources/unit-tests/exclude_schema_expr/pom.xml @@ -0,0 +1,52 @@ + + 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 + + + false + + app + + + + UT_DOCUMENTATION_REPORTER + + + UT_COVERAGE_SONAR_REPORTER + coverage-sonar-report.xml + false + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + * + + + + + diff --git a/src/test/resources/unit-tests/include_object_expr/pom.xml b/src/test/resources/unit-tests/include_object_expr/pom.xml new file mode 100644 index 0000000..636098b --- /dev/null +++ b/src/test/resources/unit-tests/include_object_expr/pom.xml @@ -0,0 +1,52 @@ + + 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 + + + false + + app + + + + UT_DOCUMENTATION_REPORTER + + + UT_COVERAGE_SONAR_REPORTER + coverage-sonar-report.xml + false + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + * + + + + + diff --git a/src/test/resources/unit-tests/include_schema_expr/pom.xml b/src/test/resources/unit-tests/include_schema_expr/pom.xml new file mode 100644 index 0000000..f953ec0 --- /dev/null +++ b/src/test/resources/unit-tests/include_schema_expr/pom.xml @@ -0,0 +1,52 @@ + + 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 + + + false + + app + + + + UT_DOCUMENTATION_REPORTER + + + UT_COVERAGE_SONAR_REPORTER + coverage-sonar-report.xml + false + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + * + + + + + From 175f23d14b5b7d6b27606142fb90029d5f93c680 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 11 Jul 2023 16:32:46 +0200 Subject: [PATCH 188/200] Added integration test for include schema by expression --- .../utplsql/maven/plugin/UtPlsqlMojoIT.java | 15 ++++++ .../utplsql/coverage-sonar-report.xml | 2 + .../utplsql/sonar-test-report.xml | 11 ++++ .../UtPlsqlMojoIT/exclude_object_expr/pom.xml | 52 +++++++++++++++++++ .../utplsql/coverage-sonar-report.xml | 1 + .../utplsql/sonar-test-report.xml | 11 ++++ .../UtPlsqlMojoIT/include_object_expr/pom.xml | 52 +++++++++++++++++++ 7 files changed, 144 insertions(+) create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/expected-output/utplsql/coverage-sonar-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/expected-output/utplsql/sonar-test-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/expected-output/utplsql/coverage-sonar-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/expected-output/utplsql/sonar-test-report.xml create mode 100644 src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java index db91d70..ce2f533 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoIT.java @@ -82,4 +82,19 @@ void ora_stuck_timeout(MavenExecutionResult result) { assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); } + + @MavenTest + void exclude_object_expr(MavenExecutionResult result) { + assertThat(result).isSuccessful(); + + assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); + } + + @MavenTest + void include_object_expr(MavenExecutionResult result) { + assertThat(result).isSuccessful(); + + assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml"); + } + } diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/expected-output/utplsql/coverage-sonar-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/expected-output/utplsql/coverage-sonar-report.xml new file mode 100644 index 0000000..cf7a48f --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/expected-output/utplsql/coverage-sonar-report.xml @@ -0,0 +1,2 @@ + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/expected-output/utplsql/sonar-test-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/expected-output/utplsql/sonar-test-report.xml new file mode 100644 index 0000000..04708f1 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/expected-output/utplsql/sonar-test-report.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml new file mode 100644 index 0000000..22d0869 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml @@ -0,0 +1,52 @@ + + 4.0.0 + + org.utplsql + owner-param + 1.0.0 + pom + + + jdbc:oracle:thin:@localhost:1521:xe + UT3 + UT3 + + + + + + org.utplsql + utplsql-maven-plugin + @project.version@ + + + + test + + + false + + TESTS_OWNER + + + + UT_COVERAGE_SONAR_REPORTER + utplsql/coverage-sonar-report.xml + true + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + *pkg_test_me + + + + + + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/expected-output/utplsql/coverage-sonar-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/expected-output/utplsql/coverage-sonar-report.xml new file mode 100644 index 0000000..2dbcb4d --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/expected-output/utplsql/coverage-sonar-report.xml @@ -0,0 +1 @@ + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/expected-output/utplsql/sonar-test-report.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/expected-output/utplsql/sonar-test-report.xml new file mode 100644 index 0000000..04708f1 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/expected-output/utplsql/sonar-test-report.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml new file mode 100644 index 0000000..e807d13 --- /dev/null +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml @@ -0,0 +1,52 @@ + + 4.0.0 + + org.utplsql + owner-param + 1.0.0 + pom + + + jdbc:oracle:thin:@localhost:1521:xe + UT3 + UT3 + + + + + + org.utplsql + utplsql-maven-plugin + @project.version@ + + + + test + + + false + + TESTS_OWNER + + + + UT_COVERAGE_SONAR_REPORTER + utplsql/coverage-sonar-report.xml + true + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-report.xml + true + + + app.* + + + + + + + From 91a530f3b7cef50fa9ae1cc732c449ab2ba30478 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 11 Jul 2023 16:44:28 +0200 Subject: [PATCH 189/200] Update versions for release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index dbc34a8..b8f50b8 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.11-SNAPSHOT + 3.1.11 maven-plugin utPLSQL Maven Plugin From f13979f3a1e99640e569d00c2f824922c88d3687 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 11 Jul 2023 16:44:31 +0200 Subject: [PATCH 190/200] Update for next development version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b8f50b8..760417b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.11 + 3.1.12-SNAPSHOT maven-plugin utPLSQL Maven Plugin From 36d6ab3c6a5094d9b0a790e008214da32e7bfa87 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 31 Aug 2024 14:00:24 +0200 Subject: [PATCH 191/200] Upgrade to Oracle Database Free #74 --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- scripts/0_start_db.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b3a4e7b..07c5189 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: services: oracle: - image: gvenzl/oracle-xe:21-slim + image: gvenzl/oracle-free:23-slim env: ORACLE_PASSWORD: oracle ports: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4825e34..f5b1c45 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: services: oracle: - image: gvenzl/oracle-xe:21-slim + image: gvenzl/oracle-free:23-slim env: ORACLE_PASSWORD: oracle ports: diff --git a/scripts/0_start_db.sh b/scripts/0_start_db.sh index d319407..d1bd8bb 100644 --- a/scripts/0_start_db.sh +++ b/scripts/0_start_db.sh @@ -1 +1 @@ -docker run -d --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle gvenzl/oracle-xe:21-slim +docker run -d --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle gvenzl/oracle-free:23-slim From 9d60472bd6bf3ba5e1f5c4046047d1bd9dffe37e Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 31 Aug 2024 14:07:31 +0200 Subject: [PATCH 192/200] User FREEPDB1 SID --- README.md | 2 +- .../java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java | 8 ++------ .../maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml | 2 +- .../plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/include_object/pom.xml | 2 +- .../plugin/UtPlsqlMojoIT/include_object_expr/pom.xml | 2 +- .../utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/owner_param/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/skip/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/type_mapping/pom.xml | 2 +- src/test/resources/unit-tests/dbms_output/pom.xml | 2 +- .../unit-tests/default_console_output_behaviour/pom.xml | 2 +- src/test/resources/unit-tests/default_reporter/pom.xml | 2 +- src/test/resources/unit-tests/exclude_object/pom.xml | 2 +- src/test/resources/unit-tests/exclude_object_expr/pom.xml | 2 +- src/test/resources/unit-tests/exclude_schema_expr/pom.xml | 2 +- src/test/resources/unit-tests/include_object/pom.xml | 2 +- src/test/resources/unit-tests/include_object_expr/pom.xml | 2 +- src/test/resources/unit-tests/include_schema_expr/pom.xml | 2 +- .../unit-tests/invalid_sources_directory/pom.xml | 2 +- .../resources/unit-tests/invalid_tests_directory/pom.xml | 2 +- src/test/resources/unit-tests/ora_stuck_timeout/pom.xml | 2 +- src/test/resources/unit-tests/skip_utplsql_tests/pom.xml | 2 +- .../sources_and_tests_parameter_does_not_exist/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../resources/unit-tests/sources_tests_parameters/pom.xml | 2 +- 32 files changed, 33 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index d57328f..c428511 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Please refer to the following usage example for the parameters descriptions: - + url_of_connection diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 6315072..3964c13 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -12,11 +12,7 @@ import java.io.PrintStream; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; public class UtPlsqlMojoTest { @@ -308,7 +304,7 @@ public void dbms_output() throws Exception { */ @Test public void db_config_using_system_properties() throws Exception { - System.setProperty("dbUrl", "jdbc:oracle:thin:@localhost:1521:xe"); + System.setProperty("dbUrl", "jdbc:oracle:thin:@localhost:1521:FREEPDB1"); System.setProperty("dbUser", "UT3"); System.setProperty("dbPass", "UT3"); diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml index 15411c2..36b3693 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:xe + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml index 22d0869..fbe3782 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:xe + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml index ee6d13f..d5c2a74 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:xe + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml index e807d13..b99d1f5 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:xe + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml index 40759d2..307b956 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:xe + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 index f0c33da..55c3bed 100644 --- 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:xe + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 961940b..156b956 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:xe + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 2620738..cbe578a 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:xe + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 c174c87..605124b 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:xe + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 f9264fb..839a6af 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:xe + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 01150a1..b82af37 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:xe + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 3cf0033..432deb2 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:xe + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/dbms_output/pom.xml b/src/test/resources/unit-tests/dbms_output/pom.xml index 4f45635..bf4bb04 100644 --- a/src/test/resources/unit-tests/dbms_output/pom.xml +++ b/src/test/resources/unit-tests/dbms_output/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml b/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml index ac6b14c..266f353 100644 --- a/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml +++ b/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/default_reporter/pom.xml b/src/test/resources/unit-tests/default_reporter/pom.xml index 8f03e25..a1483af 100644 --- a/src/test/resources/unit-tests/default_reporter/pom.xml +++ b/src/test/resources/unit-tests/default_reporter/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/exclude_object/pom.xml b/src/test/resources/unit-tests/exclude_object/pom.xml index d65fde3..59c2529 100644 --- a/src/test/resources/unit-tests/exclude_object/pom.xml +++ b/src/test/resources/unit-tests/exclude_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/exclude_object_expr/pom.xml b/src/test/resources/unit-tests/exclude_object_expr/pom.xml index 7993e05..2540641 100644 --- a/src/test/resources/unit-tests/exclude_object_expr/pom.xml +++ b/src/test/resources/unit-tests/exclude_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/exclude_schema_expr/pom.xml b/src/test/resources/unit-tests/exclude_schema_expr/pom.xml index 28df05e..29a9a01 100644 --- a/src/test/resources/unit-tests/exclude_schema_expr/pom.xml +++ b/src/test/resources/unit-tests/exclude_schema_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/include_object/pom.xml b/src/test/resources/unit-tests/include_object/pom.xml index f031df5..b3bcfa4 100644 --- a/src/test/resources/unit-tests/include_object/pom.xml +++ b/src/test/resources/unit-tests/include_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/include_object_expr/pom.xml b/src/test/resources/unit-tests/include_object_expr/pom.xml index 636098b..c3f43b9 100644 --- a/src/test/resources/unit-tests/include_object_expr/pom.xml +++ b/src/test/resources/unit-tests/include_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/include_schema_expr/pom.xml b/src/test/resources/unit-tests/include_schema_expr/pom.xml index f953ec0..95f28dd 100644 --- a/src/test/resources/unit-tests/include_schema_expr/pom.xml +++ b/src/test/resources/unit-tests/include_schema_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/invalid_sources_directory/pom.xml b/src/test/resources/unit-tests/invalid_sources_directory/pom.xml index af6643d..b6b3d5e 100644 --- a/src/test/resources/unit-tests/invalid_sources_directory/pom.xml +++ b/src/test/resources/unit-tests/invalid_sources_directory/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 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 c7380ef..af69a88 100644 --- a/src/test/resources/unit-tests/invalid_tests_directory/pom.xml +++ b/src/test/resources/unit-tests/invalid_tests_directory/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml b/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml index f04825c..2e3649d 100644 --- a/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml +++ b/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 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 3e978d5..88e75af 100644 --- a/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml +++ b/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml index a556a7e..bb59752 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml index a556a7e..bb59752 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml index d5382b4..fe55db1 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml index d33e917..c848bbd 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml @@ -10,7 +10,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 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 6f4c2d0..c07668c 100644 --- a/src/test/resources/unit-tests/sources_tests_parameters/pom.xml +++ b/src/test/resources/unit-tests/sources_tests_parameters/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:xe + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 From f67d92a003aaba57f77dad358c1c56650e68d92e Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 31 Aug 2024 14:11:48 +0200 Subject: [PATCH 193/200] Fixed JDBC Url --- README.md | 2 +- src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java | 2 +- .../utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml | 2 +- .../utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/skip/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/pom.xml | 2 +- src/test/resources/unit-tests/dbms_output/pom.xml | 2 +- .../unit-tests/default_console_output_behaviour/pom.xml | 2 +- src/test/resources/unit-tests/default_reporter/pom.xml | 2 +- src/test/resources/unit-tests/exclude_object/pom.xml | 2 +- src/test/resources/unit-tests/exclude_object_expr/pom.xml | 2 +- src/test/resources/unit-tests/exclude_schema_expr/pom.xml | 2 +- src/test/resources/unit-tests/include_object/pom.xml | 2 +- src/test/resources/unit-tests/include_object_expr/pom.xml | 2 +- src/test/resources/unit-tests/include_schema_expr/pom.xml | 2 +- src/test/resources/unit-tests/invalid_sources_directory/pom.xml | 2 +- src/test/resources/unit-tests/invalid_tests_directory/pom.xml | 2 +- src/test/resources/unit-tests/ora_stuck_timeout/pom.xml | 2 +- src/test/resources/unit-tests/skip_utplsql_tests/pom.xml | 2 +- .../sources_and_tests_parameter_does_not_exist/pom.xml | 2 +- .../pom.xml | 2 +- .../sources_and_tests_parameter_have_not_directory_tag/pom.xml | 2 +- .../sources_and_tests_parameter_have_not_includes_tag/pom.xml | 2 +- src/test/resources/unit-tests/sources_tests_parameters/pom.xml | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index c428511..ae7b2d7 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Please refer to the following usage example for the parameters descriptions: - + url_of_connection diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 3964c13..deb7546 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -304,7 +304,7 @@ public void dbms_output() throws Exception { */ @Test public void db_config_using_system_properties() throws Exception { - System.setProperty("dbUrl", "jdbc:oracle:thin:@localhost:1521:FREEPDB1"); + System.setProperty("dbUrl", "jdbc:oracle:thin:@localhost:1521/FREEPDB1"); System.setProperty("dbUser", "UT3"); System.setProperty("dbPass", "UT3"); diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml index 36b3693..4889335 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml index fbe3782..c4a016f 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml index d5c2a74..bcdc456 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml index b99d1f5..df74866 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml index 307b956..0660f2e 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521/FREEPDB1 UT3 UT3 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 index 55c3bed..0c2f255 100644 --- 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521/FREEPDB1 UT3 UT3 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 156b956..e358a2d 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521/FREEPDB1 UT3 UT3 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 cbe578a..3e1fd7f 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521/FREEPDB1 UT3 UT3 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 605124b..c8e0113 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521/FREEPDB1 UT3 UT3 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 839a6af..864cb07 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521/FREEPDB1 UT3 UT3 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 b82af37..2403efd 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521/FREEPDB1 UT3 UT3 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 432deb2..493e0d3 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/dbms_output/pom.xml b/src/test/resources/unit-tests/dbms_output/pom.xml index bf4bb04..7e0ded0 100644 --- a/src/test/resources/unit-tests/dbms_output/pom.xml +++ b/src/test/resources/unit-tests/dbms_output/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml b/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml index 266f353..60c5437 100644 --- a/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml +++ b/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/default_reporter/pom.xml b/src/test/resources/unit-tests/default_reporter/pom.xml index a1483af..c5eec78 100644 --- a/src/test/resources/unit-tests/default_reporter/pom.xml +++ b/src/test/resources/unit-tests/default_reporter/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/exclude_object/pom.xml b/src/test/resources/unit-tests/exclude_object/pom.xml index 59c2529..c5a1b47 100644 --- a/src/test/resources/unit-tests/exclude_object/pom.xml +++ b/src/test/resources/unit-tests/exclude_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/exclude_object_expr/pom.xml b/src/test/resources/unit-tests/exclude_object_expr/pom.xml index 2540641..28e2b2b 100644 --- a/src/test/resources/unit-tests/exclude_object_expr/pom.xml +++ b/src/test/resources/unit-tests/exclude_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/exclude_schema_expr/pom.xml b/src/test/resources/unit-tests/exclude_schema_expr/pom.xml index 29a9a01..97e900f 100644 --- a/src/test/resources/unit-tests/exclude_schema_expr/pom.xml +++ b/src/test/resources/unit-tests/exclude_schema_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/include_object/pom.xml b/src/test/resources/unit-tests/include_object/pom.xml index b3bcfa4..d15d710 100644 --- a/src/test/resources/unit-tests/include_object/pom.xml +++ b/src/test/resources/unit-tests/include_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/include_object_expr/pom.xml b/src/test/resources/unit-tests/include_object_expr/pom.xml index c3f43b9..ddd1e1d 100644 --- a/src/test/resources/unit-tests/include_object_expr/pom.xml +++ b/src/test/resources/unit-tests/include_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/include_schema_expr/pom.xml b/src/test/resources/unit-tests/include_schema_expr/pom.xml index 95f28dd..09d3793 100644 --- a/src/test/resources/unit-tests/include_schema_expr/pom.xml +++ b/src/test/resources/unit-tests/include_schema_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/invalid_sources_directory/pom.xml b/src/test/resources/unit-tests/invalid_sources_directory/pom.xml index b6b3d5e..74d9946 100644 --- a/src/test/resources/unit-tests/invalid_sources_directory/pom.xml +++ b/src/test/resources/unit-tests/invalid_sources_directory/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 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 af69a88..e086711 100644 --- a/src/test/resources/unit-tests/invalid_tests_directory/pom.xml +++ b/src/test/resources/unit-tests/invalid_tests_directory/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml b/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml index 2e3649d..4bcb833 100644 --- a/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml +++ b/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 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 88e75af..4a0809e 100644 --- a/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml +++ b/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml index bb59752..123d569 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml index bb59752..123d569 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml index fe55db1..8f6fd16 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml index c848bbd..9c1550e 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml @@ -10,7 +10,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 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 c07668c..5588400 100644 --- a/src/test/resources/unit-tests/sources_tests_parameters/pom.xml +++ b/src/test/resources/unit-tests/sources_tests_parameters/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 UT3 UT3 From 482b7f1e2b63d28a7095127cd8a2270f5f150a2f Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Sat, 31 Aug 2024 14:25:43 +0200 Subject: [PATCH 194/200] Updated scripts for new DB --- .gitignore | 460 ++++++++++++++++++++++++++++++ scripts/0_start_db.sh | 0 scripts/1_install_utplsql.sh | 2 +- scripts/2_install_demo_project.sh | 8 +- 4 files changed, 465 insertions(+), 5 deletions(-) mode change 100644 => 100755 scripts/0_start_db.sh mode change 100644 => 100755 scripts/1_install_utplsql.sh mode change 100644 => 100755 scripts/2_install_demo_project.sh diff --git a/.gitignore b/.gitignore index ed6f99b..4325a42 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,463 @@ doc/ /utPLSQL/ /utPLSQL.zip /tree.txt +/scripts/utPLSQL.zip +/scripts/utPLSQL/docs/about/authors.html +/scripts/utPLSQL/docs/about/license.html +/scripts/utPLSQL/docs/about/project-details.html +/scripts/utPLSQL/docs/about/support.html +/scripts/utPLSQL/docs/assets/images/favicon.png +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.ar.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.da.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.de.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.du.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.el.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.es.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.fi.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.fr.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.he.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.hi.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.hu.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.hy.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.it.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.ja.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.jp.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.kn.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.ko.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.multi.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.nl.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.no.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.pt.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.ro.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.ru.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.sa.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.stemmer.support.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.sv.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.ta.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.te.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.th.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.tr.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.vi.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.zh.min.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/tinyseg.js +/scripts/utPLSQL/docs/assets/javascripts/lunr/wordcut.js +/scripts/utPLSQL/docs/assets/javascripts/workers/search.b8dbb3d2.min.js +/scripts/utPLSQL/docs/assets/javascripts/workers/search.b8dbb3d2.min.js.map +/scripts/utPLSQL/docs/assets/javascripts/bundle.8fd75fb4.min.js +/scripts/utPLSQL/docs/assets/javascripts/bundle.8fd75fb4.min.js.map +/scripts/utPLSQL/docs/assets/stylesheets/main.7e359304.min.css +/scripts/utPLSQL/docs/assets/stylesheets/main.7e359304.min.css.map +/scripts/utPLSQL/docs/assets/stylesheets/palette.06af60db.min.css +/scripts/utPLSQL/docs/assets/stylesheets/palette.06af60db.min.css.map +/scripts/utPLSQL/docs/assets/favicon.png +/scripts/utPLSQL/docs/assets/icon-transparent.png +/scripts/utPLSQL/docs/images/3_steps_to_run_utPLSQL.gif +/scripts/utPLSQL/docs/images/coverage_html_details.png +/scripts/utPLSQL/docs/images/coverage_html_summary.png +/scripts/utPLSQL/docs/images/documentation_reporter.png +/scripts/utPLSQL/docs/images/documentation_reporter_color.png +/scripts/utPLSQL/docs/images/example_1_coverage_mapping.png +/scripts/utPLSQL/docs/images/example_1_test_mapping.png +/scripts/utPLSQL/docs/images/example_2_coverage_mapping.png +/scripts/utPLSQL/docs/images/example_2_test_mapping.png +/scripts/utPLSQL/docs/images/example_3_coverage_mapping.png +/scripts/utPLSQL/docs/images/example_3_test_mapping.png +/scripts/utPLSQL/docs/images/example_4_coverage_mapping.png +/scripts/utPLSQL/docs/images/example_4_test_mapping.png +/scripts/utPLSQL/docs/images/extended_coverage_html_line.png +/scripts/utPLSQL/docs/images/extended_coverage_html_summary.png +/scripts/utPLSQL/docs/images/junit_errors.png +/scripts/utPLSQL/docs/images/junit_summary.png +/scripts/utPLSQL/docs/images/supported_by_redgate_100.png +/scripts/utPLSQL/docs/images/teamcity_report_example.png +/scripts/utPLSQL/docs/images/teamcity_report_example_errors.png +/scripts/utPLSQL/docs/images/tfs_details.png +/scripts/utPLSQL/docs/images/tfs_summary.png +/scripts/utPLSQL/docs/images/utPLSQL-testing-framework-transparent_120.png +/scripts/utPLSQL/docs/images/venn21.gif +/scripts/utPLSQL/docs/images/venn22.gif +/scripts/utPLSQL/docs/stylesheets/extra.css +/scripts/utPLSQL/docs/userguide/advanced_data_comparison.html +/scripts/utPLSQL/docs/userguide/annotations.html +/scripts/utPLSQL/docs/userguide/best-practices.html +/scripts/utPLSQL/docs/userguide/exception-reporting.html +/scripts/utPLSQL/docs/userguide/expectations.html +/scripts/utPLSQL/docs/userguide/getting-started.html +/scripts/utPLSQL/docs/userguide/install.html +/scripts/utPLSQL/docs/userguide/querying_suites.html +/scripts/utPLSQL/docs/userguide/reporters.html +/scripts/utPLSQL/docs/userguide/running-unit-tests.html +/scripts/utPLSQL/docs/userguide/upgrade.html +/scripts/utPLSQL/docs/404.html +/scripts/utPLSQL/docs/compare_version2_to_3.html +/scripts/utPLSQL/docs/index.html +/scripts/utPLSQL/docs/sitemap.xml +/scripts/utPLSQL/examples/award_bonus/award_bonus.sql +/scripts/utPLSQL/examples/award_bonus/employees_test.sql +/scripts/utPLSQL/examples/award_bonus/run_award_bonus_test.sql +/scripts/utPLSQL/examples/award_bonus/test_award_bonus.pkg +/scripts/utPLSQL/examples/between_string/betwnstr.sql +/scripts/utPLSQL/examples/between_string/run_betwnstr_test.sql +/scripts/utPLSQL/examples/between_string/run_betwnstr_test_coverage.sql +/scripts/utPLSQL/examples/between_string/test_betwnstr.pkb +/scripts/utPLSQL/examples/between_string/test_betwnstr.pks +/scripts/utPLSQL/examples/custom_reporters/run_ut_custom_reporter.sql +/scripts/utPLSQL/examples/custom_reporters/run_ut_expectations_reporter.sql +/scripts/utPLSQL/examples/custom_reporters/ut_custom_reporter.tpb +/scripts/utPLSQL/examples/custom_reporters/ut_custom_reporter.tps +/scripts/utPLSQL/examples/custom_reporters/ut_expectations_reporter.tpb +/scripts/utPLSQL/examples/custom_reporters/ut_expectations_reporter.tps +/scripts/utPLSQL/examples/demo_of_expectations/demo_equal_matcher.sql +/scripts/utPLSQL/examples/demo_of_expectations/drop_demo_equal_matcher.sql +/scripts/utPLSQL/examples/demo_of_expectations/run.sql +/scripts/utPLSQL/examples/developer_examples/RunExampleTestAnnotationsParsingTimeHugePackage.sql +/scripts/utPLSQL/examples/developer_examples/RunExampleTestSuite.sql +/scripts/utPLSQL/examples/developer_examples/RunExampleTestSuiteWithCompositeReporter.sql +/scripts/utPLSQL/examples/developer_examples/tst_pkg_huge.pks +/scripts/utPLSQL/examples/developer_examples/ut_exampletest.pkb +/scripts/utPLSQL/examples/developer_examples/ut_exampletest.pks +/scripts/utPLSQL/examples/developer_examples/ut_exampletest2.pkb +/scripts/utPLSQL/examples/developer_examples/ut_exampletest2.pks +/scripts/utPLSQL/examples/remove_rooms_by_name/remove_rooms_by_name.sql +/scripts/utPLSQL/examples/remove_rooms_by_name/rooms.sql +/scripts/utPLSQL/examples/remove_rooms_by_name/run_remove_rooms_by_name_test.sql +/scripts/utPLSQL/examples/remove_rooms_by_name/test_remove_rooms_by_name.pkg +/scripts/utPLSQL/examples/demo_expectations.pck +/scripts/utPLSQL/examples/department.tps +/scripts/utPLSQL/examples/departments.tps +/scripts/utPLSQL/examples/readme.md +/scripts/utPLSQL/examples/RunAllExamples.sql +/scripts/utPLSQL/examples/RunAllExamplesAsTests.sql +/scripts/utPLSQL/examples/RunCustomReportersExamples.sql +/scripts/utPLSQL/examples/RunDeveloperExamples.sql +/scripts/utPLSQL/examples/RunExampleTestAnnotationBasedForCurrentSchema.sql +/scripts/utPLSQL/examples/RunExpectations.sql +/scripts/utPLSQL/examples/RunUserExamples.sql +/scripts/utPLSQL/examples/RunWithDocumentationReporter.sql +/scripts/utPLSQL/examples/test_pkg1.pck +/scripts/utPLSQL/examples/test_pkg2.pck +/scripts/utPLSQL/source/api/be_between.syn +/scripts/utPLSQL/source/api/be_empty.syn +/scripts/utPLSQL/source/api/be_false.syn +/scripts/utPLSQL/source/api/be_greater_or_equal.syn +/scripts/utPLSQL/source/api/be_greater_than.syn +/scripts/utPLSQL/source/api/be_less_or_equal.syn +/scripts/utPLSQL/source/api/be_less_than.syn +/scripts/utPLSQL/source/api/be_like.syn +/scripts/utPLSQL/source/api/be_not_null.syn +/scripts/utPLSQL/source/api/be_null.syn +/scripts/utPLSQL/source/api/be_true.syn +/scripts/utPLSQL/source/api/be_within.syn +/scripts/utPLSQL/source/api/be_within_pct.syn +/scripts/utPLSQL/source/api/contain.syn +/scripts/utPLSQL/source/api/equal.syn +/scripts/utPLSQL/source/api/have_count.syn +/scripts/utPLSQL/source/api/match.syn +/scripts/utPLSQL/source/api/ut.pkb +/scripts/utPLSQL/source/api/ut.pks +/scripts/utPLSQL/source/api/ut_runner.pkb +/scripts/utPLSQL/source/api/ut_runner.pks +/scripts/utPLSQL/source/api/ut_suite_item_info.tpb +/scripts/utPLSQL/source/api/ut_suite_item_info.tps +/scripts/utPLSQL/source/api/ut_suite_items_info.tps +/scripts/utPLSQL/source/core/annotations/ut_annotated_object.tps +/scripts/utPLSQL/source/core/annotations/ut_annotated_objects.tps +/scripts/utPLSQL/source/core/annotations/ut_annotation.tps +/scripts/utPLSQL/source/core/annotations/ut_annotation_cache.sql +/scripts/utPLSQL/source/core/annotations/ut_annotation_cache_info.sql +/scripts/utPLSQL/source/core/annotations/ut_annotation_cache_manager.pkb +/scripts/utPLSQL/source/core/annotations/ut_annotation_cache_manager.pks +/scripts/utPLSQL/source/core/annotations/ut_annotation_cache_schema.sql +/scripts/utPLSQL/source/core/annotations/ut_annotation_cache_seq.sql +/scripts/utPLSQL/source/core/annotations/ut_annotation_manager.pkb +/scripts/utPLSQL/source/core/annotations/ut_annotation_manager.pks +/scripts/utPLSQL/source/core/annotations/ut_annotation_obj_cache_info.tps +/scripts/utPLSQL/source/core/annotations/ut_annotation_objs_cache_info.tps +/scripts/utPLSQL/source/core/annotations/ut_annotation_parser.pkb +/scripts/utPLSQL/source/core/annotations/ut_annotation_parser.pks +/scripts/utPLSQL/source/core/annotations/ut_annotations.tps +/scripts/utPLSQL/source/core/annotations/ut_trigger_annotation_parsing.trg +/scripts/utPLSQL/source/core/annotations/ut_trigger_check.pkb +/scripts/utPLSQL/source/core/annotations/ut_trigger_check.pks +/scripts/utPLSQL/source/core/coverage/dbms_plssqlcode.sql +/scripts/utPLSQL/source/core/coverage/proftab.sql +/scripts/utPLSQL/source/core/coverage/ut_coverage.pkb +/scripts/utPLSQL/source/core/coverage/ut_coverage.pks +/scripts/utPLSQL/source/core/coverage/ut_coverage_block.pkb +/scripts/utPLSQL/source/core/coverage/ut_coverage_block.pks +/scripts/utPLSQL/source/core/coverage/ut_coverage_helper.pkb +/scripts/utPLSQL/source/core/coverage/ut_coverage_helper.pks +/scripts/utPLSQL/source/core/coverage/ut_coverage_helper_block.pkb +/scripts/utPLSQL/source/core/coverage/ut_coverage_helper_block.pks +/scripts/utPLSQL/source/core/coverage/ut_coverage_helper_profiler.pkb +/scripts/utPLSQL/source/core/coverage/ut_coverage_helper_profiler.pks +/scripts/utPLSQL/source/core/coverage/ut_coverage_profiler.pkb +/scripts/utPLSQL/source/core/coverage/ut_coverage_profiler.pks +/scripts/utPLSQL/source/core/coverage/ut_coverage_reporter_base.tpb +/scripts/utPLSQL/source/core/coverage/ut_coverage_reporter_base.tps +/scripts/utPLSQL/source/core/coverage/ut_coverage_runs.sql +/scripts/utPLSQL/source/core/coverage/ut_coverage_sources_tmp.sql +/scripts/utPLSQL/source/core/events/ut_event_item.tps +/scripts/utPLSQL/source/core/events/ut_event_listener.tps +/scripts/utPLSQL/source/core/events/ut_event_manager.pkb +/scripts/utPLSQL/source/core/events/ut_event_manager.pks +/scripts/utPLSQL/source/core/output_buffers/ut_output_buffer_base.tpb +/scripts/utPLSQL/source/core/output_buffers/ut_output_buffer_base.tps +/scripts/utPLSQL/source/core/output_buffers/ut_output_buffer_info_tmp.sql +/scripts/utPLSQL/source/core/output_buffers/ut_output_buffer_tmp.sql +/scripts/utPLSQL/source/core/output_buffers/ut_output_bulk_buffer.tpb +/scripts/utPLSQL/source/core/output_buffers/ut_output_bulk_buffer.tps +/scripts/utPLSQL/source/core/output_buffers/ut_output_clob_buffer_tmp.sql +/scripts/utPLSQL/source/core/output_buffers/ut_output_clob_table_buffer.tpb +/scripts/utPLSQL/source/core/output_buffers/ut_output_clob_table_buffer.tps +/scripts/utPLSQL/source/core/output_buffers/ut_output_data_row.tps +/scripts/utPLSQL/source/core/output_buffers/ut_output_data_rows.tps +/scripts/utPLSQL/source/core/output_buffers/ut_output_table_buffer.tpb +/scripts/utPLSQL/source/core/output_buffers/ut_output_table_buffer.tps +/scripts/utPLSQL/source/core/session_context/ut_session_context.pkb +/scripts/utPLSQL/source/core/session_context/ut_session_context.pks +/scripts/utPLSQL/source/core/session_context/ut_session_info.tpb +/scripts/utPLSQL/source/core/session_context/ut_session_info.tps +/scripts/utPLSQL/source/core/types/ut_console_reporter_base.tpb +/scripts/utPLSQL/source/core/types/ut_console_reporter_base.tps +/scripts/utPLSQL/source/core/types/ut_coverage_options.tpb +/scripts/utPLSQL/source/core/types/ut_coverage_options.tps +/scripts/utPLSQL/source/core/types/ut_executable.tpb +/scripts/utPLSQL/source/core/types/ut_executable.tps +/scripts/utPLSQL/source/core/types/ut_executable_test.tpb +/scripts/utPLSQL/source/core/types/ut_executable_test.tps +/scripts/utPLSQL/source/core/types/ut_executables.tps +/scripts/utPLSQL/source/core/types/ut_expectation_result.tpb +/scripts/utPLSQL/source/core/types/ut_expectation_result.tps +/scripts/utPLSQL/source/core/types/ut_expectation_results.tps +/scripts/utPLSQL/source/core/types/ut_file_mapping.tpb +/scripts/utPLSQL/source/core/types/ut_file_mapping.tps +/scripts/utPLSQL/source/core/types/ut_file_mappings.tps +/scripts/utPLSQL/source/core/types/ut_integer_list.tps +/scripts/utPLSQL/source/core/types/ut_key_value_pair.tps +/scripts/utPLSQL/source/core/types/ut_key_value_pairs.tps +/scripts/utPLSQL/source/core/types/ut_logical_suite.tpb +/scripts/utPLSQL/source/core/types/ut_logical_suite.tps +/scripts/utPLSQL/source/core/types/ut_object_name.tpb +/scripts/utPLSQL/source/core/types/ut_object_name.tps +/scripts/utPLSQL/source/core/types/ut_object_names.tps +/scripts/utPLSQL/source/core/types/ut_output_reporter_base.tpb +/scripts/utPLSQL/source/core/types/ut_output_reporter_base.tps +/scripts/utPLSQL/source/core/types/ut_path_item.tpb +/scripts/utPLSQL/source/core/types/ut_path_item.tps +/scripts/utPLSQL/source/core/types/ut_path_items.tps +/scripts/utPLSQL/source/core/types/ut_reporter_base.tpb +/scripts/utPLSQL/source/core/types/ut_reporter_base.tps +/scripts/utPLSQL/source/core/types/ut_reporter_info.tps +/scripts/utPLSQL/source/core/types/ut_reporters.tps +/scripts/utPLSQL/source/core/types/ut_reporters_info.tps +/scripts/utPLSQL/source/core/types/ut_results_counter.tpb +/scripts/utPLSQL/source/core/types/ut_results_counter.tps +/scripts/utPLSQL/source/core/types/ut_run.tpb +/scripts/utPLSQL/source/core/types/ut_run.tps +/scripts/utPLSQL/source/core/types/ut_run_info.tpb +/scripts/utPLSQL/source/core/types/ut_run_info.tps +/scripts/utPLSQL/source/core/types/ut_stack.tpb +/scripts/utPLSQL/source/core/types/ut_stack.tps +/scripts/utPLSQL/source/core/types/ut_suite.tpb +/scripts/utPLSQL/source/core/types/ut_suite.tps +/scripts/utPLSQL/source/core/types/ut_suite_cache_row.tps +/scripts/utPLSQL/source/core/types/ut_suite_cache_rows.tps +/scripts/utPLSQL/source/core/types/ut_suite_context.tpb +/scripts/utPLSQL/source/core/types/ut_suite_context.tps +/scripts/utPLSQL/source/core/types/ut_suite_item.tpb +/scripts/utPLSQL/source/core/types/ut_suite_item.tps +/scripts/utPLSQL/source/core/types/ut_suite_items.tps +/scripts/utPLSQL/source/core/types/ut_test.tpb +/scripts/utPLSQL/source/core/types/ut_test.tps +/scripts/utPLSQL/source/core/types/ut_varchar2_list.tps +/scripts/utPLSQL/source/core/types/ut_varchar2_rows.tps +/scripts/utPLSQL/source/core/ut_dbms_output_cache.sql +/scripts/utPLSQL/source/core/ut_expectation_processor.pkb +/scripts/utPLSQL/source/core/ut_expectation_processor.pks +/scripts/utPLSQL/source/core/ut_file_mapper.pkb +/scripts/utPLSQL/source/core/ut_file_mapper.pks +/scripts/utPLSQL/source/core/ut_metadata.pkb +/scripts/utPLSQL/source/core/ut_metadata.pks +/scripts/utPLSQL/source/core/ut_savepoint_seq.sql +/scripts/utPLSQL/source/core/ut_suite_builder.pkb +/scripts/utPLSQL/source/core/ut_suite_builder.pks +/scripts/utPLSQL/source/core/ut_suite_cache.sql +/scripts/utPLSQL/source/core/ut_suite_cache_manager.pkb +/scripts/utPLSQL/source/core/ut_suite_cache_manager.pks +/scripts/utPLSQL/source/core/ut_suite_cache_package.sql +/scripts/utPLSQL/source/core/ut_suite_cache_schema.sql +/scripts/utPLSQL/source/core/ut_suite_cache_seq.sql +/scripts/utPLSQL/source/core/ut_suite_manager.pkb +/scripts/utPLSQL/source/core/ut_suite_manager.pks +/scripts/utPLSQL/source/core/ut_suite_tag_filter.pkb +/scripts/utPLSQL/source/core/ut_suite_tag_filter.pks +/scripts/utPLSQL/source/core/ut_utils.pkb +/scripts/utPLSQL/source/core/ut_utils.pks +/scripts/utPLSQL/source/expectations/data_values/ut_compound_data_diff_tmp.sql +/scripts/utPLSQL/source/expectations/data_values/ut_compound_data_helper.pkb +/scripts/utPLSQL/source/expectations/data_values/ut_compound_data_helper.pks +/scripts/utPLSQL/source/expectations/data_values/ut_compound_data_tmp.sql +/scripts/utPLSQL/source/expectations/data_values/ut_compound_data_value.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_compound_data_value.tps +/scripts/utPLSQL/source/expectations/data_values/ut_cursor_column.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_cursor_column.tps +/scripts/utPLSQL/source/expectations/data_values/ut_cursor_column_tab.tps +/scripts/utPLSQL/source/expectations/data_values/ut_cursor_details.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_cursor_details.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_anydata.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_anydata.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_blob.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_blob.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_boolean.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_boolean.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_clob.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_clob.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_date.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_date.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_dsinterval.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_dsinterval.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_json.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_json.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_number.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_number.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_refcursor.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_refcursor.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_timestamp.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_timestamp.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_timestamp_ltz.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_timestamp_ltz.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_timestamp_tz.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_timestamp_tz.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_varchar2.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_varchar2.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_xmltype.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_xmltype.tps +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_yminterval.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_data_value_yminterval.tps +/scripts/utPLSQL/source/expectations/data_values/ut_json_data_diff_tmp.sql +/scripts/utPLSQL/source/expectations/data_values/ut_json_leaf.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_json_leaf.tps +/scripts/utPLSQL/source/expectations/data_values/ut_json_leaf_tab.tps +/scripts/utPLSQL/source/expectations/data_values/ut_json_tree_details.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_json_tree_details.tps +/scripts/utPLSQL/source/expectations/data_values/ut_key_anyval_pair.tps +/scripts/utPLSQL/source/expectations/data_values/ut_key_anyval_pairs.tps +/scripts/utPLSQL/source/expectations/data_values/ut_key_anyvalues.tpb +/scripts/utPLSQL/source/expectations/data_values/ut_key_anyvalues.tps +/scripts/utPLSQL/source/expectations/matchers/ut_be_between.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_be_between.tps +/scripts/utPLSQL/source/expectations/matchers/ut_be_empty.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_be_empty.tps +/scripts/utPLSQL/source/expectations/matchers/ut_be_false.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_be_false.tps +/scripts/utPLSQL/source/expectations/matchers/ut_be_greater_or_equal.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_be_greater_or_equal.tps +/scripts/utPLSQL/source/expectations/matchers/ut_be_greater_than.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_be_greater_than.tps +/scripts/utPLSQL/source/expectations/matchers/ut_be_less_or_equal.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_be_less_or_equal.tps +/scripts/utPLSQL/source/expectations/matchers/ut_be_less_than.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_be_less_than.tps +/scripts/utPLSQL/source/expectations/matchers/ut_be_like.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_be_like.tps +/scripts/utPLSQL/source/expectations/matchers/ut_be_not_null.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_be_not_null.tps +/scripts/utPLSQL/source/expectations/matchers/ut_be_null.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_be_null.tps +/scripts/utPLSQL/source/expectations/matchers/ut_be_true.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_be_true.tps +/scripts/utPLSQL/source/expectations/matchers/ut_be_within.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_be_within.tps +/scripts/utPLSQL/source/expectations/matchers/ut_be_within_helper.pkb +/scripts/utPLSQL/source/expectations/matchers/ut_be_within_helper.pks +/scripts/utPLSQL/source/expectations/matchers/ut_be_within_pct.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_be_within_pct.tps +/scripts/utPLSQL/source/expectations/matchers/ut_comparison_matcher.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_comparison_matcher.tps +/scripts/utPLSQL/source/expectations/matchers/ut_contain.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_contain.tps +/scripts/utPLSQL/source/expectations/matchers/ut_equal.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_equal.tps +/scripts/utPLSQL/source/expectations/matchers/ut_have_count.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_have_count.tps +/scripts/utPLSQL/source/expectations/matchers/ut_match.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_match.tps +/scripts/utPLSQL/source/expectations/matchers/ut_matcher.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_matcher.tps +/scripts/utPLSQL/source/expectations/matchers/ut_matcher_base.tps +/scripts/utPLSQL/source/expectations/matchers/ut_matcher_options.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_matcher_options.tps +/scripts/utPLSQL/source/expectations/matchers/ut_matcher_options_items.tpb +/scripts/utPLSQL/source/expectations/matchers/ut_matcher_options_items.tps +/scripts/utPLSQL/source/expectations/json_objects_specs.sql +/scripts/utPLSQL/source/expectations/ut_expectation.tpb +/scripts/utPLSQL/source/expectations/ut_expectation.tps +/scripts/utPLSQL/source/expectations/ut_expectation_base.tpb +/scripts/utPLSQL/source/expectations/ut_expectation_base.tps +/scripts/utPLSQL/source/expectations/ut_expectation_compound.tpb +/scripts/utPLSQL/source/expectations/ut_expectation_compound.tps +/scripts/utPLSQL/source/expectations/ut_expectation_json.tpb +/scripts/utPLSQL/source/expectations/ut_expectation_json.tps +/scripts/utPLSQL/source/reporters/ut_ansiconsole_helper.pkb +/scripts/utPLSQL/source/reporters/ut_ansiconsole_helper.pks +/scripts/utPLSQL/source/reporters/ut_coverage_cobertura_reporter.tpb +/scripts/utPLSQL/source/reporters/ut_coverage_cobertura_reporter.tps +/scripts/utPLSQL/source/reporters/ut_coverage_html_reporter.tpb +/scripts/utPLSQL/source/reporters/ut_coverage_html_reporter.tps +/scripts/utPLSQL/source/reporters/ut_coverage_report_html_helper.pkb +/scripts/utPLSQL/source/reporters/ut_coverage_report_html_helper.pks +/scripts/utPLSQL/source/reporters/ut_coverage_sonar_reporter.tpb +/scripts/utPLSQL/source/reporters/ut_coverage_sonar_reporter.tps +/scripts/utPLSQL/source/reporters/ut_coveralls_reporter.tpb +/scripts/utPLSQL/source/reporters/ut_coveralls_reporter.tps +/scripts/utPLSQL/source/reporters/ut_debug_reporter.tpb +/scripts/utPLSQL/source/reporters/ut_debug_reporter.tps +/scripts/utPLSQL/source/reporters/ut_documentation_reporter.tpb +/scripts/utPLSQL/source/reporters/ut_documentation_reporter.tps +/scripts/utPLSQL/source/reporters/ut_junit_reporter.tpb +/scripts/utPLSQL/source/reporters/ut_junit_reporter.tps +/scripts/utPLSQL/source/reporters/ut_realtime_reporter.tpb +/scripts/utPLSQL/source/reporters/ut_realtime_reporter.tps +/scripts/utPLSQL/source/reporters/ut_sonar_test_reporter.tpb +/scripts/utPLSQL/source/reporters/ut_sonar_test_reporter.tps +/scripts/utPLSQL/source/reporters/ut_teamcity_reporter.tpb +/scripts/utPLSQL/source/reporters/ut_teamcity_reporter.tps +/scripts/utPLSQL/source/reporters/ut_teamcity_reporter_helper.pkb +/scripts/utPLSQL/source/reporters/ut_teamcity_reporter_helper.pks +/scripts/utPLSQL/source/reporters/ut_tfs_junit_reporter.tpb +/scripts/utPLSQL/source/reporters/ut_tfs_junit_reporter.tps +/scripts/utPLSQL/source/reporters/ut_xunit_reporter.tpb +/scripts/utPLSQL/source/reporters/ut_xunit_reporter.tps +/scripts/utPLSQL/source/check_object_grants.sql +/scripts/utPLSQL/source/check_sys_grants.sql +/scripts/utPLSQL/source/create_grants.sql +/scripts/utPLSQL/source/create_synonyms.sql +/scripts/utPLSQL/source/create_synonyms_and_grants_for_public.sql +/scripts/utPLSQL/source/create_user_grants.sql +/scripts/utPLSQL/source/create_user_synonyms.sql +/scripts/utPLSQL/source/create_utplsql_owner.sql +/scripts/utPLSQL/source/define_ut3_owner_param.sql +/scripts/utPLSQL/source/dummy.sql +/scripts/utPLSQL/source/install.log +/scripts/utPLSQL/source/install.sql +/scripts/utPLSQL/source/install_above_12_1.sql +/scripts/utPLSQL/source/install_component.sql +/scripts/utPLSQL/source/install_ddl_trigger.sql +/scripts/utPLSQL/source/install_headless.sql +/scripts/utPLSQL/source/install_headless_with_trigger.sql +/scripts/utPLSQL/source/set_install_params.sql +/scripts/utPLSQL/source/uninstall.sql +/scripts/utPLSQL/source/uninstall_all.sql +/scripts/utPLSQL/source/uninstall_coverage_tables.sql +/scripts/utPLSQL/source/uninstall_objects.sql +/scripts/utPLSQL/source/uninstall_synonyms.sql +/scripts/utPLSQL/BUILD_NO +/scripts/utPLSQL/CODE_OF_CONDUCT.md +/scripts/utPLSQL/CONTRIBUTING.md +/scripts/utPLSQL/LICENSE +/scripts/utPLSQL/mkdocs_offline.yml +/scripts/utPLSQL/readme.md +/scripts/utPLSQL/VERSION diff --git a/scripts/0_start_db.sh b/scripts/0_start_db.sh old mode 100644 new mode 100755 diff --git a/scripts/1_install_utplsql.sh b/scripts/1_install_utplsql.sh old mode 100644 new mode 100755 index bb6577c..4b803f2 --- a/scripts/1_install_utplsql.sh +++ b/scripts/1_install_utplsql.sh @@ -5,4 +5,4 @@ curl -Lk "${UTPLSQL_DOWNLOAD_URL}" -o utPLSQL.zip unzip -q utPLSQL.zip docker run --rm -v $(pwd)/utPLSQL:/utPLSQL -w /utPLSQL/source --network host \ - --entrypoint sqlplus truemark/sqlplus:19.8 sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users + --entrypoint sqlplus truemark/sqlplus:19.8 sys/oracle@//127.0.0.1:1521/FREEPDB1 as sysdba @install_headless.sql UT3 UT3 users diff --git a/scripts/2_install_demo_project.sh b/scripts/2_install_demo_project.sh old mode 100644 new mode 100755 index a4089b1..319b8a8 --- a/scripts/2_install_demo_project.sh +++ b/scripts/2_install_demo_project.sh @@ -1,11 +1,11 @@ docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \ - sys/oracle@//127.0.0.1:1521/XE as sysdba @scripts/sql/create_users.sql + sys/oracle@//127.0.0.1:1521/FREEPDB1 as sysdba @scripts/sql/create_users.sql docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \ - app/pass@//127.0.0.1:1521/XE @scripts/sql/create_app_objects.sql + app/pass@//127.0.0.1:1521/FREEPDB1 @scripts/sql/create_app_objects.sql docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \ - code_owner/pass@//127.0.0.1:1521/XE @scripts/sql/create_source_owner_objects.sql + code_owner/pass@//127.0.0.1:1521/ @scripts/sql/create_source_owner_objects.sql docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \ - tests_owner/pass@//127.0.0.1:1521/XE @scripts/sql/create_tests_owner_objects.sql + tests_owner/pass@//127.0.0.1:1521/FREEPDB1 @scripts/sql/create_tests_owner_objects.sql From 6464650f9fa90eb5d81b2406bd72b1e0b3059ff9 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 15 Oct 2024 09:18:36 +0200 Subject: [PATCH 195/200] Revert "Updated scripts for new DB" This reverts commit 482b7f1e2b63d28a7095127cd8a2270f5f150a2f. --- .gitignore | 460 ------------------------------ scripts/0_start_db.sh | 0 scripts/1_install_utplsql.sh | 2 +- scripts/2_install_demo_project.sh | 8 +- 4 files changed, 5 insertions(+), 465 deletions(-) mode change 100755 => 100644 scripts/0_start_db.sh mode change 100755 => 100644 scripts/1_install_utplsql.sh mode change 100755 => 100644 scripts/2_install_demo_project.sh diff --git a/.gitignore b/.gitignore index 4325a42..ed6f99b 100644 --- a/.gitignore +++ b/.gitignore @@ -27,463 +27,3 @@ doc/ /utPLSQL/ /utPLSQL.zip /tree.txt -/scripts/utPLSQL.zip -/scripts/utPLSQL/docs/about/authors.html -/scripts/utPLSQL/docs/about/license.html -/scripts/utPLSQL/docs/about/project-details.html -/scripts/utPLSQL/docs/about/support.html -/scripts/utPLSQL/docs/assets/images/favicon.png -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.ar.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.da.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.de.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.du.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.el.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.es.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.fi.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.fr.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.he.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.hi.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.hu.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.hy.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.it.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.ja.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.jp.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.kn.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.ko.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.multi.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.nl.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.no.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.pt.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.ro.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.ru.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.sa.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.stemmer.support.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.sv.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.ta.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.te.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.th.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.tr.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.vi.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/min/lunr.zh.min.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/tinyseg.js -/scripts/utPLSQL/docs/assets/javascripts/lunr/wordcut.js -/scripts/utPLSQL/docs/assets/javascripts/workers/search.b8dbb3d2.min.js -/scripts/utPLSQL/docs/assets/javascripts/workers/search.b8dbb3d2.min.js.map -/scripts/utPLSQL/docs/assets/javascripts/bundle.8fd75fb4.min.js -/scripts/utPLSQL/docs/assets/javascripts/bundle.8fd75fb4.min.js.map -/scripts/utPLSQL/docs/assets/stylesheets/main.7e359304.min.css -/scripts/utPLSQL/docs/assets/stylesheets/main.7e359304.min.css.map -/scripts/utPLSQL/docs/assets/stylesheets/palette.06af60db.min.css -/scripts/utPLSQL/docs/assets/stylesheets/palette.06af60db.min.css.map -/scripts/utPLSQL/docs/assets/favicon.png -/scripts/utPLSQL/docs/assets/icon-transparent.png -/scripts/utPLSQL/docs/images/3_steps_to_run_utPLSQL.gif -/scripts/utPLSQL/docs/images/coverage_html_details.png -/scripts/utPLSQL/docs/images/coverage_html_summary.png -/scripts/utPLSQL/docs/images/documentation_reporter.png -/scripts/utPLSQL/docs/images/documentation_reporter_color.png -/scripts/utPLSQL/docs/images/example_1_coverage_mapping.png -/scripts/utPLSQL/docs/images/example_1_test_mapping.png -/scripts/utPLSQL/docs/images/example_2_coverage_mapping.png -/scripts/utPLSQL/docs/images/example_2_test_mapping.png -/scripts/utPLSQL/docs/images/example_3_coverage_mapping.png -/scripts/utPLSQL/docs/images/example_3_test_mapping.png -/scripts/utPLSQL/docs/images/example_4_coverage_mapping.png -/scripts/utPLSQL/docs/images/example_4_test_mapping.png -/scripts/utPLSQL/docs/images/extended_coverage_html_line.png -/scripts/utPLSQL/docs/images/extended_coverage_html_summary.png -/scripts/utPLSQL/docs/images/junit_errors.png -/scripts/utPLSQL/docs/images/junit_summary.png -/scripts/utPLSQL/docs/images/supported_by_redgate_100.png -/scripts/utPLSQL/docs/images/teamcity_report_example.png -/scripts/utPLSQL/docs/images/teamcity_report_example_errors.png -/scripts/utPLSQL/docs/images/tfs_details.png -/scripts/utPLSQL/docs/images/tfs_summary.png -/scripts/utPLSQL/docs/images/utPLSQL-testing-framework-transparent_120.png -/scripts/utPLSQL/docs/images/venn21.gif -/scripts/utPLSQL/docs/images/venn22.gif -/scripts/utPLSQL/docs/stylesheets/extra.css -/scripts/utPLSQL/docs/userguide/advanced_data_comparison.html -/scripts/utPLSQL/docs/userguide/annotations.html -/scripts/utPLSQL/docs/userguide/best-practices.html -/scripts/utPLSQL/docs/userguide/exception-reporting.html -/scripts/utPLSQL/docs/userguide/expectations.html -/scripts/utPLSQL/docs/userguide/getting-started.html -/scripts/utPLSQL/docs/userguide/install.html -/scripts/utPLSQL/docs/userguide/querying_suites.html -/scripts/utPLSQL/docs/userguide/reporters.html -/scripts/utPLSQL/docs/userguide/running-unit-tests.html -/scripts/utPLSQL/docs/userguide/upgrade.html -/scripts/utPLSQL/docs/404.html -/scripts/utPLSQL/docs/compare_version2_to_3.html -/scripts/utPLSQL/docs/index.html -/scripts/utPLSQL/docs/sitemap.xml -/scripts/utPLSQL/examples/award_bonus/award_bonus.sql -/scripts/utPLSQL/examples/award_bonus/employees_test.sql -/scripts/utPLSQL/examples/award_bonus/run_award_bonus_test.sql -/scripts/utPLSQL/examples/award_bonus/test_award_bonus.pkg -/scripts/utPLSQL/examples/between_string/betwnstr.sql -/scripts/utPLSQL/examples/between_string/run_betwnstr_test.sql -/scripts/utPLSQL/examples/between_string/run_betwnstr_test_coverage.sql -/scripts/utPLSQL/examples/between_string/test_betwnstr.pkb -/scripts/utPLSQL/examples/between_string/test_betwnstr.pks -/scripts/utPLSQL/examples/custom_reporters/run_ut_custom_reporter.sql -/scripts/utPLSQL/examples/custom_reporters/run_ut_expectations_reporter.sql -/scripts/utPLSQL/examples/custom_reporters/ut_custom_reporter.tpb -/scripts/utPLSQL/examples/custom_reporters/ut_custom_reporter.tps -/scripts/utPLSQL/examples/custom_reporters/ut_expectations_reporter.tpb -/scripts/utPLSQL/examples/custom_reporters/ut_expectations_reporter.tps -/scripts/utPLSQL/examples/demo_of_expectations/demo_equal_matcher.sql -/scripts/utPLSQL/examples/demo_of_expectations/drop_demo_equal_matcher.sql -/scripts/utPLSQL/examples/demo_of_expectations/run.sql -/scripts/utPLSQL/examples/developer_examples/RunExampleTestAnnotationsParsingTimeHugePackage.sql -/scripts/utPLSQL/examples/developer_examples/RunExampleTestSuite.sql -/scripts/utPLSQL/examples/developer_examples/RunExampleTestSuiteWithCompositeReporter.sql -/scripts/utPLSQL/examples/developer_examples/tst_pkg_huge.pks -/scripts/utPLSQL/examples/developer_examples/ut_exampletest.pkb -/scripts/utPLSQL/examples/developer_examples/ut_exampletest.pks -/scripts/utPLSQL/examples/developer_examples/ut_exampletest2.pkb -/scripts/utPLSQL/examples/developer_examples/ut_exampletest2.pks -/scripts/utPLSQL/examples/remove_rooms_by_name/remove_rooms_by_name.sql -/scripts/utPLSQL/examples/remove_rooms_by_name/rooms.sql -/scripts/utPLSQL/examples/remove_rooms_by_name/run_remove_rooms_by_name_test.sql -/scripts/utPLSQL/examples/remove_rooms_by_name/test_remove_rooms_by_name.pkg -/scripts/utPLSQL/examples/demo_expectations.pck -/scripts/utPLSQL/examples/department.tps -/scripts/utPLSQL/examples/departments.tps -/scripts/utPLSQL/examples/readme.md -/scripts/utPLSQL/examples/RunAllExamples.sql -/scripts/utPLSQL/examples/RunAllExamplesAsTests.sql -/scripts/utPLSQL/examples/RunCustomReportersExamples.sql -/scripts/utPLSQL/examples/RunDeveloperExamples.sql -/scripts/utPLSQL/examples/RunExampleTestAnnotationBasedForCurrentSchema.sql -/scripts/utPLSQL/examples/RunExpectations.sql -/scripts/utPLSQL/examples/RunUserExamples.sql -/scripts/utPLSQL/examples/RunWithDocumentationReporter.sql -/scripts/utPLSQL/examples/test_pkg1.pck -/scripts/utPLSQL/examples/test_pkg2.pck -/scripts/utPLSQL/source/api/be_between.syn -/scripts/utPLSQL/source/api/be_empty.syn -/scripts/utPLSQL/source/api/be_false.syn -/scripts/utPLSQL/source/api/be_greater_or_equal.syn -/scripts/utPLSQL/source/api/be_greater_than.syn -/scripts/utPLSQL/source/api/be_less_or_equal.syn -/scripts/utPLSQL/source/api/be_less_than.syn -/scripts/utPLSQL/source/api/be_like.syn -/scripts/utPLSQL/source/api/be_not_null.syn -/scripts/utPLSQL/source/api/be_null.syn -/scripts/utPLSQL/source/api/be_true.syn -/scripts/utPLSQL/source/api/be_within.syn -/scripts/utPLSQL/source/api/be_within_pct.syn -/scripts/utPLSQL/source/api/contain.syn -/scripts/utPLSQL/source/api/equal.syn -/scripts/utPLSQL/source/api/have_count.syn -/scripts/utPLSQL/source/api/match.syn -/scripts/utPLSQL/source/api/ut.pkb -/scripts/utPLSQL/source/api/ut.pks -/scripts/utPLSQL/source/api/ut_runner.pkb -/scripts/utPLSQL/source/api/ut_runner.pks -/scripts/utPLSQL/source/api/ut_suite_item_info.tpb -/scripts/utPLSQL/source/api/ut_suite_item_info.tps -/scripts/utPLSQL/source/api/ut_suite_items_info.tps -/scripts/utPLSQL/source/core/annotations/ut_annotated_object.tps -/scripts/utPLSQL/source/core/annotations/ut_annotated_objects.tps -/scripts/utPLSQL/source/core/annotations/ut_annotation.tps -/scripts/utPLSQL/source/core/annotations/ut_annotation_cache.sql -/scripts/utPLSQL/source/core/annotations/ut_annotation_cache_info.sql -/scripts/utPLSQL/source/core/annotations/ut_annotation_cache_manager.pkb -/scripts/utPLSQL/source/core/annotations/ut_annotation_cache_manager.pks -/scripts/utPLSQL/source/core/annotations/ut_annotation_cache_schema.sql -/scripts/utPLSQL/source/core/annotations/ut_annotation_cache_seq.sql -/scripts/utPLSQL/source/core/annotations/ut_annotation_manager.pkb -/scripts/utPLSQL/source/core/annotations/ut_annotation_manager.pks -/scripts/utPLSQL/source/core/annotations/ut_annotation_obj_cache_info.tps -/scripts/utPLSQL/source/core/annotations/ut_annotation_objs_cache_info.tps -/scripts/utPLSQL/source/core/annotations/ut_annotation_parser.pkb -/scripts/utPLSQL/source/core/annotations/ut_annotation_parser.pks -/scripts/utPLSQL/source/core/annotations/ut_annotations.tps -/scripts/utPLSQL/source/core/annotations/ut_trigger_annotation_parsing.trg -/scripts/utPLSQL/source/core/annotations/ut_trigger_check.pkb -/scripts/utPLSQL/source/core/annotations/ut_trigger_check.pks -/scripts/utPLSQL/source/core/coverage/dbms_plssqlcode.sql -/scripts/utPLSQL/source/core/coverage/proftab.sql -/scripts/utPLSQL/source/core/coverage/ut_coverage.pkb -/scripts/utPLSQL/source/core/coverage/ut_coverage.pks -/scripts/utPLSQL/source/core/coverage/ut_coverage_block.pkb -/scripts/utPLSQL/source/core/coverage/ut_coverage_block.pks -/scripts/utPLSQL/source/core/coverage/ut_coverage_helper.pkb -/scripts/utPLSQL/source/core/coverage/ut_coverage_helper.pks -/scripts/utPLSQL/source/core/coverage/ut_coverage_helper_block.pkb -/scripts/utPLSQL/source/core/coverage/ut_coverage_helper_block.pks -/scripts/utPLSQL/source/core/coverage/ut_coverage_helper_profiler.pkb -/scripts/utPLSQL/source/core/coverage/ut_coverage_helper_profiler.pks -/scripts/utPLSQL/source/core/coverage/ut_coverage_profiler.pkb -/scripts/utPLSQL/source/core/coverage/ut_coverage_profiler.pks -/scripts/utPLSQL/source/core/coverage/ut_coverage_reporter_base.tpb -/scripts/utPLSQL/source/core/coverage/ut_coverage_reporter_base.tps -/scripts/utPLSQL/source/core/coverage/ut_coverage_runs.sql -/scripts/utPLSQL/source/core/coverage/ut_coverage_sources_tmp.sql -/scripts/utPLSQL/source/core/events/ut_event_item.tps -/scripts/utPLSQL/source/core/events/ut_event_listener.tps -/scripts/utPLSQL/source/core/events/ut_event_manager.pkb -/scripts/utPLSQL/source/core/events/ut_event_manager.pks -/scripts/utPLSQL/source/core/output_buffers/ut_output_buffer_base.tpb -/scripts/utPLSQL/source/core/output_buffers/ut_output_buffer_base.tps -/scripts/utPLSQL/source/core/output_buffers/ut_output_buffer_info_tmp.sql -/scripts/utPLSQL/source/core/output_buffers/ut_output_buffer_tmp.sql -/scripts/utPLSQL/source/core/output_buffers/ut_output_bulk_buffer.tpb -/scripts/utPLSQL/source/core/output_buffers/ut_output_bulk_buffer.tps -/scripts/utPLSQL/source/core/output_buffers/ut_output_clob_buffer_tmp.sql -/scripts/utPLSQL/source/core/output_buffers/ut_output_clob_table_buffer.tpb -/scripts/utPLSQL/source/core/output_buffers/ut_output_clob_table_buffer.tps -/scripts/utPLSQL/source/core/output_buffers/ut_output_data_row.tps -/scripts/utPLSQL/source/core/output_buffers/ut_output_data_rows.tps -/scripts/utPLSQL/source/core/output_buffers/ut_output_table_buffer.tpb -/scripts/utPLSQL/source/core/output_buffers/ut_output_table_buffer.tps -/scripts/utPLSQL/source/core/session_context/ut_session_context.pkb -/scripts/utPLSQL/source/core/session_context/ut_session_context.pks -/scripts/utPLSQL/source/core/session_context/ut_session_info.tpb -/scripts/utPLSQL/source/core/session_context/ut_session_info.tps -/scripts/utPLSQL/source/core/types/ut_console_reporter_base.tpb -/scripts/utPLSQL/source/core/types/ut_console_reporter_base.tps -/scripts/utPLSQL/source/core/types/ut_coverage_options.tpb -/scripts/utPLSQL/source/core/types/ut_coverage_options.tps -/scripts/utPLSQL/source/core/types/ut_executable.tpb -/scripts/utPLSQL/source/core/types/ut_executable.tps -/scripts/utPLSQL/source/core/types/ut_executable_test.tpb -/scripts/utPLSQL/source/core/types/ut_executable_test.tps -/scripts/utPLSQL/source/core/types/ut_executables.tps -/scripts/utPLSQL/source/core/types/ut_expectation_result.tpb -/scripts/utPLSQL/source/core/types/ut_expectation_result.tps -/scripts/utPLSQL/source/core/types/ut_expectation_results.tps -/scripts/utPLSQL/source/core/types/ut_file_mapping.tpb -/scripts/utPLSQL/source/core/types/ut_file_mapping.tps -/scripts/utPLSQL/source/core/types/ut_file_mappings.tps -/scripts/utPLSQL/source/core/types/ut_integer_list.tps -/scripts/utPLSQL/source/core/types/ut_key_value_pair.tps -/scripts/utPLSQL/source/core/types/ut_key_value_pairs.tps -/scripts/utPLSQL/source/core/types/ut_logical_suite.tpb -/scripts/utPLSQL/source/core/types/ut_logical_suite.tps -/scripts/utPLSQL/source/core/types/ut_object_name.tpb -/scripts/utPLSQL/source/core/types/ut_object_name.tps -/scripts/utPLSQL/source/core/types/ut_object_names.tps -/scripts/utPLSQL/source/core/types/ut_output_reporter_base.tpb -/scripts/utPLSQL/source/core/types/ut_output_reporter_base.tps -/scripts/utPLSQL/source/core/types/ut_path_item.tpb -/scripts/utPLSQL/source/core/types/ut_path_item.tps -/scripts/utPLSQL/source/core/types/ut_path_items.tps -/scripts/utPLSQL/source/core/types/ut_reporter_base.tpb -/scripts/utPLSQL/source/core/types/ut_reporter_base.tps -/scripts/utPLSQL/source/core/types/ut_reporter_info.tps -/scripts/utPLSQL/source/core/types/ut_reporters.tps -/scripts/utPLSQL/source/core/types/ut_reporters_info.tps -/scripts/utPLSQL/source/core/types/ut_results_counter.tpb -/scripts/utPLSQL/source/core/types/ut_results_counter.tps -/scripts/utPLSQL/source/core/types/ut_run.tpb -/scripts/utPLSQL/source/core/types/ut_run.tps -/scripts/utPLSQL/source/core/types/ut_run_info.tpb -/scripts/utPLSQL/source/core/types/ut_run_info.tps -/scripts/utPLSQL/source/core/types/ut_stack.tpb -/scripts/utPLSQL/source/core/types/ut_stack.tps -/scripts/utPLSQL/source/core/types/ut_suite.tpb -/scripts/utPLSQL/source/core/types/ut_suite.tps -/scripts/utPLSQL/source/core/types/ut_suite_cache_row.tps -/scripts/utPLSQL/source/core/types/ut_suite_cache_rows.tps -/scripts/utPLSQL/source/core/types/ut_suite_context.tpb -/scripts/utPLSQL/source/core/types/ut_suite_context.tps -/scripts/utPLSQL/source/core/types/ut_suite_item.tpb -/scripts/utPLSQL/source/core/types/ut_suite_item.tps -/scripts/utPLSQL/source/core/types/ut_suite_items.tps -/scripts/utPLSQL/source/core/types/ut_test.tpb -/scripts/utPLSQL/source/core/types/ut_test.tps -/scripts/utPLSQL/source/core/types/ut_varchar2_list.tps -/scripts/utPLSQL/source/core/types/ut_varchar2_rows.tps -/scripts/utPLSQL/source/core/ut_dbms_output_cache.sql -/scripts/utPLSQL/source/core/ut_expectation_processor.pkb -/scripts/utPLSQL/source/core/ut_expectation_processor.pks -/scripts/utPLSQL/source/core/ut_file_mapper.pkb -/scripts/utPLSQL/source/core/ut_file_mapper.pks -/scripts/utPLSQL/source/core/ut_metadata.pkb -/scripts/utPLSQL/source/core/ut_metadata.pks -/scripts/utPLSQL/source/core/ut_savepoint_seq.sql -/scripts/utPLSQL/source/core/ut_suite_builder.pkb -/scripts/utPLSQL/source/core/ut_suite_builder.pks -/scripts/utPLSQL/source/core/ut_suite_cache.sql -/scripts/utPLSQL/source/core/ut_suite_cache_manager.pkb -/scripts/utPLSQL/source/core/ut_suite_cache_manager.pks -/scripts/utPLSQL/source/core/ut_suite_cache_package.sql -/scripts/utPLSQL/source/core/ut_suite_cache_schema.sql -/scripts/utPLSQL/source/core/ut_suite_cache_seq.sql -/scripts/utPLSQL/source/core/ut_suite_manager.pkb -/scripts/utPLSQL/source/core/ut_suite_manager.pks -/scripts/utPLSQL/source/core/ut_suite_tag_filter.pkb -/scripts/utPLSQL/source/core/ut_suite_tag_filter.pks -/scripts/utPLSQL/source/core/ut_utils.pkb -/scripts/utPLSQL/source/core/ut_utils.pks -/scripts/utPLSQL/source/expectations/data_values/ut_compound_data_diff_tmp.sql -/scripts/utPLSQL/source/expectations/data_values/ut_compound_data_helper.pkb -/scripts/utPLSQL/source/expectations/data_values/ut_compound_data_helper.pks -/scripts/utPLSQL/source/expectations/data_values/ut_compound_data_tmp.sql -/scripts/utPLSQL/source/expectations/data_values/ut_compound_data_value.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_compound_data_value.tps -/scripts/utPLSQL/source/expectations/data_values/ut_cursor_column.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_cursor_column.tps -/scripts/utPLSQL/source/expectations/data_values/ut_cursor_column_tab.tps -/scripts/utPLSQL/source/expectations/data_values/ut_cursor_details.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_cursor_details.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_anydata.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_anydata.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_blob.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_blob.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_boolean.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_boolean.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_clob.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_clob.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_date.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_date.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_dsinterval.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_dsinterval.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_json.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_json.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_number.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_number.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_refcursor.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_refcursor.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_timestamp.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_timestamp.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_timestamp_ltz.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_timestamp_ltz.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_timestamp_tz.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_timestamp_tz.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_varchar2.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_varchar2.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_xmltype.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_xmltype.tps -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_yminterval.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_data_value_yminterval.tps -/scripts/utPLSQL/source/expectations/data_values/ut_json_data_diff_tmp.sql -/scripts/utPLSQL/source/expectations/data_values/ut_json_leaf.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_json_leaf.tps -/scripts/utPLSQL/source/expectations/data_values/ut_json_leaf_tab.tps -/scripts/utPLSQL/source/expectations/data_values/ut_json_tree_details.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_json_tree_details.tps -/scripts/utPLSQL/source/expectations/data_values/ut_key_anyval_pair.tps -/scripts/utPLSQL/source/expectations/data_values/ut_key_anyval_pairs.tps -/scripts/utPLSQL/source/expectations/data_values/ut_key_anyvalues.tpb -/scripts/utPLSQL/source/expectations/data_values/ut_key_anyvalues.tps -/scripts/utPLSQL/source/expectations/matchers/ut_be_between.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_be_between.tps -/scripts/utPLSQL/source/expectations/matchers/ut_be_empty.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_be_empty.tps -/scripts/utPLSQL/source/expectations/matchers/ut_be_false.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_be_false.tps -/scripts/utPLSQL/source/expectations/matchers/ut_be_greater_or_equal.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_be_greater_or_equal.tps -/scripts/utPLSQL/source/expectations/matchers/ut_be_greater_than.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_be_greater_than.tps -/scripts/utPLSQL/source/expectations/matchers/ut_be_less_or_equal.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_be_less_or_equal.tps -/scripts/utPLSQL/source/expectations/matchers/ut_be_less_than.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_be_less_than.tps -/scripts/utPLSQL/source/expectations/matchers/ut_be_like.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_be_like.tps -/scripts/utPLSQL/source/expectations/matchers/ut_be_not_null.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_be_not_null.tps -/scripts/utPLSQL/source/expectations/matchers/ut_be_null.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_be_null.tps -/scripts/utPLSQL/source/expectations/matchers/ut_be_true.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_be_true.tps -/scripts/utPLSQL/source/expectations/matchers/ut_be_within.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_be_within.tps -/scripts/utPLSQL/source/expectations/matchers/ut_be_within_helper.pkb -/scripts/utPLSQL/source/expectations/matchers/ut_be_within_helper.pks -/scripts/utPLSQL/source/expectations/matchers/ut_be_within_pct.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_be_within_pct.tps -/scripts/utPLSQL/source/expectations/matchers/ut_comparison_matcher.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_comparison_matcher.tps -/scripts/utPLSQL/source/expectations/matchers/ut_contain.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_contain.tps -/scripts/utPLSQL/source/expectations/matchers/ut_equal.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_equal.tps -/scripts/utPLSQL/source/expectations/matchers/ut_have_count.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_have_count.tps -/scripts/utPLSQL/source/expectations/matchers/ut_match.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_match.tps -/scripts/utPLSQL/source/expectations/matchers/ut_matcher.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_matcher.tps -/scripts/utPLSQL/source/expectations/matchers/ut_matcher_base.tps -/scripts/utPLSQL/source/expectations/matchers/ut_matcher_options.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_matcher_options.tps -/scripts/utPLSQL/source/expectations/matchers/ut_matcher_options_items.tpb -/scripts/utPLSQL/source/expectations/matchers/ut_matcher_options_items.tps -/scripts/utPLSQL/source/expectations/json_objects_specs.sql -/scripts/utPLSQL/source/expectations/ut_expectation.tpb -/scripts/utPLSQL/source/expectations/ut_expectation.tps -/scripts/utPLSQL/source/expectations/ut_expectation_base.tpb -/scripts/utPLSQL/source/expectations/ut_expectation_base.tps -/scripts/utPLSQL/source/expectations/ut_expectation_compound.tpb -/scripts/utPLSQL/source/expectations/ut_expectation_compound.tps -/scripts/utPLSQL/source/expectations/ut_expectation_json.tpb -/scripts/utPLSQL/source/expectations/ut_expectation_json.tps -/scripts/utPLSQL/source/reporters/ut_ansiconsole_helper.pkb -/scripts/utPLSQL/source/reporters/ut_ansiconsole_helper.pks -/scripts/utPLSQL/source/reporters/ut_coverage_cobertura_reporter.tpb -/scripts/utPLSQL/source/reporters/ut_coverage_cobertura_reporter.tps -/scripts/utPLSQL/source/reporters/ut_coverage_html_reporter.tpb -/scripts/utPLSQL/source/reporters/ut_coverage_html_reporter.tps -/scripts/utPLSQL/source/reporters/ut_coverage_report_html_helper.pkb -/scripts/utPLSQL/source/reporters/ut_coverage_report_html_helper.pks -/scripts/utPLSQL/source/reporters/ut_coverage_sonar_reporter.tpb -/scripts/utPLSQL/source/reporters/ut_coverage_sonar_reporter.tps -/scripts/utPLSQL/source/reporters/ut_coveralls_reporter.tpb -/scripts/utPLSQL/source/reporters/ut_coveralls_reporter.tps -/scripts/utPLSQL/source/reporters/ut_debug_reporter.tpb -/scripts/utPLSQL/source/reporters/ut_debug_reporter.tps -/scripts/utPLSQL/source/reporters/ut_documentation_reporter.tpb -/scripts/utPLSQL/source/reporters/ut_documentation_reporter.tps -/scripts/utPLSQL/source/reporters/ut_junit_reporter.tpb -/scripts/utPLSQL/source/reporters/ut_junit_reporter.tps -/scripts/utPLSQL/source/reporters/ut_realtime_reporter.tpb -/scripts/utPLSQL/source/reporters/ut_realtime_reporter.tps -/scripts/utPLSQL/source/reporters/ut_sonar_test_reporter.tpb -/scripts/utPLSQL/source/reporters/ut_sonar_test_reporter.tps -/scripts/utPLSQL/source/reporters/ut_teamcity_reporter.tpb -/scripts/utPLSQL/source/reporters/ut_teamcity_reporter.tps -/scripts/utPLSQL/source/reporters/ut_teamcity_reporter_helper.pkb -/scripts/utPLSQL/source/reporters/ut_teamcity_reporter_helper.pks -/scripts/utPLSQL/source/reporters/ut_tfs_junit_reporter.tpb -/scripts/utPLSQL/source/reporters/ut_tfs_junit_reporter.tps -/scripts/utPLSQL/source/reporters/ut_xunit_reporter.tpb -/scripts/utPLSQL/source/reporters/ut_xunit_reporter.tps -/scripts/utPLSQL/source/check_object_grants.sql -/scripts/utPLSQL/source/check_sys_grants.sql -/scripts/utPLSQL/source/create_grants.sql -/scripts/utPLSQL/source/create_synonyms.sql -/scripts/utPLSQL/source/create_synonyms_and_grants_for_public.sql -/scripts/utPLSQL/source/create_user_grants.sql -/scripts/utPLSQL/source/create_user_synonyms.sql -/scripts/utPLSQL/source/create_utplsql_owner.sql -/scripts/utPLSQL/source/define_ut3_owner_param.sql -/scripts/utPLSQL/source/dummy.sql -/scripts/utPLSQL/source/install.log -/scripts/utPLSQL/source/install.sql -/scripts/utPLSQL/source/install_above_12_1.sql -/scripts/utPLSQL/source/install_component.sql -/scripts/utPLSQL/source/install_ddl_trigger.sql -/scripts/utPLSQL/source/install_headless.sql -/scripts/utPLSQL/source/install_headless_with_trigger.sql -/scripts/utPLSQL/source/set_install_params.sql -/scripts/utPLSQL/source/uninstall.sql -/scripts/utPLSQL/source/uninstall_all.sql -/scripts/utPLSQL/source/uninstall_coverage_tables.sql -/scripts/utPLSQL/source/uninstall_objects.sql -/scripts/utPLSQL/source/uninstall_synonyms.sql -/scripts/utPLSQL/BUILD_NO -/scripts/utPLSQL/CODE_OF_CONDUCT.md -/scripts/utPLSQL/CONTRIBUTING.md -/scripts/utPLSQL/LICENSE -/scripts/utPLSQL/mkdocs_offline.yml -/scripts/utPLSQL/readme.md -/scripts/utPLSQL/VERSION diff --git a/scripts/0_start_db.sh b/scripts/0_start_db.sh old mode 100755 new mode 100644 diff --git a/scripts/1_install_utplsql.sh b/scripts/1_install_utplsql.sh old mode 100755 new mode 100644 index 4b803f2..bb6577c --- a/scripts/1_install_utplsql.sh +++ b/scripts/1_install_utplsql.sh @@ -5,4 +5,4 @@ curl -Lk "${UTPLSQL_DOWNLOAD_URL}" -o utPLSQL.zip unzip -q utPLSQL.zip docker run --rm -v $(pwd)/utPLSQL:/utPLSQL -w /utPLSQL/source --network host \ - --entrypoint sqlplus truemark/sqlplus:19.8 sys/oracle@//127.0.0.1:1521/FREEPDB1 as sysdba @install_headless.sql UT3 UT3 users + --entrypoint sqlplus truemark/sqlplus:19.8 sys/oracle@//127.0.0.1:1521/XE as sysdba @install_headless.sql UT3 UT3 users diff --git a/scripts/2_install_demo_project.sh b/scripts/2_install_demo_project.sh old mode 100755 new mode 100644 index 319b8a8..a4089b1 --- a/scripts/2_install_demo_project.sh +++ b/scripts/2_install_demo_project.sh @@ -1,11 +1,11 @@ docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \ - sys/oracle@//127.0.0.1:1521/FREEPDB1 as sysdba @scripts/sql/create_users.sql + sys/oracle@//127.0.0.1:1521/XE as sysdba @scripts/sql/create_users.sql docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \ - app/pass@//127.0.0.1:1521/FREEPDB1 @scripts/sql/create_app_objects.sql + app/pass@//127.0.0.1:1521/XE @scripts/sql/create_app_objects.sql docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \ - code_owner/pass@//127.0.0.1:1521/ @scripts/sql/create_source_owner_objects.sql + code_owner/pass@//127.0.0.1:1521/XE @scripts/sql/create_source_owner_objects.sql docker run --rm -v $(pwd):/work -w /work/ --network host --entrypoint sqlplus truemark/sqlplus:19.8 \ - tests_owner/pass@//127.0.0.1:1521/FREEPDB1 @scripts/sql/create_tests_owner_objects.sql + tests_owner/pass@//127.0.0.1:1521/XE @scripts/sql/create_tests_owner_objects.sql From ebccd01e9a35d10ef71c3ba3b683191790b7c345 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 15 Oct 2024 09:18:39 +0200 Subject: [PATCH 196/200] Revert "Fixed JDBC Url" This reverts commit f67d92a003aaba57f77dad358c1c56650e68d92e. --- README.md | 2 +- src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java | 2 +- .../utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml | 2 +- .../utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/owner_param/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/skip/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/type_mapping/pom.xml | 2 +- src/test/resources/unit-tests/dbms_output/pom.xml | 2 +- .../unit-tests/default_console_output_behaviour/pom.xml | 2 +- src/test/resources/unit-tests/default_reporter/pom.xml | 2 +- src/test/resources/unit-tests/exclude_object/pom.xml | 2 +- src/test/resources/unit-tests/exclude_object_expr/pom.xml | 2 +- src/test/resources/unit-tests/exclude_schema_expr/pom.xml | 2 +- src/test/resources/unit-tests/include_object/pom.xml | 2 +- src/test/resources/unit-tests/include_object_expr/pom.xml | 2 +- src/test/resources/unit-tests/include_schema_expr/pom.xml | 2 +- src/test/resources/unit-tests/invalid_sources_directory/pom.xml | 2 +- src/test/resources/unit-tests/invalid_tests_directory/pom.xml | 2 +- src/test/resources/unit-tests/ora_stuck_timeout/pom.xml | 2 +- src/test/resources/unit-tests/skip_utplsql_tests/pom.xml | 2 +- .../sources_and_tests_parameter_does_not_exist/pom.xml | 2 +- .../pom.xml | 2 +- .../sources_and_tests_parameter_have_not_directory_tag/pom.xml | 2 +- .../sources_and_tests_parameter_have_not_includes_tag/pom.xml | 2 +- src/test/resources/unit-tests/sources_tests_parameters/pom.xml | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index ae7b2d7..c428511 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Please refer to the following usage example for the parameters descriptions: - + url_of_connection diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index deb7546..3964c13 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -304,7 +304,7 @@ public void dbms_output() throws Exception { */ @Test public void db_config_using_system_properties() throws Exception { - System.setProperty("dbUrl", "jdbc:oracle:thin:@localhost:1521/FREEPDB1"); + System.setProperty("dbUrl", "jdbc:oracle:thin:@localhost:1521:FREEPDB1"); System.setProperty("dbUser", "UT3"); System.setProperty("dbPass", "UT3"); diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml index 4889335..36b3693 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521/FREEPDB1 + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml index c4a016f..fbe3782 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521/FREEPDB1 + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml index bcdc456..d5c2a74 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521/FREEPDB1 + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml index df74866..b99d1f5 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521/FREEPDB1 + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml index 0660f2e..307b956 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521/FREEPDB1 + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 index 0c2f255..55c3bed 100644 --- 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521/FREEPDB1 + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 e358a2d..156b956 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521/FREEPDB1 + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 3e1fd7f..cbe578a 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521/FREEPDB1 + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 c8e0113..605124b 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521/FREEPDB1 + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 864cb07..839a6af 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521/FREEPDB1 + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 2403efd..b82af37 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521/FREEPDB1 + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 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 493e0d3..432deb2 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521/FREEPDB1 + jdbc:oracle:thin:@localhost:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/dbms_output/pom.xml b/src/test/resources/unit-tests/dbms_output/pom.xml index 7e0ded0..bf4bb04 100644 --- a/src/test/resources/unit-tests/dbms_output/pom.xml +++ b/src/test/resources/unit-tests/dbms_output/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml b/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml index 60c5437..266f353 100644 --- a/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml +++ b/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/default_reporter/pom.xml b/src/test/resources/unit-tests/default_reporter/pom.xml index c5eec78..a1483af 100644 --- a/src/test/resources/unit-tests/default_reporter/pom.xml +++ b/src/test/resources/unit-tests/default_reporter/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/exclude_object/pom.xml b/src/test/resources/unit-tests/exclude_object/pom.xml index c5a1b47..59c2529 100644 --- a/src/test/resources/unit-tests/exclude_object/pom.xml +++ b/src/test/resources/unit-tests/exclude_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/exclude_object_expr/pom.xml b/src/test/resources/unit-tests/exclude_object_expr/pom.xml index 28e2b2b..2540641 100644 --- a/src/test/resources/unit-tests/exclude_object_expr/pom.xml +++ b/src/test/resources/unit-tests/exclude_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/exclude_schema_expr/pom.xml b/src/test/resources/unit-tests/exclude_schema_expr/pom.xml index 97e900f..29a9a01 100644 --- a/src/test/resources/unit-tests/exclude_schema_expr/pom.xml +++ b/src/test/resources/unit-tests/exclude_schema_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/include_object/pom.xml b/src/test/resources/unit-tests/include_object/pom.xml index d15d710..b3bcfa4 100644 --- a/src/test/resources/unit-tests/include_object/pom.xml +++ b/src/test/resources/unit-tests/include_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/include_object_expr/pom.xml b/src/test/resources/unit-tests/include_object_expr/pom.xml index ddd1e1d..c3f43b9 100644 --- a/src/test/resources/unit-tests/include_object_expr/pom.xml +++ b/src/test/resources/unit-tests/include_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/include_schema_expr/pom.xml b/src/test/resources/unit-tests/include_schema_expr/pom.xml index 09d3793..95f28dd 100644 --- a/src/test/resources/unit-tests/include_schema_expr/pom.xml +++ b/src/test/resources/unit-tests/include_schema_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/invalid_sources_directory/pom.xml b/src/test/resources/unit-tests/invalid_sources_directory/pom.xml index 74d9946..b6b3d5e 100644 --- a/src/test/resources/unit-tests/invalid_sources_directory/pom.xml +++ b/src/test/resources/unit-tests/invalid_sources_directory/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 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 e086711..af69a88 100644 --- a/src/test/resources/unit-tests/invalid_tests_directory/pom.xml +++ b/src/test/resources/unit-tests/invalid_tests_directory/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml b/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml index 4bcb833..2e3649d 100644 --- a/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml +++ b/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 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 4a0809e..88e75af 100644 --- a/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml +++ b/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml index 123d569..bb59752 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml index 123d569..bb59752 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml index 8f6fd16..fe55db1 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml index 9c1550e..c848bbd 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml @@ -10,7 +10,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 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 5588400..c07668c 100644 --- a/src/test/resources/unit-tests/sources_tests_parameters/pom.xml +++ b/src/test/resources/unit-tests/sources_tests_parameters/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521/FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 UT3 UT3 From a312a2588c12816d4b15f062fd13437211a3094d Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 15 Oct 2024 09:18:42 +0200 Subject: [PATCH 197/200] Revert "User FREEPDB1 SID" This reverts commit 9d60472bd6bf3ba5e1f5c4046047d1bd9dffe37e. --- README.md | 2 +- .../java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java | 8 ++++++-- .../maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml | 2 +- .../plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/include_object/pom.xml | 2 +- .../plugin/UtPlsqlMojoIT/include_object_expr/pom.xml | 2 +- .../utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/ora_stuck_timeout/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/owner_param/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/regex/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/simple/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/skip/pom.xml | 2 +- .../org/utplsql/maven/plugin/UtPlsqlMojoIT/tags/pom.xml | 2 +- .../maven/plugin/UtPlsqlMojoIT/type_mapping/pom.xml | 2 +- src/test/resources/unit-tests/dbms_output/pom.xml | 2 +- .../unit-tests/default_console_output_behaviour/pom.xml | 2 +- src/test/resources/unit-tests/default_reporter/pom.xml | 2 +- src/test/resources/unit-tests/exclude_object/pom.xml | 2 +- src/test/resources/unit-tests/exclude_object_expr/pom.xml | 2 +- src/test/resources/unit-tests/exclude_schema_expr/pom.xml | 2 +- src/test/resources/unit-tests/include_object/pom.xml | 2 +- src/test/resources/unit-tests/include_object_expr/pom.xml | 2 +- src/test/resources/unit-tests/include_schema_expr/pom.xml | 2 +- .../unit-tests/invalid_sources_directory/pom.xml | 2 +- .../resources/unit-tests/invalid_tests_directory/pom.xml | 2 +- src/test/resources/unit-tests/ora_stuck_timeout/pom.xml | 2 +- src/test/resources/unit-tests/skip_utplsql_tests/pom.xml | 2 +- .../sources_and_tests_parameter_does_not_exist/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../resources/unit-tests/sources_tests_parameters/pom.xml | 2 +- 32 files changed, 37 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index c428511..d57328f 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Please refer to the following usage example for the parameters descriptions: - + url_of_connection diff --git a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 3964c13..6315072 100644 --- a/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java +++ b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java @@ -12,7 +12,11 @@ import java.io.PrintStream; import java.util.List; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; public class UtPlsqlMojoTest { @@ -304,7 +308,7 @@ public void dbms_output() throws Exception { */ @Test public void db_config_using_system_properties() throws Exception { - System.setProperty("dbUrl", "jdbc:oracle:thin:@localhost:1521:FREEPDB1"); + System.setProperty("dbUrl", "jdbc:oracle:thin:@localhost:1521:xe"); System.setProperty("dbUser", "UT3"); System.setProperty("dbPass", "UT3"); diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml index 36b3693..15411c2 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521:xe UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml index fbe3782..22d0869 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521:xe UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml index d5c2a74..ee6d13f 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521:xe UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml index b99d1f5..e807d13 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521:xe UT3 UT3 diff --git a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml index 307b956..40759d2 100644 --- a/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml +++ b/src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/minimalist/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521:xe UT3 UT3 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 index 55c3bed..f0c33da 100644 --- 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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521:xe UT3 UT3 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 156b956..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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521:xe UT3 UT3 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 cbe578a..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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521:xe UT3 UT3 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 605124b..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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521:xe UT3 UT3 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 839a6af..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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521:xe UT3 UT3 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 b82af37..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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521:xe UT3 UT3 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 432deb2..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 @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@localhost:1521:FREEPDB1 + jdbc:oracle:thin:@localhost:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/dbms_output/pom.xml b/src/test/resources/unit-tests/dbms_output/pom.xml index bf4bb04..4f45635 100644 --- a/src/test/resources/unit-tests/dbms_output/pom.xml +++ b/src/test/resources/unit-tests/dbms_output/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml b/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml index 266f353..ac6b14c 100644 --- a/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml +++ b/src/test/resources/unit-tests/default_console_output_behaviour/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/default_reporter/pom.xml b/src/test/resources/unit-tests/default_reporter/pom.xml index a1483af..8f03e25 100644 --- a/src/test/resources/unit-tests/default_reporter/pom.xml +++ b/src/test/resources/unit-tests/default_reporter/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/exclude_object/pom.xml b/src/test/resources/unit-tests/exclude_object/pom.xml index 59c2529..d65fde3 100644 --- a/src/test/resources/unit-tests/exclude_object/pom.xml +++ b/src/test/resources/unit-tests/exclude_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/exclude_object_expr/pom.xml b/src/test/resources/unit-tests/exclude_object_expr/pom.xml index 2540641..7993e05 100644 --- a/src/test/resources/unit-tests/exclude_object_expr/pom.xml +++ b/src/test/resources/unit-tests/exclude_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/exclude_schema_expr/pom.xml b/src/test/resources/unit-tests/exclude_schema_expr/pom.xml index 29a9a01..28df05e 100644 --- a/src/test/resources/unit-tests/exclude_schema_expr/pom.xml +++ b/src/test/resources/unit-tests/exclude_schema_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/include_object/pom.xml b/src/test/resources/unit-tests/include_object/pom.xml index b3bcfa4..f031df5 100644 --- a/src/test/resources/unit-tests/include_object/pom.xml +++ b/src/test/resources/unit-tests/include_object/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/include_object_expr/pom.xml b/src/test/resources/unit-tests/include_object_expr/pom.xml index c3f43b9..636098b 100644 --- a/src/test/resources/unit-tests/include_object_expr/pom.xml +++ b/src/test/resources/unit-tests/include_object_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/include_schema_expr/pom.xml b/src/test/resources/unit-tests/include_schema_expr/pom.xml index 95f28dd..f953ec0 100644 --- a/src/test/resources/unit-tests/include_schema_expr/pom.xml +++ b/src/test/resources/unit-tests/include_schema_expr/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/invalid_sources_directory/pom.xml b/src/test/resources/unit-tests/invalid_sources_directory/pom.xml index b6b3d5e..af6643d 100644 --- a/src/test/resources/unit-tests/invalid_sources_directory/pom.xml +++ b/src/test/resources/unit-tests/invalid_sources_directory/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 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 af69a88..c7380ef 100644 --- a/src/test/resources/unit-tests/invalid_tests_directory/pom.xml +++ b/src/test/resources/unit-tests/invalid_tests_directory/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml b/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml index 2e3649d..f04825c 100644 --- a/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml +++ b/src/test/resources/unit-tests/ora_stuck_timeout/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 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 88e75af..3e978d5 100644 --- a/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml +++ b/src/test/resources/unit-tests/skip_utplsql_tests/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml index bb59752..a556a7e 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml index bb59752..a556a7e 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_does_not_exist_but_default_directory_exists/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml index fe55db1..d5382b4 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_directory_tag/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 diff --git a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml index c848bbd..d33e917 100644 --- a/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml +++ b/src/test/resources/unit-tests/sources_and_tests_parameter_have_not_includes_tag/pom.xml @@ -10,7 +10,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 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 c07668c..6f4c2d0 100644 --- a/src/test/resources/unit-tests/sources_tests_parameters/pom.xml +++ b/src/test/resources/unit-tests/sources_tests_parameters/pom.xml @@ -9,7 +9,7 @@ pom - jdbc:oracle:thin:@127.0.0.1:1521:FREEPDB1 + jdbc:oracle:thin:@127.0.0.1:1521:xe UT3 UT3 From 560f1983236b6db4e713d9643f4a8982a14cf948 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 15 Oct 2024 09:18:45 +0200 Subject: [PATCH 198/200] Revert "Upgrade to Oracle Database Free #74" This reverts commit 36d6ab3c6a5094d9b0a790e008214da32e7bfa87. --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- scripts/0_start_db.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 07c5189..b3a4e7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: services: oracle: - image: gvenzl/oracle-free:23-slim + image: gvenzl/oracle-xe:21-slim env: ORACLE_PASSWORD: oracle ports: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f5b1c45..4825e34 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: services: oracle: - image: gvenzl/oracle-free:23-slim + image: gvenzl/oracle-xe:21-slim env: ORACLE_PASSWORD: oracle ports: diff --git a/scripts/0_start_db.sh b/scripts/0_start_db.sh index d1bd8bb..d319407 100644 --- a/scripts/0_start_db.sh +++ b/scripts/0_start_db.sh @@ -1 +1 @@ -docker run -d --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle gvenzl/oracle-free:23-slim +docker run -d --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle gvenzl/oracle-xe:21-slim From d95d4885502f85ba2ea53e2a934480b23fa142d9 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 15 Oct 2024 09:23:50 +0200 Subject: [PATCH 199/200] Java 8 --- .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 b3a4e7b..8410bc3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: - name: Set up JDK 11 uses: actions/setup-java@v2 with: - java-version: '11' + java-version: '8' distribution: 'adopt' server-id: ossrh server-username: MAVEN_USERNAME From 1eecf3b755f1d20601f5e542517a4285a52d6cbe Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 15 Oct 2024 09:43:25 +0200 Subject: [PATCH 200/200] SonarQube requires later Java version --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8410bc3..6c848b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,10 +40,10 @@ jobs: - name: Install demo project run: sh ${{ github.workspace }}/scripts/2_install_demo_project.sh - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v2 with: - java-version: '8' + java-version: '17' distribution: 'adopt' server-id: ossrh server-username: MAVEN_USERNAME