From 1b68462ae131e0c93ecf008562a67c188576b570 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 11 Jul 2023 16:00:19 +0200 Subject: [PATCH] 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 + + + * + + + + +