Search in sources :

Example 1 with EventIndexTemplateProvider

use of org.graylog2.indexer.EventIndexTemplateProvider in project graylog2-server by Graylog2.

the class EventsIndexMappingTest method createsValidMappingTemplates.

@ParameterizedTest
@ValueSource(strings = { "5.0.0", "6.0.0", "7.0.0" })
void createsValidMappingTemplates(String versionString) throws Exception {
    final SearchVersion version = SearchVersion.elasticsearch(versionString);
    final IndexMappingTemplate mapping = new EventIndexTemplateProvider().create(version, null);
    assertJsonPath(mapping.toTemplate(indexSetConfig, "test_*"), at -> {
        at.jsonPathAsString("$.index_patterns").isEqualTo("test_*");
        at.jsonPathAsInteger("$.order").isEqualTo(-1);
        assertStandardMappingValues(at, version);
    });
    assertJsonPath(mapping.toTemplate(indexSetConfig, "test_*", 23), at -> {
        at.jsonPathAsString("$.index_patterns").isEqualTo("test_*");
        at.jsonPathAsInteger("$.order").isEqualTo(23);
        assertStandardMappingValues(at, version);
    });
}
Also used : SearchVersion(org.graylog2.storage.SearchVersion) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

SearchVersion (org.graylog2.storage.SearchVersion)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 ValueSource (org.junit.jupiter.params.provider.ValueSource)1