Skip to content

Commit 322a3f0

Browse files
committed
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
1 parent 42ec927 commit 322a3f0

File tree

6 files changed

+20
-17
lines changed

6 files changed

+20
-17
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ utplsql run "my/Username"/"myP@ssword"@connectstring
182182
183183
--coverage-schemes - A comma separated list of schemas on which coverage should be gathered
184184
Format: --coverage-schemes=schema1[,schema2[,schema3]]
185+
186+
--ora-stuck-timeout - Sets a timeout around Reporter creation and retries when not ready after a while. 0 = no timeout.
185187
```
186188

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ TestRunner newTestRunner(List<Reporter> reporterList) {
167167
.randomTestOrderSeed(config.getRandomTestOrderSeed())
168168
.addTags(Arrays.asList(config.getTags()))
169169
.addCoverageSchemes(Arrays.asList(config.getCoverageSchemes()))
170-
.catchOraStuck(config.isCatchOraStuck());
170+
.oraStuckTimeout(config.getOraStuckTimeout());
171171
}
172172

173173
private void outputMainInformation() {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ FileMapperConfig toFileMapperConfig() {
183183
@Option(names = "-h", usageHelp = true, description = "display this help and exit")
184184
boolean help;
185185

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

189189
private RunAction runAction;
190190

@@ -248,7 +248,7 @@ public RunCommandConfig getRunCommandConfig() {
248248
.randomTestOrderSeed(randomTestOrderSeed)
249249
.tags(tags.toArray(new String[0]))
250250
.coverageSchemes(coverageSchemes.toArray(new String[0]))
251-
.catchOraStuck(catchOraStuck)
251+
.oraStuckTimeout(oraStuckTimeout)
252252
.create();
253253
}
254254

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public class RunCommandConfig extends ConnectionConfig {
2323
private final Integer randomTestOrderSeed;
2424
private final String[] tags;
2525
private final String[] coverageSchemes;
26-
private final boolean catchOraStuck;
26+
private final Integer oraStuckTimeout;
2727

28-
@ConstructorProperties({"connectString", "suitePaths", "reporters", "outputAnsiColor", "failureExitCode", "skipCompatibilityCheck", "includePackages", "excludePackages", "sourceMapping", "testMapping", "logConfigLevel", "timeoutInMinutes", "dbmsOutput", "randomTestOrder", "randomTestOrderSeed", "tags", "coverageSchemes", "catchOraStuck"})
29-
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) {
28+
@ConstructorProperties({"connectString", "suitePaths", "reporters", "outputAnsiColor", "failureExitCode", "skipCompatibilityCheck", "includePackages", "excludePackages", "sourceMapping", "testMapping", "logConfigLevel", "timeoutInMinutes", "dbmsOutput", "randomTestOrder", "randomTestOrderSeed", "tags", "coverageSchemes", "oraStuckTimeout"})
29+
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) {
3030
super(connectString);
3131
this.suitePaths = suitePaths;
3232
this.reporters = reporters;
@@ -44,7 +44,7 @@ public RunCommandConfig(String connectString, String[] suitePaths, ReporterConfi
4444
this.randomTestOrderSeed = randomTestOrderSeed;
4545
this.tags = tags;
4646
this.coverageSchemes = coverageSchemes;
47-
this.catchOraStuck = catchOraStuck;
47+
this.oraStuckTimeout = oraStuckTimeout;
4848
}
4949

5050
public String[] getSuitePaths() {
@@ -111,7 +111,7 @@ public String[] getCoverageSchemes() {
111111
return coverageSchemes;
112112
}
113113

114-
public boolean isCatchOraStuck() { return catchOraStuck; }
114+
public Integer getOraStuckTimeout() { return oraStuckTimeout; }
115115

116116
public static class Builder {
117117

@@ -132,7 +132,7 @@ public static class Builder {
132132
private Integer randomTestOrderSeed;
133133
private String[] tags = new String[0];
134134
private String[] coverageSchemes = new String[0];
135-
private boolean catchOraStuck;
135+
private Integer oraStuckTimeout;
136136

137137
public Builder connectString(String connectString) {
138138
this.connectString = connectString;
@@ -219,13 +219,13 @@ public Builder coverageSchemes(String[] coverageSchemes) {
219219
return this;
220220
}
221221

222-
public Builder catchOraStuck(boolean catchOraStuck) {
223-
this.catchOraStuck = catchOraStuck;
222+
public Builder oraStuckTimeout(Integer oraStuckTimeout) {
223+
this.oraStuckTimeout = oraStuckTimeout;
224224
return this;
225225
}
226226

227227
public RunCommandConfig create() {
228-
return new RunCommandConfig(connectString, suitePaths, reporters, outputAnsiColor, failureExitCode, skipCompatibilityCheck, includePackages, excludePackages, sourceMapping, testMapping, logConfigLevel, timeoutInMinutes, dbmsOutput, randomTestOrder, randomTestOrderSeed, tags, coverageSchemes, catchOraStuck);
228+
return new RunCommandConfig(connectString, suitePaths, reporters, outputAnsiColor, failureExitCode, skipCompatibilityCheck, includePackages, excludePackages, sourceMapping, testMapping, logConfigLevel, timeoutInMinutes, dbmsOutput, randomTestOrder, randomTestOrderSeed, tags, coverageSchemes, oraStuckTimeout);
229229
}
230230
}
231231
}

src/test/java/org/utplsql/cli/RunCommandArgumentsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void allArgumentsAreRecognized() {
4242
"-owner_subexpression=0",
4343
"-type_subexpression=0",
4444
"-name_subexpression=0",
45-
"--catch-ora-stuck"
45+
"--ora-stuck-timeout=2"
4646
);
4747

4848
TestRunner testRunner = runCmd.newTestRunner(new ArrayList<>());

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import static org.hamcrest.MatcherAssert.assertThat;
1010
import static org.hamcrest.Matchers.contains;
11+
import static org.hamcrest.Matchers.equalTo;
1112
import static org.junit.jupiter.api.Assertions.assertTrue;
1213

1314
public class RunCommandConfigParamsArePassedToTestRunnerTest {
@@ -31,11 +32,11 @@ void coverageSchemes() {
3132
}
3233

3334
@Test
34-
void catchOraStuck() {
35+
void oraStuckTimeout() {
3536
RunCommandConfig config = new RunCommandConfig.Builder()
36-
.catchOraStuck(true)
37+
.oraStuckTimeout(2)
3738
.create();
3839
TestRunner testRunner = new RunAction(config).newTestRunner(new ArrayList<>());
39-
assertTrue( testRunner.getOptions().catchOraStuck );
40+
assertThat( testRunner.getOptions().oraStuckTimeout, equalTo(2) );
4041
}
4142
}

0 commit comments

Comments
 (0)