Package oi.thekraken.grok.api

Examples of oi.thekraken.grok.api.Grok.compile()


    boolean thrown = false;

    /** This should always throw */
    for (String regx : badRegxp) {
      try {
        g.compile(regx);
      } catch (PatternSyntaxException e) {
        thrown = true;
      }
      assertTrue(thrown);
      thrown = false;
View Full Code Here


    regxp.add("(test)");
    regxp.add("(?:hello)");
    regxp.add("(?=testing)");

    for (String regx : regxp) {
      g.compile(regx);
    }
  }

  @Test
  public void test003_samePattern() throws GrokException {
View Full Code Here

  @Test
  public void test003_samePattern() throws GrokException {
    Grok g = Grok.create("patterns/patterns");

    String pattern = "Hello World";
    g.compile(pattern);
    assertEquals(pattern, g.getOriginalGrokPattern());
  }

  @Test
  public void test004_sameExpantedPatern() throws GrokException {
View Full Code Here

  @Test
  public void test004_sameExpantedPatern() throws GrokException {
    Grok g = Grok.create("patterns/patterns");

    g.addPattern("test", "hello world");
    g.compile("%{test}");
    assertEquals("(?<name0>hello world)", g.getNamedRegex());
  }

  @Test
  public void test005_testLoadPatternFromFile() throws IOException, GrokException{
View Full Code Here

    BufferedWriter bw = new BufferedWriter(new FileWriter(temp));
    bw.write("TEST \\d+");
    bw.close();

    Grok grok = Grok.create(temp.getAbsolutePath());
    grok.compile("%{TEST}");
    assertEquals("(?<name0>\\d+)", grok.getNamedRegex());
    temp.delete();
  }

}
View Full Code Here

  @Test
  public void test001_linux_messages() throws GrokException, IOException {
    Grok g = new Grok();
    g.addPatternFromFile("patterns/patterns");
    g.compile("%{MESSAGESLOG}");

    BufferedReader br = new BufferedReader(new FileReader(LOG_FILE));
    String line;
    System.out.println("Starting test with linux messages log -- may take a while");
    while ((line = br.readLine()) != null) {
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.