Skip to content

Commit 25de681

Browse files
authored
Merge pull request utPLSQL#9 from viniciusam/output_ident
Documentation Reporter Identation and Small Fixes
2 parents 3f244a1 + 50a88e2 commit 25de681

File tree

4 files changed

+54
-4
lines changed

4 files changed

+54
-4
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<dependencies>
2020
<dependency>
2121
<groupId>com.oracle.jdbc</groupId>
22-
<artifactId>ojdbc7</artifactId>
23-
<version>12.1.0.2</version>
22+
<artifactId>ojdbc8</artifactId>
23+
<version>12.2.0.1</version>
2424
<scope>compile</scope>
2525
</dependency>
2626
<dependency>

src/main/java/io/github/utplsql/api/TestRunner.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class TestRunner {
1515

1616
private List<String> pathList = new ArrayList<>();
1717
private List<Reporter> reporterList = new ArrayList<>();
18+
private boolean colorConsole = false;
1819
private List<String> coverageSchemes = new ArrayList<>();
1920
private List<String> sourceFiles = new ArrayList<>();
2021
private List<String> testFiles = new ArrayList<>();
@@ -36,6 +37,11 @@ public TestRunner addReporter(Reporter reporter) {
3637
return this;
3738
}
3839

40+
public TestRunner colorConsole(boolean colorConsole) {
41+
this.colorConsole = colorConsole;
42+
return this;
43+
}
44+
3945
public TestRunner addReporterList(List<Reporter> reporterList) {
4046
this.reporterList.addAll(reporterList);
4147
return this;
@@ -87,13 +93,16 @@ public void run(Connection conn) throws SQLException {
8793
Array includeObjectsArray = oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST, this.includeObjects.toArray());
8894
Array excludeObjectsArray = oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST, this.excludeObjects.toArray());
8995

96+
// Workaround because Oracle JDBC doesn't support passing boolean to stored procedures.
97+
String colorConsoleStr = Boolean.toString(this.colorConsole);
98+
9099
CallableStatement callableStatement = null;
91100
try {
92101
callableStatement = conn.prepareCall(
93102
"BEGIN " +
94103
"ut_runner.run(" +
95-
"a_paths => ?, a_reporters => ?, a_coverage_schemes => ?," +
96-
"a_source_files => ?, a_test_files => ?, " +
104+
"a_paths => ?, a_reporters => ?, a_color_console => " + colorConsoleStr + ", " +
105+
"a_coverage_schemes => ?, a_source_files => ?, a_test_files => ?, " +
97106
"a_include_objects => ?, a_exclude_objects => ?); " +
98107
"END;");
99108
callableStatement.setArray(1, pathArray);

src/main/java/io/github/utplsql/api/reporter/DocumentationReporter.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,52 @@
33
import io.github.utplsql.api.CustomTypes;
44

55
import java.sql.SQLException;
6+
import java.sql.SQLInput;
7+
import java.sql.SQLOutput;
68

79
public class DocumentationReporter extends Reporter {
810

11+
private int lvl;
12+
private int failed;
13+
14+
public DocumentationReporter() {
15+
this.lvl = 0;
16+
this.failed = 0;
17+
}
18+
19+
public int getLvl() {
20+
return lvl;
21+
}
22+
23+
public void setLvl(int lvl) {
24+
this.lvl = lvl;
25+
}
26+
27+
public int getFailed() {
28+
return failed;
29+
}
30+
31+
public void setFailed(int failed) {
32+
this.failed = failed;
33+
}
34+
935
@Override
1036
public String getSQLTypeName() throws SQLException {
1137
return CustomTypes.UT_DOCUMENTATION_REPORTER;
1238
}
1339

40+
@Override
41+
public void readSQL(SQLInput stream, String typeName) throws SQLException {
42+
super.readSQL(stream, typeName);
43+
setLvl(stream.readInt());
44+
setFailed(stream.readInt());
45+
}
46+
47+
@Override
48+
public void writeSQL(SQLOutput stream) throws SQLException {
49+
super.writeSQL(stream);
50+
stream.writeInt(getLvl());
51+
stream.writeInt(getFailed());
52+
}
53+
1454
}

src/main/java/io/github/utplsql/api/reporter/Reporter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public abstract class Reporter implements SQLData {
1717
public Reporter() {}
1818

1919
public Reporter init(Connection conn) throws SQLException {
20+
setSelfType(getSQLTypeName());
2021
setStartDate(new java.sql.Date(Calendar.getInstance().getTimeInMillis()));
2122
setReporterId(DBHelper.newSysGuid(conn));
2223
return this;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy