use of de.ipk_gatersleben.bit.bi.bridge.brapicomp.dbentities.MiniTestReport in project IPK-BrAPI-Validator by plantbreeding.
the class TestReportResource method generateCSVReport.
private String generateCSVReport(TestReport tr) throws JsonProcessingException, IOException {
String csv = "";
MiniTestReport miniReport = tr.getMiniReport();
// Columns
String resourceName = tr.getResource().getName();
String baseURL = tr.getResourceUrl();
String warningCalls = miniReport.getWarningTests().toString();
String failedCalls = miniReport.getFailedTests().toString();
String testedCalls = miniReport.getTotalTests().toString();
String warningCallsCount = "" + miniReport.getWarningTests().size();
String failedCallsCount = "" + miniReport.getFailedTests().size();
String testedCallsCount = "" + miniReport.getTotalTests().size();
String medianTestTime = Double.toString(miniReport.getTime());
String linkFullTest = Config.get("baseDomain") + "?report=" + tr.getReportId().toString();
List<String> header = Arrays.asList("resourceName", "baseURL", "warningCalls", "failedCalls", "testedCalls", "warningCallsCount", "failedCallsCount", "testedCallsCount", "medianTestTimeMS", "linkFullTest");
csv += CSVUtils.writeLine(header, '\t');
List<String> values = Arrays.asList(resourceName, baseURL, warningCalls, failedCalls, testedCalls, warningCallsCount, failedCallsCount, testedCallsCount, medianTestTime, linkFullTest);
csv += CSVUtils.writeLine(values, '\t');
return csv;
}
use of de.ipk_gatersleben.bit.bi.bridge.brapicomp.dbentities.MiniTestReport in project IPK-BrAPI-Validator by plantbreeding.
the class TestReportResource method generateJSONReport.
private String generateJSONReport(TestReport tr) throws IOException {
Map<String, Object> json = new HashMap<String, Object>();
MiniTestReport miniReport = tr.getMiniReport();
json.put("resourceName", tr.getResource().getName());
json.put("baseURL", tr.getResourceUrl());
json.put("implementedCalls", miniReport.getTotalTests());
json.put("successfulCalls", miniReport.getPassedTests());
json.put("failedCalls", miniReport.getFailedTests());
json.put("medianTestTimeMS", miniReport.getTime());
json.put("linkFullTest", Config.get("baseDomain") + "?report=" + tr.getReportId().toString());
ObjectMapper mapper = new ObjectMapper();
return mapper.writeValueAsString(json);
}
Aggregations