Package org.springmodules.util

Examples of org.springmodules.util.StringResource


    public void testResolve_WithEncoding() throws Exception {

        String name = "name";
        String encoding = "encoding";

        StringResource resource = new StringResource("resource");
        loaderControl.expectAndReturn(loader.getResource("name.ext"), resource);

        Template template = new DummyTemplate();
        engineControl.expectAndReturn(engine.createTemplate(resource, encoding), template);
View Full Code Here


    public void testResolve_WithEncodingAndLocale() throws Exception {

        String name = "name";
        String encoding = "encoding";

        StringResource resource = new StringResource("resource");
        loaderControl.expectAndReturn(loader.getResource("name_en_US.ext"), null);
        loaderControl.expectAndReturn(loader.getResource("name_en.ext"), null);
        loaderControl.expectAndReturn(loader.getResource("name.ext"), resource);

        Template template = new DummyTemplate();
View Full Code Here

        engine.afterPropertiesSet();
    }

    public void testCreateTemplate() throws Exception {
        String encoding = "UTF-8";
        Resource resource = new StringResource("Hello ${name}");
        Template template = engine.createTemplate(resource, encoding);

        Map model = new HashMap();
        model.put("name", "Lian");
        assertEquals("Hello Lian", template.generate(model));
View Full Code Here

    public void createTemplate_WithInclude() throws Exception {
        String encoding = "UTF-8";

        loaderControl.expectAndReturn(loader.getResource("name_en_US"), null);
        loaderControl.expectAndReturn(loader.getResource("name_en"), null);
        loaderControl.expectAndReturn(loader.getResource("name"), new StringResource("Hello"));

        Resource resource = new StringResource("<#include \"name\">");

        loaderControl.replay();

        Template template = engine.createTemplate(resource, encoding);
View Full Code Here

        engine.afterPropertiesSet();
    }

    public void testCreateTemplate() throws Exception {
        String encoding = "UTF-8";
        Resource resource = new StringResource("Hello $name");
        Template template = engine.createTemplate(resource, encoding);

        Map model = new HashMap();
        model.put("name", "Daan");
View Full Code Here

    public void testCreateTemplate_WithInclude() throws Exception {
        String encoding = "UTF-8";

        // first, velocity calls the loader to load the resource
        loaderControl.expectAndReturn(loader.getResource("name"), new StringResource("Hello"));

        // second, velocity calls the loader when trying to get the last modified date of the resource.
        loaderControl.expectAndReturn(loader.getResource("name"), null);

        Resource resource = new StringResource("#include( \"name\" )");

        loaderControl.replay();

        Template template = engine.createTemplate(resource, encoding);
View Full Code Here

        engine.afterPropertiesSet();
    }

    public void testCreateTemplate() throws Exception {
        String encoding = "UTF-8";
        Resource resource = new StringResource("Hello ${name}");
        Template template = engine.createTemplate(resource, encoding);

        Map model = new HashMap();
        model.put("name", "Lian");
        assertEquals("Hello Lian", template.generate(model));
View Full Code Here

    public void testCreateTemplate_WithInclude() throws Exception {
        String encoding = "UTF-8";

        loaderControl.expectAndReturn(loader.getResource("name_en_US"), null);
        loaderControl.expectAndReturn(loader.getResource("name_en"), null);
        loaderControl.expectAndReturn(loader.getResource("name"), new StringResource("Hello"));

        Resource resource = new StringResource("<#include \"name\">");

        loaderControl.replay();

        Template template = engine.createTemplate(resource, encoding);
View Full Code Here

    }

    public void testResolve() throws Exception {
        String name = "name";

        StringResource resource = new StringResource("resource");
        loaderControl.expectAndReturn(loader.getResource("prefix/name/suffix"), resource);

        Template template = new DummyTemplate();
        engineControl.expectAndReturn(engine.createTemplate(resource, "UTF-8"), template);
View Full Code Here

    public void testResolve_WithEncoding() throws Exception {
        String name = "name";
        String encoding = "encoding";

        StringResource resource = new StringResource("resource");
        loaderControl.expectAndReturn(loader.getResource("prefix/name/suffix"), resource);

        Template template = new DummyTemplate();
        engineControl.expectAndReturn(engine.createTemplate(resource, encoding), template);
View Full Code Here

TOP

Related Classes of org.springmodules.util.StringResource

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.