diff options
author | megumi.telles | 2017-12-05 15:05:09 +0000 |
---|---|---|
committer | Megumi Telles | 2017-12-05 16:50:46 +0000 |
commit | ef7b269f88ef2d3a9752ab7f0526056eda7c5848 (patch) | |
tree | ea23f042234136ab0803d35c08af1f0e60523067 | |
parent | d42bc64fb253df4b3e1c649a6fc3e661993dbe7b (diff) | |
download | org.eclipse.osee-ef7b269f88ef2d3a9752ab7f0526056eda7c5848.tar.gz org.eclipse.osee-ef7b269f88ef2d3a9752ab7f0526056eda7c5848.tar.xz org.eclipse.osee-ef7b269f88ef2d3a9752ab7f0526056eda7c5848.zip |
feature[ats_TW3988]: Update Coverage Export to include additional info
Change-Id: I7127f5afd0aa77c708011815180c760c9d728547
3 files changed, 50 insertions, 26 deletions
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/report/ExportSet.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/report/ExportSet.java index a56fe3a8094..0a42caa0357 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/report/ExportSet.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/report/ExportSet.java @@ -26,6 +26,7 @@ import org.eclipse.osee.disposition.model.DispoAnnotationData; import org.eclipse.osee.disposition.model.DispoConfig; import org.eclipse.osee.disposition.model.DispoItem; import org.eclipse.osee.disposition.model.DispoSet; +import org.eclipse.osee.disposition.model.DispoStrings; import org.eclipse.osee.disposition.model.ResolutionMethod; import org.eclipse.osee.disposition.rest.DispoApi; import org.eclipse.osee.disposition.rest.internal.DispoConnector; @@ -156,8 +157,8 @@ public class ExportSet { sheetWriter.endSheet(); // Write Summary Sheet - sheetWriter.startSheet("Summary Sheet", headers.length); Object[] summarySheetHeaders = {"Unit", "Lines Covered", "Total Lines", "Percent Coverage"}; + sheetWriter.startSheet("Summary Sheet", summarySheetHeaders.length); sheetWriter.writeRow(summarySheetHeaders); Object[] row2 = new String[4]; for (String unit : unitToCovered.keySet()) { @@ -173,6 +174,24 @@ public class ExportSet { } sheetWriter.endSheet(); + // Write Test_Script Sheet + Object[] testScriptSheetHeaders = + {"Unit", "Code Line", "Resolution Type", "Script Name", "Script Path", "Script Notes"}; + sheetWriter.startSheet("Test Script Sheet", testScriptSheetHeaders.length); + sheetWriter.writeRow(testScriptSheetHeaders); + for (DispoItem item : items) { + List<DispoAnnotationData> annotations = item.getAnnotationsList(); + for (DispoAnnotationData annotation : annotations) { + if (annotation.getResolutionType().equals(DispoStrings.Test_Unit_Resolution)) { + HashMap<String, String> testNameToPath = + DispoUtil.splitTestScriptNameAndPath(Collections.singletonList(annotation)); + sheetWriter.writeRow(item.getName(), annotation.getLocationRefs(), annotation.getResolutionType(), + testNameToPath.keySet(), testNameToPath.values(), annotation.getResolution()); + } + } + } + sheetWriter.endSheet(); + sheetWriter.endWorkbook(); } catch (Exception ex) diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/report/FindReruns.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/report/FindReruns.java index f54a64cc825..344eac74758 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/report/FindReruns.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/report/FindReruns.java @@ -12,38 +12,15 @@ package org.eclipse.osee.disposition.rest.internal.report; import java.util.HashMap; import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import org.eclipse.osee.disposition.model.DispoAnnotationData; +import org.eclipse.osee.disposition.rest.util.DispoUtil; /** * @author Megumi Telles */ public class FindReruns { - Pattern removeLastDot = Pattern.compile("[^\\.]([^.]*)$", Pattern.CASE_INSENSITIVE); public HashMap<String, String> createList(List<DispoAnnotationData> annotations) { - HashMap<String, String> reruns = new HashMap<>(); - for (DispoAnnotationData data : annotations) { - String name = "", path = "", comment = ""; - String resolution = data.getResolution(); - if (!resolution.isEmpty()) { - String[] split = resolution.split("___"); - if (split.length > 1) { - path = split[0]; - comment = split[1]; - } else { - path = split.toString(); - } - path = path.replaceFirst("results", ""); - Matcher matcher = removeLastDot.matcher(path); - while (matcher.find()) { - name = matcher.group() + ".java"; - } - path = path.replaceAll("\\.", "/"); - } - reruns.put(name, path); - } - return reruns; + return DispoUtil.splitTestScriptNameAndPath(annotations); } } diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoUtil.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoUtil.java index 78de6ed7a06..1ff9895da24 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoUtil.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoUtil.java @@ -14,6 +14,7 @@ import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; @@ -44,6 +45,7 @@ import org.json.JSONObject; public final class DispoUtil { private static final Pattern pattern = Pattern.compile("^[,\\d-\\s]+$"); + private static final Pattern removeLastDot = Pattern.compile("[^\\.]([^.]*)$", Pattern.CASE_INSENSITIVE); private DispoUtil() { // @@ -530,4 +532,30 @@ public final class DispoUtil { } return date; } + + public static HashMap<String, String> splitTestScriptNameAndPath(List<DispoAnnotationData> annotations) { + HashMap<String, String> testScriptNameToPath = new HashMap<>(); + for (DispoAnnotationData data : annotations) { + String name = "", path = "", comment = ""; + String resolution = data.getResolution(); + if (!resolution.isEmpty()) { + String[] split = resolution.split("___"); + if (split.length > 1) { + path = split[0]; + comment = split[1]; + } else { + path = split.toString(); + } + path = path.replaceFirst("results", ""); + Matcher matcher = removeLastDot.matcher(path); + while (matcher.find()) { + name = matcher.group() + ".java"; + } + path = path.replaceAll("\\.", "/"); + } + testScriptNameToPath.put(name, path); + } + return testScriptNameToPath; + } + } |