use of org.jtwig.spaceless.configuration.SpacelessConfiguration in project sakuli by ConSol.
the class AbstractTemplateOutputBuilder method createOutput.
/**
* Converts the current test suite to a string based on the template for the concrete converter.
*
* @return
*/
public String createOutput() throws SakuliForwarderException {
try {
JtwigModel model = createModel();
EnvironmentConfiguration configuration = EnvironmentConfigurationBuilder.configuration().extensions().add(new SpacelessExtension(new SpacelessConfiguration(new LeadingWhitespaceRemover()))).and().functions().add(new IsBlankFunction()).add(new GetOutputStateFunction()).add(new GetOutputDurationFunction()).add(new ExtractScreenshotFunction(screenshotDivConverter)).add(new AbbreviateFunction()).and().build();
JtwigTemplate template = JtwigTemplate.fileTemplate(getTemplatePath().toFile(), configuration);
logger.debug(String.format("Render model into JTwig template. Model: '%s'", model));
return template.render(model);
} catch (Throwable thr) {
throw new SakuliForwarderException(thr, "Exception during rendering of Twig template occurred!");
}
}
use of org.jtwig.spaceless.configuration.SpacelessConfiguration in project sakuli by ConSol.
the class AbstractTemplateOutputBuilder method createOutput.
/**
* Converts the current test data entity to a string based on the template for the concrete converter.
*
* @param abstractTestDataEntity Test data entity, which has to be converted
* @return A string representation of the provided test data entity
*/
public String createOutput(AbstractTestDataEntity abstractTestDataEntity) throws SakuliForwarderCheckedException {
try {
JtwigModel model = createModel(abstractTestDataEntity);
EnvironmentConfiguration configuration = EnvironmentConfigurationBuilder.configuration().extensions().add(new SpacelessExtension(new SpacelessConfiguration(new LeadingWhitespaceRemover()))).and().functions().add(new IsBlankFunction()).add(new GetOutputStateFunction()).add(new GetOutputDurationFunction()).add(new ExtractScreenshotFunction(screenshotDivConverter)).add(new AbbreviateFunction()).add(new UnixTimestampConverterFunction()).add(new GetTestDataEntityTypeFunction()).and().build();
JtwigTemplate template = JtwigTemplate.fileTemplate(getTemplatePath().toFile(), configuration);
logger.debug(String.format("Render model into JTwig template. Model: '%s'", model));
return template.render(model);
} catch (Exception e) {
throw new SakuliForwarderCheckedException(e, "Exception during rendering of Twig template occurred!");
}
}
Aggregations