Package oi.thekraken.grok.api

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


    String subname = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_abc:def";
    grok.addPattern(name, "\\w+");
    grok.compile("%{"+name+":"+subname+"}");
    Match m = grok.match("Hello");
    m.captures();
    assertEquals(1, m.toMap().size());
    assertEquals("Hello", m.toMap().get(subname).toString());
    assertEquals("{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_abc:def=Hello}", m.toMap().toString());
  }

}
View Full Code Here


    grok.addPattern(name, "\\w+");
    grok.compile("%{"+name+":"+subname+"}");
    Match m = grok.match("Hello");
    m.captures();
    assertEquals(1, m.toMap().size());
    assertEquals("Hello", m.toMap().get(subname).toString());
    assertEquals("{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_abc:def=Hello}", m.toMap().toString());
  }

}
View Full Code Here

    grok.compile("%{"+name+":"+subname+"}");
    Match m = grok.match("Hello");
    m.captures();
    assertEquals(1, m.toMap().size());
    assertEquals("Hello", m.toMap().get(subname).toString());
    assertEquals("{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_abc:def=Hello}", m.toMap().toString());
  }

}
View Full Code Here

  public void test001_static_metod_factory() throws Throwable {

    Grok staticGrok = Grok.create("patterns/patterns", "%{USERNAME}");
    Match gm = staticGrok.match("root");
    gm.captures();
    assertEquals("{USERNAME=root}", gm.toMap().toString());

    gm = staticGrok.match("r00t");
    gm.captures();
    assertEquals("{USERNAME=r00t}", gm.toMap().toString());
View Full Code Here

    gm.captures();
    assertEquals("{USERNAME=root}", gm.toMap().toString());

    gm = staticGrok.match("r00t");
    gm.captures();
    assertEquals("{USERNAME=r00t}", gm.toMap().toString());

    gm = staticGrok.match("guest");
    gm.captures();
    assertEquals("{USERNAME=guest}", gm.toMap().toString());
View Full Code Here

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

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

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

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

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

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

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

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


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

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

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

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

    gm.captures();
    assertEquals("{USERNAME=root}", gm.toMap().toString());

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

    gm = g.match("guest");
    gm.captures();
    assertEquals("{USERNAME=guest}", gm.toMap().toString());
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.