use of org.graylog2.rest.models.system.grokpattern.requests.GrokPatternTestRequest in project graylog2-server by Graylog2.
the class GrokResourceTest method testPatternWithSampleData.
@Test
public void testPatternWithSampleData() throws Exception {
final String sampleData = "1.2.3.4";
final GrokPattern grokPattern = GrokPattern.create("IP", "\\d.\\d.\\d.\\d");
grokPatternService.save(grokPattern);
final GrokPatternTestRequest grokPatternTestRequest = GrokPatternTestRequest.create(grokPattern, sampleData);
final Map<String, Object> expectedReturn = Collections.singletonMap("IP", "1.2.3.4");
final Response response = grokResource.testPattern(grokPatternTestRequest);
assertThat(response.hasEntity()).isTrue();
assertThat(response.getEntity()).isEqualTo(expectedReturn);
}
Aggregations