Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormegumi.telles2017-08-30 09:48:44 -0400
committerMegumi Telles2017-08-30 12:32:19 -0400
commit55b1e283ec5157abe0b739ee4f1913d1dcc59270 (patch)
treefa82668e799d897d97bc03b025f3257adf8baf0b
parentafb197483e48cc0407c21038be9dbc27c9167936 (diff)
downloadorg.eclipse.osee-55b1e283ec5157abe0b739ee4f1913d1dcc59270.tar.gz
org.eclipse.osee-55b1e283ec5157abe0b739ee4f1913d1dcc59270.tar.xz
org.eclipse.osee-55b1e283ec5157abe0b739ee4f1913d1dcc59270.zip
bug: Fix level b query.0.25.0.v201708301751-NR
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/LisFileParser.java24
-rw-r--r--plugins/org.eclipse.osee.vcast/src/org/eclipse/osee/vcast/internal/VCastDataStoreImpl.java13
2 files changed, 26 insertions, 11 deletions
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 d25ad02a38..c67f81f1a5 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
@@ -58,6 +58,10 @@ import org.eclipse.osee.vcast.model.VCastStatementCoverage;
* @author Angel Avila
*/
public class LisFileParser implements DispoImporterApi {
+ 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).*";
+
private final DispoDataFactory dataFactory;
private static final Pattern fileMethod5LineNumberPattern =
@@ -289,7 +293,7 @@ public class LisFileParser implements DispoImporterApi {
} catch (Exception ex) {
report.addEntry("SQL", ex.getMessage(), ERROR);
}
- String location;
+ String location = "";
if (lineData != null) {
boolean isMCDCPair = statementCoverageItem.getIsMCDCPair();
String text;
@@ -297,8 +301,8 @@ public class LisFileParser implements DispoImporterApi {
location = String.format("%s.%s.%s", lineNumber, statementCoverageItem.getAbbrevCondition(), "T");
String location2 = String.format("%s.%s.%s", lineNumber, statementCoverageItem.getAbbrevCondition(), "F");
- if (!lineData.getFirst().matches("\\s*\\( \\)\\s*(WHEN|FOR).*")) {
- // Only add corresponding 'F' disrepancy if it's not a WHEN condition statment
+ if (!lineData.getFirst().matches(WHEN_FOR)) {
+ // Only add corresponding 'F' discrepancy if it's not a WHEN condition statement
text = statementCoverageItem.getFullCondition();
addDiscrepancy(discrepancies, location, text);
addDiscrepancy(discrepancies, location2, text);
@@ -311,9 +315,17 @@ public class LisFileParser implements DispoImporterApi {
text = lineData.getFirst().trim();
if (statementCoverageItem.getNumConditions() == 2) {
location = String.format("%s.%s", lineNumber, "T");
- addDiscrepancy(discrepancies, location, text);
- location = String.format("%s.%s", lineNumber, "F");
- addDiscrepancy(discrepancies, location, text);
+ String locationF = String.format("%s.%s", lineNumber, "F");
+
+ if (!lineData.getFirst().matches(WHEN_FOR) //
+ && !lineData.getFirst().matches(EXIT_WHEN) //
+ && !lineData.getFirst().matches(LOG) //
+ ) {
+ addDiscrepancy(discrepancies, location, text);
+ addDiscrepancy(discrepancies, locationF, text);
+ } else {
+ addDiscrepancy(discrepancies, location, text);
+ }
} else {
location = String.valueOf(lineNumber);
addDiscrepancy(discrepancies, location, text);
diff --git a/plugins/org.eclipse.osee.vcast/src/org/eclipse/osee/vcast/internal/VCastDataStoreImpl.java b/plugins/org.eclipse.osee.vcast/src/org/eclipse/osee/vcast/internal/VCastDataStoreImpl.java
index f8fbcd3558..05b02622b3 100644
--- a/plugins/org.eclipse.osee.vcast/src/org/eclipse/osee/vcast/internal/VCastDataStoreImpl.java
+++ b/plugins/org.eclipse.osee.vcast/src/org/eclipse/osee/vcast/internal/VCastDataStoreImpl.java
@@ -565,14 +565,17 @@ public class VCastDataStoreImpl implements VCastDataStore {
try {
// @formatter:off
String query =
- "SELECT sc.id as sc_id, sc.hit_count, sc.max_hit_count, sc.line, branch.num_conditions" +
- " FROM statement_coverage sc left outer join branch_coverage branch on (sc.function_id = branch.function_id)" +
- " where sc.function_id = ?";
+ "with temp as (SELECT sc.id, sc.function_id, sc.hit_count, sc.max_hit_count, sc.line, branch.num_conditions" +
+ " FROM statement_coverage sc left outer join branch_coverage branch on sc.function_id = branch.function_id and sc.line=branch.line where branch.function_id = ?)" +
+ " SELECT id, function_id, hit_count, max_hit_count, line, num_conditions from temp union all " +
+ " select sc2.id, sc2.function_id, sc2.hit_count, sc2.max_hit_count, sc2.line, 0 from statement_coverage sc2 where not exists " +
+ " (select 1 from temp where sc2.function_id = temp.function_id and sc2.line=temp.line)" +
+ " and sc2.function_id=?";
// @formatter:on
- stmt.runPreparedQuery(query, function.getId());
+ stmt.runPreparedQuery(query, function.getId(), function.getId());
while (stmt.next()) {
- Integer id = stmt.getInt("sc_id");
+ Integer id = stmt.getInt("id");
Integer line = stmt.getInt("line");
Integer hit_count = stmt.getInt("hit_count");
Integer max_hit_count = stmt.getInt("max_hit_count");

Back to the top