Skip to content

Commit

Permalink
Added unit tests for include/exclude by expression
Browse files Browse the repository at this point in the history
  • Loading branch information
simasch committed Jul 11, 2023
1 parent 0790904 commit 1b68462
Show file tree
Hide file tree
Showing 5 changed files with 277 additions and 0 deletions.
69 changes: 69 additions & 0 deletions src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <p>
* 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
* <p>
* 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
* <p>
* 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
* <p>
* 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");
}
Expand Down
52 changes: 52 additions & 0 deletions src/test/resources/unit-tests/exclude_object_expr/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
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">
<modelVersion>4.0.0</modelVersion>

<groupId>org.utplsql</groupId>
<artifactId>utplsql-maven-plugin-test</artifactId>
<version>3.1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<dbUrl>jdbc:oracle:thin:@127.0.0.1:1521:xe</dbUrl>
<dbUser>UT3</dbUser>
<dbPass>UT3</dbPass>
</properties>

<build>
<directory>../../../target</directory>
<plugins>
<plugin>
<groupId>org.utplsql</groupId>
<artifactId>utplsql-maven-plugin</artifactId>
<version>@proj</version>
<goals>
<goal>test</goal>
</goals>
<configuration>
<ignoreFailure>false</ignoreFailure>
<paths>
<path>app</path>
</paths>
<reporters>
<reporter>
<name>UT_DOCUMENTATION_REPORTER</name>
</reporter>
<reporter>
<name>UT_COVERAGE_SONAR_REPORTER</name>
<fileOutput>coverage-sonar-report.xml</fileOutput>
<consoleOutput>false</consoleOutput>
</reporter>
<reporter>
<name>UT_SONAR_TEST_REPORTER</name>
<fileOutput>utplsql/sonar-test-report.xml</fileOutput>
<consoleOutput>true</consoleOutput>
</reporter>
</reporters>
<excludeObjectExpr>*</excludeObjectExpr>
</configuration>
</plugin>
</plugins>
</build>
</project>
52 changes: 52 additions & 0 deletions src/test/resources/unit-tests/exclude_schema_expr/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
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">
<modelVersion>4.0.0</modelVersion>

<groupId>org.utplsql</groupId>
<artifactId>utplsql-maven-plugin-test</artifactId>
<version>3.1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<dbUrl>jdbc:oracle:thin:@127.0.0.1:1521:xe</dbUrl>
<dbUser>UT3</dbUser>
<dbPass>UT3</dbPass>
</properties>

<build>
<directory>../../../target</directory>
<plugins>
<plugin>
<groupId>org.utplsql</groupId>
<artifactId>utplsql-maven-plugin</artifactId>
<version>@proj</version>
<goals>
<goal>test</goal>
</goals>
<configuration>
<ignoreFailure>false</ignoreFailure>
<paths>
<path>app</path>
</paths>
<reporters>
<reporter>
<name>UT_DOCUMENTATION_REPORTER</name>
</reporter>
<reporter>
<name>UT_COVERAGE_SONAR_REPORTER</name>
<fileOutput>coverage-sonar-report.xml</fileOutput>
<consoleOutput>false</consoleOutput>
</reporter>
<reporter>
<name>UT_SONAR_TEST_REPORTER</name>
<fileOutput>utplsql/sonar-test-report.xml</fileOutput>
<consoleOutput>true</consoleOutput>
</reporter>
</reporters>
<excludeSchemaExpr>*</excludeSchemaExpr>
</configuration>
</plugin>
</plugins>
</build>
</project>
52 changes: 52 additions & 0 deletions src/test/resources/unit-tests/include_object_expr/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
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">
<modelVersion>4.0.0</modelVersion>

<groupId>org.utplsql</groupId>
<artifactId>utplsql-maven-plugin-test</artifactId>
<version>3.1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<dbUrl>jdbc:oracle:thin:@127.0.0.1:1521:xe</dbUrl>
<dbUser>UT3</dbUser>
<dbPass>UT3</dbPass>
</properties>

<build>
<directory>../../../target</directory>
<plugins>
<plugin>
<groupId>org.utplsql</groupId>
<artifactId>utplsql-maven-plugin</artifactId>
<version>@proj</version>
<goals>
<goal>test</goal>
</goals>
<configuration>
<ignoreFailure>false</ignoreFailure>
<paths>
<path>app</path>
</paths>
<reporters>
<reporter>
<name>UT_DOCUMENTATION_REPORTER</name>
</reporter>
<reporter>
<name>UT_COVERAGE_SONAR_REPORTER</name>
<fileOutput>coverage-sonar-report.xml</fileOutput>
<consoleOutput>false</consoleOutput>
</reporter>
<reporter>
<name>UT_SONAR_TEST_REPORTER</name>
<fileOutput>utplsql/sonar-test-report.xml</fileOutput>
<consoleOutput>true</consoleOutput>
</reporter>
</reporters>
<includeObjectExpr>*</includeObjectExpr>
</configuration>
</plugin>
</plugins>
</build>
</project>
52 changes: 52 additions & 0 deletions src/test/resources/unit-tests/include_schema_expr/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
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">
<modelVersion>4.0.0</modelVersion>

<groupId>org.utplsql</groupId>
<artifactId>utplsql-maven-plugin-test</artifactId>
<version>3.1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<dbUrl>jdbc:oracle:thin:@127.0.0.1:1521:xe</dbUrl>
<dbUser>UT3</dbUser>
<dbPass>UT3</dbPass>
</properties>

<build>
<directory>../../../target</directory>
<plugins>
<plugin>
<groupId>org.utplsql</groupId>
<artifactId>utplsql-maven-plugin</artifactId>
<version>@proj</version>
<goals>
<goal>test</goal>
</goals>
<configuration>
<ignoreFailure>false</ignoreFailure>
<paths>
<path>app</path>
</paths>
<reporters>
<reporter>
<name>UT_DOCUMENTATION_REPORTER</name>
</reporter>
<reporter>
<name>UT_COVERAGE_SONAR_REPORTER</name>
<fileOutput>coverage-sonar-report.xml</fileOutput>
<consoleOutput>false</consoleOutput>
</reporter>
<reporter>
<name>UT_SONAR_TEST_REPORTER</name>
<fileOutput>utplsql/sonar-test-report.xml</fileOutput>
<consoleOutput>true</consoleOutput>
</reporter>
</reporters>
<includeSchemaExpr>*</includeSchemaExpr>
</configuration>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 1b68462

Please sign in to comment.