@@ -22,6 +22,8 @@ public class TestRunner {
2222 private List <String > testFiles = new ArrayList <>();
2323 private List <String > includeObjects = new ArrayList <>();
2424 private List <String > excludeObjects = new ArrayList <>();
25+ private FileMapperOptions sourceMappingOptions ;
26+ private FileMapperOptions testMappingOptions ;
2527 private boolean failOnErrors = false ;
2628
2729 public TestRunner addPath (String path ) {
@@ -74,6 +76,16 @@ public TestRunner excludeObject(String obj) {
7476 return this ;
7577 }
7678
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+
7789 public TestRunner failOnErrors (boolean failOnErrors ) {
7890 this .failOnErrors = failOnErrors ;
7991 return this ;
@@ -95,21 +107,29 @@ public void run(Connection conn) throws SomeTestsFailedException, SQLException {
95107 String colorConsoleStr = Boolean .toString (this .colorConsole );
96108 String failOnErrors = Boolean .toString (this .failOnErrors );
97109
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+
98118 OracleConnection oraConn = conn .unwrap (OracleConnection .class );
99119 CallableStatement callableStatement = null ;
100120 try {
101121 callableStatement = conn .prepareCall (
102122 "BEGIN " +
103123 "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 + "); " +
113133 "END;" );
114134
115135 int paramIdx = 0 ;
@@ -129,13 +149,25 @@ public void run(Connection conn) throws SomeTestsFailedException, SQLException {
129149
130150 if (this .sourceFiles .isEmpty ()) {
131151 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 ));
132158 } else {
133159 callableStatement .setArray (
134160 ++paramIdx , oraConn .createOracleArray (CustomTypes .UT_VARCHAR2_LIST , this .sourceFiles .toArray ()));
135161 }
136162
137163 if (this .testFiles .isEmpty ()) {
138164 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 ));
139171 } else {
140172 callableStatement .setArray (
141173 ++paramIdx , oraConn .createOracleArray (CustomTypes .UT_VARCHAR2_LIST , this .testFiles .toArray ()));
0 commit comments