Search in sources :

Example 6 with GrokTesterResponse

use of org.graylog2.rest.resources.tools.responses.GrokTesterResponse in project graylog2-server by Graylog2.

the class GrokTesterResourceTest method testGrokWithEmptyTestString.

@Test
public void testGrokWithEmptyTestString() {
    final GrokTesterResponse response = resource.grokTest("%{NUMBER}", "", false);
    assertThat(response.matched()).isFalse();
    assertThat(response.pattern()).isEqualTo("%{NUMBER}");
    assertThat(response.string()).isEqualTo("");
    assertThat(response.errorMessage()).isNullOrEmpty();
}
Also used : GrokTesterResponse(org.graylog2.rest.resources.tools.responses.GrokTesterResponse) Test(org.junit.Test)

Example 7 with GrokTesterResponse

use of org.graylog2.rest.resources.tools.responses.GrokTesterResponse in project graylog2-server by Graylog2.

the class GrokTesterResourceTest method testGrokWithValidPatternAndNoMatch.

@Test
public void testGrokWithValidPatternAndNoMatch() {
    final GrokTesterResponse response = resource.grokTest("%{NUMBER}", "abc def", false);
    assertThat(response.matched()).isFalse();
    assertThat(response.pattern()).isEqualTo("%{NUMBER}");
    assertThat(response.string()).isEqualTo("abc def");
    assertThat(response.matches()).isEmpty();
    assertThat(response.errorMessage()).isNullOrEmpty();
}
Also used : GrokTesterResponse(org.graylog2.rest.resources.tools.responses.GrokTesterResponse) Test(org.junit.Test)

Aggregations

GrokTesterResponse (org.graylog2.rest.resources.tools.responses.GrokTesterResponse)7 Test (org.junit.Test)6 Grok (io.krakens.grok.api.Grok)1 GrokCompiler (io.krakens.grok.api.GrokCompiler)1 Match (io.krakens.grok.api.Match)1 GrokException (io.krakens.grok.api.exception.GrokException)1 Map (java.util.Map)1 GrokPattern (org.graylog2.grok.GrokPattern)1