Search in sources :

Example 1 with FileTemplateResolver

use of org.thymeleaf.templateresolver.FileTemplateResolver in project thymeleaf-tests by thymeleaf.

the class TemplateEngineTest method testTemplateResolverConfiguration04.

@Test
public void testTemplateResolverConfiguration04() {
    final TemplateEngine templateEngine = new TemplateEngine();
    templateEngine.setTemplateResolver(new ClassLoaderTemplateResolver());
    templateEngine.setTemplateResolver(new FileTemplateResolver());
    templateEngine.initialize();
    final List<ITemplateResolver> templateResolvers = new ArrayList<ITemplateResolver>(templateEngine.getTemplateResolvers());
    Assert.assertEquals(1, templateResolvers.size());
    Assert.assertEquals("org.thymeleaf.templateresolver.FileTemplateResolver", templateResolvers.get(0).getName());
}
Also used : SpringTemplateEngine(org.thymeleaf.spring5.SpringTemplateEngine) ClassLoaderTemplateResolver(org.thymeleaf.templateresolver.ClassLoaderTemplateResolver) FileTemplateResolver(org.thymeleaf.templateresolver.FileTemplateResolver) ArrayList(java.util.ArrayList) ITemplateResolver(org.thymeleaf.templateresolver.ITemplateResolver) Test(org.junit.Test)

Example 2 with FileTemplateResolver

use of org.thymeleaf.templateresolver.FileTemplateResolver in project thymeleaf-tests by thymeleaf.

the class TemplateEngineTest method testTemplateResolverConfiguration09.

@Test
public void testTemplateResolverConfiguration09() {
    final TemplateEngine templateEngine = new TemplateEngine();
    final Set<ITemplateResolver> resolvers = new LinkedHashSet<ITemplateResolver>();
    resolvers.add(new ClassLoaderTemplateResolver());
    resolvers.add(new FileTemplateResolver());
    templateEngine.setTemplateResolvers(resolvers);
    templateEngine.initialize();
    final List<ITemplateResolver> templateResolvers = new ArrayList<ITemplateResolver>(templateEngine.getTemplateResolvers());
    Assert.assertEquals(2, templateResolvers.size());
    Assert.assertEquals("org.thymeleaf.templateresolver.ClassLoaderTemplateResolver", templateResolvers.get(0).getName());
    Assert.assertEquals("org.thymeleaf.templateresolver.FileTemplateResolver", templateResolvers.get(1).getName());
}
Also used : LinkedHashSet(java.util.LinkedHashSet) SpringTemplateEngine(org.thymeleaf.spring5.SpringTemplateEngine) ClassLoaderTemplateResolver(org.thymeleaf.templateresolver.ClassLoaderTemplateResolver) FileTemplateResolver(org.thymeleaf.templateresolver.FileTemplateResolver) ArrayList(java.util.ArrayList) ITemplateResolver(org.thymeleaf.templateresolver.ITemplateResolver) Test(org.junit.Test)

Example 3 with FileTemplateResolver

use of org.thymeleaf.templateresolver.FileTemplateResolver in project thymeleaf-tests by thymeleaf.

the class TemplateEngineTest method testTemplateResolverConfiguration08.

@Test
public void testTemplateResolverConfiguration08() {
    final TemplateEngine templateEngine = new SpringTemplateEngine();
    templateEngine.addTemplateResolver(new ClassLoaderTemplateResolver());
    templateEngine.addTemplateResolver(new FileTemplateResolver());
    templateEngine.initialize();
    final List<ITemplateResolver> templateResolvers = new ArrayList<ITemplateResolver>(templateEngine.getTemplateResolvers());
    Assert.assertEquals(2, templateResolvers.size());
    Assert.assertEquals("org.thymeleaf.templateresolver.ClassLoaderTemplateResolver", templateResolvers.get(0).getName());
    Assert.assertEquals("org.thymeleaf.templateresolver.FileTemplateResolver", templateResolvers.get(1).getName());
}
Also used : SpringTemplateEngine(org.thymeleaf.spring5.SpringTemplateEngine) SpringTemplateEngine(org.thymeleaf.spring5.SpringTemplateEngine) ClassLoaderTemplateResolver(org.thymeleaf.templateresolver.ClassLoaderTemplateResolver) FileTemplateResolver(org.thymeleaf.templateresolver.FileTemplateResolver) ArrayList(java.util.ArrayList) ITemplateResolver(org.thymeleaf.templateresolver.ITemplateResolver) Test(org.junit.Test)

Example 4 with FileTemplateResolver

use of org.thymeleaf.templateresolver.FileTemplateResolver in project thymeleaf-tests by thymeleaf.

the class TemplateEngineTest method testTemplateResolverConfiguration06.

@Test
public void testTemplateResolverConfiguration06() {
    final TemplateEngine templateEngine = new SpringTemplateEngine();
    templateEngine.setTemplateResolver(new ClassLoaderTemplateResolver());
    templateEngine.addTemplateResolver(new FileTemplateResolver());
    templateEngine.initialize();
    final List<ITemplateResolver> templateResolvers = new ArrayList<ITemplateResolver>(templateEngine.getTemplateResolvers());
    Assert.assertEquals(2, templateResolvers.size());
    Assert.assertEquals("org.thymeleaf.templateresolver.ClassLoaderTemplateResolver", templateResolvers.get(0).getName());
    Assert.assertEquals("org.thymeleaf.templateresolver.FileTemplateResolver", templateResolvers.get(1).getName());
}
Also used : SpringTemplateEngine(org.thymeleaf.spring5.SpringTemplateEngine) SpringTemplateEngine(org.thymeleaf.spring5.SpringTemplateEngine) ClassLoaderTemplateResolver(org.thymeleaf.templateresolver.ClassLoaderTemplateResolver) FileTemplateResolver(org.thymeleaf.templateresolver.FileTemplateResolver) ArrayList(java.util.ArrayList) ITemplateResolver(org.thymeleaf.templateresolver.ITemplateResolver) Test(org.junit.Test)

Example 5 with FileTemplateResolver

use of org.thymeleaf.templateresolver.FileTemplateResolver in project thymeleaf-tests by thymeleaf.

the class TemplateEngineTest method testTemplateResolverConfiguration07.

@Test
public void testTemplateResolverConfiguration07() {
    final TemplateEngine templateEngine = new TemplateEngine();
    templateEngine.addTemplateResolver(new ClassLoaderTemplateResolver());
    templateEngine.addTemplateResolver(new FileTemplateResolver());
    templateEngine.initialize();
    final List<ITemplateResolver> templateResolvers = new ArrayList<ITemplateResolver>(templateEngine.getTemplateResolvers());
    Assert.assertEquals(2, templateResolvers.size());
    Assert.assertEquals("org.thymeleaf.templateresolver.ClassLoaderTemplateResolver", templateResolvers.get(0).getName());
    Assert.assertEquals("org.thymeleaf.templateresolver.FileTemplateResolver", templateResolvers.get(1).getName());
}
Also used : SpringTemplateEngine(org.thymeleaf.spring5.SpringTemplateEngine) ClassLoaderTemplateResolver(org.thymeleaf.templateresolver.ClassLoaderTemplateResolver) FileTemplateResolver(org.thymeleaf.templateresolver.FileTemplateResolver) ArrayList(java.util.ArrayList) ITemplateResolver(org.thymeleaf.templateresolver.ITemplateResolver) Test(org.junit.Test)

Aggregations

FileTemplateResolver (org.thymeleaf.templateresolver.FileTemplateResolver)9 ClassLoaderTemplateResolver (org.thymeleaf.templateresolver.ClassLoaderTemplateResolver)8 ArrayList (java.util.ArrayList)7 Test (org.junit.Test)7 SpringTemplateEngine (org.thymeleaf.spring5.SpringTemplateEngine)7 ITemplateResolver (org.thymeleaf.templateresolver.ITemplateResolver)7 LinkedHashSet (java.util.LinkedHashSet)2 AbstractConfigurableTemplateResolver (org.thymeleaf.templateresolver.AbstractConfigurableTemplateResolver)2 Slf4j (lombok.extern.slf4j.Slf4j)1 StringUtils (org.apache.commons.lang3.StringUtils)1 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)1 ChainingTemplateViewResolver (org.apereo.cas.web.view.ChainingTemplateViewResolver)1 ThemeFileTemplateResolver (org.apereo.cas.web.view.ThemeFileTemplateResolver)1 Unchecked (org.jooq.lambda.Unchecked)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 ThymeleafProperties (org.springframework.boot.autoconfigure.thymeleaf.ThymeleafProperties)1 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)1 Bean (org.springframework.context.annotation.Bean)1 Configuration (org.springframework.context.annotation.Configuration)1 ResourceUtils (org.springframework.util.ResourceUtils)1