Skip to content

Commit abf5256

Browse files
pesseSamuel Nitsche
authored andcommitted
Very simple fail-fast if DB framework is not compatible
1 parent 088b130 commit abf5256

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>org.utplsql</groupId>
66
<artifactId>cli</artifactId>
7-
<version>1.0-SNAPSHOT</version>
7+
<version>3.0.3-SNAPSHOT</version>
88
<packaging>jar</packaging>
99

1010
<name>cli</name>
@@ -20,7 +20,7 @@
2020
<dependency>
2121
<groupId>org.utplsql</groupId>
2222
<artifactId>java-api</artifactId>
23-
<version>1.0-SNAPSHOT</version>
23+
<version>3.0.3-SNAPSHOT</version>
2424
<scope>compile</scope>
2525
</dependency>
2626
<dependency>

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.beust.jcommander.Parameter;
44
import com.beust.jcommander.Parameters;
55
import org.utplsql.api.*;
6+
import org.utplsql.api.exception.DatabaseNotCompatibleException;
67
import org.utplsql.api.exception.SomeTestsFailedException;
78
import org.utplsql.api.reporter.Reporter;
89
import org.utplsql.api.reporter.ReporterFactory;
@@ -80,6 +81,9 @@ public List<String> getTestPaths() {
8081
public int run() throws Exception {
8182
final ConnectionInfo ci = getConnectionInfo();
8283

84+
// First of all do a compatibility check and fail-fast
85+
checkFrameworkCompatibility(ci);
86+
8387
final List<ReporterOptions> reporterOptionsList = getReporterOptionsList();
8488
final List<String> testPaths = getTestPaths();
8589
final List<Reporter> reporterList = new ArrayList<>();
@@ -199,6 +203,19 @@ public List<ReporterOptions> getReporterOptionsList() {
199203
return reporterOptionsList;
200204
}
201205

206+
private void checkFrameworkCompatibility(ConnectionInfo ci) throws SQLException {
207+
try
208+
{
209+
DBHelper.failOnVersionCompatibilityCheckFailed(ci.getConnection());
210+
}
211+
catch ( DatabaseNotCompatibleException e )
212+
{
213+
System.out.println(e.getMessage());
214+
215+
throw e;
216+
}
217+
}
218+
202219
public FileMapperOptions getMapperOptions(List<String> mappingParams, List<String> filePaths) {
203220
FileMapperOptions mapperOptions = new FileMapperOptions(filePaths);
204221

0 commit comments

Comments
 (0)