@@ -233,7 +233,37 @@ private FileMapperOptions buildSourcesOptions() throws MojoExecutionException {
233
233
234
234
List <String > scripts = SQLScannerHelper .findSQLs (project .getBasedir (), sources ,
235
235
PluginDefault .SOURCE_DIRECTORY , PluginDefault .SOURCE_FILE_PATTERN );
236
- return createFileMapperOptions (scripts );
236
+ FileMapperOptions fileMapperOptions = new FileMapperOptions (scripts );
237
+
238
+ if (StringUtils .isNotEmpty (sourcesOwner )) {
239
+ fileMapperOptions .setObjectOwner (sourcesOwner );
240
+ }
241
+
242
+ if (StringUtils .isNotEmpty (sourcesRegexExpression )) {
243
+ fileMapperOptions .setRegexPattern (sourcesRegexExpression );
244
+ }
245
+
246
+ if (sourcesOwnerSubexpression != null ) {
247
+ fileMapperOptions .setOwnerSubExpression (sourcesOwnerSubexpression );
248
+ }
249
+
250
+ if (sourcesNameSubexpression != null ) {
251
+ fileMapperOptions .setNameSubExpression (sourcesNameSubexpression );
252
+ }
253
+
254
+ if (sourcesTypeSubexpression != null ) {
255
+ fileMapperOptions .setTypeSubExpression (sourcesTypeSubexpression );
256
+ }
257
+
258
+ if (sourcesCustomTypeMapping != null && !sourcesCustomTypeMapping .isEmpty ()) {
259
+ fileMapperOptions .setTypeMappings (new ArrayList <>());
260
+ for (CustomTypeMapping typeMapping : sourcesCustomTypeMapping ) {
261
+ fileMapperOptions .getTypeMappings ()
262
+ .add (new KeyValuePair (typeMapping .getCustomMapping (), typeMapping .getType ()));
263
+ }
264
+ }
265
+
266
+ return fileMapperOptions ;
237
267
238
268
} catch (Exception e ) {
239
269
throw new MojoExecutionException ("Invalid <SOURCES> in your pom.xml" , e );
@@ -254,46 +284,42 @@ private FileMapperOptions buildTestsOptions() throws MojoExecutionException {
254
284
255
285
List <String > scripts = SQLScannerHelper .findSQLs (project .getBasedir (), tests , PluginDefault .TEST_DIRECTORY ,
256
286
PluginDefault .TEST_FILE_PATTERN );
257
- return createFileMapperOptions (scripts );
258
-
259
- } catch (Exception e ) {
260
- throw new MojoExecutionException ("Invalid <TESTS> in your pom.xml: " + e .getMessage ());
261
- }
287
+ FileMapperOptions fileMapperOptions = new FileMapperOptions (scripts );
262
288
263
- }
289
+ if (StringUtils .isNotEmpty (testsOwner )) {
290
+ fileMapperOptions .setObjectOwner (testsOwner );
291
+ }
264
292
265
- private FileMapperOptions createFileMapperOptions (List <String > scripts ) {
266
- FileMapperOptions fileMapperOptions = new FileMapperOptions (scripts );
293
+ if (StringUtils .isNotEmpty (testsRegexExpression )) {
294
+ fileMapperOptions .setRegexPattern (testsRegexExpression );
295
+ }
267
296
268
- if (StringUtils . isNotEmpty ( sourcesOwner ) ) {
269
- fileMapperOptions .setObjectOwner ( sourcesOwner );
270
- }
297
+ if (testsOwnerSubexpression != null ) {
298
+ fileMapperOptions .setOwnerSubExpression ( testsOwnerSubexpression );
299
+ }
271
300
272
- if (StringUtils . isNotEmpty ( sourcesRegexExpression ) ) {
273
- fileMapperOptions .setRegexPattern ( sourcesRegexExpression );
274
- }
301
+ if (testsNameSubexpression != null ) {
302
+ fileMapperOptions .setNameSubExpression ( testsNameSubexpression );
303
+ }
275
304
276
- if (sourcesOwnerSubexpression != null ) {
277
- fileMapperOptions .setOwnerSubExpression ( sourcesOwnerSubexpression );
278
- }
305
+ if (testsTypeSubexpression != null ) {
306
+ fileMapperOptions .setTypeSubExpression ( testsTypeSubexpression );
307
+ }
279
308
280
- if (sourcesNameSubexpression != null ) {
281
- fileMapperOptions .setNameSubExpression (sourcesNameSubexpression );
282
- }
309
+ if (testsCustomTypeMapping != null && !testsCustomTypeMapping .isEmpty ()) {
310
+ fileMapperOptions .setTypeMappings (new ArrayList <>());
311
+ for (CustomTypeMapping typeMapping : testsCustomTypeMapping ) {
312
+ fileMapperOptions .getTypeMappings ()
313
+ .add (new KeyValuePair (typeMapping .getCustomMapping (), typeMapping .getType ()));
314
+ }
315
+ }
283
316
284
- if (sourcesTypeSubexpression != null ) {
285
- fileMapperOptions .setTypeSubExpression (sourcesTypeSubexpression );
286
- }
317
+ return fileMapperOptions ;
287
318
288
- if (sourcesCustomTypeMapping != null && !sourcesCustomTypeMapping .isEmpty ()) {
289
- fileMapperOptions .setTypeMappings (new ArrayList <>());
290
- for (CustomTypeMapping typeMapping : sourcesCustomTypeMapping ) {
291
- fileMapperOptions .getTypeMappings ()
292
- .add (new KeyValuePair (typeMapping .getCustomMapping (), typeMapping .getType ()));
293
- }
319
+ } catch (Exception e ) {
320
+ throw new MojoExecutionException ("Invalid <TESTS> in your pom.xml: " + e .getMessage ());
294
321
}
295
322
296
- return fileMapperOptions ;
297
323
}
298
324
299
325
private List <Reporter > initReporters (Connection connection , Version utlVersion , ReporterFactory reporterFactory )
0 commit comments