Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngel Avila2013-09-11 21:15:48 +0000
committerRoberto E. Escobar2013-09-17 23:29:51 +0000
commit40fed2850d69516c039ee24e8b4343051c20d847 (patch)
treeab2cf9b5cd83234c66e8fe490598254f2e1477a0 /plugins
parentb32aaad3e80111ec1f00c4f19ca24644d1d96abe (diff)
downloadorg.eclipse.osee-40fed2850d69516c039ee24e8b4343051c20d847.tar.gz
org.eclipse.osee-40fed2850d69516c039ee24e8b4343051c20d847.tar.xz
org.eclipse.osee-40fed2850d69516c039ee24e8b4343051c20d847.zip
feature[ats_8TPSZ]: Add File Line Number for Coverage
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xcover/CoverageLabelProvider.java3
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/vcast/executor/VcpSourceFileWorker.java9
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/vcast/executor/VcpSourceLisFile.java8
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java9
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/LineData.java39
5 files changed, 61 insertions, 7 deletions
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xcover/CoverageLabelProvider.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xcover/CoverageLabelProvider.java
index 829817d2f6..711b99bfa4 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xcover/CoverageLabelProvider.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/xcover/CoverageLabelProvider.java
@@ -152,6 +152,9 @@ public class CoverageLabelProvider extends XViewerLabelProvider {
if (xCol.equals(CoverageXViewerFactory.Execution_Number)) {
return coverageItem.getOrderNumber();
}
+ if (xCol.equals(CoverageXViewerFactory.Line_Number)) {
+ return coverageItem.getLineNumber();
+ }
if (xCol.equals(CoverageXViewerFactory.Coverage_Method)) {
return coverageItem.getCoverageMethod().getName();
}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/vcast/executor/VcpSourceFileWorker.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/vcast/executor/VcpSourceFileWorker.java
index 3e6a41780f..c1935fae42 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/vcast/executor/VcpSourceFileWorker.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/vcast/executor/VcpSourceFileWorker.java
@@ -27,10 +27,10 @@ import org.eclipse.osee.coverage.model.CoverageImport;
import org.eclipse.osee.coverage.model.CoverageItem;
import org.eclipse.osee.coverage.model.CoverageOptionManager;
import org.eclipse.osee.coverage.model.CoverageUnit;
+import org.eclipse.osee.coverage.util.LineData;
import org.eclipse.osee.coverage.vcast.CoverageImportData;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.util.XResultData;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.framework.jdk.core.util.AHTML;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -131,17 +131,18 @@ public class VcpSourceFileWorker extends AbstractVcpFileWorker<VcpSourceFile> {
CoverageItem coverageItem =
new CoverageItem(methodCoverageUnit, CoverageOptionManager.Not_Covered,
String.valueOf(lineNumToBranches.getLineNum()));
- Pair<String, Boolean> lineData =
+ LineData lineData =
vcpSourceLisFile.getExecutionLine(String.valueOf(methodNum),
String.valueOf(lineNumToBranches.getLineNum()));
- String sourceLine = lineData.getFirst();
+ String sourceLine = lineData.getLineText();
// Need to get rid of line method num and line num before storing
sourceLineMatcher.reset(sourceLine);
if (!sourceLineMatcher.find()) {
getLogger().logError(String.format("Coverage line doesn't match \"n n <line>\" [%s]. ", sourceLine));
} else {
+ coverageItem.setLineNumber(lineData.getLineNumber());
coverageItem.setName(sourceLineMatcher.group(1));
- if (input.isResolveExceptionHandling() && lineData.getSecond()) {
+ if (input.isResolveExceptionHandling() && lineData.getIsException()) {
coverageItem.setCoverageMethod(CoverageOptionManager.Exception_Handling);
}
methodCoverageUnit.addCoverageItem(coverageItem);
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/vcast/executor/VcpSourceLisFile.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/vcast/executor/VcpSourceLisFile.java
index f12d812dd8..5815d60295 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/vcast/executor/VcpSourceLisFile.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/internal/vcast/executor/VcpSourceLisFile.java
@@ -16,10 +16,10 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.osee.coverage.internal.vcast.operations.VcpSourceFile;
import org.eclipse.osee.coverage.model.ICoverageUnitFileContentsLoader;
+import org.eclipse.osee.coverage.util.LineData;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeWrappedException;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.framework.jdk.core.util.Lib;
/**
@@ -74,13 +74,15 @@ public class VcpSourceLisFile implements ICoverageUnitFileContentsLoader {
private static final Pattern exceptionPattern = Pattern.compile("^\\s+EXCEPTION\\s*$");
private static final Pattern endMethodPattern = Pattern.compile("^\\s*END\\s+(.*);\\s*$");
- public Pair<String, Boolean> getExecutionLine(String method, String executionLine) throws OseeCoreException {
+ public LineData getExecutionLine(String method, String executionLine) throws OseeCoreException {
ensureLoaded();
String startsWith = method + " " + executionLine + " ";
boolean exceptionLine = false;
+ int lineNum = 0;
for (String line : lines) {
+ lineNum++;
if (line.startsWith(startsWith)) {
- return new Pair<String, Boolean>(line, exceptionLine);
+ return new LineData(line, exceptionLine, lineNum);
}
Matcher m = exceptionPattern.matcher(line);
if (m.find()) {
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java
index 0b25ba99e8..75df3f707d 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java
@@ -38,6 +38,7 @@ public class CoverageItem extends NamedIdentity<String> implements ICoverage, IW
String orderNumber;
String workProductGuid;
WorkProductTask workProductTask;
+ int fileLineNumber;
private final CoverageUnit coverageUnit;
private static String PROPERTY_STORE_ID = "coverage.item";
@@ -257,6 +258,14 @@ public class CoverageItem extends NamedIdentity<String> implements ICoverage, IW
this.testUnitProvider = testUnitProvider;
}
+ public void setLineNumber(int lineNum) {
+ fileLineNumber = lineNum;
+ }
+
+ public String getLineNumber() {
+ return String.valueOf(fileLineNumber);
+ }
+
public static Pair<String, String> getNameGuidFromStore(String string) throws Exception {
PropertyStore store = new PropertyStore();
store.load(string);
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/LineData.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/LineData.java
new file mode 100644
index 0000000000..be3338acb2
--- /dev/null
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/util/LineData.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.coverage.util;
+
+/**
+ * @author Angel Avila
+ */
+public class LineData {
+
+ private final String lineText;
+ private final boolean isException;
+ private final int lineNumber;
+
+ public LineData(String lineText, boolean isException, int lineNumber) {
+ this.lineText = lineText;
+ this.isException = isException;
+ this.lineNumber = lineNumber;
+ }
+
+ public String getLineText() {
+ return lineText;
+ }
+
+ public boolean getIsException() {
+ return isException;
+ }
+
+ public int getLineNumber() {
+ return lineNumber;
+ }
+}

Back to the top