@@ -22,6 +22,8 @@ public class TestRunner {
22
22
private List <String > testFiles = new ArrayList <>();
23
23
private List <String > includeObjects = new ArrayList <>();
24
24
private List <String > excludeObjects = new ArrayList <>();
25
+ private FileMapperOptions sourceMappingOptions ;
26
+ private FileMapperOptions testMappingOptions ;
25
27
private boolean failOnErrors = false ;
26
28
27
29
public TestRunner addPath (String path ) {
@@ -74,6 +76,16 @@ public TestRunner excludeObject(String obj) {
74
76
return this ;
75
77
}
76
78
79
+ public TestRunner sourceMappingOptions (FileMapperOptions mapperOptions ) {
80
+ this .sourceMappingOptions = mapperOptions ;
81
+ return this ;
82
+ }
83
+
84
+ public TestRunner testMappingOptions (FileMapperOptions mapperOptions ) {
85
+ this .testMappingOptions = mapperOptions ;
86
+ return this ;
87
+ }
88
+
77
89
public TestRunner failOnErrors (boolean failOnErrors ) {
78
90
this .failOnErrors = failOnErrors ;
79
91
return this ;
@@ -95,21 +107,29 @@ public void run(Connection conn) throws SomeTestsFailedException, SQLException {
95
107
String colorConsoleStr = Boolean .toString (this .colorConsole );
96
108
String failOnErrors = Boolean .toString (this .failOnErrors );
97
109
110
+ String sourceFilesParam = "a_source_files" ;
111
+ if (this .sourceMappingOptions != null && !this .sourceFiles .isEmpty ())
112
+ sourceFilesParam = "a_source_file_mappings" ;
113
+
114
+ String testFilesParam = "a_test_files" ;
115
+ if (this .testMappingOptions != null && !this .testFiles .isEmpty ())
116
+ sourceFilesParam = "a_test_file_mappings" ;
117
+
98
118
OracleConnection oraConn = conn .unwrap (OracleConnection .class );
99
119
CallableStatement callableStatement = null ;
100
120
try {
101
121
callableStatement = conn .prepareCall (
102
122
"BEGIN " +
103
123
"ut_runner.run(" +
104
- "a_paths => ?, " +
105
- "a_reporters => ?, " +
106
- "a_color_console => " + colorConsoleStr + ", " +
107
- "a_coverage_schemes => ?, " +
108
- "a_source_files => ?, " +
109
- "a_test_files => ?, " +
110
- "a_include_objects => ?, " +
111
- "a_exclude_objects => ?, " +
112
- "a_fail_on_errors => " + failOnErrors + "); " +
124
+ "a_paths => ?, " +
125
+ "a_reporters => ?, " +
126
+ "a_color_console => " + colorConsoleStr + ", " +
127
+ "a_coverage_schemes => ?, " +
128
+ sourceFilesParam + " => ?, " +
129
+ testFilesParam + " => ?, " +
130
+ "a_include_objects => ?, " +
131
+ "a_exclude_objects => ?, " +
132
+ "a_fail_on_errors => " + failOnErrors + "); " +
113
133
"END;" );
114
134
115
135
int paramIdx = 0 ;
@@ -129,13 +149,25 @@ public void run(Connection conn) throws SomeTestsFailedException, SQLException {
129
149
130
150
if (this .sourceFiles .isEmpty ()) {
131
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 ));
132
158
} else {
133
159
callableStatement .setArray (
134
160
++paramIdx , oraConn .createOracleArray (CustomTypes .UT_VARCHAR2_LIST , this .sourceFiles .toArray ()));
135
161
}
136
162
137
163
if (this .testFiles .isEmpty ()) {
138
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 ));
139
171
} else {
140
172
callableStatement .setArray (
141
173
++paramIdx , oraConn .createOracleArray (CustomTypes .UT_VARCHAR2_LIST , this .testFiles .toArray ()));
0 commit comments