use of org.graylog2.contentpacks.model.entities.NativeEntity in project graylog2-server by Graylog2.
the class PipelineFacadeTest method findExisting.
@Test
@MongoDBFixtures("PipelineFacadeTest/pipelines.json")
public void findExisting() {
final Entity entity = EntityV1.builder().id(ModelId.of("1")).type(ModelTypes.PIPELINE_V1).data(objectMapper.convertValue(PipelineEntity.create(ValueReference.of("Title"), ValueReference.of("Description"), ValueReference.of("pipeline \"Title\"\nstage 0 match either\nrule \"debug\"\nrule \"no-op\"\nend"), Collections.singleton(ValueReference.of("5adf23894b900a0f00000001"))), JsonNode.class)).build();
final Optional<NativeEntity<PipelineDao>> existingEntity = facade.findExisting(entity, Collections.emptyMap());
assertThat(existingEntity).isEmpty();
}
use of org.graylog2.contentpacks.model.entities.NativeEntity in project graylog2-server by Graylog2.
the class InputFacadeTest method findExisting.
@Test
@MongoDBFixtures("InputFacadeTest.json")
public void findExisting() {
final Map<String, Object> configuration = new HashMap<>();
configuration.put("override_source", null);
configuration.put("recv_buffer_size", 262144);
configuration.put("bind_address", "127.0.0.1");
configuration.put("port", 5555);
configuration.put("number_worker_threads", 8);
final Entity entity = EntityV1.builder().id(ModelId.of("5acc84f84b900a4ff290d9a7")).type(ModelTypes.INPUT_V1).data(objectMapper.convertValue(InputEntity.create(ValueReference.of("Local Raw UDP"), ReferenceMapUtils.toReferenceMap(configuration), Collections.emptyMap(), ValueReference.of("org.graylog2.inputs.raw.udp.RawUDPInput"), ValueReference.of(false), Collections.emptyList()), JsonNode.class)).build();
final Optional<NativeEntity<InputWithExtractors>> existingInput = facade.findExisting(entity, Collections.emptyMap());
assertThat(existingInput).isEmpty();
}
use of org.graylog2.contentpacks.model.entities.NativeEntity in project graylog2-server by Graylog2.
the class LookupDataAdapterFacadeTest method createNativeEntity.
@Test
public void createNativeEntity() {
final Entity entity = EntityV1.builder().id(ModelId.of("1")).type(ModelTypes.LOOKUP_ADAPTER_V1).data(objectMapper.convertValue(LookupDataAdapterEntity.create(ValueReference.of("http-dsv"), ValueReference.of("HTTP DSV"), ValueReference.of("HTTP DSV"), ReferenceMapUtils.toReferenceMap(Collections.emptyMap())), JsonNode.class)).build();
assertThat(dataAdapterService.findAll()).isEmpty();
final NativeEntity<DataAdapterDto> nativeEntity = facade.createNativeEntity(entity, Collections.emptyMap(), Collections.emptyMap(), "username");
assertThat(nativeEntity.descriptor().id()).isNotNull();
assertThat(nativeEntity.descriptor().type()).isEqualTo(ModelTypes.LOOKUP_ADAPTER_V1);
assertThat(nativeEntity.entity().name()).isEqualTo("http-dsv");
assertThat(nativeEntity.entity().title()).isEqualTo("HTTP DSV");
assertThat(nativeEntity.entity().description()).isEqualTo("HTTP DSV");
assertThat(dataAdapterService.findAll()).hasSize(1);
}
use of org.graylog2.contentpacks.model.entities.NativeEntity in project graylog2-server by Graylog2.
the class OutputFacadeTest method findExisting.
@Test
@MongoDBFixtures("OutputFacadeTest.json")
public void findExisting() {
final Entity entity = EntityV1.builder().id(ModelId.of("1")).type(ModelTypes.OUTPUT_V1).data(objectMapper.convertValue(OutputEntity.create(ValueReference.of("STDOUT"), ValueReference.of("org.graylog2.outputs.LoggingOutput"), ReferenceMapUtils.toReferenceMap(ImmutableMap.of("prefix", "Writing message: "))), JsonNode.class)).build();
final Optional<NativeEntity<Output>> existingOutput = facade.findExisting(entity, Collections.emptyMap());
assertThat(existingOutput).isEmpty();
}
use of org.graylog2.contentpacks.model.entities.NativeEntity in project graylog2-server by Graylog2.
the class OutputFacadeTest method createNativeEntity.
@Test
public void createNativeEntity() {
final Entity entity = EntityV1.builder().id(ModelId.of("1")).type(ModelTypes.OUTPUT_V1).data(objectMapper.convertValue(OutputEntity.create(ValueReference.of("STDOUT"), ValueReference.of("org.graylog2.outputs.LoggingOutput"), ReferenceMapUtils.toReferenceMap(ImmutableMap.of("prefix", "Writing message: "))), JsonNode.class)).build();
final NativeEntity<Output> nativeEntity = facade.createNativeEntity(entity, Collections.emptyMap(), Collections.emptyMap(), "username");
assertThat(nativeEntity.descriptor().type()).isEqualTo(ModelTypes.OUTPUT_V1);
assertThat(nativeEntity.entity().getTitle()).isEqualTo("STDOUT");
assertThat(nativeEntity.entity().getType()).isEqualTo("org.graylog2.outputs.LoggingOutput");
assertThat(nativeEntity.entity().getCreatorUserId()).isEqualTo("username");
assertThat(nativeEntity.entity().getConfiguration()).containsEntry("prefix", "Writing message: ");
}
Aggregations