|
5 | 5 | import io.github.utplsql.api.reporter.Reporter;
|
6 | 6 | import oracle.jdbc.OracleConnection;
|
7 | 7 |
|
8 |
| -import java.sql.*; |
| 8 | +import java.sql.CallableStatement; |
| 9 | +import java.sql.Connection; |
| 10 | +import java.sql.SQLException; |
| 11 | +import java.sql.Types; |
9 | 12 | import java.util.ArrayList;
|
10 | 13 | import java.util.List;
|
11 | 14 |
|
@@ -108,12 +111,12 @@ public void run(Connection conn) throws SomeTestsFailedException, SQLException {
|
108 | 111 | String failOnErrors = Boolean.toString(this.failOnErrors);
|
109 | 112 |
|
110 | 113 | String sourceFilesParam = "a_source_files";
|
111 |
| - if (this.sourceMappingOptions != null && !this.sourceFiles.isEmpty()) |
112 |
| - sourceFilesParam = "a_source_file_mappings"; |
113 |
| - |
114 | 114 | String testFilesParam = "a_test_files";
|
115 |
| - if (this.testMappingOptions != null && !this.testFiles.isEmpty()) |
116 |
| - sourceFilesParam = "a_test_file_mappings"; |
| 115 | + |
| 116 | + if (this.sourceMappingOptions != null || this.testMappingOptions != null) { |
| 117 | + sourceFilesParam = "a_source_file_mappings"; |
| 118 | + testFilesParam = "a_test_file_mappings"; |
| 119 | + } |
117 | 120 |
|
118 | 121 | OracleConnection oraConn = conn.unwrap(OracleConnection.class);
|
119 | 122 | CallableStatement callableStatement = null;
|
@@ -147,30 +150,40 @@ public void run(Connection conn) throws SomeTestsFailedException, SQLException {
|
147 | 150 | ++paramIdx, oraConn.createOracleArray(CustomTypes.UT_VARCHAR2_LIST, this.coverageSchemes.toArray()));
|
148 | 151 | }
|
149 | 152 |
|
150 |
| - if (this.sourceFiles.isEmpty()) { |
151 |
| - callableStatement.setNull(++paramIdx, Types.ARRAY, CustomTypes.UT_VARCHAR2_LIST); |
152 |
| - } else if (this.sourceMappingOptions != null) { |
153 |
| - Array sourceMappings = FileMapper.buildFileMappingArray( |
154 |
| - conn, this.sourceFiles, this.sourceMappingOptions); |
155 |
| - |
156 |
| - callableStatement.setArray( |
157 |
| - ++paramIdx, oraConn.createOracleArray(CustomTypes.UT_FILE_MAPPINGS, sourceMappings)); |
158 |
| - } else { |
159 |
| - callableStatement.setArray( |
160 |
| - ++paramIdx, oraConn.createOracleArray(CustomTypes.UT_VARCHAR2_LIST, this.sourceFiles.toArray())); |
161 |
| - } |
162 |
| - |
163 |
| - if (this.testFiles.isEmpty()) { |
164 |
| - callableStatement.setNull(++paramIdx, Types.ARRAY, CustomTypes.UT_VARCHAR2_LIST); |
165 |
| - } else if (this.testMappingOptions != null) { |
166 |
| - Array sourceMappings = FileMapper.buildFileMappingArray( |
167 |
| - conn, this.testFiles, this.testMappingOptions); |
168 |
| - |
169 |
| - callableStatement.setArray( |
170 |
| - ++paramIdx, oraConn.createOracleArray(CustomTypes.UT_FILE_MAPPINGS, sourceMappings)); |
| 153 | + if (this.sourceMappingOptions != null || this.testMappingOptions != null) { |
| 154 | + if (this.sourceMappingOptions != null) { |
| 155 | + List<FileMapping> sourceMappings = FileMapper.buildFileMappingList( |
| 156 | + conn, this.sourceFiles, this.sourceMappingOptions); |
| 157 | + |
| 158 | + callableStatement.setArray( |
| 159 | + ++paramIdx, oraConn.createOracleArray(CustomTypes.UT_FILE_MAPPINGS, sourceMappings.toArray())); |
| 160 | + } else { |
| 161 | + callableStatement.setNull(++paramIdx, Types.ARRAY, CustomTypes.UT_FILE_MAPPINGS); |
| 162 | + } |
| 163 | + |
| 164 | + if (this.testMappingOptions != null) { |
| 165 | + List<FileMapping> sourceMappings = FileMapper.buildFileMappingList( |
| 166 | + conn, this.testFiles, this.testMappingOptions); |
| 167 | + |
| 168 | + callableStatement.setArray( |
| 169 | + ++paramIdx, oraConn.createOracleArray(CustomTypes.UT_FILE_MAPPINGS, sourceMappings.toArray())); |
| 170 | + } else { |
| 171 | + callableStatement.setNull(++paramIdx, Types.ARRAY, CustomTypes.UT_FILE_MAPPINGS); |
| 172 | + } |
171 | 173 | } else {
|
172 |
| - callableStatement.setArray( |
173 |
| - ++paramIdx, oraConn.createOracleArray(CustomTypes.UT_VARCHAR2_LIST, this.testFiles.toArray())); |
| 174 | + if (this.sourceFiles.isEmpty()) { |
| 175 | + callableStatement.setNull(++paramIdx, Types.ARRAY, CustomTypes.UT_VARCHAR2_LIST); |
| 176 | + } else { |
| 177 | + callableStatement.setArray( |
| 178 | + ++paramIdx, oraConn.createOracleArray(CustomTypes.UT_VARCHAR2_LIST, this.sourceFiles.toArray())); |
| 179 | + } |
| 180 | + |
| 181 | + if (this.testFiles.isEmpty()) { |
| 182 | + callableStatement.setNull(++paramIdx, Types.ARRAY, CustomTypes.UT_VARCHAR2_LIST); |
| 183 | + } else { |
| 184 | + callableStatement.setArray( |
| 185 | + ++paramIdx, oraConn.createOracleArray(CustomTypes.UT_VARCHAR2_LIST, this.testFiles.toArray())); |
| 186 | + } |
174 | 187 | }
|
175 | 188 |
|
176 | 189 | if (this.includeObjects.isEmpty()) {
|
|
0 commit comments