Skip to content

Make "Catch Oracle stuck" optional end not enabled by default #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ env:
- UTPLSQL_VERSION="v3.1.6"
- UTPLSQL_VERSION="v3.1.7"
- UTPLSQL_VERSION="v3.1.8"
- UTPLSQL_VERSION="v3.1.9"
- UTPLSQL_VERSION="v3.1.10"
- UTPLSQL_VERSION="develop"
UTPLSQL_FILE="utPLSQL"

Expand Down
11 changes: 10 additions & 1 deletion src/main/java/org/utplsql/api/TestRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ public TestRunner addTags(Collection<String> tags) {
return this;
}

public TestRunner catchOraStuck( boolean catchOraStuck ) {
this.options.catchOraStuck = catchOraStuck;
return this;
}

public TestRunnerOptions getOptions() { return options; }

private void delayedAddReporters() {
Expand Down Expand Up @@ -213,7 +218,7 @@ public void run(Connection conn) throws SQLException {

TestRunnerStatement testRunnerStatement = null;
try {
testRunnerStatement = initStatementWithTimeout(conn);
testRunnerStatement = ( options.catchOraStuck ) ? initStatementWithTimeout(conn) : initStatement(conn);
logger.info("Running tests");
testRunnerStatement.execute();
logger.info("Running tests finished.");
Expand All @@ -227,6 +232,10 @@ public void run(Connection conn) throws SQLException {
}
}

private TestRunnerStatement initStatement( Connection conn ) throws SQLException {
return compatibilityProxy.getTestRunnerStatement(options, conn);
}

private TestRunnerStatement initStatementWithTimeout( Connection conn ) throws OracleCreateStatmenetStuckException, SQLException {
ExecutorService executor = Executors.newSingleThreadExecutor();
Callable<TestRunnerStatement> callable = () -> compatibilityProxy.getTestRunnerStatement(options, conn);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/utplsql/api/TestRunnerOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class TestRunnerOptions {
public boolean randomTestOrder = false;
public Integer randomTestOrderSeed;
public final Set<String> tags = new LinkedHashSet<>();
public boolean catchOraStuck = false;

public String getTagsAsString() {
return String.join(",", tags);
Expand Down