diff --git a/README.md b/README.md index 6385883..20c9cf3 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,10 +152,10 @@ Please refer to the following usage example for the parameters descriptions: false - + - 0 + 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 + diff --git a/pom.xml b/pom.xml index 5a97c58..b8f50b8 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.utplsql utplsql-maven-plugin - 3.1.10 + 3.1.11 maven-plugin utPLSQL Maven Plugin @@ -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) { 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/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java b/src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java index 3e8fb3c..6315072 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(5, (int) utPlsqlMojo.oraStuckTimeout); + } /** * Ora Stuck Timeout @@ -322,11 +323,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 +339,92 @@ 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); + } + + /** + * 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-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/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/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 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.* + + + + + + + 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/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 + + + + + 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 + + + * + + + + + 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