Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0757c4

Browse files
authored
Merge pull request#11 from viniciusam/bugfix/test_runner_null_param
Test runner null params and html reporter default assets path
2 parentsf2ba5ed +ffc110c commitc0757c4

File tree

2 files changed

+56
-23
lines changed

2 files changed

+56
-23
lines changed

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

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public TestRunner addPath(String path) {
2828
}
2929

3030
publicTestRunneraddPathList(List<String>paths) {
31-
this.pathList.addAll(paths);
31+
if (pathList !=null)this.pathList.addAll(paths);
3232
returnthis;
3333
}
3434

@@ -43,7 +43,7 @@ public TestRunner colorConsole(boolean colorConsole) {
4343
}
4444

4545
publicTestRunneraddReporterList(List<Reporter>reporterList) {
46-
this.reporterList.addAll(reporterList);
46+
if (reporterList !=null)this.reporterList.addAll(reporterList);
4747
returnthis;
4848
}
4949

@@ -53,12 +53,12 @@ public TestRunner addCoverageScheme(String coverageScheme) {
5353
}
5454

5555
publicTestRunnerwithSourceFiles(List<String>sourceFiles) {
56-
this.sourceFiles.addAll(sourceFiles);
56+
if (sourceFiles !=null)this.sourceFiles.addAll(sourceFiles);
5757
returnthis;
5858
}
5959

6060
publicTestRunnerwithTestFiles(List<String>testFiles) {
61-
this.testFiles.addAll(testFiles);
61+
if (testFiles !=null)this.testFiles.addAll(testFiles);
6262
returnthis;
6363
}
6464

@@ -84,34 +84,63 @@ public void run(Connection conn) throws SQLException {
8484
this.reporterList.add(newDocumentationReporter().init(conn));
8585
}
8686

87-
OracleConnectionoraConn =conn.unwrap(OracleConnection.class);
88-
ArraypathArray =oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST,this.pathList.toArray());
89-
ArrayreporterArray =oraConn.createARRAY(CustomTypes.UT_REPORTERS,this.reporterList.toArray());
90-
ArraycoverageSchemesArray =oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST,this.coverageSchemes.toArray());
91-
ArraysourceFilesArray =oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST,this.sourceFiles.toArray());
92-
ArraytestFilesArray =oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST,this.testFiles.toArray());
93-
ArrayincludeObjectsArray =oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST,this.includeObjects.toArray());
94-
ArrayexcludeObjectsArray =oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST,this.excludeObjects.toArray());
95-
9687
// Workaround because Oracle JDBC doesn't support passing boolean to stored procedures.
9788
StringcolorConsoleStr =Boolean.toString(this.colorConsole);
9889

90+
OracleConnectionoraConn =conn.unwrap(OracleConnection.class);
9991
CallableStatementcallableStatement =null;
10092
try {
10193
callableStatement =conn.prepareCall(
10294
"BEGIN " +
103-
"ut_runner.run(" +
95+
"ut_runner.run(" +
10496
"a_paths => ?, a_reporters => ?, a_color_console => " +colorConsoleStr +", " +
10597
"a_coverage_schemes => ?, a_source_files => ?, a_test_files => ?, " +
10698
"a_include_objects => ?, a_exclude_objects => ?); " +
107-
"END;");
108-
callableStatement.setArray(1,pathArray);
109-
callableStatement.setArray(2,reporterArray);
110-
callableStatement.setArray(3,coverageSchemesArray);
111-
callableStatement.setArray(4,sourceFilesArray);
112-
callableStatement.setArray(5,testFilesArray);
113-
callableStatement.setArray(6,includeObjectsArray);
114-
callableStatement.setArray(7,excludeObjectsArray);
99+
"END;");
100+
101+
intparamIdx =0;
102+
103+
callableStatement.setArray(
104+
++paramIdx,oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST,this.pathList.toArray()));
105+
106+
callableStatement.setArray(
107+
++paramIdx,oraConn.createARRAY(CustomTypes.UT_REPORTERS,this.reporterList.toArray()));
108+
109+
if (this.coverageSchemes.isEmpty()) {
110+
callableStatement.setNull(++paramIdx,Types.ARRAY,CustomTypes.UT_VARCHAR2_LIST);
111+
}else {
112+
callableStatement.setArray(
113+
++paramIdx,oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST,this.coverageSchemes.toArray()));
114+
}
115+
116+
if (this.sourceFiles.isEmpty()) {
117+
callableStatement.setNull(++paramIdx,Types.ARRAY,CustomTypes.UT_VARCHAR2_LIST);
118+
}else {
119+
callableStatement.setArray(
120+
++paramIdx,oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST,this.sourceFiles.toArray()));
121+
}
122+
123+
if (this.testFiles.isEmpty()) {
124+
callableStatement.setNull(++paramIdx,Types.ARRAY,CustomTypes.UT_VARCHAR2_LIST);
125+
}else {
126+
callableStatement.setArray(
127+
++paramIdx,oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST,this.testFiles.toArray()));
128+
}
129+
130+
if (this.includeObjects.isEmpty()) {
131+
callableStatement.setNull(++paramIdx,Types.ARRAY,CustomTypes.UT_VARCHAR2_LIST);
132+
}else {
133+
callableStatement.setArray(
134+
++paramIdx,oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST,this.includeObjects.toArray()));
135+
}
136+
137+
if (this.excludeObjects.isEmpty()) {
138+
callableStatement.setNull(++paramIdx,Types.ARRAY,CustomTypes.UT_VARCHAR2_LIST);
139+
}else {
140+
callableStatement.setArray(
141+
++paramIdx,oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST,this.excludeObjects.toArray()));
142+
}
143+
115144
callableStatement.execute();
116145
}finally {
117146
if (callableStatement !=null)

‎src/main/java/io/github/utplsql/api/reporter/CoverageHTMLReporter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@
88

99
publicclassCoverageHTMLReporterextendsReporter {
1010

11+
// Could override Reporter.init and call ut_coverage_report_html_helper.get_default_html_assets_path from database,
12+
// but had permissions issues.
13+
publicstaticfinalStringDEFAULT_ASSETS_PATH ="https://utplsql.github.io/utPLSQL-coverage-html/assets/";
14+
1115
privateStringprojectName;
1216
privateStringassetsPath;
1317

1418
publicCoverageHTMLReporter() {
15-
19+
this(null,DEFAULT_ASSETS_PATH);
1620
}
1721

1822
publicCoverageHTMLReporter(StringprojectName,StringassetsPath) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp