Search in sources :

Example 21 with TaskFormModel

use of org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel 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(), anyString());
    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);
        }
    }
}
Also used : BusinessProcessFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel) JBPMFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.JBPMFormModel) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel) Test(org.junit.Test)

Aggregations

TaskFormModel (org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel)21 Test (org.junit.Test)15 Matchers.anyString (org.mockito.Matchers.anyString)9 BusinessProcessFormModel (org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel)7 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)4 Definitions (org.eclipse.bpmn2.Definitions)4 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)4 FormDefinition (org.kie.workbench.common.forms.model.FormDefinition)4 ModelProperty (org.kie.workbench.common.forms.model.ModelProperty)4 Path (org.uberfire.backend.vfs.Path)4 CheckBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.definition.CheckBoxFieldDefinition)3 IntegerBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.definition.IntegerBoxFieldDefinition)3 TextBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.definition.TextBoxFieldDefinition)3 ModelPropertyImpl (org.kie.workbench.common.forms.model.impl.ModelPropertyImpl)3 TypeInfoImpl (org.kie.workbench.common.forms.model.impl.TypeInfoImpl)3 IOException (java.io.IOException)2 List (java.util.List)2 Optional (java.util.Optional)2 Dependent (javax.enterprise.context.Dependent)2