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

Skip to content

Commit 260da96

Browse files
committed
Add new config option so Catching "Ora Stuck" is not enabled by default
Reson for this that I have the assumption that catch is too greedy, leading to more abort- and retries than necessary.
1 parent 91b5612 commit 260da96

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/main/java/org/utplsql/api/TestRunner.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ public TestRunner addTags(Collection<String> tags) {
145145
return this;
146146
}
147147

148+
public TestRunner catchOraStuck( boolean catchOraStuck ) {
149+
this.options.catchOraStuck = catchOraStuck;
150+
return this;
151+
}
152+
148153
public TestRunnerOptions getOptions() { return options; }
149154

150155
private void delayedAddReporters() {
@@ -213,7 +218,7 @@ public void run(Connection conn) throws SQLException {
213218

214219
TestRunnerStatement testRunnerStatement = null;
215220
try {
216-
testRunnerStatement = initStatementWithTimeout(conn);
221+
testRunnerStatement = ( options.catchOraStuck ) ? initStatementWithTimeout(conn) : initStatement(conn);
217222
logger.info("Running tests");
218223
testRunnerStatement.execute();
219224
logger.info("Running tests finished.");
@@ -227,6 +232,10 @@ public void run(Connection conn) throws SQLException {
227232
}
228233
}
229234

235+
private TestRunnerStatement initStatement( Connection conn ) throws SQLException {
236+
return compatibilityProxy.getTestRunnerStatement(options, conn);
237+
}
238+
230239
private TestRunnerStatement initStatementWithTimeout( Connection conn ) throws OracleCreateStatmenetStuckException, SQLException {
231240
ExecutorService executor = Executors.newSingleThreadExecutor();
232241
Callable<TestRunnerStatement> callable = () -> compatibilityProxy.getTestRunnerStatement(options, conn);

src/main/java/org/utplsql/api/TestRunnerOptions.java

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class TestRunnerOptions {
3030
public boolean randomTestOrder = false;
3131
public Integer randomTestOrderSeed;
3232
public final Set<String> tags = new LinkedHashSet<>();
33+
public boolean catchOraStuck = false;
3334

3435
public String getTagsAsString() {
3536
return String.join(",", tags);

0 commit comments

Comments
 (0)