use of io.kestra.core.models.flows.Flow in project kestra by kestra-io.
the class KafkaElasticIndexerTest method buildExecutionRecord.
private ConsumerRecord<String, String> buildExecutionRecord(String topic, int offset) throws JsonProcessingException {
Flow flow = TestsUtils.mockFlow();
Execution execution = TestsUtils.mockExecution(flow, ImmutableMap.of());
return buildRecord(topic, execution.getId(), JacksonMapper.ofJson().writeValueAsString(execution), offset);
}
use of io.kestra.core.models.flows.Flow in project kestra by kestra-io.
the class ElasticSearchFlowRepository method delete.
@Override
public Flow delete(Flow flow) {
Flow deleted = flow.toDeleted();
flowQueue.emit(deleted);
this.deleteRequest(INDEX_NAME, flowId(deleted));
this.putRequest(REVISIONS_NAME, deleted.uid(), deleted);
ListUtils.emptyOnNull(flow.getTriggers()).forEach(abstractTrigger -> triggerQueue.delete(Trigger.of(flow, abstractTrigger)));
eventPublisher.publishEvent(new CrudEvent<>(flow, CrudEventType.DELETE));
return deleted;
}
use of io.kestra.core.models.flows.Flow in project kestra by kestra-io.
the class YamlFlowParserTest method serialization.
@Test
void serialization() throws IOException {
Flow flow = this.parse("flows/valids/minimal.yaml");
String s = mapper.writeValueAsString(flow);
assertThat(s, is("{\"id\":\"minimal\",\"namespace\":\"io.kestra.tests\",\"revision\":2,\"tasks\":[{\"id\":\"date\",\"type\":\"io.kestra.core.tasks.debugs.Return\",\"format\":\"{{taskrun.startDate}}\"}],\"deleted\":false}"));
}
use of io.kestra.core.models.flows.Flow in project kestra by kestra-io.
the class YamlFlowParserTest method inputs.
@Test
void inputs() {
Flow flow = this.parse("flows/valids/inputs.yaml");
assertThat(flow.getInputs().size(), is(8));
assertThat(flow.getInputs().stream().filter(Input::getRequired).count(), is(6L));
assertThat(flow.getInputs().stream().filter(r -> !r.getRequired()).count(), is(2L));
assertThat(flow.getInputs().stream().filter(r -> r.getDefaults() != null).count(), is(1L));
}
use of io.kestra.core.models.flows.Flow in project kestra by kestra-io.
the class YamlFlowParserTest method triggerEmpty.
@Test
void triggerEmpty() {
Flow parse = this.parse("flows/tests/trigger-empty.yaml");
assertThat(((Schedule) parse.getTriggers().get(0)).getBackfill().getStart(), nullValue());
}
Aggregations