Search in sources :

Example 36 with GrokPattern

use of org.graylog2.grok.GrokPattern in project graylog2-server by Graylog2.

the class V20191121145100_FixDefaultGrokPatternsTest method patternWasModified.

@Test
public void patternWasModified() throws ValidationException {
    final GrokPattern pattern = GrokPattern.builder().name(PATTERN_NAME).pattern("modified").build();
    when(grokPatternService.loadByName(PATTERN_NAME)).thenReturn(Optional.of(pattern));
    migration.upgrade();
    verify(grokPatternService, never()).update(any(GrokPattern.class));
    verify(configService).write(MigrationCompleted.create(Collections.singleton(PATTERN_NAME)));
}
Also used : GrokPattern(org.graylog2.grok.GrokPattern) Test(org.junit.Test)

Aggregations

GrokPattern (org.graylog2.grok.GrokPattern)28 Test (org.junit.Test)15 ValidationException (org.graylog2.plugin.database.ValidationException)9 Timed (com.codahale.metrics.annotation.Timed)7 ApiOperation (io.swagger.annotations.ApiOperation)7 NativeEntityDescriptor (org.graylog2.contentpacks.model.entities.NativeEntityDescriptor)7 GrokException (io.krakens.grok.api.exception.GrokException)6 AuditEvent (org.graylog2.audit.jersey.AuditEvent)6 GrokPatternEntity (org.graylog2.contentpacks.model.entities.GrokPatternEntity)6 NotFoundException (org.graylog2.database.NotFoundException)5 PatternSyntaxException (java.util.regex.PatternSyntaxException)4 Response (javax.ws.rs.core.Response)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 POST (javax.ws.rs.POST)3 Path (javax.ws.rs.Path)3 Entity (org.graylog2.contentpacks.model.entities.Entity)3 EntityDescriptor (org.graylog2.contentpacks.model.entities.EntityDescriptor)3 Before (org.junit.Before)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 Grok (io.krakens.grok.api.Grok)2