use of org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel in project kie-wb-common by kiegroup.
the class FormDefinitionGeneratorImplTest method testGenerateAllForms.
@Test
public void testGenerateAllForms() {
generator.generateAllForms(diagram);
verify(generator, times(4)).createFormForModel(formModelArgumentCaptor.capture(), any());
verify(formDefinitionSerializer, times(4)).serialize(formDefinitionArgumentCaptor.capture());
verify(ioService, times(1)).startBatch(any());
verify(ioService, times(1)).getFileSystem(any());
verify(ioService, times(4)).createFile(any());
verify(ioService, times(4)).write(any(), Mockito.<String>any());
verify(ioService, times(1)).endBatch();
List<JBPMFormModel> formModels = formModelArgumentCaptor.getAllValues();
List<FormDefinition> forms = formDefinitionArgumentCaptor.getAllValues();
Assertions.assertThat(formModels).isNotEmpty().hasSize(forms.size()).hasSize(4);
for (int i = 0; i < formModels.size(); i++) {
JBPMFormModel formModel = formModels.get(i);
FormDefinition form = forms.get(i);
if (formModel instanceof BusinessProcessFormModel) {
checkProcessFormGenerated((BusinessProcessFormModel) formModel, form);
} else {
TaskFormModel taskFormModel = (TaskFormModel) formModel;
checkTaskFormGenerated(taskFormModel, taskFormModel.getTaskName(), form);
}
}
}
use of org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel in project kie-wb-common by kiegroup.
the class AbstractBPMNFormGeneratorServiceTest method launchNestedFormsTest.
protected FormGenerationResult launchNestedFormsTest() {
List<ModelProperty> variableList = new ArrayList<>();
variableList.add(new ModelPropertyImpl(EXPENSE_VARIABLE, new TypeInfoImpl(TypeKind.OBJECT, Expense.class.getName(), false)));
variableList.add(new ModelPropertyImpl(TEXT_VARIABLE, new TypeInfoImpl(String.class.getName())));
BusinessProcessFormModel model = new BusinessProcessFormModel(PROCESS_ID, PROCESS_ID, variableList);
FormGenerationResult result = service.generateForms(model, source);
assertNotNull(result);
assertNotNull(result.getRootForm());
checkRootForm(model, result, variableList);
return result;
}
use of org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel in project kie-wb-common by kiegroup.
the class AbstractBPMNFormGeneratorServiceTest method checkSimpleVariableForms.
protected void checkSimpleVariableForms() {
List<ModelProperty> properties = new ArrayList<>();
properties.add(new ModelPropertyImpl(TEXT_VARIABLE, new TypeInfoImpl(String.class.getName())));
properties.add(new ModelPropertyImpl(INTEGER_VARIABLE, new TypeInfoImpl(Integer.class.getName())));
properties.add(new ModelPropertyImpl(DOUBLE_VARIABLE, new TypeInfoImpl(Double.class.getName())));
properties.add(new ModelPropertyImpl(BOOLEAN_VARIABLE, new TypeInfoImpl(Boolean.class.getName())));
properties.add(new ModelPropertyImpl(DATE_VARIABLE, new TypeInfoImpl(Date.class.getName())));
BusinessProcessFormModel model = new BusinessProcessFormModel(PROCESS_ID, PROCESS_ID, properties);
FormGenerationResult result = service.generateForms(model, source);
assertNotNull(result);
assertNotNull(result.getRootForm());
assertTrue(result.getNestedForms().isEmpty());
checkRootForm(model, result, properties);
}
use of org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel in project kie-wb-common by kiegroup.
the class AbstractBPMNFormGeneratorServiceTest method launchNestedFormWithCyclicReference.
protected FormGenerationResult launchNestedFormWithCyclicReference() {
List<ModelProperty> variableList = new ArrayList<>();
variableList.add(new ModelPropertyImpl("person", new TypeInfoImpl(TypeKind.OBJECT, Person.class.getName(), false)));
BusinessProcessFormModel model = new BusinessProcessFormModel(PROCESS_ID, PROCESS_ID, variableList);
FormGenerationResult result = service.generateForms(model, source);
assertNotNull(result);
assertNotNull(result.getRootForm());
checkRootForm(model, result, variableList);
return result;
}
use of org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel in project kie-wb-common by kiegroup.
the class BPMFinderServiceImpl method parseToModel.
private JBPMProcessModel parseToModel(final Definitions definitions, final Path path) {
BusinessProcessFormModel processFormModel = bpmnFormModelGenerator.generateProcessFormModel(definitions, path);
List<TaskFormModel> taskModels = bpmnFormModelGenerator.generateTaskFormModels(definitions, path);
return new JBPMProcessModel(processFormModel, taskModels);
}
Aggregations