use of org.graylog.testing.mongodb.MongoDBFixtures in project graylog2-server by Graylog2.
the class PipelineRuleFacadeTest method findExistingWithDifferentSource.
@Test
@MongoDBFixtures("PipelineRuleFacadeTest.json")
public void findExistingWithDifferentSource() {
final Entity entity = EntityV1.builder().id(ModelId.of("debug")).type(ModelTypes.PIPELINE_RULE_V1).data(objectMapper.convertValue(PipelineRuleEntity.create(ValueReference.of("debug"), ValueReference.of("Debug"), ValueReference.of("rule \"debug\"\nwhen\n true\nthen\n\nend")), JsonNode.class)).build();
assertThatThrownBy(() -> facade.findExisting(entity, Collections.emptyMap())).isInstanceOf(DivergingEntityConfigurationException.class).hasMessage("Different pipeline rule sources for pipeline rule with name \"debug\"");
}
use of org.graylog.testing.mongodb.MongoDBFixtures in project graylog2-server by Graylog2.
the class PipelineRuleFacadeTest method delete.
@Test
@MongoDBFixtures("PipelineRuleFacadeTest.json")
public void delete() throws NotFoundException {
final RuleDao ruleDao = ruleService.loadByName("debug");
assertThat(ruleService.loadAll()).hasSize(2);
facade.delete(ruleDao);
assertThatThrownBy(() -> ruleService.loadByName("debug")).isInstanceOf(NotFoundException.class);
assertThat(ruleService.loadAll()).hasSize(1);
}
use of org.graylog.testing.mongodb.MongoDBFixtures in project graylog2-server by Graylog2.
the class PipelineRuleFacadeTest method resolveEntityDescriptor.
@Test
@MongoDBFixtures("PipelineRuleFacadeTest.json")
public void resolveEntityDescriptor() {
final EntityDescriptor descriptor = EntityDescriptor.create("debug", ModelTypes.PIPELINE_RULE_V1);
final Graph<EntityDescriptor> graph = facade.resolveNativeEntity(descriptor);
assertThat(graph.nodes()).containsOnly(descriptor);
}
use of org.graylog.testing.mongodb.MongoDBFixtures in project graylog2-server by Graylog2.
the class PipelineRuleFacadeTest method resolveEntity.
@Test
@MongoDBFixtures("PipelineRuleFacadeTest.json")
public void resolveEntity() {
final Entity entity = EntityV1.builder().id(ModelId.of("debug")).type(ModelTypes.PIPELINE_RULE_V1).data(objectMapper.convertValue(PipelineRuleEntity.create(ValueReference.of("debug"), ValueReference.of("Debug"), ValueReference.of("rule \"debug\"\nwhen\n true\nthen\n debug($message.message);\nend")), 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 SidecarCollectorFacadeTest method createExcerpt.
@Test
@MongoDBFixtures("SidecarCollectorFacadeTest.json")
public void createExcerpt() {
final Collector collector = collectorService.find("5b4c920b4b900a0024af0001");
final EntityExcerpt excerpt = facade.createExcerpt(collector);
assertThat(excerpt.id()).isEqualTo(ModelId.of("5b4c920b4b900a0024af0001"));
assertThat(excerpt.type()).isEqualTo(ModelTypes.SIDECAR_COLLECTOR_V1);
assertThat(excerpt.title()).isEqualTo("filebeat");
}
Aggregations