FileDocCategorySizeDatePackage
BaseTemplateEngineTest.javaAPI DocExample3198Mon Jul 23 13:26:10 BST 2007org.apache.struts2.components.template

BaseTemplateEngineTest

public class BaseTemplateEngineTest extends TestCase
Test case for BaseTemplateEngine

Fields Summary
Constructors Summary
Methods Summary
public voidtestGetThemePropsThroughClasspath()


        Template template = new Template("org/apache/struts2/components/template", "theme1", "template2");
        TemplateEngine templateEngine = new InnerBaseTemplateEngine("themeThroughClassPath.properties");
        Map propertiesMap = templateEngine.getThemeProps(template);

        assertNotNull(propertiesMap);
        assertTrue(propertiesMap.size() > 0);
    
public voidtestGetThemePropsThroughFileSystem()


        URL dummyResourceUrl = getClass().getResource("dummy.properties");
        File dummyResourceFile = new File(dummyResourceUrl.getFile().replaceAll("%20", " "));
        String themePropertiesDir = dummyResourceFile.getParent();

        System.out.println("dummy resource url="+dummyResourceUrl);
        System.out.println("resource file="+dummyResourceFile);
        System.out.println("theme properties dir="+themePropertiesDir);

        assertTrue(dummyResourceFile.exists());
        assertNotNull(themePropertiesDir);

        Template template = new Template(themePropertiesDir, "theme1", "template1");

        TemplateEngine templateEngine = new InnerBaseTemplateEngine("themeThroughFileSystem.properties");
        Map propertiesMap = templateEngine.getThemeProps(template);

        assertNotNull(propertiesMap);
        assertTrue(propertiesMap.size() > 0);