Package cn.bran.japid.compiler

Examples of cn.bran.japid.compiler.JapidTemplateCompiler


  public void testVerbatim() throws IOException, ParseException {
    String srcFile = "JapidSample/app/japidviews/Application/verbatim.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("japidviews/Application/verbatim.html", src);
    JapidAbstractCompiler cp = new JapidTemplateCompiler ();
    cp.compile(bt);
    CompilationUnit cu = JavaSyntaxTool.parse(bt.javaSource);
    System.out.println(cu);
  }
View Full Code Here


  public void testTagBlock() throws IOException {
    String srcFile = "JapidSample/app/japidviews/templates/tagBody.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("japidviews/templates/tagBody.html", src);
    JapidAbstractCompiler cp = new JapidTemplateCompiler ();
    cp.compile(bt);
    System.out.println(bt.javaSource);
    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
    assertTrue(bt.javaSource.contains("_fooTag0.render(\"hi\", new fooTag.DoBody(){"));
    assertTrue(bt.javaSource.contains("_anotherTag1.render(echo, new anotherTag.DoBody<String>(){"));
  }
View Full Code Here

  public void testEachDirective() throws IOException {
    String srcFile = "tests/eachTag.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("eachTag.html", src);
    JapidAbstractCompiler cp = new JapidTemplateCompiler ();
    cp.compile(bt);
    System.out.println(bt.javaSource);
    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
    assertTrue(bt.javaSource.contains("final Each _Each0 = new Each(getOut());"));
    assertTrue(bt.javaSource.contains("_Each0.setActionRunners(getActionRunners());"));
    assertTrue(bt.javaSource.contains("_Each0.render(sa, new Each.DoBody<String>(){"));
View Full Code Here

  public void testSetDirective() throws IOException {
    String srcFile = "tests/setTag.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("tests/setTag.html", src);
    JapidAbstractCompiler cp = new JapidTemplateCompiler ();
    cp.compile(bt);
    System.out.println(bt.javaSource);
    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
    assertTrue(bt.javaSource.contains("@Override protected void message() {"));
    assertTrue(bt.javaSource.contains("@Override protected void title() {"));
  }
View Full Code Here

  public void testSimpleInvoke() throws IOException {
    String srcFile = "tests/simpleInvoke.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("simpleInvoke.html", src);
    JapidAbstractCompiler cp = new JapidTemplateCompiler ();
    cp.compile(bt);
    String code = bt.javaSource;
    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
    System.out.println(code);
    assertTrue(code.contains("actionRunners.put(getOut().length(), new cn.bran.play.CacheablePlayActionRunner(\"\", MyController.class, \"action\", s + \"2\") {"));
    assertTrue(code.contains("MyController.action(s);"));
View Full Code Here

  public void testOldInvoke() throws IOException {
    String srcFile = "JapidSample/app/japidviews/Application/authorPanel2.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("simpleInvoke.html", src);
    JapidAbstractCompiler cp = new JapidTemplateCompiler ();
    cp.compile(bt);
    String code = bt.javaSource;
    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
    System.out.println(code);
  }
View Full Code Here

TOP

Related Classes of cn.bran.japid.compiler.JapidTemplateCompiler

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.