use of org.kie.workbench.common.forms.services.backend.serialization.impl.FormModelSerializer in project kie-wb-common by kiegroup.
the class FormGenerationIntegrationTest method setup.
@BeforeClass
public static void setup() {
FormModelPropertiesUtil.registerBaseType(DOCUMENT_TYPE);
FormModelPropertiesUtil.registerBaseType(DocumentFieldType.DOCUMENT_IMPL_TYPE);
fieldManager = new TestFieldManager() {
{
registerFieldProvider(new DocumentFieldProvider() {
{
doRegisterFields();
}
});
}
};
formSerializer = new FormDefinitionSerializerImpl(new FieldSerializer(), new FormModelSerializer(), new TestMetaDataEntryManager());
ioService = new IOServiceDotFileImpl();
templateGenerator = new StaticFormLayoutTemplateGenerator();
formModelSynchronizationUtil = new FormModelSynchronizationUtilImpl(fieldManager, templateGenerator);
moduleClassLoader = FormGenerationIntegrationTest.class.getClassLoader();
formGenerationProcessDefinitions = TestUtils.getDefinitionsFromResources(FormGenerationIntegrationTest.class, DEFINITION_PATH);
formModelerContent = new FormModelerContent();
formEditorHelper = new FormEditorHelper(fieldManager, null, mock(SyncBeanManager.class));
}
use of org.kie.workbench.common.forms.services.backend.serialization.impl.FormModelSerializer in project kie-wb-common by kiegroup.
the class AbstractFormDefinitionGeneratorTest method init.
@Before
public void init() throws Exception {
formDefinitionSerializer = new FormDefinitionSerializerImpl(new FieldSerializer(), new FormModelSerializer(), new TestMetaDataEntryManager());
when(migrationServicesCDIWrapper.getIOService()).thenReturn(ioService);
when(formsMigrationServicesCDIWrapper.getFormDefinitionSerializer()).thenReturn(formDefinitionSerializer);
simpleFileSystemProvider = new SimpleFileSystemProvider();
simpleFileSystemProvider.forceAsDefault();
when(path.toURI()).thenReturn(ROOT_PATH);
when(workspaceProject.getRootPath()).thenReturn(path);
generator = new FormDefinitionGenerator(DataObjectFormAdapter::new, this::getBPMNAdapter);
doInit();
}
use of org.kie.workbench.common.forms.services.backend.serialization.impl.FormModelSerializer in project kie-wb-common by kiegroup.
the class FormDefinitionIndexerTest method setup.
@Override
public void setup() throws IOException {
FormModelVisitor visitor = mock(FormModelVisitor.class);
FormModelVisitorProvider provider = mock(FormModelVisitorProvider.class);
when(provider.getModelType()).thenReturn(FormModel.class);
when(provider.getVisitor()).thenReturn(visitor);
Instance<FormModelVisitorProvider<?>> providersInstance = mock(Instance.class);
List<FormModelVisitorProvider<?>> providers = Arrays.asList(provider);
when(providersInstance.iterator()).thenReturn(providers.iterator());
indexer = spy(new TestFormDefinitionIndexer(new FormResourceTypeDefinition(new Form()), new FormDefinitionSerializerImpl(new FieldSerializer(), new FormModelSerializer(), new TestMetaDataEntryManager()), providersInstance));
when(indexer.getProviderForModel(any())).thenReturn(provider);
super.setup();
}
use of org.kie.workbench.common.forms.services.backend.serialization.impl.FormModelSerializer in project kie-wb-common by kiegroup.
the class AbstractFormDefinitionHelperTest method init.
@Before
public void init() throws IOException {
simpleFileSystemProvider = new SimpleFileSystemProvider();
simpleFileSystemProvider.forceAsDefault();
serializer = spy(new FormDefinitionSerializerImpl(new FieldSerializer(), new FormModelSerializer(), new TestMetaDataEntryManager()));
when(originalPath.getFileName()).thenReturn(ORIGNAL_FORM_ASSET_NAME);
when(destinationPath.getFileName()).thenReturn(DESTINATION_FORM_ASSET_NAME);
when(destinationPath.toURI()).thenReturn(DESTINATION_FORM_PATH);
when(ioService.readAllString(any())).thenReturn(IOUtils.toString(new InputStreamReader(this.getClass().getResourceAsStream(ORIGINAL_FORM_PATH))));
doAnswer((Answer<FormDefinition>) invocationOnMock -> {
FormDefinition formDefinition = (FormDefinition) invocationOnMock.callRealMethod();
beforeProcess(formDefinition);
return formDefinition;
}).when(serializer).deserialize(Mockito.<String>any());
helper = getHelper(ioService, serializer, commentedOptionFactory);
}
use of org.kie.workbench.common.forms.services.backend.serialization.impl.FormModelSerializer in project kie-wb-common by kiegroup.
the class FormEditorServiceImplTest method init.
@Before
public void init() {
Instance<FormModelHandler<? extends FormModel>> instances = mock(Instance.class);
when(dataObjectFormModelHandler.getModelType()).thenReturn(DataObjectFormModel.class);
when(dataObjectFormModelHandler.newInstance()).thenReturn(dataObjectFormModelHandler);
List<FormModelHandler> handlers = Arrays.asList(dataObjectFormModelHandler);
when(instances.iterator()).then(invocationOnMock -> handlers.iterator());
modelHandlerManager = spy(new FormModelHandlerManagerImpl(instances));
formDefinitionSerializer = spy(new FormDefinitionSerializerImpl(new FieldSerializer(), new FormModelSerializer(), new TestMetaDataEntryManager()));
formEditorService = spy(new FormEditorServiceImpl(ioService, sessionInfo, resourceOpenedEvent, fieldManager, modelHandlerManager, moduleService, formDefinitionSerializer, moduleFormFinderService, deleteService, commentedOptionFactory, renameService, copyService));
when(path.toURI()).thenReturn("file:///src/main/resources/test.frm");
when(moduleService.resolveModule(any())).thenReturn(module);
}
Aggregations