Examples of JapidAbstractCompiler


Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  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));
    assertFalse(bt.javaSource.contains("setActionRunners"));
  }
View Full Code Here

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  public void testDoBodyInDef() throws IOException {
    String srcFile = "tests/doBodyInDef.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("doBodyInDef.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

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  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

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  public void testGetDirective() throws IOException, ParseException {
    String srcFile = "tests/getTag.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("tests/getTag.html", src);
    JapidAbstractCompiler cp = new JapidLayoutCompiler();
    cp.compile(bt);
    System.out.println(bt.javaSource);
//    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
    CompilationUnit cu = JavaSyntaxTool.parse(bt.javaSource);
    assertTrue("method is not declared", JavaSyntaxTool.hasMethod(cu, "title", Modifier.PROTECTED, "void", ""));
    assertTrue("method is not declared", JavaSyntaxTool.hasMethod(cu, "footer", Modifier.PROTECTED, "void", ""));
View Full Code Here

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  public void testNamedParams() throws IOException, ParseException {
    String srcFile = "tests/namedParam.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("tests/namedParam.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("new person(namedParam.this).render(named(\"name\", \"Bing\"), named(\"age\", foo(18)))"));
//    assertTrue(bt.javaSource.contains("@Override protected void title() {"));
View Full Code Here

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  public void testInclude() throws IOException, ParseException {
    String srcFile = "tests/include.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 testDefDirective() throws IOException, ParseException {
    String srcFile = "JapidSample/app/japidviews/templates/def.html";
    String src = readFile(srcFile);
   
    JapidTemplate bt = new JapidTemplate("japidviews/templates/def.html", src);
    JapidAbstractCompiler cp = new JapidTemplateCompiler();
    cp.compile(bt);
//    System.out.println(bt.javaSource);
//    assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
    CompilationUnit cu = JavaSyntaxTool.parse(bt.javaSource);
    System.out.println(cu);
    assertTrue("method is not declared", JavaSyntaxTool.hasMethod(cu, "foo", "public", "String", null));
View Full Code Here

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  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

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

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

Examples of cn.bran.japid.compiler.JapidAbstractCompiler

  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
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.