Skip to content

Commit 28aa0d3

Browse files
committed
Merge branch 'develop'
2 parents 825b30e + 91a530f commit 28aa0d3

File tree

19 files changed

+517
-14
lines changed

19 files changed

+517
-14
lines changed

README.md

+15-3
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Please refer to the following usage example for the parameters descriptions:
9090
<plugin>
9191
<groupId>org.utplsql</groupId>
9292
<artifactId>utplsql-maven-plugin</artifactId>
93-
<version>3.1.10</version>
93+
<version>3.1.11</version>
9494
<executions>
9595
<execution>
9696
<goals>
@@ -100,7 +100,7 @@ Please refer to the following usage example for the parameters descriptions:
100100
<!-- REQUIRED PARAMETERS -->
101101

102102
<!-- A list of tests suite paths. -->
103-
103+
104104
<!-- The path(s) can be in one of the following formats: -->
105105
<!-- schema[.package[.procedure]] -->
106106
<!-- schema:suite[.suite[.suite][...]][.procedure] -->
@@ -152,7 +152,7 @@ Please refer to the following usage example for the parameters descriptions:
152152
<!-- Enables DBMS_OUTPUT -->
153153
<!-- Defaults to: false -->
154154
<dbmsOutput>false</dbmsOutput>
155-
155+
156156
<!-- Sets a timeout around Reporter creation and retries when not ready after a while. -->
157157
<!-- 0 = no timeout. -->
158158
<oraStuckTimeout>0</oraStuckTimeout>
@@ -177,6 +177,18 @@ Please refer to the following usage example for the parameters descriptions:
177177
<!-- See coverage reporting options in framework documentation. -->
178178
<excludeObject>app.test1,app.test2</excludeObject>
179179

180+
<!-- Regular expression to match against schema name to include in coverage -->
181+
<includeSchemaExpr>app.test1,app.test2</includeSchemaExpr>
182+
183+
<!-- Regular expression to match against schema name to exclude in coverage -->
184+
<excludeSchemaExprr>app.test1,app.test2</excludeSchemaExprr>
185+
186+
<!-- Regular expression to match against schema name to include in coverage -->
187+
<includeObjectExpr>app.test1,app.test2</includeObjectExpr>
188+
189+
<!-- Regular expression to match against object name to exclude in coverage -->
190+
<excludeObjectExpr>app.test1,app.test2</excludeObjectExpr>
191+
180192
<!-- List of reporters. -->
181193
<!-- You can pass the name of the reporter and/or the output file -->
182194
<!-- of the reporter and/or if the report is logged to the console. -->

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>org.utplsql</groupId>
77
<artifactId>utplsql-maven-plugin</artifactId>
8-
<version>3.1.10</version>
8+
<version>3.1.11</version>
99
<packaging>maven-plugin</packaging>
1010

1111
<name>utPLSQL Maven Plugin</name>

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

+15
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,19 @@ void ora_stuck_timeout(MavenExecutionResult result) {
8282

8383
assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml");
8484
}
85+
86+
@MavenTest
87+
void exclude_object_expr(MavenExecutionResult result) {
88+
assertThat(result).isSuccessful();
89+
90+
assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml");
91+
}
92+
93+
@MavenTest
94+
void include_object_expr(MavenExecutionResult result) {
95+
assertThat(result).isSuccessful();
96+
97+
assertThatReportsAreGeneratedAsExpected(result, "sonar-test-report.xml", "coverage-sonar-report.xml");
98+
}
99+
85100
}

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

+93-6
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ public void skip_utplsql_tests() throws Exception {
268268
}
269269

270270
/**
271-
* Enable DBMS_OUTPUT
271+
* Set ORA Stuck Timeout
272272
* <p>
273-
* Given : a pom.xml with dbmsOutput=true
273+
* Given : a pom.xml with oraStuckTimeout=0
274274
* When : pom is read
275275
* Then : Property is set
276276
*/
@@ -280,8 +280,9 @@ public void ora_stuck_timeout() throws Exception {
280280
assertNotNull(utPlsqlMojo);
281281

282282
utPlsqlMojo.execute();
283-
}
284283

284+
assertEquals(5, (int) utPlsqlMojo.oraStuckTimeout);
285+
}
285286

286287
/**
287288
* Ora Stuck Timeout
@@ -322,11 +323,11 @@ public void db_config_using_system_properties() throws Exception {
322323
}
323324

324325
/**
325-
* DB configuration from System Properties
326+
* Exclude a list of objects
326327
* <p>
327-
* Given : a pom.xml without dbUrl, dbUser and dbPass configured
328+
* Given : a pom.xml with a list of objects to exclude
328329
* When : pom is read
329-
* Then : System Properties must be used to configure database
330+
* Then : Objects are excluded
330331
*/
331332
@Test
332333
public void exclude_object() throws Exception {
@@ -338,6 +339,92 @@ public void exclude_object() throws Exception {
338339
assertEquals("app.pkg_test_me,app.test_pkg_test_me", utPlsqlMojo.excludeObject);
339340
}
340341

342+
/**
343+
* Include a list of objects
344+
* <p>
345+
* Given : a pom.xml with a list of objects to include
346+
* When : pom is read
347+
* Then : Objects are included
348+
*/
349+
@Test
350+
public void include_object() throws Exception {
351+
UtPlsqlMojo utPlsqlMojo = createUtPlsqlMojo("include_object");
352+
assertNotNull(utPlsqlMojo);
353+
354+
utPlsqlMojo.execute();
355+
356+
assertEquals("app.pkg_test_me,app.test_pkg_test_me", utPlsqlMojo.includeObject);
357+
}
358+
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+
341428
private UtPlsqlMojo createUtPlsqlMojo(String directory) throws Exception {
342429
return (UtPlsqlMojo) rule.lookupConfiguredMojo(new File("src/test/resources/unit-tests/" + directory), "test");
343430
}

src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<consoleOutput>true</consoleOutput>
4343
</reporter>
4444
</reporters>
45-
<excludeObject>tests_owner.test_pkg_test_me</excludeObject>
45+
<excludeObject>app.pkg_test_me,app.test_pkg_test_me</excludeObject>
4646
</configuration>
4747
</execution>
4848
</executions>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<coverage version="1">
2+
</coverage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<testExecutions version="1">
2+
<file path="plsql.examples.test_pkg_test_me">
3+
<testCase name="test_fc_input_1" duration="1" ></testCase>
4+
<testCase name="test_fc_input_0" duration="1" ></testCase>
5+
<testCase name="test_fc_input_null" duration="1" ></testCase>
6+
<testCase name="test_pr_test_me_null" duration="1" ></testCase>
7+
<testCase name="test_pr_test_me_not_null" duration="1" ></testCase>
8+
<testCase name="test_pr_test_me_exists" duration="1" ></testCase>
9+
<testCase name="test_pr_test_me_cursor" duration="1" ></testCase>
10+
</file>
11+
</testExecutions>
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>owner-param</artifactId>
8+
<version>1.0.0</version>
9+
<packaging>pom</packaging>
10+
11+
<properties>
12+
<dbUrl>jdbc:oracle:thin:@localhost:1521:xe</dbUrl>
13+
<dbUser>UT3</dbUser>
14+
<dbPass>UT3</dbPass>
15+
</properties>
16+
17+
<build>
18+
<plugins>
19+
<plugin>
20+
<groupId>org.utplsql</groupId>
21+
<artifactId>utplsql-maven-plugin</artifactId>
22+
<version>@project.version@</version>
23+
<executions>
24+
<execution>
25+
<goals>
26+
<goal>test</goal>
27+
</goals>
28+
<configuration>
29+
<ignoreFailure>false</ignoreFailure>
30+
<paths>
31+
<path>TESTS_OWNER</path>
32+
</paths>
33+
<reporters>
34+
<reporter>
35+
<name>UT_COVERAGE_SONAR_REPORTER</name>
36+
<fileOutput>utplsql/coverage-sonar-report.xml</fileOutput>
37+
<consoleOutput>true</consoleOutput>
38+
</reporter>
39+
<reporter>
40+
<name>UT_SONAR_TEST_REPORTER</name>
41+
<fileOutput>utplsql/sonar-test-report.xml</fileOutput>
42+
<consoleOutput>true</consoleOutput>
43+
</reporter>
44+
</reporters>
45+
<excludeObjectExpr>*pkg_test_me</excludeObjectExpr>
46+
</configuration>
47+
</execution>
48+
</executions>
49+
</plugin>
50+
</plugins>
51+
</build>
52+
</project>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<coverage version="1"><file path="package body tests_owner.test_pkg_test_me"><lineToCover lineNumber="8" covered="true"/><lineToCover lineNumber="16" covered="true"/><lineToCover lineNumber="23" covered="true"/><lineToCover lineNumber="29" covered="true"/><lineToCover lineNumber="36" covered="true"/><lineToCover lineNumber="42" covered="true"/><lineToCover lineNumber="48" covered="true"/><lineToCover lineNumber="55" covered="true"/><lineToCover lineNumber="62" covered="true"/><lineToCover lineNumber="71" covered="true"/><lineToCover lineNumber="72" covered="true"/><lineToCover lineNumber="73" covered="true"/><lineToCover lineNumber="74" covered="true"/><lineToCover lineNumber="85" covered="true"/><lineToCover lineNumber="86" covered="true"/><lineToCover lineNumber="87" covered="true"/><lineToCover lineNumber="88" covered="true"/><lineToCover lineNumber="91" covered="true"/><lineToCover lineNumber="92" covered="true"/><lineToCover lineNumber="95" covered="true"/><lineToCover lineNumber="96" covered="true"/><lineToCover lineNumber="97" covered="true"/><lineToCover lineNumber="104" covered="true"/><lineToCover lineNumber="105" covered="true"/><lineToCover lineNumber="107" covered="false"/><lineToCover lineNumber="108" covered="false"/><lineToCover lineNumber="117" covered="true"/><lineToCover lineNumber="118" covered="true"/><lineToCover lineNumber="120" covered="true"/><lineToCover lineNumber="122" covered="true"/></file></coverage>
1+
<coverage version="1"><file path="package body app.pkg_test_me"><lineToCover lineNumber="1" covered="false"/><lineToCover lineNumber="2" covered="false"/><lineToCover lineNumber="3" covered="false"/><lineToCover lineNumber="4" covered="false"/><lineToCover lineNumber="5" covered="false"/><lineToCover lineNumber="6" covered="false"/><lineToCover lineNumber="7" covered="false"/><lineToCover lineNumber="8" covered="false"/><lineToCover lineNumber="9" covered="false"/><lineToCover lineNumber="10" covered="false"/><lineToCover lineNumber="11" covered="false"/><lineToCover lineNumber="12" covered="false"/><lineToCover lineNumber="13" covered="false"/><lineToCover lineNumber="14" covered="false"/><lineToCover lineNumber="15" covered="false"/><lineToCover lineNumber="16" covered="false"/><lineToCover lineNumber="17" covered="false"/><lineToCover lineNumber="18" covered="false"/><lineToCover lineNumber="19" covered="false"/><lineToCover lineNumber="20" covered="false"/><lineToCover lineNumber="21" covered="false"/><lineToCover lineNumber="22" covered="false"/><lineToCover lineNumber="23" covered="false"/><lineToCover lineNumber="24" covered="false"/><lineToCover lineNumber="25" covered="false"/><lineToCover lineNumber="26" covered="false"/></file></coverage>

src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<consoleOutput>true</consoleOutput>
4343
</reporter>
4444
</reporters>
45-
<includeObject>tests_owner.test_pkg_test_me</includeObject>
45+
<includeObject>app.pkg_test_me</includeObject>
4646
</configuration>
4747
</execution>
4848
</executions>

src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/include_object_expr/expected-output/utplsql/coverage-sonar-report.xml

+1
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<testExecutions version="1">
2+
<file path="plsql.examples.test_pkg_test_me">
3+
<testCase name="test_fc_input_1" duration="1" ></testCase>
4+
<testCase name="test_fc_input_0" duration="1" ></testCase>
5+
<testCase name="test_fc_input_null" duration="1" ></testCase>
6+
<testCase name="test_pr_test_me_null" duration="1" ></testCase>
7+
<testCase name="test_pr_test_me_not_null" duration="1" ></testCase>
8+
<testCase name="test_pr_test_me_exists" duration="1" ></testCase>
9+
<testCase name="test_pr_test_me_cursor" duration="1" ></testCase>
10+
</file>
11+
</testExecutions>
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>owner-param</artifactId>
8+
<version>1.0.0</version>
9+
<packaging>pom</packaging>
10+
11+
<properties>
12+
<dbUrl>jdbc:oracle:thin:@localhost:1521:xe</dbUrl>
13+
<dbUser>UT3</dbUser>
14+
<dbPass>UT3</dbPass>
15+
</properties>
16+
17+
<build>
18+
<plugins>
19+
<plugin>
20+
<groupId>org.utplsql</groupId>
21+
<artifactId>utplsql-maven-plugin</artifactId>
22+
<version>@project.version@</version>
23+
<executions>
24+
<execution>
25+
<goals>
26+
<goal>test</goal>
27+
</goals>
28+
<configuration>
29+
<ignoreFailure>false</ignoreFailure>
30+
<paths>
31+
<path>TESTS_OWNER</path>
32+
</paths>
33+
<reporters>
34+
<reporter>
35+
<name>UT_COVERAGE_SONAR_REPORTER</name>
36+
<fileOutput>utplsql/coverage-sonar-report.xml</fileOutput>
37+
<consoleOutput>true</consoleOutput>
38+
</reporter>
39+
<reporter>
40+
<name>UT_SONAR_TEST_REPORTER</name>
41+
<fileOutput>utplsql/sonar-test-report.xml</fileOutput>
42+
<consoleOutput>true</consoleOutput>
43+
</reporter>
44+
</reporters>
45+
<includeObjectExpr>app.*</includeObjectExpr>
46+
</configuration>
47+
</execution>
48+
</executions>
49+
</plugin>
50+
</plugins>
51+
</build>
52+
</project>

0 commit comments

Comments
 (0)