Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormegumi.telles2018-02-27 20:19:59 +0000
committerMegumi Telles2018-03-02 18:51:20 +0000
commitc48d13aa9de89acc31f578af8d957260a886b619 (patch)
tree6bc19b9be490cf77f978773992c76b4085146845
parent8f3f7e5cfcc1309c2cf91cb1236e3477018d92b1 (diff)
downloadorg.eclipse.osee-c48d13aa9de89acc31f578af8d957260a886b619.tar.gz
org.eclipse.osee-c48d13aa9de89acc31f578af8d957260a886b619.tar.xz
org.eclipse.osee-c48d13aa9de89acc31f578af8d957260a886b619.zip
feature[ats_TW7747]: Support case insensitivity in dispo file extentions
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApiConfiguration.java16
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoConstants.java1
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/LisFileParser.java32
-rw-r--r--plugins/org.eclipse.osee.vcast/src/org/eclipse/osee/vcast/VCastLisFileParser.java8
4 files changed, 51 insertions, 6 deletions
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApiConfiguration.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApiConfiguration.java
index f7f980fee17..81c635b35d0 100644
--- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApiConfiguration.java
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApiConfiguration.java
@@ -18,6 +18,7 @@ import java.util.Map;
public class DispoApiConfiguration {
private String fileExtRegex;
+ private String resultsFileExtRegex;
private DispoApiConfiguration() {
//Builder Class
@@ -31,9 +32,18 @@ public class DispoApiConfiguration {
this.fileExtRegex = fileExtRegex;
}
+ public String getResultsFileExtRegex() {
+ return resultsFileExtRegex;
+ }
+
+ public void setResultsFileExtRegex(String resultsFileExtRegex) {
+ this.resultsFileExtRegex = resultsFileExtRegex;
+ }
+
public DispoApiConfiguration copy() {
DispoApiConfiguration data = new DispoApiConfiguration();
data.fileExtRegex = this.fileExtRegex;
+ data.resultsFileExtRegex = this.resultsFileExtRegex;
return data;
}
@@ -58,6 +68,7 @@ public class DispoApiConfiguration {
public DispoApiConfigurationBuilder properties(Map<String, Object> props) {
fileExtRegex(get(props, DispoConstants.FILE_EXT_REGEX, ""));
+ resultsFileExtRegex(get(props, DispoConstants.RESULTS_FILE_EXT_REGEX, ""));
return this;
}
@@ -66,6 +77,11 @@ public class DispoApiConfiguration {
return this;
}
+ public DispoApiConfigurationBuilder resultsFileExtRegex(String resultsFileExtRegex) {
+ config.setResultsFileExtRegex(resultsFileExtRegex);
+ return this;
+ }
+
private static String get(Map<String, Object> props, String key, String defaultValue) {
String toReturn = defaultValue;
Object object = props != null ? props.get(key) : null;
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoConstants.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoConstants.java
index c80a418517b..d17e9558786 100644
--- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoConstants.java
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoConstants.java
@@ -63,6 +63,7 @@ public final class DispoConstants {
}
public static final String FILE_EXT_REGEX = qualify("file.ext.regex");
+ public static final String RESULTS_FILE_EXT_REGEX = qualify("results.file.ext.regex");
// @formatter:on
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/LisFileParser.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/LisFileParser.java
index 208f3a02bda..71d80cb8bc8 100644
--- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/LisFileParser.java
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/LisFileParser.java
@@ -61,6 +61,7 @@ import org.eclipse.osee.vcast.model.VCastStatementCoverage;
* @author Angel Avila
*/
public class LisFileParser implements DispoImporterApi {
+ private static final String RESULTS = "results";
private static final String LOG = "\\s*(log).*";
private static final String EXIT_WHEN = "\\s*\\( \\)\\s*\\( \\)\\s*(EXIT WHEN).*";
private static final String WHEN_FOR = "\\s*\\( \\)\\s*(WHEN|FOR).*";
@@ -377,12 +378,30 @@ public class LisFileParser implements DispoImporterApi {
String resultPath = result.getPath();
String resultPathAbs = vCastDir + File.separator + resultPath;
+ boolean exists = false;
File resultsFile = new File(resultPathAbs);
if (!resultsFile.exists()) {
- report.addEntry("SQL", String.format("Could not find DAT file [%s]", resultPathAbs), ERROR);
- } else if (isDupcliateFile(resultsFile, report)) {
- // Ignore
+ File resultsDir = new File(vCastDir + File.separator + RESULTS);
+ File[] files = resultsDir.listFiles();
+ for (File file : files) {
+ String inputF = file.toString();
+ String outputF = inputF.replaceAll(config.getResultsFileExtRegex(), "");
+ if (outputF.toString().equalsIgnoreCase(resultsFile.toString())) {
+ process(report, resultPath, file);
+ exists = true;
+ break;
+ }
+ }
+ if (!exists) {
+ report.addEntry("SQL", String.format("Could not find DAT file [%s]", resultPathAbs), WARNING);
+ }
} else {
+ process(report, resultPath, resultsFile);
+ }
+ }
+
+ private void process(OperationReport report, String resultPath, File resultsFile) {
+ if (!isDuplicateFile(resultsFile, report)) {
//Start reading line by line
BufferedReader br = null;
try {
@@ -416,7 +435,10 @@ public class LisFileParser implements DispoImporterApi {
processMultiResultMCDC(resultPath, m);
}
} else {
- // ERROR
+ report.addEntry("RESULTS FILE PARSE",
+ String.format("This line [%s] could not be parsed. In DAT file [%s]", resultsLine,
+ resultsFile.getName()),
+ WARNING);
}
}
}
@@ -430,7 +452,7 @@ public class LisFileParser implements DispoImporterApi {
}
}
- private boolean isDupcliateFile(File file, OperationReport report) {
+ private boolean isDuplicateFile(File file, OperationReport report) {
String normalizedFileName = file.getName().replaceAll("//....", "");
if (alreadyUsedFileNames.contains(normalizedFileName)) {
report.addEntry(file.getName(), "Duplicate File skipped", DispoSummarySeverity.WARNING);
diff --git a/plugins/org.eclipse.osee.vcast/src/org/eclipse/osee/vcast/VCastLisFileParser.java b/plugins/org.eclipse.osee.vcast/src/org/eclipse/osee/vcast/VCastLisFileParser.java
index a20a6859660..bfe55fa5981 100644
--- a/plugins/org.eclipse.osee.vcast/src/org/eclipse/osee/vcast/VCastLisFileParser.java
+++ b/plugins/org.eclipse.osee.vcast/src/org/eclipse/osee/vcast/VCastLisFileParser.java
@@ -24,6 +24,8 @@ import org.eclipse.osee.vcast.model.ICoverageUnitFileContentsLoader;
*/
public class VCastLisFileParser implements ICoverageUnitFileContentsLoader {
+ private static final String lis = ".lis";
+ private static final String LIS = ".LIS";
private static final Pattern sourceLinePattern = Pattern.compile("^[0-9]+ [0-9]+(.*?)$");
private static final Pattern exceptionPattern = Pattern.compile("^\\s+EXCEPTION\\s*$");
private static final Pattern endMethodPattern = Pattern.compile("^\\s*END\\s+(.*);\\s*$");
@@ -46,7 +48,11 @@ public class VCastLisFileParser implements ICoverageUnitFileContentsLoader {
String lisFilePathName = vCastDir + File.separator + lisFileName;
File lisFile = new File(lisFilePathName);
if (!lisFile.exists()) {
- throw new OseeArgumentException(String.format("VectorCast *.LIS file doesn't exist [%s]", lisFilePathName));
+ lisFile = new File(lisFilePathName.replace(LIS, lis));
+ if (!lisFile.exists()) {
+ throw new OseeArgumentException(
+ String.format("VectorCast *.LIS file doesn't exist [%s]", lisFilePathName));
+ }
}
try {
fileText = Lib.fileToString(lisFile);

Back to the top