Search in sources :

Example 1 with DataDefinitionServiceImpl

use of com.qcadoo.model.internal.DataDefinitionServiceImpl in project qcadoo by qcadoo.

the class ModelXmlToDefinitionConverterTest method init.

@BeforeClass
public static void init() throws Exception {
    applicationContext = mock(ApplicationContext.class);
    dataAccessService = mock(DataAccessService.class);
    translationService = mock(TranslationService.class);
    dataDefinitionService = new DataDefinitionServiceImpl();
    modelXmlToDefinitionConverter = new ModelXmlToDefinitionConverterImpl();
    setField(modelXmlToDefinitionConverter, "dataDefinitionService", dataDefinitionService);
    setField(modelXmlToDefinitionConverter, "dataAccessService", dataAccessService);
    setField(modelXmlToDefinitionConverter, "applicationContext", applicationContext);
    setField(modelXmlToDefinitionConverter, "translationService", translationService);
    given(applicationContext.getBean(CustomHook.class)).willReturn(new CustomHook());
    modelXmlToClassConverter = new ModelXmlToClassConverterImpl();
    ((ModelXmlToClassConverterImpl) modelXmlToClassConverter).setBeanClassLoader(ClassLoader.getSystemClassLoader());
    dataDefinitions = performConvert(Utils.FULL_FIRST_ENTITY_XML_RESOURCE, Utils.FULL_SECOND_ENTITY_XML_RESOURCE, Utils.FULL_THIRD_ENTITY_XML_RESOURCE, Utils.OTHER_FIRST_ENTITY_XML_RESOURCE, Utils.OTHER_SECOND_ENTITY_XML_RESOURCE);
    for (DataDefinition dd : dataDefinitions.toArray(new DataDefinition[dataDefinitions.size()])) {
        if (dd.getName().equals("firstEntity") && dd.getPluginIdentifier().equals("full")) {
            dataDefinition = (InternalDataDefinition) dd;
        }
    }
}
Also used : CustomHook(com.qcadoo.model.CustomHook) ApplicationContext(org.springframework.context.ApplicationContext) TranslationService(com.qcadoo.localization.api.TranslationService) DataAccessService(com.qcadoo.model.internal.api.DataAccessService) DataDefinitionServiceImpl(com.qcadoo.model.internal.DataDefinitionServiceImpl) ModelXmlToClassConverterImpl(com.qcadoo.model.internal.classconverter.ModelXmlToClassConverterImpl) InternalDataDefinition(com.qcadoo.model.internal.api.InternalDataDefinition) DataDefinition(com.qcadoo.model.api.DataDefinition) BeforeClass(org.junit.BeforeClass)

Aggregations

TranslationService (com.qcadoo.localization.api.TranslationService)1 CustomHook (com.qcadoo.model.CustomHook)1 DataDefinition (com.qcadoo.model.api.DataDefinition)1 DataDefinitionServiceImpl (com.qcadoo.model.internal.DataDefinitionServiceImpl)1 DataAccessService (com.qcadoo.model.internal.api.DataAccessService)1 InternalDataDefinition (com.qcadoo.model.internal.api.InternalDataDefinition)1 ModelXmlToClassConverterImpl (com.qcadoo.model.internal.classconverter.ModelXmlToClassConverterImpl)1 BeforeClass (org.junit.BeforeClass)1 ApplicationContext (org.springframework.context.ApplicationContext)1