Skip to content

Commit 2f07390

Browse files
authored
Merge pull request #235 from utPLSQL/feature/sponsoring_info_in_reporters
Add --no-support-info option to the run command
2 parents ba6ca3e + 9a79fe8 commit 2f07390

7 files changed

Lines changed: 48 additions & 6 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ The TNS alias used in the connect string must match the alias of the credential
236236
Format: --coverage-schemes=schema1[,schema2[,schema3]]
237237
238238
--ora-stuck-timeout - Sets a timeout around Reporter creation and retries when not ready after a while. 0 = no timeout.
239+
240+
--no-support-info - Leaves out the utPLSQL support line from the documentation, TAP and HTML coverage reports.
241+
Requires utPLSQL framework 3.2.4 or newer. Default: the line is printed
239242
```
240243

241244
Parameters -f, -o, -s are correlated. That is parameters -o and -s are controlling outputs for reporter specified by the preceding -f parameter.

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1515
<maven.compiler.release>17</maven.compiler.release>
1616

17-
<utplsql-java-api.version>3.2.5</utplsql-java-api.version>
17+
<utplsql-java-api.version>3.2.6-SNAPSHOT</utplsql-java-api.version>
1818

1919
<junit.jupiter.version>5.12.2</junit.jupiter.version>
2020
<picocli.version>4.7.7</picocli.version>

‎src/main/java/org/utplsql/cli/RunAction.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ TestRunner newTestRunner(List<Reporter> reporterList) {
171171
.excludeSchemaExpr(config.getExcludeSchemaExpr())
172172
.includeObjectExpr(config.getIncludeObjectExpr())
173173
.excludeObjectExpr(config.getExcludeObjectExpr())
174-
.oraStuckTimeout(config.getOraStuckTimeout());
174+
.oraStuckTimeout(config.getOraStuckTimeout())
175+
.supportInfo(config.isSupportInfo());
175176
}
176177

177178
private void outputMainInformation() {

‎src/main/java/org/utplsql/cli/RunPicocliCommand.java‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,13 @@ FileMapperConfig toFileMapperConfig() {
214214
@Option(names = "--ora-stuck-timeout", description = "Sets a timeout around Reporter creation and retries when not ready after a while. 0 = no timeout.")
215215
Integer oraStuckTimeout = 0;
216216

217+
@Option(
218+
names = {"--no-support-info"},
219+
description = "Leaves out the utPLSQL support line from the documentation, TAP and HTML coverage reports. " +
220+
"Requires utPLSQL framework 3.2.4 or newer"
221+
)
222+
private boolean noSupportInfo = false;
223+
217224
private RunAction runAction;
218225

219226
private String[] splitOrEmpty(String value) {
@@ -281,6 +288,7 @@ public RunCommandConfig getRunCommandConfig() {
281288
.excludeSchemaExpr(excludeSchemaExpr)
282289
.includeObjectExpr(includeObjectExpr)
283290
.excludeObjectExpr(excludeObjectExpr)
291+
.supportInfo(!noSupportInfo)
284292
.create();
285293
}
286294

‎src/main/java/org/utplsql/cli/config/RunCommandConfig.java‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ public class RunCommandConfig extends ConnectionConfig {
2828
private final String excludeSchemaExpr;
2929
private final String includeObjectExpr;
3030
private final String excludeObjectExpr;
31+
private boolean supportInfo = true;
3132

32-
@ConstructorProperties({"connectString", "suitePaths", "reporters", "outputAnsiColor", "failureExitCode", "skipCompatibilityCheck", "includePackages", "excludePackages", "sourceMapping", "testMapping", "logConfigLevel", "timeoutInMinutes", "dbmsOutput", "randomTestOrder", "randomTestOrderSeed", "tags", "coverageSchemes", "oraStuckTimeout", "includeSchemaExpr", "excludeSchemaExpr", "includeObjectExpr", "excludeObjectExpr"})
33-
public RunCommandConfig(String connectString, String[] suitePaths, ReporterConfig[] reporters, boolean outputAnsiColor, Integer failureExitCode, boolean skipCompatibilityCheck, String[] includePackages, String[] excludePackages, FileMapperConfig sourceMapping, FileMapperConfig testMapping, ConfigLevel logConfigLevel, Integer timeoutInMinutes, boolean dbmsOutput, boolean randomTestOrder, Integer randomTestOrderSeed, String[] tags, String[] coverageSchemes, Integer oraStuckTimeout, String includeSchemaExpr, String excludeSchemaExpr, String includeObjectExpr, String excludeObjectExpr) {
33+
@ConstructorProperties({"connectString", "suitePaths", "reporters", "outputAnsiColor", "failureExitCode", "skipCompatibilityCheck", "includePackages", "excludePackages", "sourceMapping", "testMapping", "logConfigLevel", "timeoutInMinutes", "dbmsOutput", "randomTestOrder", "randomTestOrderSeed", "tags", "coverageSchemes", "oraStuckTimeout", "includeSchemaExpr", "excludeSchemaExpr", "includeObjectExpr", "excludeObjectExpr", "supportInfo"})
34+
public RunCommandConfig(String connectString, String[] suitePaths, ReporterConfig[] reporters, boolean outputAnsiColor, Integer failureExitCode, boolean skipCompatibilityCheck, String[] includePackages, String[] excludePackages, FileMapperConfig sourceMapping, FileMapperConfig testMapping, ConfigLevel logConfigLevel, Integer timeoutInMinutes, boolean dbmsOutput, boolean randomTestOrder, Integer randomTestOrderSeed, String[] tags, String[] coverageSchemes, Integer oraStuckTimeout, String includeSchemaExpr, String excludeSchemaExpr, String includeObjectExpr, String excludeObjectExpr, boolean supportInfo) {
3435
super(connectString);
3536
this.suitePaths = suitePaths;
3637
this.reporters = reporters;
@@ -53,6 +54,7 @@ public RunCommandConfig(String connectString, String[] suitePaths, ReporterConfi
5354
this.excludeSchemaExpr = excludeSchemaExpr;
5455
this.includeObjectExpr = includeObjectExpr;
5556
this.excludeObjectExpr = excludeObjectExpr;
57+
this.supportInfo = supportInfo;
5658
}
5759

5860
public String[] getSuitePaths() {
@@ -129,6 +131,8 @@ public String[] getCoverageSchemes() {
129131

130132
public String getExcludeObjectExpr() { return excludeObjectExpr; }
131133

134+
public boolean isSupportInfo() { return supportInfo; }
135+
132136
public static class Builder {
133137

134138
private String connectString;
@@ -153,6 +157,7 @@ public static class Builder {
153157
private String excludeSchemaExpr;
154158
private String includeObjectExpr;
155159
private String excludeObjectExpr;
160+
private boolean supportInfo = true;
156161

157162
public Builder connectString(String connectString) {
158163
this.connectString = connectString;
@@ -264,8 +269,13 @@ public Builder excludeObjectExpr(String excludeObjectExpr) {
264269
return this;
265270
}
266271

272+
public Builder supportInfo(boolean supportInfo) {
273+
this.supportInfo = supportInfo;
274+
return this;
275+
}
276+
267277
public RunCommandConfig create() {
268-
return new RunCommandConfig(connectString, suitePaths, reporters, outputAnsiColor, failureExitCode, skipCompatibilityCheck, includePackages, excludePackages, sourceMapping, testMapping, logConfigLevel, timeoutInMinutes, dbmsOutput, randomTestOrder, randomTestOrderSeed, tags, coverageSchemes, oraStuckTimeout, includeSchemaExpr, excludeSchemaExpr, includeObjectExpr, excludeObjectExpr);
278+
return new RunCommandConfig(connectString, suitePaths, reporters, outputAnsiColor, failureExitCode, skipCompatibilityCheck, includePackages, excludePackages, sourceMapping, testMapping, logConfigLevel, timeoutInMinutes, dbmsOutput, randomTestOrder, randomTestOrderSeed, tags, coverageSchemes, oraStuckTimeout, includeSchemaExpr, excludeSchemaExpr, includeObjectExpr, excludeObjectExpr, supportInfo);
269279
}
270280
}
271281
}

‎src/test/java/org/utplsql/cli/PicocliRunCommandTest.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ void runCommandAllArguments() throws Exception {
5353
"-include-schema-expr=^APP$",
5454
"-exclude-schema-expr=^APP_TEST$",
5555
"-include-object-expr=^PKG_",
56-
"-exclude-object-expr=_TMP$");
56+
"-exclude-object-expr=_TMP$",
57+
"--no-support-info");
5758

5859
assertNotNull(config.getConnectString());
5960
assertThat( config.getSuitePaths(), is(new String[]{"app.betwnstr", "app.basic"}));
@@ -62,6 +63,7 @@ void runCommandAllArguments() throws Exception {
6263
assertEquals( "^APP_TEST$", config.getExcludeSchemaExpr() );
6364
assertEquals( "^PKG_", config.getIncludeObjectExpr() );
6465
assertEquals( "_TMP$", config.getExcludeObjectExpr() );
66+
assertFalse( config.isSupportInfo() );
6567
assertTrue( config.isOutputAnsiColor() );
6668
assertEquals( LoggerConfiguration.ConfigLevel.NONE, config.getLogConfigLevel());
6769
assertEquals( 10, config.getFailureExitCode());

‎src/test/java/org/utplsql/cli/RunCommandConfigParamsArePassedToTestRunnerTest.java‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import static org.hamcrest.MatcherAssert.assertThat;
1010
import static org.hamcrest.Matchers.contains;
1111
import static org.hamcrest.Matchers.equalTo;
12+
import static org.junit.jupiter.api.Assertions.assertFalse;
1213
import static org.junit.jupiter.api.Assertions.assertTrue;
1314

1415
public class RunCommandConfigParamsArePassedToTestRunnerTest {
@@ -54,4 +55,21 @@ void expressionFilters() {
5455
assertThat( testRunner.getOptions().includeObjectExpr, equalTo("^PKG_") );
5556
assertThat( testRunner.getOptions().excludeObjectExpr, equalTo("_TMP$") );
5657
}
58+
59+
@Test
60+
void supportInfoIsOnByDefault() {
61+
RunCommandConfig config = new RunCommandConfig.Builder()
62+
.create();
63+
TestRunner testRunner = new RunAction(config).newTestRunner(new ArrayList<>());
64+
assertTrue( testRunner.getOptions().supportInfo );
65+
}
66+
67+
@Test
68+
void supportInfoSwitchedOff() {
69+
RunCommandConfig config = new RunCommandConfig.Builder()
70+
.supportInfo(false)
71+
.create();
72+
TestRunner testRunner = new RunAction(config).newTestRunner(new ArrayList<>());
73+
assertFalse( testRunner.getOptions().supportInfo );
74+
}
5775
}

0 commit comments

Comments
 (0)