use of org.kie.workbench.common.forms.fields.test.TestMetaDataEntryManager 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(migrationServicesCDIWrapper.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.fields.test.TestMetaDataEntryManager in project kie-wb-common by kiegroup.
the class FormGenerationIntegrationTest method setup.
@BeforeClass
public static void setup() throws ClassNotFoundException {
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);
}
use of org.kie.workbench.common.forms.fields.test.TestMetaDataEntryManager 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.fields.test.TestMetaDataEntryManager in project kie-wb-common by kiegroup.
the class FormDefinitionSerializerImplTest method initTest.
@Before
public void initTest() {
fieldManager = new TestFieldManager();
definitionSerializer = new FormDefinitionSerializerImpl(new FieldSerializer(), new FormModelSerializer(), new TestMetaDataEntryManager());
JavaFormModel model = new PortableJavaModel("org.test.MyParentModel");
formDefinition = new FormDefinition(model);
formDefinition.setId("testForm");
formDefinition.setName("testForm");
formDefinition.setLayoutTemplate(new LayoutTemplate());
for (BasicTypeFieldProvider provider : fieldManager.getAllBasicTypeProviders()) {
for (String type : provider.getSupportedTypes()) {
FieldDefinition field = provider.getFieldByType(new TypeInfoImpl(type));
assertNotNull(field);
String fieldDescription = provider.getFieldTypeName() + "_" + type;
field.setName(fieldDescription);
field.setLabel(fieldDescription);
field.setStandaloneClassName(type);
field.setBinding(fieldDescription);
model.getProperties().add(new ModelPropertyImpl(fieldDescription, new TypeInfoImpl(type)));
formDefinition.getFields().add(field);
}
}
SubFormFieldDefinition subForm = new SubFormFieldDefinition();
subForm.setLabel("SubForm");
subForm.setNestedForm("");
subForm.setBinding("model");
subForm.setStandaloneClassName("org.test.MyTestModel");
subForm.setBinding("SubForm");
formDefinition.getFields().add(subForm);
model.getProperties().add(new ModelPropertyImpl(subForm.getBinding(), new TypeInfoImpl(TypeKind.OBJECT, subForm.getStandaloneClassName(), false)));
MultipleSubFormFieldDefinition multipleSubForm = new MultipleSubFormFieldDefinition();
multipleSubForm.setLabel("MultipleSubForm");
multipleSubForm.setCreationForm("");
multipleSubForm.setEditionForm("");
multipleSubForm.setStandaloneClassName("org.test.MyTestModel");
multipleSubForm.setBinding("MultipleSubForm");
formDefinition.getFields().add(multipleSubForm);
model.getProperties().add(new ModelPropertyImpl(multipleSubForm.getBinding(), new TypeInfoImpl(TypeKind.OBJECT, multipleSubForm.getStandaloneClassName(), true)));
EnumListBoxFieldDefinition enumListBox = new EnumListBoxFieldDefinition();
enumListBox.setLabel("EnumListBox");
enumListBox.setBinding("EnumListBox");
enumListBox.setStandaloneClassName("org.test.MyTestModel");
formDefinition.getFields().add(enumListBox);
model.getProperties().add(new ModelPropertyImpl(enumListBox.getBinding(), new TypeInfoImpl(TypeKind.ENUM, enumListBox.getStandaloneClassName(), false)));
}
Aggregations