Examples of ClassTemplateLoader


Examples of net.sf.lapg.templates.api.impl.ClassTemplateLoader

    Assert.assertEquals("\n88 - 67\n99 - 45\n77 - 54\n\n", q);
  }

  // filter.ltp
  public void testMap() {
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));
    EvaluationContext context = new EvaluationContext(null);
    context.setVariable("util", new DefaultStaticMethods());

    // test 1
    String q = env.executeTemplate("filter.map1", context, null, null);
View Full Code Here

Examples of net.sf.lapg.templates.api.impl.ClassTemplateLoader

    String q = env.executeTemplate("filter.map1", context, null, null);
    Assert.assertEquals("[nbsss -> a3,a45 -> 943q,ano -> yes]\n", q);
  }

  public void testCollect() {
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));
    EvaluationContext context = new EvaluationContext(null);
    context.setVariable("util", new DefaultStaticMethods());

    // test 1
    String q = env.executeTemplate("filter.collectorUnique", context, null, null);
View Full Code Here

Examples of net.sf.lapg.templates.api.impl.ClassTemplateLoader

    q = env.executeTemplate("filter.collectorStd", context, null, null);
    Assert.assertEquals("1A BB BB C D D C ", q);
  }

  public void testCollectMap() {
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));
    EvaluationContext context = new EvaluationContext(null);
    context.setVariable("util", new DefaultStaticMethods());

    // test 1
    String q = env.executeTemplate("filter.collector1", context, null, null);
View Full Code Here

Examples of net.sf.lapg.templates.api.impl.ClassTemplateLoader

    String q = env.executeTemplate("filter.collector1", context, null, null);
    Assert.assertEquals("[1a -> 1A,Bb -> BB,c -> C,d -> D]", q);
  }

  public void testSort() {
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));
    EvaluationContext context = new EvaluationContext(null);
    context.setVariable("util", new DefaultStaticMethods());

    // test 1
    String q = env.executeTemplate("filter.sorted1", context, null, null);
View Full Code Here

Examples of net.sf.lapg.templates.api.impl.ClassTemplateLoader

    Assert.assertEquals("a -> yo1; daa -> yo2; xb -> yo3; 1a -> yo4; ", q);
  }

  // arithm.ltp
  public void testArithm() {
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));

    // test 1
    String q = env.executeTemplate("arithm.arithm1", new EvaluationContext(null), null, null);
    Assert.assertEquals("\n2 = 2\n\n", q);
View Full Code Here

Examples of net.sf.lapg.templates.api.impl.ClassTemplateLoader

  // assert.ltp
  public void testAssert() {
    Hashtable<String,String[]> h = new Hashtable<String,String[]>();
    h.put("list", new String[] { "w1", "w2" });
    TestTemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));

    // test 1
    env.addErrors("Evaluation of `l` failed for java.util.Hashtable: null");
    env.addErrors("Assertion `list.length > 5` failed for java.util.Hashtable");
    env.addErrors("Assertion `list[1] == 'w4'` failed for java.util.Hashtable");
View Full Code Here

Examples of net.sf.lapg.templates.api.impl.ClassTemplateLoader

  // TODO split call & format
  public void testCall() {
    Hashtable<String,String[]> h = new Hashtable<String,String[]>();
    h.put("list", new String[] { "a", "b" });
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));
    EvaluationContext context = new EvaluationContext(h);
    context.setVariable("util", new DefaultStaticMethods());

    // test 1
    String q = env.executeTemplate("format.callTempl", context, null, null);
View Full Code Here

Examples of net.sf.lapg.templates.api.impl.ClassTemplateLoader

  public void testOverrides() {
    Hashtable<String,String[]> h = new Hashtable<String,String[]>();
    h.put("list", new String[] { "a", "b" });
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(),
        new StringTemplateLoader("inline", "${template overrides.my2}go next my2(${call base})\n\n${end}"),
        new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));
    EvaluationContext context = new EvaluationContext(h);
    context.setVariable("util", new DefaultStaticMethods());

    // test 1
    String q = env.executeTemplate("overrides.my1", context, null, null);
View Full Code Here

Examples of net.sf.lapg.templates.api.impl.ClassTemplateLoader

  }

  public void testOverrides2() {
    TestTemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(),
        new StringTemplateLoader("inline", "${template overrides.my1(aa)}go next my1\n\n${end}"),
        new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET));
    EvaluationContext context = new EvaluationContext(null);

    // test 1
    env.addErrors("Template `my1(aa)` is not compatible with base template `my1`");
    env.addErrors("Wrong number of arguments used while calling `my1(aa)`: should be 1 instead of 0");
View Full Code Here

Examples of net.sf.lapg.templates.api.impl.ClassTemplateLoader

    Assert.assertEquals("", q);
  }

  public void testFile() {
    final Map<String,String> fileContent = new HashMap<String,String>();
    TemplatesFacade env = new TestTemplatesFacade(new DefaultNavigationFactory(), new ClassTemplateLoader(getClass().getClassLoader(), TEMPLATES_LOCATION, TEMPLATES_CHARSET)) {
      @Override
      public void createFile(String name, String contents) {
        fileContent.put(name, contents);
      }
    };
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.