Package oi.thekraken.grok.api

Examples of oi.thekraken.grok.api.Match.toMap()


    gm.captures();
    assertEquals("{USER=r00t}", gm.toMap().toString());

    gm = g.match("guest");
    gm.captures();
    assertEquals("{USER=guest}", gm.toMap().toString());

    gm = g.match("guest1234");
    gm.captures();
    assertEquals("{USER=guest1234}", gm.toMap().toString());
View Full Code Here


    gm.captures();
    assertEquals("{USER=guest}", gm.toMap().toString());

    gm = g.match("guest1234");
    gm.captures();
    assertEquals("{USER=guest1234}", gm.toMap().toString());

    gm = g.match("john doe");
    gm.captures();
    assertEquals("{USER=john}", gm.toMap().toString());
  }
View Full Code Here

    gm.captures();
    assertEquals("{USER=guest1234}", gm.toMap().toString());

    gm = g.match("john doe");
    gm.captures();
    assertEquals("{USER=john}", gm.toMap().toString());
  }

  @Test
  public void test002_numbers() throws Throwable {
View Full Code Here

    g.addPatternFromFile("patterns/patterns");
    g.compile("%{NUMBER}");

    Match gm = g.match("-42");
    gm.captures();
    assertEquals("{NUMBER=-42}", gm.toMap().toString());

  }

  @Test
  public void test003_word() throws Throwable {
View Full Code Here

    g.addPatternFromFile("patterns/patterns");
    g.compile("%{WORD}");

    Match gm = g.match("a");
    gm.captures();
    assertEquals("{WORD=a}", gm.toMap().toString());

    gm = g.match("abc");
    gm.captures();
    assertEquals("{WORD=abc}", gm.toMap().toString());
View Full Code Here

    gm.captures();
    assertEquals("{WORD=a}", gm.toMap().toString());

    gm = g.match("abc");
    gm.captures();
    assertEquals("{WORD=abc}", gm.toMap().toString());

  }

  @Test
  public void test004_SPACE() throws Throwable {
View Full Code Here

    g.addPatternFromFile("patterns/patterns");
    g.compile("%{SPACE}");

    Match gm = g.match("abc dc");
    gm.captures();
    assertEquals("{SPACE=}", gm.toMap().toString());

  }

  @Test
  public void test004_number() throws Throwable {
View Full Code Here

    g.addPatternFromFile("patterns/patterns");
    g.compile("%{NUMBER}");

    Match gm = g.match("Something costs $55.4!");
    gm.captures();
    assertEquals("{NUMBER=55.4}", gm.toMap().toString());

  }

  @Test
  public void test005_NOTSPACE() throws Throwable {
View Full Code Here

    g.addPatternFromFile("patterns/patterns");
    g.compile("%{NOTSPACE}");

    Match gm = g.match("abc dc");
    gm.captures();
    assertEquals("{NOTSPACE=abc}", gm.toMap().toString());

  }

  @Test
  public void test006_QUOTEDSTRING() throws Throwable {
View Full Code Here

    g.addPatternFromFile("patterns/patterns");
    g.compile("%{QUOTEDSTRING:text}");

    Match gm = g.match("\"abc dc\"");
    gm.captures();
    assertEquals("{text=abc dc}", gm.toMap().toString());

  }

  @Test
  public void test007_UUID() throws Throwable {
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.