Search in sources :

Example 1 with FormModelSynchronizationUtil

use of org.kie.workbench.common.forms.editor.service.shared.model.FormModelSynchronizationUtil in project kie-wb-common by kiegroup.

the class FormGenerationIntegrationTest method init.

@Before
public void init() {
    formModelHandlerManager = new TestFormModelHandlerManager(moduleService, moduleClassLoaderHelper, fieldManager, finderService);
    when(pathModelReaderService.getModelReader(any())).thenReturn(new RuntimeDMOModelReader(moduleClassLoader, new RawMVELEvaluator()));
    when(formFinderService.findFormsForType(anyString(), any())).then((Answer<List<FormDefinition>>) invocationOnMock -> {
        String type = invocationOnMock.getArguments()[0].toString();
        return Collections.singletonList(readFormDefinitionForType(type));
    });
    service = new BPMNVFSFormDefinitionGeneratorService(fieldManager, pathModelReaderService, formModelHandlerManager, formFinderService, formSerializer, ioService, commentedOptionFactory, formModelSynchronizationUtil);
    when(moduleService.resolveModule(any())).thenReturn(module);
    when(moduleClassLoaderHelper.getModuleClassLoader(any())).thenReturn(moduleClassLoader);
    generator = new BPMNFormModelGeneratorImpl(moduleService, moduleClassLoaderHelper);
    final Path rootPathWithNestedForms = PathFactory.newPath(DATA_OBJECTS_FOLDER, getUriOfResource(PREPARED_NESTED_FORMS_FOLDER));
    ;
    processFormModel = generator.generateProcessFormModel(formGenerationProcessDefinitions, rootPathWithNestedForms);
    taskFormModels = generator.generateTaskFormModels(formGenerationProcessDefinitions, rootPathWithNestedForms);
}
Also used : ModelFinderService(org.kie.workbench.common.forms.data.modeller.service.shared.ModelFinderService) Arrays(java.util.Arrays) DocumentFieldType(org.kie.workbench.common.forms.jbpm.model.authoring.document.type.DocumentFieldType) ModuleClassLoaderHelper(org.kie.workbench.common.services.backend.project.ModuleClassLoaderHelper) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) FormModelerContent(org.kie.workbench.common.forms.editor.model.FormModelerContent) FieldDefinition(org.kie.workbench.common.forms.model.FieldDefinition) FormDefinitionSerializer(org.kie.workbench.common.forms.services.backend.serialization.FormDefinitionSerializer) StaticFormLayoutTemplateGenerator(org.kie.workbench.common.forms.commons.shared.layout.impl.StaticFormLayoutTemplateGenerator) PathFactory(org.uberfire.backend.vfs.PathFactory) KieModuleService(org.kie.workbench.common.services.shared.project.KieModuleService) FieldManager(org.kie.workbench.common.forms.service.shared.FieldManager) FormModelSerializer(org.kie.workbench.common.forms.services.backend.serialization.impl.FormModelSerializer) FieldSerializer(org.kie.workbench.common.forms.services.backend.serialization.impl.FieldSerializer) RawMVELEvaluator(org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator) ModuleFormFinderService(org.kie.workbench.common.forms.editor.service.shared.ModuleFormFinderService) SubFormFieldType(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.type.SubFormFieldType) KieModule(org.kie.workbench.common.services.shared.project.KieModule) BusinessProcessFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel) BPMNFormModelGeneratorImpl(org.kie.workbench.common.forms.jbpm.server.service.impl.BPMNFormModelGeneratorImpl) Collectors(java.util.stream.Collectors) TaskFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel) IOUtils(org.apache.commons.io.IOUtils) List(java.util.List) Stream(java.util.stream.Stream) ModelReaderService(org.kie.workbench.common.forms.data.modeller.service.ext.ModelReaderService) FormModelPropertiesUtil(org.kie.workbench.common.forms.model.util.formModel.FormModelPropertiesUtil) FormModelSynchronizationUtilImpl(org.kie.workbench.common.forms.editor.service.shared.model.impl.FormModelSynchronizationUtilImpl) MultipleSubFormFieldType(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.type.MultipleSubFormFieldType) IntegerBoxFieldType(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.integerBox.type.IntegerBoxFieldType) TestMetaDataEntryManager(org.kie.workbench.common.forms.fields.test.TestMetaDataEntryManager) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) FormModelHandlerManager(org.kie.workbench.common.forms.editor.service.backend.FormModelHandlerManager) DatePickerFieldType(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.datePicker.type.DatePickerFieldType) Mockito.mock(org.mockito.Mockito.mock) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Iterables(com.google.common.collect.Iterables) BeforeClass(org.junit.BeforeClass) FormGenerationTest_NestedObject(org.kie.workbench.common.forms.integration.tests.formgeneration.model.FormGenerationTest_NestedObject) DecimalBoxFieldType(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.decimalBox.type.DecimalBoxFieldType) BPMNVFSFormDefinitionGeneratorService(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.impl.authoring.BPMNVFSFormDefinitionGeneratorService) Mock(org.mockito.Mock) RunWith(org.junit.runner.RunWith) FormLayoutTemplateGenerator(org.kie.workbench.common.forms.commons.shared.layout.FormLayoutTemplateGenerator) AbstractJBPMFormModel(org.kie.workbench.common.forms.jbpm.model.authoring.AbstractJBPMFormModel) TextBoxFieldType(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textBox.type.TextBoxFieldType) FormEditorHelper(org.kie.workbench.common.forms.editor.client.editor.FormEditorHelper) TextAreaFieldType(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.textArea.type.TextAreaFieldType) Answer(org.mockito.stubbing.Answer) Charset(java.nio.charset.Charset) CommentedOptionFactory(org.guvnor.common.services.backend.util.CommentedOptionFactory) FormDefinitionSerializerImpl(org.kie.workbench.common.forms.services.backend.serialization.impl.FormDefinitionSerializerImpl) LayoutRow(org.uberfire.ext.layout.editor.api.editor.LayoutRow) FormGenerationResult(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.FormGenerationResult) FormDefinition(org.kie.workbench.common.forms.model.FormDefinition) SubFormFieldDefinition(org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition) IOServiceDotFileImpl(org.uberfire.io.impl.IOServiceDotFileImpl) DocumentFieldProvider(org.kie.workbench.common.forms.jbpm.model.authoring.document.provider.DocumentFieldProvider) Path(org.uberfire.backend.vfs.Path) Definitions(org.eclipse.bpmn2.Definitions) Before(org.junit.Before) TestUtils(org.kie.workbench.common.forms.integration.tests.TestUtils) AbstractBPMNFormGeneratorService.generateNestedFormName(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.impl.AbstractBPMNFormGeneratorService.generateNestedFormName) CheckBoxFieldType(org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.type.CheckBoxFieldType) FormModelSynchronizationUtil(org.kie.workbench.common.forms.editor.service.shared.model.FormModelSynchronizationUtil) CommentedOption(org.uberfire.java.nio.base.options.CommentedOption) IOException(java.io.IOException) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) TestFormModelHandlerManager(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.test.TestFormModelHandlerManager) FormGenerationTest_DataObject(org.kie.workbench.common.forms.integration.tests.formgeneration.model.FormGenerationTest_DataObject) TestFieldManager(org.kie.workbench.common.forms.fields.test.TestFieldManager) IOService(org.uberfire.io.IOService) DOCUMENT_TYPE(org.kie.workbench.common.forms.jbpm.model.authoring.document.type.DocumentFieldType.DOCUMENT_TYPE) SyncBeanManager(org.jboss.errai.ioc.client.container.SyncBeanManager) Collections(java.util.Collections) RuntimeDMOModelReader(org.kie.workbench.common.forms.data.modeller.service.impl.ext.dmo.runtime.RuntimeDMOModelReader) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Path(org.uberfire.backend.vfs.Path) RawMVELEvaluator(org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator) TestFormModelHandlerManager(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.test.TestFormModelHandlerManager) List(java.util.List) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) BPMNFormModelGeneratorImpl(org.kie.workbench.common.forms.jbpm.server.service.impl.BPMNFormModelGeneratorImpl) RuntimeDMOModelReader(org.kie.workbench.common.forms.data.modeller.service.impl.ext.dmo.runtime.RuntimeDMOModelReader) BPMNVFSFormDefinitionGeneratorService(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.impl.authoring.BPMNVFSFormDefinitionGeneratorService) Before(org.junit.Before)

Aggregations

Iterables (com.google.common.collect.Iterables)1 IOException (java.io.IOException)1 Charset (java.nio.charset.Charset)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 IOUtils (org.apache.commons.io.IOUtils)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Definitions (org.eclipse.bpmn2.Definitions)1 CommentedOptionFactory (org.guvnor.common.services.backend.util.CommentedOptionFactory)1 SyncBeanManager (org.jboss.errai.ioc.client.container.SyncBeanManager)1 Before (org.junit.Before)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1 RunWith (org.junit.runner.RunWith)1 RawMVELEvaluator (org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator)1 FormLayoutTemplateGenerator (org.kie.workbench.common.forms.commons.shared.layout.FormLayoutTemplateGenerator)1 StaticFormLayoutTemplateGenerator (org.kie.workbench.common.forms.commons.shared.layout.impl.StaticFormLayoutTemplateGenerator)1