Search in sources :

Example 16 with EntityExcerpt

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

the class InputFacadeTest method createExcerpt.

@Test
public void createExcerpt() {
    final ImmutableMap<String, Object> fields = ImmutableMap.of("title", "Dashboard Title");
    final InputImpl input = new InputImpl(fields);
    final InputWithExtractors inputWithExtractors = InputWithExtractors.create(input);
    final EntityExcerpt excerpt = facade.createExcerpt(inputWithExtractors);
    assertThat(excerpt.id()).isEqualTo(ModelId.of(input.getId()));
    assertThat(excerpt.type()).isEqualTo(ModelTypes.INPUT_V1);
    assertThat(excerpt.title()).isEqualTo(input.getTitle());
}
Also used : InputImpl(org.graylog2.inputs.InputImpl) EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) Test(org.junit.Test)

Example 17 with EntityExcerpt

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

the class CatalogResourceTest method showEntityIndex.

@Test
public void showEntityIndex() {
    final ImmutableSet<EntityExcerpt> entityExcerpts = ImmutableSet.of(EntityExcerpt.builder().id(ModelId.of("1234567890")).type(ModelType.of("test", "1")).title("Test Entity").build());
    when(mockEntityFacade.listEntityExcerpts()).thenReturn(entityExcerpts);
    final CatalogIndexResponse catalogIndexResponse = catalogResource.showEntityIndex();
    assertThat(catalogIndexResponse.entities()).hasSize(1).containsAll(entityExcerpts);
}
Also used : EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) CatalogIndexResponse(org.graylog2.rest.models.system.contentpacks.responses.CatalogIndexResponse) Test(org.junit.Test)

Example 18 with EntityExcerpt

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

the class InputFacadeTest method listEntityExcerpts.

@Test
@MongoDBFixtures("InputFacadeTest.json")
public void listEntityExcerpts() {
    final EntityExcerpt expectedEntityExcerpt1 = EntityExcerpt.builder().id(ModelId.of("5adf25294b900a0fdb4e5365")).type(ModelTypes.INPUT_V1).title("Global Random HTTP").build();
    final EntityExcerpt expectedEntityExcerpt2 = EntityExcerpt.builder().id(ModelId.of("5acc84f84b900a4ff290d9a7")).type(ModelTypes.INPUT_V1).title("Local Raw UDP").build();
    final EntityExcerpt expectedEntityExcerpt3 = EntityExcerpt.builder().id(ModelId.of("5ae2eb0a3d27464477f0fd8b")).type(ModelTypes.INPUT_V1).title("TEST PLAIN TEXT").build();
    final EntityExcerpt expectedEntityExcerpt4 = EntityExcerpt.builder().id(ModelId.of("5ae2ebbeef27464477f0fd8b")).type(ModelTypes.INPUT_V1).title("TEST PLAIN TEXT").build();
    final Set<EntityExcerpt> entityExcerpts = facade.listEntityExcerpts();
    assertThat(entityExcerpts).containsOnly(expectedEntityExcerpt1, expectedEntityExcerpt2, expectedEntityExcerpt3, expectedEntityExcerpt4);
}
Also used : EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) MongoDBFixtures(org.graylog.testing.mongodb.MongoDBFixtures) Test(org.junit.Test)

Example 19 with EntityExcerpt

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

the class LookupDataAdapterFacadeTest method createExcerpt.

@Test
public void createExcerpt() {
    final DataAdapterDto dataAdapterDto = DataAdapterDto.builder().id("1234567890").name("data-adapter-name").title("Data Adapter Title").description("Data Adapter Description").config(new FallbackAdapterConfig()).build();
    final EntityExcerpt excerpt = facade.createExcerpt(dataAdapterDto);
    assertThat(excerpt.id()).isEqualTo(ModelId.of("1234567890"));
    assertThat(excerpt.type()).isEqualTo(ModelTypes.LOOKUP_ADAPTER_V1);
    assertThat(excerpt.title()).isEqualTo("Data Adapter Title");
}
Also used : DataAdapterDto(org.graylog2.lookup.dto.DataAdapterDto) EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) FallbackAdapterConfig(org.graylog2.plugin.lookup.FallbackAdapterConfig) Test(org.junit.Test)

Example 20 with EntityExcerpt

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

the class OutputFacadeTest method createExcerpt.

@Test
public void createExcerpt() {
    final ImmutableMap<String, Object> configuration = ImmutableMap.of();
    final OutputImpl output = OutputImpl.create("01234567890", "Output Title", "org.graylog2.output.SomeOutputClass", "admin", configuration, new Date(0L), null);
    final EntityExcerpt excerpt = facade.createExcerpt(output);
    assertThat(excerpt.id()).isEqualTo(ModelId.of(output.getId()));
    assertThat(excerpt.type()).isEqualTo(ModelTypes.OUTPUT_V1);
    assertThat(excerpt.title()).isEqualTo(output.getTitle());
}
Also used : EntityExcerpt(org.graylog2.contentpacks.model.entities.EntityExcerpt) OutputImpl(org.graylog2.streams.OutputImpl) Date(java.util.Date) 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