@VisibleForTesting
    Entity exportNativeEntity(Output output, EntityDescriptorIds entityDescriptorIds) {
        final OutputEntity outputEntity = OutputEntity.create(
                ValueReference.of(output.getTitle()),
                ValueReference.of(output.getType()),
                toReferenceMap(output.getConfiguration())
        );
        final JsonNode data = objectMapper.convertValue(outputEntity, JsonNode.class);
        final Set<Constraint> constraints = versionConstraints(output);
        return EntityV1.builder()
                .id(ModelId.of(entityDescriptorIds.getOrThrow(output.getId(), ModelTypes.OUTPUT_V1)))
                .type(ModelTypes.OUTPUT_V1)
                .constraints(ImmutableSet.copyOf(constraints))
                .data(data)
                .build();

    }
@Test
    @MongoDBFixtures("OutputFacadeTest.json")
    public void exportNativeEntity() throws NotFoundException {
        final Output output = outputService.load("5adf239e4b900a0fdb4e5197");

        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("STDOUT"));
        assertThat(outputEntity.type()).isEqualTo(ValueReference.of("org.graylog2.outputs.LoggingOutput"));
        assertThat(outputEntity.configuration()).containsEntry("prefix", ValueReference.of("Writing message: "));
    }