Search in sources :

Example 6 with EntityExcerpt

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

the class LookupTableFacadeTest method createExcerpt.

@Test
public void createExcerpt() {
    final LookupTableDto lookupTableDto = LookupTableDto.builder().id("1234567890").name("lookup-table-name").title("Lookup Table Title").description("Lookup Table Description").dataAdapterId("data-adapter-1234").cacheId("cache-1234").defaultSingleValue("default-single").defaultSingleValueType(LookupDefaultValue.Type.STRING).defaultMultiValue("default-multi").defaultMultiValueType(LookupDefaultValue.Type.STRING).build();
    final EntityExcerpt excerpt = facade.createExcerpt(lookupTableDto);
    assertThat(excerpt.id()).isEqualTo(ModelId.of("1234567890"));
    assertThat(excerpt.type()).isEqualTo(ModelTypes.LOOKUP_TABLE_V1);
    assertThat(excerpt.title()).isEqualTo("Lookup Table Title");
}
Also used : EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) LookupTableDto(org.graylog2.lookup.dto.LookupTableDto) Test(org.junit.Test)

Example 7 with EntityExcerpt

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

the class StreamCatalogTest method listEntityExcerpts.

@Test
@MongoDBFixtures("StreamCatalogTest.json")
public void listEntityExcerpts() {
    final EntityExcerpt expectedEntityExcerpt1 = EntityExcerpt.builder().id(ModelId.of("000000000000000000000001")).type(ModelTypes.STREAM_V1).title("All messages").build();
    final EntityExcerpt expectedEntityExcerpt2 = EntityExcerpt.builder().id(ModelId.of("5adf23894b900a0fdb4e517d")).type(ModelTypes.STREAM_V1).title("Test").build();
    final Set<EntityExcerpt> entityExcerpts = facade.listEntityExcerpts();
    assertThat(entityExcerpts).containsOnly(expectedEntityExcerpt1, expectedEntityExcerpt2);
}
Also used : EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) MongoDBFixtures(org.graylog.testing.mongodb.MongoDBFixtures) Test(org.junit.Test)

Example 8 with EntityExcerpt

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

the class StreamCatalogTest method createExcerpt.

@Test
public void createExcerpt() {
    final ImmutableMap<String, Object> fields = ImmutableMap.of("title", "Stream Title");
    final StreamImpl stream = new StreamImpl(fields);
    final EntityExcerpt excerpt = facade.createExcerpt(stream);
    assertThat(excerpt.id()).isEqualTo(ModelId.of(stream.getId()));
    assertThat(excerpt.type()).isEqualTo(ModelTypes.STREAM_V1);
    assertThat(excerpt.title()).isEqualTo(stream.getTitle());
}
Also used : EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) StreamImpl(org.graylog2.streams.StreamImpl) Test(org.junit.Test)

Example 9 with EntityExcerpt

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

the class PipelineRuleFacadeTest method createExcerpt.

@Test
public void createExcerpt() {
    final RuleDao pipelineRule = RuleDao.builder().id("id").title("title").description("description").source("rule \"debug\"\nwhen\n  true\nthen\n  debug($message.message);\nend").build();
    final EntityExcerpt excerpt = facade.createExcerpt(pipelineRule);
    assertThat(excerpt.id()).isEqualTo(ModelId.of("id"));
    assertThat(excerpt.type()).isEqualTo(ModelTypes.PIPELINE_RULE_V1);
    assertThat(excerpt.title()).isEqualTo("title");
}
Also used : RuleDao(org.graylog.plugins.pipelineprocessor.db.RuleDao) EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) Test(org.junit.Test)

Example 10 with EntityExcerpt

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

the class SidecarCollectorFacadeTest method createExcerpt.

@Test
@MongoDBFixtures("SidecarCollectorFacadeTest.json")
public void createExcerpt() {
    final Collector collector = collectorService.find("5b4c920b4b900a0024af0001");
    final EntityExcerpt excerpt = facade.createExcerpt(collector);
    assertThat(excerpt.id()).isEqualTo(ModelId.of("5b4c920b4b900a0024af0001"));
    assertThat(excerpt.type()).isEqualTo(ModelTypes.SIDECAR_COLLECTOR_V1);
    assertThat(excerpt.title()).isEqualTo("filebeat");
}
Also used : EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) Collector(org.graylog.plugins.sidecar.rest.models.Collector) 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