Package groovy.text.markup

Examples of groovy.text.markup.MarkupTemplateEngine$TemplateResource


    TemplateEngine engine = this.configurer.getTemplateEngine();
    assertNotNull(engine);
    assertEquals(MarkupTemplateEngine.class, engine.getClass());

    MarkupTemplateEngine markupEngine = (MarkupTemplateEngine) engine;
    TemplateConfiguration configuration = markupEngine.getTemplateConfiguration();
    assertNotNull(configuration);
    assertEquals(GroovyMarkupConfigurer.class, configuration.getClass());
  }
View Full Code Here


    TemplateEngine engine = this.configurer.getTemplateEngine();
    assertNotNull(engine);
    assertEquals(MarkupTemplateEngine.class, engine.getClass());

    MarkupTemplateEngine markupEngine = (MarkupTemplateEngine) engine;
    TemplateConfiguration configuration = markupEngine.getTemplateConfiguration();
    assertNotNull(configuration);
    assertFalse(configuration.isCacheTemplates());
  }
View Full Code Here

  }

  protected MarkupTemplateEngine createTemplateEngine() throws IOException {
    if (this.templateEngine == null) {
      ClassLoader templateClassLoader = createTemplateClassLoader();
      this.templateEngine = new MarkupTemplateEngine(templateClassLoader, this, new LocaleTemplateResolver());
    }
    return this.templateEngine;
  }
View Full Code Here

  @Test
  public void renderTemplate() throws Exception {
    registerAndRefreshContext();
    GroovyMarkupConfig config = this.context.getBean(GroovyMarkupConfig.class);
    MarkupTemplateEngine engine = config.getTemplateEngine();
    Writer writer = new StringWriter();
    engine.createTemplate(new ClassPathResource("templates/message.tpl").getFile())
        .make(new HashMap<String, Object>(Collections.singletonMap("greeting",
            "Hello World"))).writeTo(writer);
    assertThat(writer.toString(), containsString("Hello World"));
  }
View Full Code Here

  MarkupTemplateEngine provideTemplateEngine(LaunchConfig launchConfig, Config config) {
    ClassLoader parent = getClass().getClassLoader();
    TemplateConfiguration effectiveConfiguration = new TemplateConfiguration(config);
    effectiveConfiguration.setCacheTemplates(config.isCacheTemplates()); // not copied by constructor
    Path templatesDir = launchConfig.getBaseDir().file(config.getTemplatesDirectory());
    return new MarkupTemplateEngine(parent, effectiveConfiguration, new CachingTemplateResolver(templatesDir));
  }
View Full Code Here

TOP

Related Classes of groovy.text.markup.MarkupTemplateEngine$TemplateResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.