Search in sources :

Example 1 with TransformationTemplate

use of com.github.jcustenborder.kafka.connect.utils.templates.TransformationTemplate in project connect-utils by jcustenborder.

the class BaseDocumentationTest method transformRstTest.

DynamicTest transformRstTest(TransformationTemplate transformationTemplate, final String templateName, final File parentDirectory) {
    if (!parentDirectory.isDirectory()) {
        parentDirectory.mkdirs();
    }
    final String testName = transformationTemplate.getTestName();
    return dynamicTest(testName, () -> {
        final File outputFile = new File(parentDirectory, testName.toLowerCase() + ".rst");
        Template template = configuration.getTemplate(templateName);
        log.info("Writing {}", outputFile);
        try (Writer writer = Files.newWriter(outputFile, Charsets.UTF_8)) {
            process(writer, template, transformationTemplate);
        }
    });
}
Also used : File(java.io.File) Writer(java.io.Writer) StringWriter(java.io.StringWriter) ConnectorTemplate(com.github.jcustenborder.kafka.connect.utils.templates.ConnectorTemplate) Template(freemarker.template.Template) TransformationTemplate(com.github.jcustenborder.kafka.connect.utils.templates.TransformationTemplate) PluginTemplate(com.github.jcustenborder.kafka.connect.utils.templates.PluginTemplate) SourceConnectorTemplate(com.github.jcustenborder.kafka.connect.utils.templates.SourceConnectorTemplate)

Aggregations

ConnectorTemplate (com.github.jcustenborder.kafka.connect.utils.templates.ConnectorTemplate)1 PluginTemplate (com.github.jcustenborder.kafka.connect.utils.templates.PluginTemplate)1 SourceConnectorTemplate (com.github.jcustenborder.kafka.connect.utils.templates.SourceConnectorTemplate)1 TransformationTemplate (com.github.jcustenborder.kafka.connect.utils.templates.TransformationTemplate)1 Template (freemarker.template.Template)1 File (java.io.File)1 StringWriter (java.io.StringWriter)1 Writer (java.io.Writer)1