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());
}
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);
}
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);
}
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");
}
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());
}
Aggregations