Skip to content

Commit a514881

Browse files
pesseSamuel Nitsche
authored andcommitted
Added -scc/--skip-compatibility-check option
If option is on, cli expects the most actual framework version to be present
1 parent abf5256 commit a514881

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
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>3.0.3-SNAPSHOT</version>
7+
<version>3.0.4-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>3.0.3-SNAPSHOT</version>
23+
<version>3.0.4-SNAPSHOT</version>
2424
<scope>compile</scope>
2525
</dependency>
2626
<dependency>

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

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
/**
2424
* Created by vinicius.moreira on 19/04/2017.
25+
*
26+
* @author vinicious moreira
27+
* @author pesse
2528
*/
2629
@Parameters(separators = "=", commandDescription = "run tests")
2730
public class RunCommand {
@@ -70,6 +73,12 @@ public class RunCommand {
7073
"-name_subexpression=0] - path to project test files")
7174
private List<String> testPathParams = new ArrayList<>();
7275

76+
@Parameter(
77+
names = {"-scc", "--skip-compatibility-check"},
78+
description = "Skips the check for compatibility with database framework. CLI expects the framework to be " +
79+
"most actual. Use this if you use CLI with a development version of utPLSQL-framework")
80+
private boolean skipCompatibilityCheck = false;
81+
7382
public ConnectionInfo getConnectionInfo() {
7483
return connectionInfoList.get(0);
7584
}
@@ -133,6 +142,7 @@ public int run() throws Exception {
133142
.testMappingOptions(testMappingOptions[0])
134143
.colorConsole(this.colorConsole)
135144
.failOnErrors(true)
145+
.skipCompatibilityCheck(skipCompatibilityCheck)
136146
.run(conn);
137147
} catch (SomeTestsFailedException e) {
138148
returnCode[0] = this.failureExitCode;
@@ -204,15 +214,19 @@ public List<ReporterOptions> getReporterOptionsList() {
204214
}
205215

206216
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());
214217

215-
throw e;
218+
if ( !skipCompatibilityCheck ) {
219+
try {
220+
DBHelper.failOnVersionCompatibilityCheckFailed(ci.getConnection());
221+
} catch (DatabaseNotCompatibleException e) {
222+
System.out.println(e.getMessage());
223+
224+
throw e;
225+
}
226+
}
227+
else {
228+
System.out.println("Skipping Compatibility check with framework version, expecting the latest version " +
229+
"to be installed in database");
216230
}
217231
}
218232

0 commit comments

Comments
 (0)