use of org.graylog2.contentpacks.model.entities.OutputEntity in project graylog2-server by Graylog2.
the class OutputFacadeTest method collectEntity.
@Test
@MongoDBFixtures("OutputFacadeTest.json")
public void collectEntity() {
final EntityDescriptor descriptor = EntityDescriptor.create("5adf239e4b900a0fdb4e5197", ModelTypes.OUTPUT_V1);
final EntityDescriptorIds entityDescriptorIds = EntityDescriptorIds.of(descriptor);
final Optional<Entity> collectedEntity = facade.exportEntity(descriptor, entityDescriptorIds);
assertThat(collectedEntity).isPresent().containsInstanceOf(EntityV1.class);
final EntityV1 entity = (EntityV1) collectedEntity.orElseThrow(AssertionError::new);
assertThat(entity.id()).isEqualTo(ModelId.of(entityDescriptorIds.get(descriptor).orElse(null)));
assertThat(entity.type()).isEqualTo(ModelTypes.OUTPUT_V1);
final OutputEntity outputEntity = objectMapper.convertValue(entity.data(), OutputEntity.class);
assertThat(outputEntity.title()).isEqualTo(ValueReference.of("STDOUT"));
assertThat(outputEntity.type()).isEqualTo(ValueReference.of("org.graylog2.outputs.LoggingOutput"));
assertThat(outputEntity.configuration()).isNotEmpty();
}
Aggregations