use of org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult in project kie-wb-common by kiegroup.
the class FormGenerationIntegrationTest method sameIOTaskFormIsCorrectlyGenerated.
@Test
public void sameIOTaskFormIsCorrectlyGenerated() {
when(module.getRootPath()).thenReturn(rootPathWithNestedForms);
final FormGenerationResult formGenerationResult = generateForm("FormGenerationTest_TaskWithTheSameInputsAndOutputs-taskform.frm", taskFormModels.get(3));
final List<String> expectedProcessFormFields = Arrays.asList("_boolean_", CHECKBOX_FIELDTYPE, "_dataObject_", SUBFORM_FIELDTYPE, "_document_", DOCUMENT_FIELDTYPE, "_float_", DECIMALBOX_FIELDTYPE, "_integer_", INTEGERBOX_FIELDTYPE, "_object_", TEXTAREA_FIELDTYPE, "_string_", TEXTBOX_FIELDTYPE);
final FormDefinition rootForm = formGenerationResult.getRootForm();
testFormDefinition(rootForm, expectedProcessFormFields);
testNestedFormsHaveCorrectId(rootForm, "_dataObject_", DATAOBJECT_FORM_ID);
}
use of org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult in project kie-wb-common by kiegroup.
the class FormGenerationIntegrationTest method differentIOTaskFormIsCorrectlyGenerated.
@Test
public void differentIOTaskFormIsCorrectlyGenerated() {
when(module.getRootPath()).thenReturn(rootPathWithNestedForms);
final FormGenerationResult formGenerationResult = generateForm("FormGenerationTest_TaskWithDifferentInputsAndOutputs-taskform.frm", taskFormModels.get(0));
final List<String> expectedProcessFormFields = Arrays.asList(// inputs
"_boolean", CHECKBOX_FIELDTYPE, "_dataObject", SUBFORM_FIELDTYPE, "_document", DOCUMENT_FIELDTYPE, "_float", DECIMALBOX_FIELDTYPE, "_integer", INTEGERBOX_FIELDTYPE, "_object", TEXTAREA_FIELDTYPE, "_string", TEXTBOX_FIELDTYPE, // outputs
"boolean_", CHECKBOX_FIELDTYPE, "dataObject_", SUBFORM_FIELDTYPE, "document_", DOCUMENT_FIELDTYPE, "float_", DECIMALBOX_FIELDTYPE, "integer_", INTEGERBOX_FIELDTYPE, "object_", TEXTAREA_FIELDTYPE, "string_", TEXTBOX_FIELDTYPE);
final FormDefinition rootForm = formGenerationResult.getRootForm();
testFormDefinition(rootForm, expectedProcessFormFields);
testNestedFormsHaveCorrectId(rootForm, "_dataObject", DATAOBJECT_FORM_ID);
testNestedFormsHaveCorrectId(rootForm, "dataObject_", DATAOBJECT_FORM_ID);
}
use of org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult in project kie-wb-common by kiegroup.
the class FormGenerationIntegrationTest method emptyTaskFormIsCorrectlyGenerated.
@Test
public void emptyTaskFormIsCorrectlyGenerated() {
final FormGenerationResult formGenerationResult = generateForm("FormGenerationTest_EmptyTask-taskform.frm", taskFormModels.get(1));
final FormDefinition rootForm = formGenerationResult.getRootForm();
testFormDefinition(rootForm, Collections.emptyList());
}
use of org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult in project kie-wb-common by kiegroup.
the class DynamicBPMNFormGeneratorImpl method createFormDefinition.
protected Collection<FormDefinition> createFormDefinition(JBPMFormModel model, ClassLoader classLoader) {
FormGenerationResult generationResult = formGeneratorService.generateForms(model, classLoader);
List<FormDefinition> result = new ArrayList<>();
result.add(generationResult.getRootForm());
result.addAll(generationResult.getNestedForms());
return result;
}
use of org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult in project kie-wb-common by kiegroup.
the class AbstractBPMNFormGeneratorServiceTest method launchNestedFormTestWithGeneratedFormsValidation.
protected void launchNestedFormTestWithGeneratedFormsValidation() {
FormGenerationResult result = launchNestedFormsTest();
assertFalse(result.getNestedForms().isEmpty());
assertEquals(3, result.getNestedForms().size());
result.getNestedForms().forEach(form -> {
assertNotNull(form);
assertFalse(form.getFields().isEmpty());
assertTrue(form.getModel() instanceof DataObjectFormModel);
DataObjectFormModel nestedModel = (DataObjectFormModel) form.getModel();
String className = nestedModel.getType();
if (Expense.class.getName().equals(className)) {
testExpenseForm(form);
} else if (Client.class.getName().equals(className)) {
testClientForm(form);
} else if (Line.class.getName().equals(className)) {
testLineForm(form);
} else {
fail();
}
assertNotNull(form.getLayoutTemplate());
assertEquals(form.getFields().size(), form.getLayoutTemplate().getRows().size());
});
}
Aggregations