use of io.gravitee.am.model.Form in project gravitee-access-management by gravitee-io.
the class FormServiceTest method shouldFindAll.
@Test
public void shouldFindAll() {
Form form = new Form();
when(formRepository.findAll(ReferenceType.ORGANIZATION)).thenReturn(Flowable.just(form));
TestSubscriber<Form> obs = formService.findAll(ReferenceType.ORGANIZATION).test();
obs.awaitTerminalEvent();
obs.assertComplete();
obs.assertValue(form);
}
use of io.gravitee.am.model.Form in project gravitee-access-management by gravitee-io.
the class FormManagerImpl method removeForm.
private void removeForm(String formId) {
logger.info("Domain {} has received form event, delete form {}", domain.getName(), formId);
Form deletedForm = forms.remove(formId);
if (deletedForm != null) {
((DomainBasedTemplateResolver) templateResolver).removeForm(getTemplateName(deletedForm));
}
}
use of io.gravitee.am.model.Form in project gravitee-access-management by gravitee-io.
the class FormRepositoryTest method shouldFindById_withRef.
@Test
public void shouldFindById_withRef() {
Form form = buildForm();
Form createdForm = repository.create(form).blockingGet();
TestObserver<Form> testObserver = repository.findById(createdForm.getReferenceType(), createdForm.getReferenceId(), createdForm.getId()).test();
testObserver.awaitTerminalEvent();
testObserver.assertComplete();
testObserver.assertNoErrors();
assertEqualsTo(form, createdForm.getId(), testObserver);
}
use of io.gravitee.am.model.Form in project gravitee-access-management by gravitee-io.
the class FormRepositoryTest method shouldFindAllByReference.
@Test
public void shouldFindAllByReference() {
final int loop = 10;
for (int i = 0; i < loop; i++) {
final Form form = buildForm();
form.setReferenceId(FIXED_REF_ID);
repository.create(form).blockingGet();
}
for (int i = 0; i < loop; i++) {
// random ref id
repository.create(buildForm()).blockingGet();
}
TestObserver<List<Form>> testObserver = repository.findAll(ReferenceType.DOMAIN, FIXED_REF_ID).toList().test();
testObserver.awaitTerminalEvent();
testObserver.assertNoErrors();
testObserver.assertValue(l -> l.size() == loop);
testObserver.assertValue(l -> l.stream().map(Form::getId).distinct().count() == loop);
}
use of io.gravitee.am.model.Form in project gravitee-access-management by gravitee-io.
the class FormRepositoryTest method buildForm.
protected Form buildForm() {
Form form = new Form();
String randomString = UUID.randomUUID().toString();
form.setClient("client" + randomString);
form.setContent("content" + randomString);
form.setReferenceId("ref" + randomString);
form.setReferenceType(ReferenceType.DOMAIN);
form.setTemplate("tpl" + randomString);
form.setAssets("assets" + randomString);
form.setEnabled(true);
form.setCreatedAt(new Date());
form.setUpdatedAt(new Date());
return form;
}
Aggregations