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

Skip to content
Merged
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
Prev Previous commit
Next Next commit
Add support for console colors
  • Loading branch information
viniciusam committed Jun 9, 2017
commit 467feaabdf75870fa9b8ce27e333608d8d62b8ce
13 changes: 11 additions & 2 deletions src/main/java/io/github/utplsql/api/TestRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class TestRunner {

private List<String> pathList = new ArrayList<>();
private List<Reporter> reporterList = new ArrayList<>();
private boolean colorConsole = false;
private List<String> coverageSchemes = new ArrayList<>();
private List<String> sourceFiles = new ArrayList<>();
private List<String> testFiles = new ArrayList<>();
Expand All @@ -36,6 +37,11 @@ public TestRunner addReporter(Reporter reporter) {
return this;
}

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

public TestRunner addReporterList(List<Reporter> reporterList) {
this.reporterList.addAll(reporterList);
return this;
Expand Down Expand Up @@ -87,13 +93,16 @@ public void run(Connection conn) throws SQLException {
Array includeObjectsArray = oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST, this.includeObjects.toArray());
Array excludeObjectsArray = oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST, this.excludeObjects.toArray());

// Workaround because Oracle JDBC doesn't support passing boolean to stored procedures.
String colorConsoleStr = Boolean.toString(this.colorConsole);

CallableStatement callableStatement = null;
try {
callableStatement = conn.prepareCall(
"BEGIN " +
"ut_runner.run(" +
"a_paths => ?, a_reporters => ?, a_coverage_schemes => ?," +
"a_source_files => ?, a_test_files => ?, " +
"a_paths => ?, a_reporters => ?, a_color_console => " + colorConsoleStr + ", " +
"a_coverage_schemes => ?, a_source_files => ?, a_test_files => ?, " +
"a_include_objects => ?, a_exclude_objects => ?); " +
"END;");
callableStatement.setArray(1, pathArray);
Expand Down