Search in sources :

Example 6 with TaskFormModel

use of org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel in project kie-wb-common by kiegroup.

the class BPMNFormModelGeneratorImplTest method testCorrectTaskFormModelIsGeneratedForTaskWithDifferentInputsAndOutputsInAdHocSubprocess.

@Test
public void testCorrectTaskFormModelIsGeneratedForTaskWithDifferentInputsAndOutputsInAdHocSubprocess() {
    final String TASK_ID = "_D3B8EE8F-5402-408D-815D-FFE1BAD943D9", TASK_NAME = "taskWithDifferentInputsAndOutputs";
    final Map<String, String> EXPECTED_TASK_VARIABLES = new HashMap<String, String>() {

        {
            putAll(EXPECTED_INPUT_VARIABLES);
            putAll(EXPECTED_OUTPUT_VARIABLES);
        }
    };
    TaskFormModel taskFormModel = generator.generateTaskFormModel(processWithAllVariablesDefinitions, TASK_ID, path);
    assertTaskFormModelIsCorrect(taskFormModel, PROCESS_WITH_ALL_VARIABLES_ID, TASK_NAME);
    assertJBPMVariablesAreCorrect(taskFormModel, EXPECTED_TASK_VARIABLES);
}
Also used : HashMap(java.util.HashMap) Matchers.anyString(org.mockito.Matchers.anyString) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel) Test(org.junit.Test)

Example 7 with TaskFormModel

use of org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel in project kie-wb-common by kiegroup.

the class BPMNFormModelGeneratorImplTest method testGenerateAllForProcessWithAllPossibleProcessVariables.

@Test
public void testGenerateAllForProcessWithAllPossibleProcessVariables() {
    final Map<String, String> EXPECTED_PROCESS_VARIABLES = new HashMap<String, String>() {

        {
            put("string", String.class.getName());
            put("integer", Integer.class.getName());
            put("boolean", Boolean.class.getName());
            put("float", Float.class.getName());
            put("object", Object.class.getName());
            put("dataObject", DATA_OBJECT_TYPE);
            put("customType", CUSTOM_TYPE);
        }
    };
    // generate all = generateProcessFormModel + generateTaskFormModels
    BusinessProcessFormModel processFormModel = generator.generateProcessFormModel(processWithAllVariablesDefinitions, path);
    assertProcessFormModelFieldsAreCorrect(processFormModel, PROCESS_WITH_ALL_VARIABLES_NAME);
    assertJBPMVariablesAreCorrect(processFormModel, EXPECTED_PROCESS_VARIABLES);
    List<TaskFormModel> taskFormModels = generator.generateTaskFormModels(processWithAllVariablesDefinitions, path);
    // taskOnlyWithOutputs-taskform, emptyTask-taskform, taskOnlyWithInputs-taskform, taskWithDifferentInputsAndOutputs-taskform, taskWithTheSameInputsAndOutputs-taskform
    final int EXPECTED_NUMBER_OF_HUMAN_TASKS = 5;
    assertEquals("Forms should be generated for all human tasks including tasks in subprocesses and swimlanes", EXPECTED_NUMBER_OF_HUMAN_TASKS, taskFormModels.size());
}
Also used : HashMap(java.util.HashMap) BusinessProcessFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel) Matchers.anyString(org.mockito.Matchers.anyString) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel) Test(org.junit.Test)

Example 8 with TaskFormModel

use of org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel in project kie-wb-common by kiegroup.

the class BPMNFormModelGeneratorImplTest method testCorrectTaskFormModelIsGeneratedForTaskThatContainsOnlyOutputsInEmbeddedSubprocess.

@Test
public void testCorrectTaskFormModelIsGeneratedForTaskThatContainsOnlyOutputsInEmbeddedSubprocess() {
    final String TASK_ID = "_9E9EAE16-F9F4-49D0-854D-0D2C8CB9382F", TASK_NAME = "taskOnlyWithOutputs";
    TaskFormModel taskFormModel = generator.generateTaskFormModel(processWithAllVariablesDefinitions, TASK_ID, path);
    assertTaskFormModelIsCorrect(taskFormModel, PROCESS_WITH_ALL_VARIABLES_ID, TASK_NAME);
    assertJBPMVariablesAreCorrect(taskFormModel, EXPECTED_OUTPUT_VARIABLES);
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel) Test(org.junit.Test)

Example 9 with TaskFormModel

use of org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel in project kie-wb-common by kiegroup.

the class BPMNFormModelGeneratorImplTest method testGenerateTaskFormModelForTaskWithSharedForm.

@Test
public void testGenerateTaskFormModelForTaskWithSharedForm() {
    final String[] TASK_IDS = new String[] { "_77BDDEC9-0D5E-4C46-8AD6-1B528836A22B", "_C976E341-8E35-42C7-B878-67049CE63E5F", "_27F23135-87E9-47C5-9B97-DA793699E8CF" };
    final String TASK_NAME = "task";
    TaskFormModel[] generatedModels = new TaskFormModel[TASK_IDS.length];
    for (int i = 0; i < TASK_IDS.length; i++) {
        generatedModels[i] = generator.generateTaskFormModel(processWithSharedForms, TASK_IDS[i], path);
        assertNotNull(generatedModels[i]);
        assertTaskFormModelIsCorrect(generatedModels[i], PROCESS_WITH_SHARED_FORMS_ID, TASK_NAME);
        checkExpectedMergedFormVariables(generatedModels[i]);
    }
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel) Test(org.junit.Test)

Example 10 with TaskFormModel

use of org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel in project kie-wb-common by kiegroup.

the class BPMNFormModelGeneratorImplTest method testCorrectTaskFormModelIsGeneratedForTaskWithoutAnyInputsOrOutputsInSwimlane.

@Test
public void testCorrectTaskFormModelIsGeneratedForTaskWithoutAnyInputsOrOutputsInSwimlane() {
    final String TASK_ID = "_23BBA464-615A-405F-8C3B-4F643BE522D6", TASK_NAME = "emptyTask";
    TaskFormModel taskFormModel = generator.generateTaskFormModel(processWithAllVariablesDefinitions, TASK_ID, path);
    assertTaskFormModelIsCorrect(taskFormModel, PROCESS_WITH_ALL_VARIABLES_ID, TASK_NAME);
    assertTrue(taskFormModel.getProperties().isEmpty());
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) 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