use of org.graylog.testing.mongodb.MongoDBFixtures 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.graylog.testing.mongodb.MongoDBFixtures in project graylog2-server by Graylog2.
the class InputFacadeTest method resolveEntity.
@Test
@MongoDBFixtures("InputFacadeTest.json")
public void resolveEntity() {
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 Graph<Entity> graph = facade.resolveForInstallation(entity, Collections.emptyMap(), Collections.emptyMap());
assertThat(graph.nodes()).containsOnly(entity);
}
use of org.graylog.testing.mongodb.MongoDBFixtures in project graylog2-server by Graylog2.
the class InputFacadeTest method delete.
@Test
@MongoDBFixtures("InputFacadeTest.json")
public void delete() throws NotFoundException {
final Input input = inputService.find("5acc84f84b900a4ff290d9a7");
final InputWithExtractors inputWithExtractors = InputWithExtractors.create(input);
assertThat(inputService.totalCount()).isEqualTo(4L);
facade.delete(inputWithExtractors);
assertThat(inputService.totalCount()).isEqualTo(3L);
assertThatThrownBy(() -> inputService.find("5acc84f84b900a4ff290d9a7")).isInstanceOf(NotFoundException.class);
}
use of org.graylog.testing.mongodb.MongoDBFixtures in project graylog2-server by Graylog2.
the class LookupDataAdapterFacadeTest method listEntityExcerpts.
@Test
@MongoDBFixtures("LookupDataAdapterFacadeTest.json")
public void listEntityExcerpts() {
final EntityExcerpt expectedEntityExcerpt = EntityExcerpt.builder().id(ModelId.of("5adf24a04b900a0fdb4e52c8")).type(ModelTypes.LOOKUP_ADAPTER_V1).title("HTTP DSV").build();
final Set<EntityExcerpt> entityExcerpts = facade.listEntityExcerpts();
assertThat(entityExcerpts).containsOnly(expectedEntityExcerpt);
}
use of org.graylog.testing.mongodb.MongoDBFixtures in project graylog2-server by Graylog2.
the class LookupDataAdapterFacadeTest method resolveEntity.
@Test
@MongoDBFixtures("LookupDataAdapterFacadeTest.json")
public void resolveEntity() {
final Entity entity = EntityV1.builder().id(ModelId.of("5adf24a04b900a0fdb4e52c8")).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();
final Graph<Entity> graph = facade.resolveForInstallation(entity, Collections.emptyMap(), Collections.emptyMap());
assertThat(graph.nodes()).containsOnly(entity);
}
Aggregations