Search in sources :

Example 1 with SearchRestrictions

use of com.qcadoo.model.api.search.SearchRestrictions in project qcadoo by qcadoo.

the class EntityListImplTest method init.

@Before
public void init() {
    dataAccessService = mock(DataAccessService.class);
    SearchRestrictions restrictions = new SearchRestrictions();
    ReflectionTestUtils.setField(restrictions, "dataAccessService", dataAccessService);
}
Also used : DataAccessService(com.qcadoo.model.internal.api.DataAccessService) SearchRestrictions(com.qcadoo.model.api.search.SearchRestrictions) Before(org.junit.Before)

Example 2 with SearchRestrictions

use of com.qcadoo.model.api.search.SearchRestrictions in project qcadoo by qcadoo.

the class DataAccessTest method superInit.

@Before
public void superInit() {
    pluginStateResolver = Mockito.mock(PluginStateResolver.class);
    given(pluginStateResolver.isEnabled(Mockito.anyString())).willReturn(true);
    given(pluginStateResolver.isEnabled(Mockito.any(Plugin.class))).willReturn(true);
    given(pluginStateResolver.isEnabledOrEnabling(Mockito.anyString())).willReturn(true);
    given(pluginStateResolver.isEnabledOrEnabling(Mockito.any(Plugin.class))).willReturn(true);
    PluginUtilsService pluginUtilsService = new PluginUtilsService(pluginStateResolver);
    pluginUtilsService.init();
    validationService = new ValidationServiceImpl();
    entityService = new EntityServiceImpl();
    ReflectionTestUtils.setField(entityService, "hibernateService", hibernateService);
    priorityService = new PriorityServiceImpl();
    ReflectionTestUtils.setField(priorityService, "entityService", entityService);
    ReflectionTestUtils.setField(priorityService, "hibernateService", hibernateService);
    dataAccessService = new DataAccessServiceImpl();
    ReflectionTestUtils.setField(dataAccessService, "entityService", entityService);
    ReflectionTestUtils.setField(dataAccessService, "priorityService", priorityService);
    ReflectionTestUtils.setField(dataAccessService, "validationService", validationService);
    ReflectionTestUtils.setField(dataAccessService, "hibernateService", hibernateService);
    AnnotationTransactionAspect.aspectOf();
    SearchRestrictions restrictions = new SearchRestrictions();
    ReflectionTestUtils.setField(restrictions, "dataAccessService", dataAccessService);
    buildParentDataDefinition();
    buildTreeDataDefinition();
    buildDataDefinition();
    given(hibernateService.getCurrentSession()).willReturn(session);
    given(session.createCriteria(any(Class.class))).willReturn(criteria);
    given(criteria.add(any(Criterion.class))).willReturn(criteria);
    given(criteria.setProjection(any(Projection.class))).willReturn(criteria);
    given(criteria.setFirstResult(anyInt())).willReturn(criteria);
    given(criteria.setMaxResults(anyInt())).willReturn(criteria);
    given(criteria.addOrder(any(Order.class))).willReturn(criteria);
}
Also used : Order(org.hibernate.criterion.Order) PluginUtilsService(com.qcadoo.plugin.internal.PluginUtilsService) Criterion(org.hibernate.criterion.Criterion) PluginStateResolver(com.qcadoo.plugin.api.PluginStateResolver) Projection(org.hibernate.criterion.Projection) SearchRestrictions(com.qcadoo.model.api.search.SearchRestrictions) Plugin(com.qcadoo.plugin.api.Plugin) Before(org.junit.Before)

Example 3 with SearchRestrictions

use of com.qcadoo.model.api.search.SearchRestrictions in project qcadoo by qcadoo.

the class EntityTreeImplTest method init.

@Before
public void init() {
    dataAccessService = mock(DataAccessService.class);
    SearchRestrictions restrictions = new SearchRestrictions();
    ReflectionTestUtils.setField(restrictions, "dataAccessService", dataAccessService);
}
Also used : DataAccessService(com.qcadoo.model.internal.api.DataAccessService) SearchRestrictions(com.qcadoo.model.api.search.SearchRestrictions) Before(org.junit.Before)

Aggregations

SearchRestrictions (com.qcadoo.model.api.search.SearchRestrictions)3 Before (org.junit.Before)3 DataAccessService (com.qcadoo.model.internal.api.DataAccessService)2 Plugin (com.qcadoo.plugin.api.Plugin)1 PluginStateResolver (com.qcadoo.plugin.api.PluginStateResolver)1 PluginUtilsService (com.qcadoo.plugin.internal.PluginUtilsService)1 Criterion (org.hibernate.criterion.Criterion)1 Order (org.hibernate.criterion.Order)1 Projection (org.hibernate.criterion.Projection)1