Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Changes on FileMapper API
  • Loading branch information
viniciusam committed Jul 23, 2017
commit bb2c8515f2467ec3baa6fe1577af990804e96c22
32 changes: 12 additions & 20 deletions src/main/java/io/github/utplsql/cli/RunCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,23 @@ public int run() throws Exception {
final List<Reporter> reporterList = new ArrayList<>();

final File baseDir = new File("").getAbsoluteFile();
List<String> sourceFilesTmp = null;
List<String> testFilesTmp = null;
FileMapperOptions sourceMappingOptionsTmp= null;
FileMapperOptions testMappingOptionsTmp = null;
final FileMapperOptions[] sourceMappingOptions = {null};
final FileMapperOptions[] testMappingOptions = {null};

final int[] returnCode = {0};

if (!this.sourcePathParams.isEmpty()) {
String sourcePath = this.sourcePathParams.get(0);
sourceFilesTmp = new FileWalker().getFileList(baseDir, sourcePath);
sourceMappingOptionsTmp = getMapperOptions(this.sourcePathParams);
List<String> sourceFiles = new FileWalker().getFileList(baseDir, sourcePath);
sourceMappingOptions[0] = getMapperOptions(this.sourcePathParams, sourceFiles);
}

if (!this.testPathParams.isEmpty()) {
String testPath = this.testPathParams.get(0);
testFilesTmp = new FileWalker().getFileList(baseDir, testPath);
testMappingOptionsTmp = getMapperOptions(this.testPathParams);
List<String> testFiles = new FileWalker().getFileList(baseDir, testPath);
testMappingOptions[0] = getMapperOptions(this.testPathParams, testFiles);
}

final List<String> sourceFiles = sourceFilesTmp;
final List<String> testFiles = testFilesTmp;
final FileMapperOptions sourceMappingOptions = sourceMappingOptionsTmp;
final FileMapperOptions testMappingOptions = testMappingOptionsTmp;
final int[] returnCode = {0};

if (testPaths.isEmpty()) testPaths.add(ci.getUser());

// Do the reporters initialization, so we can use the id to run and gather results.
Expand All @@ -131,10 +125,8 @@ public int run() throws Exception {
new TestRunner()
.addPathList(testPaths)
.addReporterList(reporterList)
.withSourceFiles(sourceFiles)
.sourceMappingOptions(sourceMappingOptions)
.withTestFiles(testFiles)
.testMappingOptions(testMappingOptions)
.sourceMappingOptions(sourceMappingOptions[0])
.testMappingOptions(testMappingOptions[0])
.colorConsole(this.colorConsole)
.failOnErrors(true)
.run(conn);
Expand Down Expand Up @@ -205,8 +197,8 @@ public List<ReporterOptions> getReporterOptionsList() {
return reporterOptionsList;
}

public FileMapperOptions getMapperOptions(List<String> mappingParams) {
FileMapperOptions mapperOptions = new FileMapperOptions();
public FileMapperOptions getMapperOptions(List<String> mappingParams, List<String> filePaths) {
FileMapperOptions mapperOptions = new FileMapperOptions(filePaths);

for (String p : mappingParams) {
if (p.startsWith("-object_owner=")) {
Expand Down