Package com.github.mustachejava

Examples of com.github.mustachejava.DefaultMustacheFactory


            ? new StaleSourceScanner(1024, Collections.singleton("**/*." + extension), Collections.<String>emptySet())
            : new SimpleSourceInclusionScanner(Collections.singleton("**/*." + extension), Collections.<String>emptySet());

    scanner.addSourceMapping(new SuffixMapping("." + extension, "." + extension));

    MustacheFactory mustacheFactory = new DefaultMustacheFactory();
    try {
      Set<File> files = scanner.getIncludedSources(sourceDirectory, outputDirectory);

      for (File file : files) {
        try {
          mustacheFactory.compile(new FileReader(file), file.getAbsolutePath());
        } catch (MustacheException e) {
          throw new MojoFailureException(e.getMessage(), e);
        }
      }

View Full Code Here


public class InverterTest extends InvertUtils {

  @Test
  public void testParser() throws IOException {
    DefaultMustacheFactory dmf = new DefaultMustacheFactory();
    Mustache compile = dmf.compile("fdbcli.mustache");
    Path file = getPath("src/test/resources/fdbcli.txt");
    String txt = new String(Files.readAllBytes(file), "UTF-8");
    Node invert = compile.invert(txt);
    System.out.println(invert);
  }
View Full Code Here

    System.out.println(invert);
  }

  @Test
  public void testSimple() throws IOException {
    DefaultMustacheFactory dmf = new DefaultMustacheFactory();
    Mustache test = dmf.compile(new StringReader("test {{value}} test"), "test");
    Node invert = test.invert("test value test");
    Node node = new Node();
    node.put("value", value("value"));
    assertEquals(node, invert);
  }
View Full Code Here

    assertEquals(node, invert);
  }

  @Test
  public void testIterable() throws IOException {
    DefaultMustacheFactory dmf = new DefaultMustacheFactory();
    Mustache test = dmf.compile(new StringReader("{{#values}}\ntest: {{value}}\n{{/values}}"), "test");
    Node invert = test.invert("test: sam\ntest: fred\n");
    Node node = new Node();
    Node sam = new Node();
    sam.put("value", value("sam"));
    Node fred = new Node();
View Full Code Here

    System.out.println(sw);
  }

  @Test
  public void testCollectPoints() throws Exception {
    MustacheFactory dmf = new DefaultMustacheFactory();
    Mustache compile = dmf.compile(new StringReader("{{#page}}This is a {{test}}{{/page}}"),
            UUID.randomUUID().toString());
    Node node = compile.invert("This is a good day");
    assertNotNull(node);
  }
View Full Code Here

    assertNotNull(node);
  }

  @Test
  public void testNoNode() throws Exception {
    MustacheFactory dmf = new DefaultMustacheFactory();
    Mustache compile = dmf.compile(new StringReader("Using cluster file [^\\n]+\nHello World"),
        UUID.randomUUID().toString());
    Node node = compile.invert("Using cluster file `/etc/foundationdb/fdb.cluster'.\nHello World");
    assertNotNull(node);
  }
View Full Code Here

import java.util.Map;

public class InvertToJsonTest extends InvertUtils {
  @Test
  public void testToJson() throws IOException {
    DefaultMustacheFactory dmf = new DefaultMustacheFactory();
    Mustache compile = dmf.compile("fdbcli.mustache");
    Path file = getPath("src/test/resources/fdbcli.txt");
    String txt = new String(Files.readAllBytes(file), "UTF-8");
    Node invert = compile.invert(txt);

    MappingJsonFactory jf = new MappingJsonFactory();
View Full Code Here

    System.out.println(out.toString());
  }

  @Test
  public void testToJson2() throws IOException {
    DefaultMustacheFactory dmf = new DefaultMustacheFactory();
    Mustache compile = dmf.compile("fdbcli2.mustache");
    Path file = getPath("src/test/resources/fdbcli2.txt");
    String txt = new String(Files.readAllBytes(file), "UTF-8");
    Node invert = compile.invert(txt);

    MappingJsonFactory jf = new MappingJsonFactory();
View Full Code Here

    System.out.println(out.toString());
  }

  @Test
  public void testToJson3() throws IOException {
    DefaultMustacheFactory dmf = new DefaultMustacheFactory();
    Mustache compile = dmf.compile("psauxwww.mustache");
    Path file = getPath("src/test/resources/psauxwww.txt");
    String txt = new String(Files.readAllBytes(file), "UTF-8");
    Node invert = compile.invert(txt);

    MappingJsonFactory jf = new MappingJsonFactory();
View Full Code Here

    System.out.println(out.toString());
  }

  @Test
  public void testToJson4() throws IOException {
    DefaultMustacheFactory dmf = new DefaultMustacheFactory();
    Mustache compile = dmf.compile("fdbcli2.mustache");
    Path file = getPath("src/test/resources/fdbcli3.txt");
    String txt = new String(Files.readAllBytes(file), "UTF-8");
    System.out.println("Input text:[");
    System.out.print(txt);
    System.out.println("]");
View Full Code Here

TOP

Related Classes of com.github.mustachejava.DefaultMustacheFactory

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.