-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTestRunnerStatementProvider.java
More file actions
49 lines (40 loc) · 1.57 KB
/
TestRunnerStatementProvider.java
File metadata and controls
49 lines (40 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package org.utplsql.api.testRunner;
import org.utplsql.api.TestRunnerOptions;
import org.utplsql.api.Version;
import org.utplsql.api.exception.InvalidVersionException;
import java.sql.Connection;
import java.sql.SQLException;
/**
* Provides different implementations of TestRunnerStatement based on the version of the database framework
*
* @author pesse
*/
public class TestRunnerStatementProvider {
private TestRunnerStatementProvider() {
throw new UnsupportedOperationException();
}
/**
* Returns the TestRunnerStatement-implementation compatible with the given databaseVersion.
*
* @param databaseVersion Version of the database framework
* @param options TestRunnerOptions to be used
* @param conn Active Connection
* @return TestRunnerStatment compatible with the database framework
* @throws SQLException
*/
public static TestRunnerStatement getCompatibleTestRunnerStatement(Version databaseVersion, TestRunnerOptions options, Connection conn) throws SQLException {
AbstractTestRunnerStatement stmt = null;
try {
if (databaseVersion.isLessThan(Version.V3_0_3)) {
stmt = new Pre303TestRunnerStatement(options, conn);
} else if (databaseVersion.isLessThan(Version.V3_1_2)) {
stmt = new Pre312TestRunnerStatement(options, conn);
}
} catch (InvalidVersionException ignored) {
}
if (stmt == null) {
stmt = new ActualTestRunnerStatement(options, conn);
}
return stmt;
}
}