diff --git a/.travis.yml b/.travis.yml index ad0cb0f..b088773 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,9 +34,8 @@ cache: install: - bash .travis/maven_cfg.sh - bash .travis/start_db.sh - - bash .travis/install_utplsql.sh $DB_UT3_USER $DB_UT3_PASS + - bash .travis/install_utplsql.sh - bash .travis/install_demo_project.sh - - bash .travis/install_demo_owner_project.sh script: - echo "Run Unit Tests" @@ -46,8 +45,8 @@ script: - mvn sonar:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin before_deploy: - - echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import - - echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust + - echo $GPG_SECRET_KEYS | base64 --decode | ${GPG_EXECUTABLE} --import + - echo $GPG_OWNERTRUST | base64 --decode | ${GPG_EXECUTABLE} --import-ownertrust deploy: - provider: script diff --git a/.travis/install_demo_owner_project.sh b/.travis/install_demo_owner_project.sh deleted file mode 100644 index 20da910..0000000 --- a/.travis/install_demo_owner_project.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -set -ev - -PROJECT_FILES_SRC="src/it/resources/owner-param-project" -PROJECT_FILES="resources-owner" -DB_CODE_USER=CODE_OWNER -DB_TESTS_USER=TESTS_OWNER -DB_PASS=pass - -cat > demo_project.sh.tmp < demo_project.sh.tmp < install.sh.tmp <${env.SONATYPE_USERNAME} ${env.SONATYPE_PASSWORD} - - maven.oracle.com - ${env.ORACLE_OTN_USER} - ${env.ORACLE_OTN_PASSWORD} - - - ANY - ANY - OAM 11g - - - - - - http.protocol.allow-circular-redirects - %b,true - - - - - - - diff --git a/.travis/sql/create_app_objects.sql b/.travis/sql/create_app_objects.sql new file mode 100644 index 0000000..ea435cd --- /dev/null +++ b/.travis/sql/create_app_objects.sql @@ -0,0 +1,9 @@ +whenever sqlerror exit failure rollback +whenever oserror exit failure rollback + +@src/it/resources/simple-project/scripts/sources/TO_TEST_ME.tab +@src/it/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.spc +@src/it/resources/simple-project/scripts/sources/APP.PKG_TEST_ME.bdy + +@src/it/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc +@src/it/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 new file mode 100644 index 0000000..611b268 --- /dev/null +++ b/.travis/sql/create_source_owner_objects.sql @@ -0,0 +1,6 @@ +whenever sqlerror exit failure rollback +whenever oserror exit failure rollback + +@src/it/resources/owner-param-project/scripts/sources/foo/tables/TO_TEST_ME.tab +@src/it/resources/owner-param-project/scripts/sources/foo/packages/PKG_TEST_ME.sql +@src/it/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 new file mode 100644 index 0000000..5b50d68 --- /dev/null +++ b/.travis/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/it/resources/owner-param-project/scripts/test/bar/packages/TEST_PKG_TEST_ME.sql +@src/it/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 new file mode 100644 index 0000000..fe64882 --- /dev/null +++ b/.travis/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; diff --git a/.travis/start_db.sh b/.travis/start_db.sh index 2367d64..a5b2414 100644 --- a/.travis/start_db.sh +++ b/.travis/start_db.sh @@ -10,5 +10,5 @@ fi # Pull the specified db version from docker hub. docker pull $DOCKER_REPO:$ORACLE_VERSION -docker run -d --name $ORACLE_VERSION $DOCKER_OPTIONS -p 1521:1521 $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 diff --git a/README.md b/README.md index 301f125..67c0151 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,16 @@ Please refer to the following usage example for the parameters descriptions. false + + + + test_tag + + + + true + + 5 @@ -204,7 +214,6 @@ Please refer to the following usage example for the parameters descriptions. package_bodies - @@ -226,12 +235,15 @@ More project samples are available in the src/test/resources directory: | --- | --- | --- | | -c | --color | | | | --failure-exit-code | | -| | | ignoreFailure | +| -p | --path | paths.path | | -f | --format | reporters.reporter.name | | -o | | reporters.reporter.fileOutput | | -s | | reporters.reporter.consoleOutput | -| -p | --path | paths.path | +| | | ignoreFailure | | -scc | --skip-compatibility-check | skipCompatibilityCheck | +| | --tags | tags.tag | +| -r | --random-test-order | randomTestOrder | +| -seed | --random-test-order-seed | randomTestOrderSeed | | -exclude | | excludeObject | | -include | | includeObject | | | | | @@ -250,4 +262,3 @@ More project samples are available in the src/test/resources directory: | -owner_subexpression | | testsOwnerSubexpression | | -type_subexpression | | testsTypeSubexpression | | -name_subexpression | | testsNameSubexpression | - diff --git a/pom.xml b/pom.xml index 8116bb8..674b9a3 100644 --- a/pom.xml +++ b/pom.xml @@ -46,10 +46,11 @@ UTF-8 - 3.5.0 + 3.5.2 1.8 2.0.0-beta.5 - 12.2.0.1 + 19.3.0.0 + 2.3.1 @@ -62,23 +63,23 @@ javax.xml.bind jaxb-api - 2.3.1 + ${jaxb.version} com.sun.xml.bind jaxb-impl - 2.3.1 + ${jaxb.version} - com.oracle.jdbc + com.oracle.ojdbc ojdbc8 ${ojdbc.version} - com.oracle.jdbc + com.oracle.ojdbc orai18n ${ojdbc.version} @@ -86,45 +87,45 @@ org.utplsql java-api - 3.1.2 + 3.1.8 org.apache.maven maven-core - 3.5.2 + ${maven.version} org.apache.maven maven-model - 3.0.2 + ${maven.version} org.apache.maven maven-plugin-api - 3.5.2 - - - - org.codehaus.plexus - plexus-utils - 3.0.8 + ${maven.version} org.apache.maven.plugin-tools maven-plugin-annotations - 3.5 + ${maven.version} provided + + org.codehaus.plexus + plexus-utils + 3.3.0 + + org.apache.maven maven-compat - 3.5.2 + ${maven.version} test @@ -152,14 +153,14 @@ org.assertj assertj-core - 3.8.0 + 3.15.0 test junit junit - 4.12 + 4.13 test @@ -169,7 +170,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.7.0 + 3.8.1 ${java.version} ${java.version} @@ -179,7 +180,7 @@ org.apache.maven.plugins maven-shade-plugin - 2.1 + 3.2.2 package @@ -199,7 +200,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.5 + ${maven.version} utplsql true @@ -245,6 +246,7 @@ org.apache.maven.plugins maven-javadoc-plugin + 3.1.1 attach-javadocs @@ -257,7 +259,7 @@ org.apache.maven.plugins maven-source-plugin - 3.0.1 + 3.2.1 attach-sources @@ -309,7 +311,7 @@ commons-io commons-io - 2.5 + 2.6 test @@ -352,7 +354,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 2.22.1 + 2.22.2 @@ -378,24 +380,5 @@ true - - - maven.oracle.com - - true - - - false - - https://maven.oracle.com - default - - - - - maven.oracle.com - https://maven.oracle.com - - diff --git a/src/it/java/org/utpsql/maven/plugin/test/UtPLSQLMojoIT.java b/src/it/java/org/utpsql/maven/plugin/test/UtPLSQLMojoIT.java index fbd7c75..af1cf98 100644 --- a/src/it/java/org/utpsql/maven/plugin/test/UtPLSQLMojoIT.java +++ b/src/it/java/org/utpsql/maven/plugin/test/UtPLSQLMojoIT.java @@ -156,6 +156,30 @@ public void testMinimalistProject() throws Exception { } } + @Test + public void testTagsProject() throws Exception { + + try { + 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.executeGoal("test"); + + checkReportsGenerated(PROJECT_NAME, "utplsql/sonar-test-reporter.xml"); + } catch (Exception e) { + e.printStackTrace(); + Assert.fail("Unexpected Exception running the test of Definition " + e.getMessage()); + } + } + /** * * @param files @@ -173,16 +197,16 @@ private void checkReportsGenerated(String projectName, String... files) { .lines(Paths.get("target", "test-classes", projectName, "target", filename)); String outputContent = stream - .map(line -> line.replaceAll("(encoding=\"[^\"]*\")", "encoding=\"WINDOWS-1252\"")) + .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")); + .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", ""), outputContent); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); Assert.fail("Unexpected Exception running the test : " + e.getMessage()); } diff --git a/src/it/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc b/src/it/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc index e2c82fa..8a2b852 100644 --- a/src/it/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc +++ b/src/it/resources/simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc @@ -75,11 +75,13 @@ CREATE OR REPLACE PACKAGE TEST_PKG_TEST_ME AS -- %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/it/resources/tags-project/expected-output/utplsql/sonar-test-reporter.xml b/src/it/resources/tags-project/expected-output/utplsql/sonar-test-reporter.xml new file mode 100644 index 0000000..e8d63ee --- /dev/null +++ b/src/it/resources/tags-project/expected-output/utplsql/sonar-test-reporter.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/it/resources/tags-project/pom.xml b/src/it/resources/tags-project/pom.xml new file mode 100644 index 0000000..5974258 --- /dev/null +++ b/src/it/resources/tags-project/pom.xml @@ -0,0 +1,64 @@ + + 4.0.0 + + org.utplsql + utplsql-maven-plugin-tags + 1.0.0 + pom + + utplsql-maven-plugin IT Tags + + + + + + + + ${project.groupId} + utplsql-maven-plugin + ${utplsql-maven-plugin-version} + + + + test + + + + + false + + + app + + + + exists + cursor + + + + + UT_SONAR_TEST_REPORTER + utplsql/sonar-test-reporter.xml + true + + + + + + scripts/tests + + **/*bdy + **/*spc + + + + + + + + + + diff --git a/src/it/resources/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy b/src/it/resources/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy new file mode 100644 index 0000000..115bc15 --- /dev/null +++ b/src/it/resources/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy @@ -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/it/resources/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc b/src/it/resources/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc new file mode 100644 index 0000000..8a2b852 --- /dev/null +++ b/src/it/resources/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc @@ -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/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java index 40db4eb..907db61 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java @@ -4,8 +4,10 @@ import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; +import java.util.LinkedHashSet; import java.util.List; -import oracle.jdbc.pool.OracleDataSource; +import java.util.Set; + import org.apache.commons.lang3.StringUtils; import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; @@ -16,12 +18,13 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.shared.utils.logging.MessageUtils; -import org.utplsql.api.DBHelper; import org.utplsql.api.FileMapperOptions; import org.utplsql.api.JavaApiVersionInfo; 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; @@ -31,6 +34,8 @@ import org.utplsql.maven.plugin.model.ReporterParameter; import org.utplsql.maven.plugin.reporter.ReporterWriter; +import oracle.jdbc.pool.OracleDataSource; + /** * This class expose the {@link TestRunner} interface to Maven. * @@ -110,6 +115,15 @@ public class UtPLSQLMojo extends AbstractMojo { @Parameter private List testsCustomTypeMapping; + @Parameter + private Set tags = new LinkedHashSet<>(); + + @Parameter + private boolean randomTestOrder; + + @Parameter + private Integer randomTestOrderSeed; + @Parameter(defaultValue = "${project.build.directory}", readonly = true) protected String targetDir; @@ -121,6 +135,8 @@ public class UtPLSQLMojo extends AbstractMojo { private ReporterWriter reporterWriter; + private DatabaseInformation databaseInformation = new DefaultDatabaseInformation(); + /** * Executes the plugin. */ @@ -140,7 +156,7 @@ public void execute() throws MojoExecutionException { ds.setPassword(password); connection = ds.getConnection(); - Version utlVersion = DBHelper.getDatabaseFrameworkVersion(connection); + Version utlVersion = this.databaseInformation.getUtPlsqlFrameworkVersion(connection); getLog().info("utPLSQL Version = " + utlVersion); List reporterList = initReporters(connection, utlVersion, ReporterFactory.createEmpty()); @@ -154,6 +170,9 @@ public void execute() throws MojoExecutionException { .testMappingOptions(testMappingOptions) .skipCompatibilityCheck(skipCompatibilityCheck) .colorConsole(colorConsole) + .addTags(tags) + .randomTestOrder(randomTestOrder) + .randomTestOrderSeed(randomTestOrderSeed) .failOnErrors(!ignoreFailure); if (StringUtils.isNotBlank(excludeObject)) {