Search in sources :

Example 1 with EntityExcerpt

use of org.graylog2.contentpacks.model.entities.EntityExcerpt in project graylog2-server by Graylog2.

the class EventDefinitionFacadeTest method listExcerpts.

@Test
@MongoDBFixtures("EventDefinitionFacadeTest.json")
public void listExcerpts() {
    final Set<EntityExcerpt> excerpts = facade.listEntityExcerpts();
    final EntityExcerpt excerpt = excerpts.iterator().next();
    assertThat(excerpt.title()).isEqualTo("title");
    assertThat(excerpt.id()).isEqualTo(ModelId.of("5d4032513d2746703d1467f6"));
    assertThat(excerpt.type()).isEqualTo(ModelTypes.EVENT_DEFINITION_V1);
}
Also used : EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) MongoDBFixtures(org.graylog.testing.mongodb.MongoDBFixtures) Test(org.junit.Test)

Example 2 with EntityExcerpt

use of org.graylog2.contentpacks.model.entities.EntityExcerpt in project graylog2-server by Graylog2.

the class GrokPatternFacadeTest method createExcerpt.

@Test
public void createExcerpt() {
    final GrokPattern grokPattern = GrokPattern.create("01234567890", "name", "pattern", null);
    final EntityExcerpt excerpt = facade.createExcerpt(grokPattern);
    assertThat(excerpt.id()).isEqualTo(ModelId.of("01234567890"));
    assertThat(excerpt.type()).isEqualTo(ModelTypes.GROK_PATTERN_V1);
    assertThat(excerpt.title()).isEqualTo(grokPattern.name());
}
Also used : EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) GrokPattern(org.graylog2.grok.GrokPattern) Test(org.junit.Test)

Example 3 with EntityExcerpt

use of org.graylog2.contentpacks.model.entities.EntityExcerpt in project graylog2-server by Graylog2.

the class GrokPatternFacadeTest method listEntityExcerpts.

@Test
public void listEntityExcerpts() throws ValidationException {
    grokPatternService.save(GrokPattern.create("Test1", "[a-z]+"));
    grokPatternService.save(GrokPattern.create("Test2", "[a-z]+"));
    final EntityExcerpt expectedEntityExcerpt1 = EntityExcerpt.builder().id(ModelId.of("1")).type(ModelTypes.GROK_PATTERN_V1).title("Test1").build();
    final EntityExcerpt expectedEntityExcerpt2 = EntityExcerpt.builder().id(ModelId.of("2")).type(ModelTypes.GROK_PATTERN_V1).title("Test2").build();
    final Set<EntityExcerpt> entityExcerpts = facade.listEntityExcerpts();
    assertThat(entityExcerpts).hasSize(2).contains(expectedEntityExcerpt1, expectedEntityExcerpt2);
}
Also used : EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) Test(org.junit.Test)

Example 4 with EntityExcerpt

use of org.graylog2.contentpacks.model.entities.EntityExcerpt in project graylog2-server by Graylog2.

the class LookupCacheFacadeTest method createExcerpt.

@Test
public void createExcerpt() {
    final CacheDto cacheDto = CacheDto.builder().id("1234567890").name("cache-name").title("Cache Title").description("Cache Description").config(new FallbackCacheConfig()).build();
    final EntityExcerpt excerpt = facade.createExcerpt(cacheDto);
    assertThat(excerpt.id()).isEqualTo(ModelId.of("1234567890"));
    assertThat(excerpt.type()).isEqualTo(ModelTypes.LOOKUP_CACHE_V1);
    assertThat(excerpt.title()).isEqualTo("Cache Title");
}
Also used : EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) CacheDto(org.graylog2.lookup.dto.CacheDto) FallbackCacheConfig(org.graylog2.plugin.lookup.FallbackCacheConfig) Test(org.junit.Test)

Example 5 with EntityExcerpt

use of org.graylog2.contentpacks.model.entities.EntityExcerpt in project graylog2-server by Graylog2.

the class LookupCacheFacadeTest method listEntityExcerpts.

@Test
@MongoDBFixtures("LookupCacheFacadeTest.json")
public void listEntityExcerpts() {
    final EntityExcerpt expectedEntityExcerpt = EntityExcerpt.builder().id(ModelId.of("5adf24b24b900a0fdb4e52dd")).type(ModelTypes.LOOKUP_CACHE_V1).title("No-op cache").build();
    final Set<EntityExcerpt> entityExcerpts = facade.listEntityExcerpts();
    assertThat(entityExcerpts).containsOnly(expectedEntityExcerpt);
}
Also used : EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) MongoDBFixtures(org.graylog.testing.mongodb.MongoDBFixtures) Test(org.junit.Test)

Aggregations

EntityExcerpt (org.graylog2.contentpacks.model.entities.EntityExcerpt)27 Test (org.junit.Test)26 MongoDBFixtures (org.graylog.testing.mongodb.MongoDBFixtures)15 NotFoundException (javax.ws.rs.NotFoundException)2 Date (java.util.Date)1 NotificationDto (org.graylog.events.notifications.NotificationDto)1 EventDefinitionDto (org.graylog.events.processor.EventDefinitionDto)1 GRN (org.graylog.grn.GRN)1 PipelineDao (org.graylog.plugins.pipelineprocessor.db.PipelineDao)1 RuleDao (org.graylog.plugins.pipelineprocessor.db.RuleDao)1 Collector (org.graylog.plugins.sidecar.rest.models.Collector)1 ViewDTO (org.graylog.plugins.views.search.views.ViewDTO)1 ViewSummaryDTO (org.graylog.plugins.views.search.views.ViewSummaryDTO)1 EntityDescriptor (org.graylog2.contentpacks.model.entities.EntityDescriptor)1 GrokPattern (org.graylog2.grok.GrokPattern)1 InputImpl (org.graylog2.inputs.InputImpl)1 CacheDto (org.graylog2.lookup.dto.CacheDto)1 DataAdapterDto (org.graylog2.lookup.dto.DataAdapterDto)1 LookupTableDto (org.graylog2.lookup.dto.LookupTableDto)1 FallbackAdapterConfig (org.graylog2.plugin.lookup.FallbackAdapterConfig)1