use of com.mercedesbenz.sechub.sarif.model.Result in project sechub by mercedes-benz.
the class SarifReportSupportTest method specification_properties_snippet_properties_contains_opensource_key_and_map_value_and_can_be_written.
@Test
void specification_properties_snippet_properties_contains_opensource_key_and_map_value_and_can_be_written() throws IOException {
/* prepare */
File folder = sarifSpecificationSnippetsFolder;
/* execute */
Report report = supportToTest.loadReport(new File(folder, "specification-properties-snippet.sarif.json"));
/* test */
List<Result> results = report.getRuns().iterator().next().getResults();
Result result = results.iterator().next();
PropertyBag properties = result.getProperties();
assertNotNull(properties);
openSourceData = properties.get("openSource");
if (openSourceData instanceof Map) {
@SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>) openSourceData;
String informationUri = (String) map.get("informationUri");
assertEquals("http://www.example.com/procedures/usingOpenSource.html", informationUri);
} else {
fail("expected map but found:" + openSourceData);
}
}
use of com.mercedesbenz.sechub.sarif.model.Result in project sechub by mercedes-benz.
the class SarifV1JSONImporter method resolveCodeInfoFromCodeFlow.
private SerecoCodeCallStackElement resolveCodeInfoFromCodeFlow(Result result) {
Optional<CodeFlow> codeFlows = result.getCodeFlows().stream().findFirst();
if (!codeFlows.isPresent()) {
return null;
}
Optional<ThreadFlow> optFlow = codeFlows.get().getThreadFlows().stream().findFirst();
if (!optFlow.isPresent()) {
return null;
}
ThreadFlow flow = optFlow.get();
List<Location> locations = flow.getLocations().stream().map(location -> location.getLocation()).collect(Collectors.toList());
return resolveCodeInfoFromLocations(locations);
}
Aggregations