use of io.kestra.core.models.templates.Template in project kestra by kestra-io.
the class AbstractTemplateRepositoryTest method delete.
@Test
void delete() {
Template template = builder().build();
Template save = templateRepository.create(template);
templateRepository.delete(save);
assertThat(templateRepository.findById(template.getNamespace(), template.getId()).isPresent(), is(false));
assertThat(TemplateListener.getEmits().size(), is(2));
assertThat(TemplateListener.getEmits().stream().filter(r -> r.getType() == CrudEventType.CREATE).count(), is(1L));
assertThat(TemplateListener.getEmits().stream().filter(r -> r.getType() == CrudEventType.DELETE).count(), is(1L));
}
use of io.kestra.core.models.templates.Template in project kestra by kestra-io.
the class RestoreQueueService method templates.
public int templates(boolean noRecreate) {
TemplateRepositoryInterface templateRepository = applicationContext.getBean(TemplateRepositoryInterface.class);
List<Template> templates = new ArrayList<>(templateRepository.findAll());
return this.send(templates, QueueFactoryInterface.TEMPLATE_NAMED, Template.class, noRecreate);
}
use of io.kestra.core.models.templates.Template in project kestra by kestra-io.
the class AbstractTemplateRepositoryTest method save.
@Test
void save() {
Template template = builder().build();
Template save = templateRepository.create(template);
assertThat(save.getId(), is(template.getId()));
}
use of io.kestra.core.models.templates.Template in project kestra by kestra-io.
the class AbstractTemplateRepositoryTest method findByNamespace.
@Test
void findByNamespace() {
Template template1 = builder().build();
Template template2 = Template.builder().id(IdUtils.create()).namespace("kestra.test.template").build();
templateRepository.create(template1);
templateRepository.create(template2);
List<Template> templates = templateRepository.findByNamespace(template1.getNamespace());
assertThat(templates.size(), greaterThanOrEqualTo(1));
templates = templateRepository.findByNamespace(template2.getNamespace());
assertThat(templates.size(), is(1));
}
use of io.kestra.core.models.templates.Template in project kestra by kestra-io.
the class AbstractTemplateRepositoryTest method findById.
@Test
void findById() {
Template template = builder().build();
templateRepository.create(template);
Optional<Template> full = templateRepository.findById(template.getNamespace(), template.getId());
assertThat(full.isPresent(), is(true));
full.ifPresent(current -> {
assertThat(full.get().getId(), is(template.getId()));
});
}
Aggregations