Skip to content

Commit 3cb6bee

Browse files
committed
Adding handling of <paths>
1 parent e612ad2 commit 3cb6bee

2 files changed

Lines changed: 21 additions & 30 deletions

File tree

‎utplsql-maven-plugin/src/main/java/org/utplsql/UtPLSQLMojo.java‎

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,38 @@
1818
import org.utplsql.api.TestRunner;
1919
import org.utplsql.api.reporter.Reporter;
2020
import org.utplsql.api.reporter.ReporterFactory;
21-
import org.utplsql.helper.PluginDefault;
2221
import org.utplsql.helper.SQLScannerHelper;
2322

2423
@Mojo(name = "test", defaultPhase = LifecyclePhase.TEST)
2524
public class UtPLSQLMojo extends AbstractMojo
2625
{
27-
28-
@Parameter(required = true)
26+
@Parameter(defaultValue = "jdbc:oracle:thin:@localhost:1521:ut3")
2927
private String url;
3028

31-
@Parameter(required = true)
29+
@Parameter(defaultValue = "ut3")
3230
private String user;
3331

34-
@Parameter(required = true)
32+
@Parameter(defaultValue = "XNtxj8eEgA6X6b6f")
3533
private String password;
3634

37-
@Parameter
35+
// This parameter should honor the -Dmaven.test.failure.ignore=false
36+
@Parameter(defaultValue = "false")
3837
private boolean failOnErrors;
3938

40-
@Parameter
39+
@Parameter(defaultValue = "false")
4140
private boolean colorConsole;
4241

43-
@Parameter
42+
@Parameter(defaultValue = "UT_DOCUMENTATION_REPORTER")
4443
private List<String> reporters;
4544

46-
// Configuration of Sources, Testing
45+
@Parameter
46+
private List<String> paths;
4747

48-
@Parameter
48+
@Parameter
4949
private List<Resource> sources = new ArrayList<>();
5050

51-
@Parameter
52-
private List<Resource> tests = new ArrayList<>();
53-
5451
@Parameter
55-
private List<String> reports = new ArrayList<>();
52+
private List<Resource> tests = new ArrayList<>();
5653

5754
/**
5855
*
@@ -64,9 +61,9 @@ public void execute() throws MojoExecutionException
6461
{
6562
// List<String> testPaths = Arrays.asList(new String[] { "tests" });
6663

67-
FileMapperOptions sourceMappingOptions = buildOptions(sources,
68-
PluginDefault.buildDefaultSource());
69-
FileMapperOptions testMappingOptions = buildOptions(tests, PluginDefault.buildDefaultTest());
64+
FileMapperOptions sourceMappingOptions = new FileMapperOptions(new ArrayList<>());
65+
FileMapperOptions testMappingOptions = new FileMapperOptions(new ArrayList<>()); // buildOptions(tests,
66+
// PluginDefault.buildDefaultTest());
7067

7168
Connection connection = null;
7269
List<Reporter> reporterList = null;
@@ -113,7 +110,7 @@ public void accept(String t) {
113110
}
114111

115112
TestRunner runner = new TestRunner()
116-
// .addPathList(testPaths)
113+
.addPathList(paths)
117114
.addReporterList(reporterList)
118115
.sourceMappingOptions(sourceMappingOptions)
119116
.testMappingOptions(testMappingOptions)
@@ -133,7 +130,7 @@ public void accept(String t) {
133130
try
134131
{
135132
for (Reporter reporter : reporterList) {
136-
new OutputBuffer(reporter).printAvailable(connection, reporter.outputFile());
133+
new OutputBuffer(reporter).printAvailable(connection, System.out);
137134
}
138135
if (connection != null) {
139136
connection.close();
@@ -160,7 +157,7 @@ private FileMapperOptions buildOptions(List<Resource> resources, Resource defaul
160157
}
161158

162159
List<String> scripts = SQLScannerHelper.findSQLs(resources);
163-
return new FileMapperOptions(scripts);
160+
return new FileMapperOptions(scripts);
164161
}
165162

166163
/**

‎utplsql-maven-plugin/src/main/java/org/utplsql/helper/PluginDefault.java‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,17 @@ public class PluginDefault
1818
// Test Directory
1919
private static final String TEST_DIRECTORY = "src/test/plsql";
2020

21-
// Default Extension for Package HEAD
22-
private static final String PACKAGE_HEAD = "**/*.pkg";
23-
24-
// Default Extension for Package HEAD
25-
private static final String PACKAGE_BODY = "**/*.pkb";
26-
2721
/**
2822
*
2923
* @return
3024
*/
31-
private static Resource buildDirectory(String directory)
25+
private static Resource buildDirectory(String directory, String includes)
3226
{
3327
Resource resource = new Resource();
3428

3529
// Configure Resources
3630
resource.setDirectory(directory);
37-
resource.setIncludes(Arrays.asList(PACKAGE_BODY, PACKAGE_HEAD));
31+
resource.setIncludes(Arrays.asList(includes));
3832

3933
return resource;
4034
}
@@ -45,7 +39,7 @@ private static Resource buildDirectory(String directory)
4539
*/
4640
public static Resource buildDefaultSource()
4741
{
48-
return buildDirectory(SOURCE_DIRECTORY);
42+
return buildDirectory(SOURCE_DIRECTORY, "**/*.*");
4943
}
5044

5145
/**
@@ -54,7 +48,7 @@ public static Resource buildDefaultSource()
5448
*/
5549
public static Resource buildDefaultTest()
5650
{
57-
return buildDirectory(TEST_DIRECTORY);
51+
return buildDirectory(TEST_DIRECTORY, "**/*.pkg");
5852
}
5953

6054
}

0 commit comments

Comments
 (0)