From d8e865f71f72ad59727b09ada83267de7b619f87 Mon Sep 17 00:00:00 2001 From: Vinicius Avellar Date: Sun, 29 Dec 2019 23:29:30 +0000 Subject: [PATCH 1/7] Library updates and build tidy up --- .travis.yml | 11 +- .travis/install_demo_owner_project.sh | 50 -------- .travis/install_demo_project.sh | 39 ++---- .travis/install_utplsql.sh | 48 ++------ .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 | 2 +- pom.xml | 111 +++++++++++------- .../maven/plugin/test/UtPLSQLMojoIT.java | 6 +- .../org/utplsql/maven/plugin/UtPLSQLMojo.java | 11 +- 12 files changed, 154 insertions(+), 176 deletions(-) delete mode 100644 .travis/install_demo_owner_project.sh create mode 100644 .travis/sql/create_app_objects.sql create mode 100644 .travis/sql/create_source_owner_objects.sql create mode 100644 .travis/sql/create_tests_owner_objects.sql create mode 100644 .travis/sql/create_users.sql diff --git a/.travis.yml b/.travis.yml index ad0cb0f..2b3cd80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,20 +34,19 @@ 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" - - mvn org.jacoco:jacoco-maven-plugin:prepare-agent test + - mvn test - echo "Run Integration Tests" - - mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify -Pintegration -DdbUser="${DB_UT3_USER}" -DdbPass="${DB_UT3_PASS}" -DdbUrl="jdbc:oracle:thin:@${DB_URL}" + - mvn verify -Pintegration -DdbUser="${DB_UT3_USER}" -DdbPass="${DB_UT3_PASS}" -DdbUrl="jdbc:oracle:thin:@${DB_URL}" - 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 < 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 + 0.8.5 @@ -62,23 +64,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 +88,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 +154,14 @@ org.assertj assertj-core - 3.8.0 + 3.15.0 test junit junit - 4.12 + 4.13 test @@ -169,7 +171,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.7.0 + 3.8.1 ${java.version} ${java.version} @@ -179,7 +181,7 @@ org.apache.maven.plugins maven-shade-plugin - 2.1 + 3.2.2 package @@ -199,7 +201,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.5 + ${maven.version} utplsql true @@ -231,6 +233,31 @@ + + default + + + true + + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + + prepare-agent + + + + + + + + release @@ -245,6 +272,7 @@ org.apache.maven.plugins maven-javadoc-plugin + 3.1.1 attach-javadocs @@ -257,7 +285,7 @@ org.apache.maven.plugins maven-source-plugin - 3.0.1 + 3.2.1 attach-sources @@ -309,7 +337,7 @@ commons-io commons-io - 2.5 + 2.6 test @@ -352,7 +380,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 2.22.1 + 2.22.2 @@ -362,6 +390,18 @@ + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + + prepare-agent-integration + + + + @@ -378,24 +418,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..9346961 100644 --- a/src/it/java/org/utpsql/maven/plugin/test/UtPLSQLMojoIT.java +++ b/src/it/java/org/utpsql/maven/plugin/test/UtPLSQLMojoIT.java @@ -173,16 +173,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/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java index 40db4eb..e6330cb 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java @@ -5,7 +5,7 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; -import oracle.jdbc.pool.OracleDataSource; + import org.apache.commons.lang3.StringUtils; import org.apache.maven.model.Resource; import org.apache.maven.plugin.AbstractMojo; @@ -16,12 +16,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 +32,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. * @@ -121,6 +124,8 @@ public class UtPLSQLMojo extends AbstractMojo { private ReporterWriter reporterWriter; + private DatabaseInformation databaseInformation = new DefaultDatabaseInformation(); + /** * Executes the plugin. */ @@ -140,7 +145,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()); From 1e90eb7c6d38dc54d7c26e7cc6e7db74f5b1b143 Mon Sep 17 00:00:00 2001 From: Vinicius Avellar Date: Sat, 22 Feb 2020 12:29:49 +0000 Subject: [PATCH 2/7] Removed Oracle maven config --- .travis/maven_cfg.sh | 12 ------------ .travis/settings.xml | 23 ----------------------- 2 files changed, 35 deletions(-) diff --git a/.travis/maven_cfg.sh b/.travis/maven_cfg.sh index 33b8187..82661ad 100644 --- a/.travis/maven_cfg.sh +++ b/.travis/maven_cfg.sh @@ -2,16 +2,4 @@ set -ev cd $(dirname $(readlink -f $0)) -# Download wagon-http recommended by Oracle. -# On maven latest version this is not needed, but travis doesn't have it. -if [ ! -f $CACHE_DIR/wagon-http-2.8-shaded.jar ]; then - curl -L -O "http://central.maven.org/maven2/org/apache/maven/wagon/wagon-http/2.8/wagon-http-2.8-shaded.jar" - mv wagon-http-2.8-shaded.jar $CACHE_DIR/ - sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/ -else - echo "Using cached wagon-http..." - sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/ -fi - cp settings.xml $MAVEN_CFG/settings.xml - diff --git a/.travis/settings.xml b/.travis/settings.xml index af585a9..5f7d87e 100644 --- a/.travis/settings.xml +++ b/.travis/settings.xml @@ -22,28 +22,5 @@ ${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 - - - - - - - From 3a58b3fcdb443645ce343116721fae15d2e3344c Mon Sep 17 00:00:00 2001 From: Vinicius Avellar Date: Sat, 22 Feb 2020 18:52:38 +0000 Subject: [PATCH 3/7] Added tags functionality --- .../maven/plugin/test/UtPLSQLMojoIT.java | 24 ++++ .../scripts/tests/APP.TEST_PKG_TEST_ME.spc | 2 + .../utplsql/sonar-test-reporter.xml | 8 ++ src/it/resources/tags-project/pom.xml | 64 +++++++++ .../scripts/tests/APP.TEST_PKG_TEST_ME.bdy | 126 ++++++++++++++++++ .../scripts/tests/APP.TEST_PKG_TEST_ME.spc | 88 ++++++++++++ .../org/utplsql/maven/plugin/UtPLSQLMojo.java | 6 + 7 files changed, 318 insertions(+) create mode 100644 src/it/resources/tags-project/expected-output/utplsql/sonar-test-reporter.xml create mode 100644 src/it/resources/tags-project/pom.xml create mode 100644 src/it/resources/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.bdy create mode 100644 src/it/resources/tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc 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 9346961..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 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..795979e 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..795979e --- /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 e6330cb..8c1712e 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java @@ -4,7 +4,9 @@ import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; +import java.util.LinkedHashSet; import java.util.List; +import java.util.Set; import org.apache.commons.lang3.StringUtils; import org.apache.maven.model.Resource; @@ -113,6 +115,9 @@ public class UtPLSQLMojo extends AbstractMojo { @Parameter private List testsCustomTypeMapping; + @Parameter + private Set tags = new LinkedHashSet<>(); + @Parameter(defaultValue = "${project.build.directory}", readonly = true) protected String targetDir; @@ -159,6 +164,7 @@ public void execute() throws MojoExecutionException { .testMappingOptions(testMappingOptions) .skipCompatibilityCheck(skipCompatibilityCheck) .colorConsole(colorConsole) + .addTags(tags) .failOnErrors(!ignoreFailure); if (StringUtils.isNotBlank(excludeObject)) { From 38f279f8a184cbba36cf29409a4798b2aa480752 Mon Sep 17 00:00:00 2001 From: Vinicius Avellar Date: Sat, 22 Feb 2020 19:09:21 +0000 Subject: [PATCH 4/7] Fix test package --- .../simple-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc | 4 ++-- .../tags-project/scripts/tests/APP.TEST_PKG_TEST_ME.spc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 795979e..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,13 +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) + -- %tags(exists) PROCEDURE TEST_PR_TEST_ME_EXISTS; -- %test -- %displayname(Demonstrating the use of cursor) -- %rollback(manual) - == %tags(cursor) + -- %tags(cursor) PROCEDURE TEST_PR_TEST_ME_CURSOR; 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 index 795979e..8a2b852 100644 --- 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 @@ -75,13 +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) + -- %tags(exists) PROCEDURE TEST_PR_TEST_ME_EXISTS; -- %test -- %displayname(Demonstrating the use of cursor) -- %rollback(manual) - == %tags(cursor) + -- %tags(cursor) PROCEDURE TEST_PR_TEST_ME_CURSOR; END; From 4800ed1aabcdffe8dbf8e4282fe836612608d0da Mon Sep 17 00:00:00 2001 From: Vinicius Avellar Date: Sat, 22 Feb 2020 19:27:17 +0000 Subject: [PATCH 5/7] Updated README --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 301f125..5a67c68 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,11 @@ Please refer to the following usage example for the parameters descriptions. schema_name + + + test_tag + + @@ -231,6 +236,7 @@ More project samples are available in the src/test/resources directory: | -o | | reporters.reporter.fileOutput | | -s | | reporters.reporter.consoleOutput | | -p | --path | paths.path | +| | --tags | tags.tag | | -scc | --skip-compatibility-check | skipCompatibilityCheck | | -exclude | | excludeObject | | -include | | includeObject | @@ -250,4 +256,3 @@ More project samples are available in the src/test/resources directory: | -owner_subexpression | | testsOwnerSubexpression | | -type_subexpression | | testsTypeSubexpression | | -name_subexpression | | testsNameSubexpression | - From a294031fd54a955827b92c817dd955d6d29f555d Mon Sep 17 00:00:00 2001 From: Vinicius Avellar Date: Tue, 25 Feb 2020 23:10:10 +0000 Subject: [PATCH 6/7] Added random test execution parameter --- README.md | 24 ++++++++++++------- .../org/utplsql/maven/plugin/UtPLSQLMojo.java | 8 +++++++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5a67c68..67c0151 100644 --- a/README.md +++ b/README.md @@ -102,11 +102,6 @@ Please refer to the following usage example for the parameters descriptions. schema_name - - - test_tag - - @@ -140,6 +135,16 @@ Please refer to the following usage example for the parameters descriptions. false + + + + test_tag + + + + true + + 5 @@ -209,7 +214,6 @@ Please refer to the following usage example for the parameters descriptions. package_bodies - @@ -231,13 +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 | -| | --tags | tags.tag | +| | | ignoreFailure | | -scc | --skip-compatibility-check | skipCompatibilityCheck | +| | --tags | tags.tag | +| -r | --random-test-order | randomTestOrder | +| -seed | --random-test-order-seed | randomTestOrderSeed | | -exclude | | excludeObject | | -include | | includeObject | | | | | diff --git a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java index 8c1712e..907db61 100644 --- a/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java +++ b/src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java @@ -118,6 +118,12 @@ public class UtPLSQLMojo extends AbstractMojo { @Parameter private Set tags = new LinkedHashSet<>(); + @Parameter + private boolean randomTestOrder; + + @Parameter + private Integer randomTestOrderSeed; + @Parameter(defaultValue = "${project.build.directory}", readonly = true) protected String targetDir; @@ -165,6 +171,8 @@ public void execute() throws MojoExecutionException { .skipCompatibilityCheck(skipCompatibilityCheck) .colorConsole(colorConsole) .addTags(tags) + .randomTestOrder(randomTestOrder) + .randomTestOrderSeed(randomTestOrderSeed) .failOnErrors(!ignoreFailure); if (StringUtils.isNotBlank(excludeObject)) { From 275e9eadac7063cb35a35beb54674429aa808369 Mon Sep 17 00:00:00 2001 From: Vinicius Avellar Date: Tue, 7 Apr 2020 20:39:08 +0100 Subject: [PATCH 7/7] Revert code coverage change --- .travis.yml | 4 ++-- pom.xml | 38 -------------------------------------- 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2b3cd80..b088773 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,9 +39,9 @@ install: script: - echo "Run Unit Tests" - - mvn test + - mvn org.jacoco:jacoco-maven-plugin:prepare-agent test - echo "Run Integration Tests" - - mvn verify -Pintegration -DdbUser="${DB_UT3_USER}" -DdbPass="${DB_UT3_PASS}" -DdbUrl="jdbc:oracle:thin:@${DB_URL}" + - mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify -Pintegration -DdbUser="${DB_UT3_USER}" -DdbPass="${DB_UT3_PASS}" -DdbUrl="jdbc:oracle:thin:@${DB_URL}" - mvn sonar:sonar -Dsonar.projectKey=org.utplsql:utplsql-maven-plugin before_deploy: diff --git a/pom.xml b/pom.xml index 4c60b89..674b9a3 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,6 @@ 2.0.0-beta.5 19.3.0.0 2.3.1 - 0.8.5 @@ -233,31 +232,6 @@ - - default - - - true - - - - - - org.jacoco - jacoco-maven-plugin - ${jacoco.version} - - - - prepare-agent - - - - - - - - release @@ -390,18 +364,6 @@ - - org.jacoco - jacoco-maven-plugin - ${jacoco.version} - - - - prepare-agent-integration - - - -