use of com.checkmarx.sdk.dto.scansummary.Severity in project cx-flow by checkmarx-ltd.
the class ScaThresholdsSteps method getFakeSCAResults.
private SCAResults getFakeSCAResults(String findingsName) {
SCAResults scaResults = new SCAResults();
scaResults.setScanId("1");
Summary summary = new Summary();
Map<Filter.Severity, Integer> summaryMap = new EnumMap<>(Filter.Severity.class);
List<Finding> findings = new LinkedList<>();
Map<String, String> specMap = findingsDefs.stream().filter(findingsDef -> findingsDef.get("name").equals(findingsName)).findAny().get();
EnumSet.allOf(Severity.class).forEach(severity -> {
String spec = specMap.get(severity.name().toLowerCase());
log.info("{}-spec: {}", severity, spec);
/* create findings */
Integer count = Arrays.stream(spec.split("-than-")).mapToInt(v -> "more".equals(v) ? 3 : "less".equals(v) ? -3 : Integer.parseInt(v)).reduce(0, Integer::sum);
log.info("going to generate {} issues with {} severity", count, severity);
summaryMap.put(Filter.Severity.valueOf(severity.name()), count);
populateFindings(findings, severity, count);
});
summary.setFindingCounts(summaryMap);
scaResults.setFindings(findings);
scaResults.setSummary(summary);
return scaResults;
}
Aggregations