Package org.pirkaengine.core

Examples of org.pirkaengine.core.Template.generate()


    @Test
    public void render_prk_debug_true() throws ParseException, PirkaLoadException, TemplateNotFoundException {
        PirkaContext.getInstance().setEnableDebug(true);
        String templateName = "Debug";
        Template tmpl = loader.load(getTemplateFileName(templateName));
        String actual = tmpl.generate().render();
        assertRenderEquals(templateName + ".true", actual);
    }

    /**
     * 非デバック時、表示されない
 
View Full Code Here


    @Test
    public void render_prk_debug_false() throws ParseException, PirkaLoadException, TemplateNotFoundException {
        PirkaContext.getInstance().setEnableDebug(false);
        String templateName = "Debug";
        Template tmpl = loader.load(getTemplateFileName(templateName));
        String actual = tmpl.generate().render();
        assertRenderEquals(templateName + ".false", actual);
    }
}
View Full Code Here

    @Test
    public void render_prk_attr_class() throws ParseException, PirkaLoadException, TemplateNotFoundException {
        String templateName = "Attr.class";
        Template tmpl = loader.load(getTemplateFileName(templateName));
        viewModel.put("selected_class", "selected");
        String actual = tmpl.generate(viewModel).render();
        assertRenderEquals(templateName, actual);
    }

    /**
     * 多重prk:attr.class が正しく置換されること
View Full Code Here

    public void render_prk_attr_multiClass() throws ParseException, PirkaLoadException, TemplateNotFoundException {
        String templateName = "Attr.multiClass";
        Template tmpl = loader.load(getTemplateFileName(templateName));
        viewModel.put("_href", "./about.html");
        viewModel.put("_title", "会社概要");
        String actual = tmpl.generate(viewModel).render();
        assertRenderEquals(templateName, actual);
    }


    /**
 
View Full Code Here

    @Test
    public void render_prk_attr_compositeClass() throws ParseException, PirkaLoadException, TemplateNotFoundException {
        String templateName = "Attr.compositeClass";
        Template tmpl = loader.load(getTemplateFileName(templateName));
        viewModel.put("name", "会社概要");
        String actual = tmpl.generate(viewModel).render();
        assertRenderEquals(templateName, actual);
    }
    /**
     * prk:attr.class が正しく置換されること
     * @throws ParseException
View Full Code Here

    @Test
    public void render_prk_attr_classReplace() throws ParseException, PirkaLoadException, TemplateNotFoundException {
        String templateName = "Attr.classReplace";
        Template tmpl = loader.load(getTemplateFileName(templateName));
        viewModel.put("selected_class", "selected");
        String actual = tmpl.generate(viewModel).render();
        assertRenderEquals(templateName, actual);
    }

    /**
     * prk:attr.class が正しく置換されること
View Full Code Here

    @Test
    public void render_prk_attr_onclick() throws ParseException, PirkaLoadException, TemplateNotFoundException {
        String templateName = "Attr.onclick";
        Template tmpl = loader.load(getTemplateFileName(templateName));
        viewModel.put("script", "alert();");
        String actual = tmpl.generate(viewModel).render();
        assertRenderEquals(templateName, actual);
    }
   
    /**
     * prk:attr.content が正しく置換されること(空要素タグ)
View Full Code Here

    @Test
    public void render_prk_attr_content() throws ParseException, PirkaLoadException, TemplateNotFoundException {
        String templateName = "Attr.content";
        Template tmpl = loader.load(getTemplateFileName(templateName));
        viewModel.put("keywords", "pirka,テンプレートエンジン,Java,Ruby on Rails");
        String actual = tmpl.generate(viewModel).render();
        assertRenderEquals(templateName, actual);
    }
   
    /**
     * prk:attr はParseException
View Full Code Here

    @Test(expected = ParseException.class)
    public void render_prk_attr() throws ParseException, PirkaLoadException, TemplateNotFoundException {
        String templateName = "Attr";
        Template tmpl = loader.load(getTemplateFileName(templateName));
        viewModel.put("script", "alert();");
        tmpl.generate(viewModel).render();
    }
   
}
View Full Code Here

       
        String templateName = "Repeat";
        Template tmpl = loader.load(getTemplateFileName(templateName));
        HashMap<String, Object> viewModel = new HashMap<String, Object>();
        viewModel.put("rate", 4);
        String actual = tmpl.generate(viewModel).render();
        assertRenderEquals(templateName, actual);
        return actual;
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.