Skip to content

Documentation Reporter Identation and Small Fixes #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<dependencies>
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,52 @@
import io.github.utplsql.api.CustomTypes;

import java.sql.SQLException;
import java.sql.SQLInput;
import java.sql.SQLOutput;

public class DocumentationReporter extends Reporter {

private int lvl;
private int failed;

public DocumentationReporter() {
this.lvl = 0;
this.failed = 0;
}

public int getLvl() {
return lvl;
}

public void setLvl(int lvl) {
this.lvl = lvl;
}

public int getFailed() {
return failed;
}

public void setFailed(int failed) {
this.failed = failed;
}

@Override
public String getSQLTypeName() throws SQLException {
return CustomTypes.UT_DOCUMENTATION_REPORTER;
}

@Override
public void readSQL(SQLInput stream, String typeName) throws SQLException {
super.readSQL(stream, typeName);
setLvl(stream.readInt());
setFailed(stream.readInt());
}

@Override
public void writeSQL(SQLOutput stream) throws SQLException {
super.writeSQL(stream);
stream.writeInt(getLvl());
stream.writeInt(getFailed());
}

}
1 change: 1 addition & 0 deletions src/main/java/io/github/utplsql/api/reporter/Reporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public abstract class Reporter implements SQLData {
public Reporter() {}

public Reporter init(Connection conn) throws SQLException {
setSelfType(getSQLTypeName());
setStartDate(new java.sql.Date(Calendar.getInstance().getTimeInMillis()));
setReporterId(DBHelper.newSysGuid(conn));
return this;
Expand Down