Skip to content

Commit 1b68462

Browse files
committed
Added unit tests for include/exclude by expression
1 parent 0790904 commit 1b68462

File tree

5 files changed

+277
-0
lines changed

5 files changed

+277
-0
lines changed

src/test/java/org/utplsql/maven/plugin/UtPlsqlMojoTest.java

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,75 @@ public void include_object() throws Exception {
356356
assertEquals("app.pkg_test_me,app.test_pkg_test_me", utPlsqlMojo.includeObject);
357357
}
358358

359+
/**
360+
* Include an object by regex
361+
* <p>
362+
* Given : a pom.xml with a regex to include
363+
* When : pom is read
364+
* Then : Objects are included
365+
*/
366+
@Test
367+
public void include_object_expr() throws Exception {
368+
UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("include_object_expr");
369+
assertNotNull(utPlsqlMojo);
370+
371+
utPlsqlMojo.execute();
372+
373+
assertEquals("*", utPlsqlMojo.includeObjectExpr);
374+
}
375+
376+
/**
377+
* Exclude an object by regex
378+
* <p>
379+
* Given : a pom.xml with a regex to exclude
380+
* When : pom is read
381+
* Then : Objects are included
382+
*/
383+
@Test
384+
public void exclude_object_expr() throws Exception {
385+
UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("exclude_object_expr");
386+
assertNotNull(utPlsqlMojo);
387+
388+
utPlsqlMojo.execute();
389+
390+
assertEquals("*", utPlsqlMojo.excludeObjectExpr);
391+
}
392+
393+
394+
/**
395+
* Include a schema by regex
396+
* <p>
397+
* Given : a pom.xml with a regex to include
398+
* When : pom is read
399+
* Then : Objects are included
400+
*/
401+
@Test
402+
public void include_schema_expr() throws Exception {
403+
UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("include_schema_expr");
404+
assertNotNull(utPlsqlMojo);
405+
406+
utPlsqlMojo.execute();
407+
408+
assertEquals("*", utPlsqlMojo.includeSchemaExpr);
409+
}
410+
411+
/**
412+
* Exclude a schema by regex
413+
* <p>
414+
* Given : a pom.xml with a regex to exclude
415+
* When : pom is read
416+
* Then : Objects are included
417+
*/
418+
@Test
419+
public void exclude_schema_expr() throws Exception {
420+
UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("exclude_schema_expr");
421+
assertNotNull(utPlsqlMojo);
422+
423+
utPlsqlMojo.execute();
424+
425+
assertEquals("*", utPlsqlMojo.excludeSchemaExpr);
426+
}
427+
359428
private UtPlsqlMojo createUtPlsqlMojo(String directory) throws Exception {
360429
return (UtPlsqlMojo) rule.lookupConfiguredMojo(new File("src/test/resources/unit-tests/" + directory), "test");
361430
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>org.utplsql</groupId>
7+
<artifactId>utplsql-maven-plugin-test</artifactId>
8+
<version>3.1.0-SNAPSHOT</version>
9+
<packaging>pom</packaging>
10+
11+
<properties>
12+
<dbUrl>jdbc:oracle:thin:@127.0.0.1:1521:xe</dbUrl>
13+
<dbUser>UT3</dbUser>
14+
<dbPass>UT3</dbPass>
15+
</properties>
16+
17+
<build>
18+
<directory>../../../target</directory>
19+
<plugins>
20+
<plugin>
21+
<groupId>org.utplsql</groupId>
22+
<artifactId>utplsql-maven-plugin</artifactId>
23+
<version>@proj</version>
24+
<goals>
25+
<goal>test</goal>
26+
</goals>
27+
<configuration>
28+
<ignoreFailure>false</ignoreFailure>
29+
<paths>
30+
<path>app</path>
31+
</paths>
32+
<reporters>
33+
<reporter>
34+
<name>UT_DOCUMENTATION_REPORTER</name>
35+
</reporter>
36+
<reporter>
37+
<name>UT_COVERAGE_SONAR_REPORTER</name>
38+
<fileOutput>coverage-sonar-report.xml</fileOutput>
39+
<consoleOutput>false</consoleOutput>
40+
</reporter>
41+
<reporter>
42+
<name>UT_SONAR_TEST_REPORTER</name>
43+
<fileOutput>utplsql/sonar-test-report.xml</fileOutput>
44+
<consoleOutput>true</consoleOutput>
45+
</reporter>
46+
</reporters>
47+
<excludeObjectExpr>*</excludeObjectExpr>
48+
</configuration>
49+
</plugin>
50+
</plugins>
51+
</build>
52+
</project>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>org.utplsql</groupId>
7+
<artifactId>utplsql-maven-plugin-test</artifactId>
8+
<version>3.1.0-SNAPSHOT</version>
9+
<packaging>pom</packaging>
10+
11+
<properties>
12+
<dbUrl>jdbc:oracle:thin:@127.0.0.1:1521:xe</dbUrl>
13+
<dbUser>UT3</dbUser>
14+
<dbPass>UT3</dbPass>
15+
</properties>
16+
17+
<build>
18+
<directory>../../../target</directory>
19+
<plugins>
20+
<plugin>
21+
<groupId>org.utplsql</groupId>
22+
<artifactId>utplsql-maven-plugin</artifactId>
23+
<version>@proj</version>
24+
<goals>
25+
<goal>test</goal>
26+
</goals>
27+
<configuration>
28+
<ignoreFailure>false</ignoreFailure>
29+
<paths>
30+
<path>app</path>
31+
</paths>
32+
<reporters>
33+
<reporter>
34+
<name>UT_DOCUMENTATION_REPORTER</name>
35+
</reporter>
36+
<reporter>
37+
<name>UT_COVERAGE_SONAR_REPORTER</name>
38+
<fileOutput>coverage-sonar-report.xml</fileOutput>
39+
<consoleOutput>false</consoleOutput>
40+
</reporter>
41+
<reporter>
42+
<name>UT_SONAR_TEST_REPORTER</name>
43+
<fileOutput>utplsql/sonar-test-report.xml</fileOutput>
44+
<consoleOutput>true</consoleOutput>
45+
</reporter>
46+
</reporters>
47+
<excludeSchemaExpr>*</excludeSchemaExpr>
48+
</configuration>
49+
</plugin>
50+
</plugins>
51+
</build>
52+
</project>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>org.utplsql</groupId>
7+
<artifactId>utplsql-maven-plugin-test</artifactId>
8+
<version>3.1.0-SNAPSHOT</version>
9+
<packaging>pom</packaging>
10+
11+
<properties>
12+
<dbUrl>jdbc:oracle:thin:@127.0.0.1:1521:xe</dbUrl>
13+
<dbUser>UT3</dbUser>
14+
<dbPass>UT3</dbPass>
15+
</properties>
16+
17+
<build>
18+
<directory>../../../target</directory>
19+
<plugins>
20+
<plugin>
21+
<groupId>org.utplsql</groupId>
22+
<artifactId>utplsql-maven-plugin</artifactId>
23+
<version>@proj</version>
24+
<goals>
25+
<goal>test</goal>
26+
</goals>
27+
<configuration>
28+
<ignoreFailure>false</ignoreFailure>
29+
<paths>
30+
<path>app</path>
31+
</paths>
32+
<reporters>
33+
<reporter>
34+
<name>UT_DOCUMENTATION_REPORTER</name>
35+
</reporter>
36+
<reporter>
37+
<name>UT_COVERAGE_SONAR_REPORTER</name>
38+
<fileOutput>coverage-sonar-report.xml</fileOutput>
39+
<consoleOutput>false</consoleOutput>
40+
</reporter>
41+
<reporter>
42+
<name>UT_SONAR_TEST_REPORTER</name>
43+
<fileOutput>utplsql/sonar-test-report.xml</fileOutput>
44+
<consoleOutput>true</consoleOutput>
45+
</reporter>
46+
</reporters>
47+
<includeObjectExpr>*</includeObjectExpr>
48+
</configuration>
49+
</plugin>
50+
</plugins>
51+
</build>
52+
</project>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>org.utplsql</groupId>
7+
<artifactId>utplsql-maven-plugin-test</artifactId>
8+
<version>3.1.0-SNAPSHOT</version>
9+
<packaging>pom</packaging>
10+
11+
<properties>
12+
<dbUrl>jdbc:oracle:thin:@127.0.0.1:1521:xe</dbUrl>
13+
<dbUser>UT3</dbUser>
14+
<dbPass>UT3</dbPass>
15+
</properties>
16+
17+
<build>
18+
<directory>../../../target</directory>
19+
<plugins>
20+
<plugin>
21+
<groupId>org.utplsql</groupId>
22+
<artifactId>utplsql-maven-plugin</artifactId>
23+
<version>@proj</version>
24+
<goals>
25+
<goal>test</goal>
26+
</goals>
27+
<configuration>
28+
<ignoreFailure>false</ignoreFailure>
29+
<paths>
30+
<path>app</path>
31+
</paths>
32+
<reporters>
33+
<reporter>
34+
<name>UT_DOCUMENTATION_REPORTER</name>
35+
</reporter>
36+
<reporter>
37+
<name>UT_COVERAGE_SONAR_REPORTER</name>
38+
<fileOutput>coverage-sonar-report.xml</fileOutput>
39+
<consoleOutput>false</consoleOutput>
40+
</reporter>
41+
<reporter>
42+
<name>UT_SONAR_TEST_REPORTER</name>
43+
<fileOutput>utplsql/sonar-test-report.xml</fileOutput>
44+
<consoleOutput>true</consoleOutput>
45+
</reporter>
46+
</reporters>
47+
<includeSchemaExpr>*</includeSchemaExpr>
48+
</configuration>
49+
</plugin>
50+
</plugins>
51+
</build>
52+
</project>

0 commit comments

Comments
 (0)