use of org.kie.workbench.common.forms.jbpm.model.authoring.JBPMFormModel in project kie-wb-common by kiegroup.
the class FormDefinitionGeneratorImplTest method testGenerateProcessForm.
@Test
public void testGenerateProcessForm() {
generator.generateProcessForm(diagram);
verify(generator, times(1)).createFormForModel(formModelArgumentCaptor.capture(), any());
verify(formDefinitionSerializer, times(1)).serialize(formDefinitionArgumentCaptor.capture());
verify(ioService, times(1)).createFile(any());
verify(ioService, times(1)).write(any(), anyString());
JBPMFormModel formModel = formModelArgumentCaptor.getValue();
Assertions.assertThat(formModel).isNotNull().isInstanceOf(BusinessProcessFormModel.class);
checkProcessFormGenerated((BusinessProcessFormModel) formModel, formDefinitionArgumentCaptor.getValue());
}
use of org.kie.workbench.common.forms.jbpm.model.authoring.JBPMFormModel in project kie-wb-common by kiegroup.
the class JBPMFormModelCreationViewImpl method init.
@PostConstruct
protected void init() {
processes.addValueChangeHandler(event -> {
JBPMProcessModel model = processes.getValue();
if (model != null) {
List<JBPMFormModel> models = new ArrayList<JBPMFormModel>();
models.add(model.getProcessFormModel());
models.addAll(model.getTaskFormModels());
tasks.setValue(null);
tasks.setAcceptableValues(models);
} else {
tasks.setAcceptableValues(new ArrayList<>());
tasks.setValue(null, true);
}
});
tasks.addValueChangeHandler(event -> {
presenter.setModel(event.getValue());
clearValidationErrors();
});
}
use of org.kie.workbench.common.forms.jbpm.model.authoring.JBPMFormModel in project kie-wb-common by kiegroup.
the class FormDefinitionGeneratorImplTest method testGenerateSelectedTaskForms.
@Test
public void testGenerateSelectedTaskForms() {
generator.generateSelectedForms(diagram, FULL_TASK_ID, INPUTS_TASK_ID, OUTPUTS_TASK_ID);
verify(generator, times(3)).createFormForModel(formModelArgumentCaptor.capture(), any());
verify(formDefinitionSerializer, times(3)).serialize(formDefinitionArgumentCaptor.capture());
verify(ioService, times(1)).startBatch(any());
verify(ioService, times(1)).getFileSystem(any());
verify(ioService, times(3)).createFile(any());
verify(ioService, times(3)).write(any(), anyString());
verify(ioService, times(1)).endBatch();
List<JBPMFormModel> formModels = formModelArgumentCaptor.getAllValues();
List<FormDefinition> taskForms = formDefinitionArgumentCaptor.getAllValues();
Assertions.assertThat(formModels).isNotEmpty().hasSize(taskForms.size()).allMatch(formModel -> formModel instanceof TaskFormModel);
for (int i = 0; i < formModels.size(); i++) {
TaskFormModel taskFormModel = (TaskFormModel) formModels.get(i);
FormDefinition taskForm = taskForms.get(i);
checkTaskFormGenerated(taskFormModel, taskFormModel.getTaskName(), taskForm);
}
}
use of org.kie.workbench.common.forms.jbpm.model.authoring.JBPMFormModel 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);
}
}
}
use of org.kie.workbench.common.forms.jbpm.model.authoring.JBPMFormModel in project kie-wb-common by kiegroup.
the class FormDefinitionGeneratorImplTest method checkSingleSelectedTaskFormGenerated.
private void checkSingleSelectedTaskFormGenerated(String taskId, String taskName) {
generator.generateSelectedForms(diagram, taskId);
verify(generator, times(1)).createFormForModel(formModelArgumentCaptor.capture(), any());
verify(formDefinitionSerializer, times(1)).serialize(formDefinitionArgumentCaptor.capture());
verify(ioService, times(1)).startBatch(any());
verify(ioService, times(1)).getFileSystem(any());
verify(ioService, times(1)).createFile(any());
verify(ioService, times(1)).write(any(), anyString());
verify(ioService, times(1)).endBatch();
JBPMFormModel formModel = formModelArgumentCaptor.getValue();
FormDefinition taskForm = formDefinitionArgumentCaptor.getValue();
Assertions.assertThat(formModel).isNotNull().isInstanceOf(TaskFormModel.class);
checkTaskFormGenerated((TaskFormModel) formModel, taskName, taskForm);
}
Aggregations