Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
New parameter --ora-stuck-timeout
Sets a timeout around Reporter creation and retries when not ready after a while. 0 = no timeout.

Fixes #199
Fixes #197
Fixes #196
Fixes #193
Fixes #191
  • Loading branch information
pesse committed Jun 8, 2022
commit 322a3f0c36ff7b1a2300b9cd49f29e7f726fc455
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ utplsql run "my/Username"/"myP@ssword"@connectstring

--coverage-schemes - A comma separated list of schemas on which coverage should be gathered
Format: --coverage-schemes=schema1[,schema2[,schema3]]

--ora-stuck-timeout - Sets a timeout around Reporter creation and retries when not ready after a while. 0 = no timeout.
```

Parameters -f, -o, -s are correlated. That is parameters -o and -s are controlling outputs for reporter specified by the preceding -f parameter.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/utplsql/cli/RunAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ TestRunner newTestRunner(List<Reporter> reporterList) {
.randomTestOrderSeed(config.getRandomTestOrderSeed())
.addTags(Arrays.asList(config.getTags()))
.addCoverageSchemes(Arrays.asList(config.getCoverageSchemes()))
.catchOraStuck(config.isCatchOraStuck());
.oraStuckTimeout(config.getOraStuckTimeout());
}

private void outputMainInformation() {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/utplsql/cli/RunPicocliCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ FileMapperConfig toFileMapperConfig() {
@Option(names = "-h", usageHelp = true, description = "display this help and exit")
boolean help;

@Option(names = "--catch-ora-stuck", description = "Sets a timeout around Reporter creation and retries when not ready after a while")
boolean catchOraStuck = false;
@Option(names = "--ora-stuck-timeout", description = "Sets a timeout around Reporter creation and retries when not ready after a while. 0 = no timeout.")
Integer oraStuckTimeout = 0;

private RunAction runAction;

Expand Down Expand Up @@ -248,7 +248,7 @@ public RunCommandConfig getRunCommandConfig() {
.randomTestOrderSeed(randomTestOrderSeed)
.tags(tags.toArray(new String[0]))
.coverageSchemes(coverageSchemes.toArray(new String[0]))
.catchOraStuck(catchOraStuck)
.oraStuckTimeout(oraStuckTimeout)
.create();
}

Expand Down
18 changes: 9 additions & 9 deletions src/main/java/org/utplsql/cli/config/RunCommandConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public class RunCommandConfig extends ConnectionConfig {
private final Integer randomTestOrderSeed;
private final String[] tags;
private final String[] coverageSchemes;
private final boolean catchOraStuck;
private final Integer oraStuckTimeout;

@ConstructorProperties({"connectString", "suitePaths", "reporters", "outputAnsiColor", "failureExitCode", "skipCompatibilityCheck", "includePackages", "excludePackages", "sourceMapping", "testMapping", "logConfigLevel", "timeoutInMinutes", "dbmsOutput", "randomTestOrder", "randomTestOrderSeed", "tags", "coverageSchemes", "catchOraStuck"})
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, boolean catchOraStuck) {
@ConstructorProperties({"connectString", "suitePaths", "reporters", "outputAnsiColor", "failureExitCode", "skipCompatibilityCheck", "includePackages", "excludePackages", "sourceMapping", "testMapping", "logConfigLevel", "timeoutInMinutes", "dbmsOutput", "randomTestOrder", "randomTestOrderSeed", "tags", "coverageSchemes", "oraStuckTimeout"})
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) {
super(connectString);
this.suitePaths = suitePaths;
this.reporters = reporters;
Expand All @@ -44,7 +44,7 @@ public RunCommandConfig(String connectString, String[] suitePaths, ReporterConfi
this.randomTestOrderSeed = randomTestOrderSeed;
this.tags = tags;
this.coverageSchemes = coverageSchemes;
this.catchOraStuck = catchOraStuck;
this.oraStuckTimeout = oraStuckTimeout;
}

public String[] getSuitePaths() {
Expand Down Expand Up @@ -111,7 +111,7 @@ public String[] getCoverageSchemes() {
return coverageSchemes;
}

public boolean isCatchOraStuck() { return catchOraStuck; }
public Integer getOraStuckTimeout() { return oraStuckTimeout; }

public static class Builder {

Expand All @@ -132,7 +132,7 @@ public static class Builder {
private Integer randomTestOrderSeed;
private String[] tags = new String[0];
private String[] coverageSchemes = new String[0];
private boolean catchOraStuck;
private Integer oraStuckTimeout;

public Builder connectString(String connectString) {
this.connectString = connectString;
Expand Down Expand Up @@ -219,13 +219,13 @@ public Builder coverageSchemes(String[] coverageSchemes) {
return this;
}

public Builder catchOraStuck(boolean catchOraStuck) {
this.catchOraStuck = catchOraStuck;
public Builder oraStuckTimeout(Integer oraStuckTimeout) {
this.oraStuckTimeout = oraStuckTimeout;
return this;
}

public RunCommandConfig create() {
return new RunCommandConfig(connectString, suitePaths, reporters, outputAnsiColor, failureExitCode, skipCompatibilityCheck, includePackages, excludePackages, sourceMapping, testMapping, logConfigLevel, timeoutInMinutes, dbmsOutput, randomTestOrder, randomTestOrderSeed, tags, coverageSchemes, catchOraStuck);
return new RunCommandConfig(connectString, suitePaths, reporters, outputAnsiColor, failureExitCode, skipCompatibilityCheck, includePackages, excludePackages, sourceMapping, testMapping, logConfigLevel, timeoutInMinutes, dbmsOutput, randomTestOrder, randomTestOrderSeed, tags, coverageSchemes, oraStuckTimeout);
}
}
}
2 changes: 1 addition & 1 deletion src/test/java/org/utplsql/cli/RunCommandArgumentsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void allArgumentsAreRecognized() {
"-owner_subexpression=0",
"-type_subexpression=0",
"-name_subexpression=0",
"--catch-ora-stuck"
"--ora-stuck-timeout=2"
);

TestRunner testRunner = runCmd.newTestRunner(new ArrayList<>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class RunCommandConfigParamsArePassedToTestRunnerTest {
Expand All @@ -31,11 +32,11 @@ void coverageSchemes() {
}

@Test
void catchOraStuck() {
void oraStuckTimeout() {
RunCommandConfig config = new RunCommandConfig.Builder()
.catchOraStuck(true)
.oraStuckTimeout(2)
.create();
TestRunner testRunner = new RunAction(config).newTestRunner(new ArrayList<>());
assertTrue( testRunner.getOptions().catchOraStuck );
assertThat( testRunner.getOptions().oraStuckTimeout, equalTo(2) );
}
}