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

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Very simple fail-fast if DB framework is not compatible
  • Loading branch information
pesse authored and Samuel Nitsche committed Nov 8, 2017
commit abf5256bd2a211a0ba506583ebc8cd65991842be
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.utplsql</groupId>
<artifactId>cli</artifactId>
<version>1.0-SNAPSHOT</version>
<version>3.0.3-SNAPSHOT</version>
<packaging>jar</packaging>

<name>cli</name>
Expand All @@ -20,7 +20,7 @@
<dependency>
<groupId>org.utplsql</groupId>
<artifactId>java-api</artifactId>
<version>1.0-SNAPSHOT</version>
<version>3.0.3-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/org/utplsql/cli/RunCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import org.utplsql.api.*;
import org.utplsql.api.exception.DatabaseNotCompatibleException;
import org.utplsql.api.exception.SomeTestsFailedException;
import org.utplsql.api.reporter.Reporter;
import org.utplsql.api.reporter.ReporterFactory;
Expand Down Expand Up @@ -80,6 +81,9 @@ public List<String> getTestPaths() {
public int run() throws Exception {
final ConnectionInfo ci = getConnectionInfo();

// First of all do a compatibility check and fail-fast
checkFrameworkCompatibility(ci);

final List<ReporterOptions> reporterOptionsList = getReporterOptionsList();
final List<String> testPaths = getTestPaths();
final List<Reporter> reporterList = new ArrayList<>();
Expand Down Expand Up @@ -199,6 +203,19 @@ public List<ReporterOptions> getReporterOptionsList() {
return reporterOptionsList;
}

private void checkFrameworkCompatibility(ConnectionInfo ci) throws SQLException {
try
{
DBHelper.failOnVersionCompatibilityCheckFailed(ci.getConnection());
}
catch ( DatabaseNotCompatibleException e )
{
System.out.println(e.getMessage());

throw e;
}
}

public FileMapperOptions getMapperOptions(List<String> mappingParams, List<String> filePaths) {
FileMapperOptions mapperOptions = new FileMapperOptions(filePaths);

Expand Down