Skip to content

Commit bb2c851

Browse files
committed
Changes on FileMapper API
1 parent 80ee1f0 commit bb2c851

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

src/main/java/io/github/utplsql/cli/RunCommand.java

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,29 +85,23 @@ public int run() throws Exception {
8585
final List<Reporter> reporterList = new ArrayList<>();
8686

8787
final File baseDir = new File("").getAbsoluteFile();
88-
List<String> sourceFilesTmp = null;
89-
List<String> testFilesTmp = null;
90-
FileMapperOptions sourceMappingOptionsTmp= null;
91-
FileMapperOptions testMappingOptionsTmp = null;
88+
final FileMapperOptions[] sourceMappingOptions = {null};
89+
final FileMapperOptions[] testMappingOptions = {null};
90+
91+
final int[] returnCode = {0};
9292

9393
if (!this.sourcePathParams.isEmpty()) {
9494
String sourcePath = this.sourcePathParams.get(0);
95-
sourceFilesTmp = new FileWalker().getFileList(baseDir, sourcePath);
96-
sourceMappingOptionsTmp = getMapperOptions(this.sourcePathParams);
95+
List<String> sourceFiles = new FileWalker().getFileList(baseDir, sourcePath);
96+
sourceMappingOptions[0] = getMapperOptions(this.sourcePathParams, sourceFiles);
9797
}
9898

9999
if (!this.testPathParams.isEmpty()) {
100100
String testPath = this.testPathParams.get(0);
101-
testFilesTmp = new FileWalker().getFileList(baseDir, testPath);
102-
testMappingOptionsTmp = getMapperOptions(this.testPathParams);
101+
List<String> testFiles = new FileWalker().getFileList(baseDir, testPath);
102+
testMappingOptions[0] = getMapperOptions(this.testPathParams, testFiles);
103103
}
104104

105-
final List<String> sourceFiles = sourceFilesTmp;
106-
final List<String> testFiles = testFilesTmp;
107-
final FileMapperOptions sourceMappingOptions = sourceMappingOptionsTmp;
108-
final FileMapperOptions testMappingOptions = testMappingOptionsTmp;
109-
final int[] returnCode = {0};
110-
111105
if (testPaths.isEmpty()) testPaths.add(ci.getUser());
112106

113107
// Do the reporters initialization, so we can use the id to run and gather results.
@@ -131,10 +125,8 @@ public int run() throws Exception {
131125
new TestRunner()
132126
.addPathList(testPaths)
133127
.addReporterList(reporterList)
134-
.withSourceFiles(sourceFiles)
135-
.sourceMappingOptions(sourceMappingOptions)
136-
.withTestFiles(testFiles)
137-
.testMappingOptions(testMappingOptions)
128+
.sourceMappingOptions(sourceMappingOptions[0])
129+
.testMappingOptions(testMappingOptions[0])
138130
.colorConsole(this.colorConsole)
139131
.failOnErrors(true)
140132
.run(conn);
@@ -205,8 +197,8 @@ public List<ReporterOptions> getReporterOptionsList() {
205197
return reporterOptionsList;
206198
}
207199

208-
public FileMapperOptions getMapperOptions(List<String> mappingParams) {
209-
FileMapperOptions mapperOptions = new FileMapperOptions();
200+
public FileMapperOptions getMapperOptions(List<String> mappingParams, List<String> filePaths) {
201+
FileMapperOptions mapperOptions = new FileMapperOptions(filePaths);
210202

211203
for (String p : mappingParams) {
212204
if (p.startsWith("-object_owner=")) {

0 commit comments

Comments
 (0)