use of org.sakuli.services.forwarder.gearman.model.ScreenshotDiv in project sakuli by ConSol.
the class AbstractOutputBuilder method getTextPlaceholder.
protected PlaceholderMap getTextPlaceholder(TestSuite testSuite) {
PlaceholderMap placeholderMap = new PlaceholderMap();
OutputState outputState = OutputState.lookupSakuliState(testSuite.getState());
ScreenshotDiv screenshotDiv = screenshotDivConverter.convert(testSuite.getException());
placeholderMap.put(STATE, outputState.name());
placeholderMap.put(STATE_SHORT, outputState.getShortState());
placeholderMap.put(STATE_DESC, testSuite.getState().getNagiosStateDescription());
placeholderMap.put(SUITE_SUMMARY, generateStateSummary(testSuite.getState()));
placeholderMap.put(NAME, testSuite.getName());
placeholderMap.put(ID, testSuite.getId());
placeholderMap.put(DURATION, String.format(Locale.ENGLISH, "%.2f", testSuite.getDuration()));
placeholderMap.put(START_DATE, (testSuite.getStartDate() == null) ? "xx" : dateFormat.format(testSuite.getStartDate()));
placeholderMap.put(STOP_DATE, (testSuite.getStopDate() == null) ? "xx" : dateFormat.format(testSuite.getStopDate()));
placeholderMap.put(WARN_THRESHOLD, String.valueOf(testSuite.getWarningTime()));
placeholderMap.put(CRITICAL_THRESHOLD, String.valueOf(testSuite.getCriticalTime()));
placeholderMap.put(ERROR_SCREENSHOT, screenshotDiv != null ? screenshotDiv.getPayloadString() : null);
placeholderMap.put(ERROR_MESSAGE, testSuite.getExceptionMessages(true));
placeholderMap.put(SUITE_FOLDER, testSuite.getTestSuiteFolder() != null ? testSuite.getTestSuiteFolder().toString() : null);
placeholderMap.put(HOST, testSuite.getHost());
placeholderMap.put(BROWSER_INFO, testSuite.getBrowserInfo());
placeholderMap.put(TD_CSS_CLASS, "service" + outputState.name());
placeholderMap.put(CASE_INFORMATION, generateCaseInformation(testSuite.getTestCasesAsSortedSet()));
placeholderMap.put(STEP_INFORMATION, testSuite.getTestCasesAsSortedSet().stream().map(c -> generateStepInformation(c.getStepsAsSortedSet())).collect(Collectors.joining()));
return placeholderMap;
}
use of org.sakuli.services.forwarder.gearman.model.ScreenshotDiv in project sakuli by ConSol.
the class ScreenshotDivConverter method convert.
public ScreenshotDiv convert(Throwable e) {
if (e != null) {
String base64String = extractScreenshotAsBase64(e);
String format = extractScreenshotFormat(e);
if (base64String != null && format != null) {
ScreenshotDiv screenshotDiv = new ScreenshotDiv();
screenshotDiv.setFormat(format);
screenshotDiv.setBase64screenshot(base64String);
screenshotDiv.setId(ScreenshotDiv.DEFAULT_SAKULI_SCREENSHOT_DIV_ID + screenshotDiv.hashCode());
return screenshotDiv;
}
}
return null;
}
Aggregations