Search in sources :

Example 11 with ClasspathResourceLoader

use of org.beetl.core.resource.ClasspathResourceLoader in project beetl2.0 by javamonkey.

the class ResourceLoaderTest method testSimple.

@Test
public void testSimple() throws Exception {
    FileResourceLoader f = new FileResourceLoader();
    boolean exist = f.exist("/build.xml");
    AssertJUnit.assertTrue(exist);
    ClasspathResourceLoader cp = new ClasspathResourceLoader();
    exist = cp.exist("/template/resourceloader/cp.txt");
    AssertJUnit.assertTrue(exist);
}
Also used : FileResourceLoader(org.beetl.core.resource.FileResourceLoader) ClasspathResourceLoader(org.beetl.core.resource.ClasspathResourceLoader) Test(org.testng.annotations.Test)

Example 12 with ClasspathResourceLoader

use of org.beetl.core.resource.ClasspathResourceLoader in project beetl2.0 by javamonkey.

the class ErrorTest method main.

public static void main(String[] args) throws Exception {
    ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader();
    Configuration cfg = Configuration.defaultConfiguration();
    GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
    Template t = gt.getTemplate("/org/beetl/sample/s0125/error1.txt");
    String str = t.render();
    t = gt.getTemplate("/org/beetl/sample/s0125/error2.txt");
    str = t.render();
    System.out.println(str);
}
Also used : Configuration(org.beetl.core.Configuration) ClasspathResourceLoader(org.beetl.core.resource.ClasspathResourceLoader) GroupTemplate(org.beetl.core.GroupTemplate) GroupTemplate(org.beetl.core.GroupTemplate) Template(org.beetl.core.Template)

Aggregations

ClasspathResourceLoader (org.beetl.core.resource.ClasspathResourceLoader)12 Configuration (org.beetl.core.Configuration)9 GroupTemplate (org.beetl.core.GroupTemplate)9 Template (org.beetl.core.Template)4 IOException (java.io.IOException)3 HashMap (java.util.HashMap)2 Bean (org.springframework.context.annotation.Bean)2 BeetlConfiguration (com.ikoori.vip.server.core.beetl.BeetlConfiguration)1 ToolUtil (com.ikoori.vip.server.core.util.ToolUtil)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Properties (java.util.Properties)1 FileResourceLoader (org.beetl.core.resource.FileResourceLoader)1 BeetlGroupUtilConfiguration (org.beetl.ext.spring.BeetlGroupUtilConfiguration)1 Test (org.testng.annotations.Test)1