@VisibleForTesting
    Entity exportNativeEntity(Collector collector, EntityDescriptorIds entityDescriptorIds) {
        final SidecarCollectorEntity collectorEntity = SidecarCollectorEntity.create(
                ValueReference.of(collector.name()),
                ValueReference.of(collector.serviceType()),
                ValueReference.of(collector.nodeOperatingSystem()),
                ValueReference.of(collector.executablePath()),
                collector.executeParameters() != null ? ValueReference.of(collector.executeParameters()) : null,
                collector.validationParameters() != null ? ValueReference.of(collector.validationParameters()) : null,
                ValueReference.of(collector.defaultTemplate()));

        final JsonNode data = objectMapper.convertValue(collectorEntity, JsonNode.class);
        return EntityV1.builder()
                .id(ModelId.of(entityDescriptorIds.getOrThrow(collector.id(), ModelTypes.SIDECAR_COLLECTOR_V1)))
                .type(TYPE_V1)
                .data(data)
                .build();
    }
@Test
    @MongoDBFixtures("SidecarCollectorFacadeTest.json")
    public void exportNativeEntity() {
        final Collector collector = collectorService.find("5b4c920b4b900a0024af0001");
        final EntityDescriptor descriptor = EntityDescriptor.create(collector.id(), ModelTypes.SIDECAR_COLLECTOR_V1);
        final EntityDescriptorIds entityDescriptorIds = EntityDescriptorIds.of(descriptor);
        final Entity entity = facade.exportNativeEntity(collector, entityDescriptorIds);

        assertThat(entity).isInstanceOf(EntityV1.class);
        assertThat(entity.id()).isEqualTo(ModelId.of(entityDescriptorIds.get(descriptor).orElse(null)));
        assertThat(entity.type()).isEqualTo(ModelTypes.SIDECAR_COLLECTOR_V1);

        final EntityV1 entityV1 = (EntityV1) entity;
        final SidecarCollectorEntity collectorEntity = objectMapper.convertValue(entityV1.data(), SidecarCollectorEntity.class);

        assertThat(collectorEntity.name()).isEqualTo(ValueReference.of("filebeat"));
        assertThat(collectorEntity.serviceType()).isEqualTo(ValueReference.of("exec"));
        assertThat(collectorEntity.nodeOperatingSystem()).isEqualTo(ValueReference.of("linux"));
        assertThat(collectorEntity.executablePath()).isEqualTo(ValueReference.of("/usr/lib/graylog-sidecar/filebeat"));
        assertThat(collectorEntity.executeParameters()).isEqualTo(ValueReference.of("-c %s"));
        assertThat(collectorEntity.validationParameters()).isEqualTo(ValueReference.of("test config -c %s"));
        assertThat(collectorEntity.defaultTemplate()).isEqualTo(ValueReference.of(""));
    }