Examples of JapidAbstractCompiler


Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  @Test
  public void testActionInvocation() throws IOException {
    String src = readFile("tests/actions.html");
   
    JapidTemplate bt = new JapidTemplate("tests/actions.html", src);
    JapidAbstractCompiler cp = new JapidTemplateCompiler ();
    cp.compile(bt);
    String source = bt.javaSource;
    System.out.println(source);
    assertTrue("invalid java code", JavaSyntaxTool.isValid(source));
    assertTrue(source.contains("MyController.foo()"));
    assertTrue(source.contains("MyController.bar()"));
View Full Code Here

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

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

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  public void testTagCalls() throws IOException {
    String srcFile = "tests/tagCalls.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("tagCalls.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("((tag)(new tag(getOut()).setActionRunners(getActionRunners()))).render(a)"));
    assertTrue(code.contains("new tag(tagCalls.this).render"));
View Full Code Here

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  public void testRecursiveTags() throws IOException {
    String srcFile = "tests/recursiveTagging.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("tests/recursiveTagging.html", src);
    JapidAbstractCompiler cp = new JapidTemplateCompiler ();
    cp.compile(bt);
    String code = bt.javaSource;
    System.out.println(code);
    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
    assertTrue(code.contains("new recursiveTagging(recursiveTagging.this).render"));
  }
View Full Code Here

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  public void testTagline() throws IOException, ParseException {
    String srcFile = "tests/tagline.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("tagline.html", src);
    JapidAbstractCompiler cp = new JapidTemplateCompiler ();
    cp.compile(bt);
    String code = bt.javaSource;
    System.out.println(code);
    CompilationUnit cu = JavaSyntaxTool.parse(code);
//    System.out.println(cu);
View Full Code Here

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  public void testTagNamedArgsWithBody() throws IOException, ParseException {
    String srcFile = "tests/callTagWithBody.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("tests/callTagWithBody.html", src);
    JapidAbstractCompiler cp = new JapidTemplateCompiler ();
    cp.compile(bt);
    String code = bt.javaSource;
    assertTrue("invalid java code", JavaSyntaxTool.isValid(code));
    System.out.println(code);
   
  }
View Full Code Here

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

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

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  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

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  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("((anotherTag)(new anotherTag(getOut())).setActionRunners(getActionRunners())).render(echo, new anotherTag.DoBody<String>(){"));
    assertTrue(bt.javaSource.contains("new moreTag(tagBody.this)"));
  }
View Full Code Here

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  @Test
  public void testElvisEscape() throws IOException {
    String src = "~{ a ?: b}";
   
    JapidTemplate bt = new JapidTemplate("baba.html", src);
    JapidAbstractCompiler cp = new JapidTemplateCompiler ();
    cp.compile(bt);
    System.out.println(bt.javaSource);
    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
  }
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.