Examples of MatchTemplate


Examples of net.sf.jmatchparser.template.MatchTemplate

  private static Map<String, MatchTemplate> cachedScripts = new HashMap<String, MatchTemplate>();

  private static <T> T parse(File dir, String file, String template, String lastupdate, Class<T> resultClass, String... extra) throws Exception {
    System.out.println("*" + file);
    MatchTemplate ps = cachedScripts.get(template);
    if (ps == null) {
      ps = new MatchTemplate(PDARoundtripParser.class, "templates/" + template + ".jmt", "ISO-8859-1");
      ps.enableCoveredStatementsTracing();
      cachedScripts.put(template, ps);
    }
    Parser p = new Parser(ps);
    p.setLocal("lastupdate", lastupdate);
    for (int i = 0; i < extra.length; i += 2) {
View Full Code Here

Examples of net.sf.jmatchparser.template.MatchTemplate

    String template = "MATCH a\n" +
            "$INCLUDE SubFile\n" +
            "$INCLUDE SubFile\n" +
            "ML c\n";
    final String subtemplate = "MATCH b\n";
    MatchTemplate tmpl = new MatchTemplate("plain", new MatchTemplate.MatchTemplateResolver() {
      @Override
      public BufferedReader resolve(String fileName) throws IOException {
        if (!fileName.equals("SubFile"))
          throw new FileNotFoundException(fileName);
        return new BufferedReader(new StringReader(subtemplate));
View Full Code Here

Examples of net.sf.jmatchparser.template.MatchTemplate

  public static void assertTemplateMatches(String text, String template) throws IOException, ParserException, ParserConfigurationException, TransformerException {
    assertTemplateMatches(text, template, "<x/>");
  }

  public static void assertTemplateMatches(String text, String template, String resultXml) throws IOException, ParserException, ParserConfigurationException, TransformerException {
    MatchTemplate tmpl = new MatchTemplate("plain", null, "UnitTest", new BufferedReader(new StringReader(template)), new Formatter[0]);
    Document doc = new Parser(tmpl).parse(text, "x");
    Assert.assertEquals(resultXml, ParameterTests.xmlToString(doc));
  }
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.