|
22 | 22 | import org.utplsql.api.reporter.CoreReporters; |
23 | 23 | import org.utplsql.api.reporter.Reporter; |
24 | 24 | import org.utplsql.api.reporter.ReporterFactory; |
| 25 | +import org.utplsql.maven.plugin.io.ReportWriter; |
| 26 | +import org.utplsql.maven.plugin.io.SqlFileScanner; |
25 | 27 | import org.utplsql.maven.plugin.model.CustomTypeMapping; |
26 | 28 | import org.utplsql.maven.plugin.model.ReporterParameter; |
27 | | -import org.utplsql.maven.plugin.io.SqlFileScanner; |
28 | | -import org.utplsql.maven.plugin.io.ReportWriter; |
29 | 29 |
|
30 | 30 | import java.io.File; |
31 | 31 | import java.sql.Connection; |
|
44 | 44 | * @author Simon Martinelli |
45 | 45 | */ |
46 | 46 | @Mojo(name = "test", defaultPhase = LifecyclePhase.TEST) |
47 | | -public class UtPLSQLMojo extends AbstractMojo { |
| 47 | +public class UtPlsqlMojo extends AbstractMojo { |
48 | 48 |
|
49 | 49 | @Parameter(readonly = true, defaultValue = "${project}") |
50 | 50 | MavenProject project; |
@@ -212,46 +212,36 @@ private void setDbConfiguration() { |
212 | 212 | } |
213 | 213 | } |
214 | 214 |
|
215 | | - FileMapperOptions buildSourcesOptions() throws MojoExecutionException { |
216 | | - try { |
217 | | - if (sources.isEmpty()) { |
218 | | - File defaultSourceDirectory = new File(project.getBasedir(), Defaults.SOURCE_DIRECTORY); |
219 | | - if (defaultSourceDirectory.exists()) { |
220 | | - sources.add(Defaults.buildDefaultSource()); |
221 | | - } else { |
222 | | - return new FileMapperOptions(new ArrayList<>()); |
223 | | - } |
| 215 | + FileMapperOptions buildSourcesOptions() { |
| 216 | + if (sources.isEmpty()) { |
| 217 | + File defaultSourceDirectory = new File(project.getBasedir(), Defaults.SOURCE_DIRECTORY); |
| 218 | + if (defaultSourceDirectory.exists()) { |
| 219 | + sources.add(Defaults.buildDefaultSource()); |
| 220 | + } else { |
| 221 | + return new FileMapperOptions(new ArrayList<>()); |
224 | 222 | } |
225 | | - |
226 | | - List<String> scripts = sqlFileScanner.findSqlScripts(project.getBasedir(), sources, |
227 | | - Defaults.SOURCE_DIRECTORY, Defaults.SOURCE_FILE_PATTERN); |
228 | | - return createFileMapperOptions(scripts, sourcesOwner, sourcesRegexExpression, sourcesOwnerSubexpression, |
229 | | - sourcesNameSubexpression, sourcesTypeSubexpression, sourcesCustomTypeMapping); |
230 | | - |
231 | | - } catch (Exception e) { |
232 | | - throw new MojoExecutionException("Invalid <SOURCES> in your pom.xml", e); |
233 | 223 | } |
| 224 | + |
| 225 | + List<String> scripts = sqlFileScanner.findSqlScripts(project.getBasedir(), sources, |
| 226 | + Defaults.SOURCE_DIRECTORY, Defaults.SOURCE_FILE_PATTERN); |
| 227 | + return createFileMapperOptions(scripts, sourcesOwner, sourcesRegexExpression, sourcesOwnerSubexpression, |
| 228 | + sourcesNameSubexpression, sourcesTypeSubexpression, sourcesCustomTypeMapping); |
234 | 229 | } |
235 | 230 |
|
236 | 231 | FileMapperOptions buildTestsOptions() throws MojoExecutionException { |
237 | | - try { |
238 | | - if (tests.isEmpty()) { |
239 | | - File defaultTestDirectory = new File(project.getBasedir(), Defaults.TEST_DIRECTORY); |
240 | | - if (defaultTestDirectory.exists()) { |
241 | | - tests.add(Defaults.buildDefaultTest()); |
242 | | - } else { |
243 | | - return new FileMapperOptions(new ArrayList<>()); |
244 | | - } |
| 232 | + if (tests.isEmpty()) { |
| 233 | + File defaultTestDirectory = new File(project.getBasedir(), Defaults.TEST_DIRECTORY); |
| 234 | + if (defaultTestDirectory.exists()) { |
| 235 | + tests.add(Defaults.buildDefaultTest()); |
| 236 | + } else { |
| 237 | + return new FileMapperOptions(new ArrayList<>()); |
245 | 238 | } |
246 | | - |
247 | | - List<String> scripts = sqlFileScanner.findSqlScripts(project.getBasedir(), tests, Defaults.TEST_DIRECTORY, |
248 | | - Defaults.TEST_FILE_PATTERN); |
249 | | - return createFileMapperOptions(scripts, testsOwner, testsRegexExpression, testsOwnerSubexpression, |
250 | | - testsNameSubexpression, testsTypeSubexpression, testsCustomTypeMapping); |
251 | | - |
252 | | - } catch (Exception e) { |
253 | | - throw new MojoExecutionException("Invalid <TESTS> in your pom.xml: " + e.getMessage()); |
254 | 239 | } |
| 240 | + |
| 241 | + List<String> scripts = sqlFileScanner.findSqlScripts(project.getBasedir(), tests, Defaults.TEST_DIRECTORY, |
| 242 | + Defaults.TEST_FILE_PATTERN); |
| 243 | + return createFileMapperOptions(scripts, testsOwner, testsRegexExpression, testsOwnerSubexpression, |
| 244 | + testsNameSubexpression, testsTypeSubexpression, testsCustomTypeMapping); |
255 | 245 | } |
256 | 246 |
|
257 | 247 | private FileMapperOptions createFileMapperOptions(List<String> scripts, String objectOwner, String regexPattern, |
|
0 commit comments