use of org.graylog2.streams.OutputImpl in project graylog2-server by Graylog2.
the class OutputFacadeTest method exportEntity.
@Test
public void exportEntity() {
final ImmutableMap<String, Object> configuration = ImmutableMap.of("some-setting", "foobar");
final OutputImpl output = OutputImpl.create("01234567890", "Output Title", "org.graylog2.outputs.LoggingOutput", "admin", configuration, new Date(0L), null);
final EntityDescriptor descriptor = EntityDescriptor.create(output.getId(), ModelTypes.OUTPUT_V1);
final EntityDescriptorIds entityDescriptorIds = EntityDescriptorIds.of(descriptor);
final Entity entity = facade.exportNativeEntity(output, entityDescriptorIds);
assertThat(entity).isInstanceOf(EntityV1.class);
assertThat(entity.id()).isEqualTo(ModelId.of(entityDescriptorIds.get(descriptor).orElse(null)));
assertThat(entity.type()).isEqualTo(ModelTypes.OUTPUT_V1);
final EntityV1 entityV1 = (EntityV1) entity;
final OutputEntity outputEntity = objectMapper.convertValue(entityV1.data(), OutputEntity.class);
assertThat(outputEntity.title()).isEqualTo(ValueReference.of("Output Title"));
assertThat(outputEntity.type()).isEqualTo(ValueReference.of("org.graylog2.outputs.LoggingOutput"));
assertThat(outputEntity.configuration()).containsEntry("some-setting", ValueReference.of("foobar"));
}
use of org.graylog2.streams.OutputImpl 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