Search in sources :

Example 1 with DataQueryService

use of org.hisp.dhis.analytics.DataQueryService in project dhis2-core by dhis2.

the class AnalyticsControllerTest method setUp.

@BeforeEach
public void setUp() {
    final DataQueryService dataQueryService = new DefaultDataQueryService(mock(IdentifiableObjectManager.class), mock(OrganisationUnitService.class), dimensionService, mock(AnalyticsSecurityManager.class), mock(SystemSettingManager.class), mock(AclService.class), mock(CurrentUserService.class), mock(I18nManager.class));
    // Controller under test
    final AnalyticsController controller = new AnalyticsController(dataQueryService, analyticsService, contextUtils);
    mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
    // When
    when(dimensionService.getDataDimensionalItemObject(IdScheme.UID, "fbfJHSPpUQD")).thenReturn(new DataElement("alfa"));
    when(dimensionService.getDataDimensionalItemObject(IdScheme.UID, "cYeuwXTCPkU")).thenReturn(new DataElement("beta"));
    when(analyticsService.getAggregatedDataValues(Mockito.any(DataQueryParams.class), Mockito.any(), Mockito.any())).thenReturn(buildMockGrid());
}
Also used : DataElement(org.hisp.dhis.dataelement.DataElement) DataQueryParams(org.hisp.dhis.analytics.DataQueryParams) OrganisationUnitService(org.hisp.dhis.organisationunit.OrganisationUnitService) AnalyticsSecurityManager(org.hisp.dhis.analytics.AnalyticsSecurityManager) CurrentUserService(org.hisp.dhis.user.CurrentUserService) DataQueryService(org.hisp.dhis.analytics.DataQueryService) DefaultDataQueryService(org.hisp.dhis.analytics.data.DefaultDataQueryService) SystemSettingManager(org.hisp.dhis.setting.SystemSettingManager) IdentifiableObjectManager(org.hisp.dhis.common.IdentifiableObjectManager) AclService(org.hisp.dhis.security.acl.AclService) DefaultDataQueryService(org.hisp.dhis.analytics.data.DefaultDataQueryService) I18nManager(org.hisp.dhis.i18n.I18nManager) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

AnalyticsSecurityManager (org.hisp.dhis.analytics.AnalyticsSecurityManager)1 DataQueryParams (org.hisp.dhis.analytics.DataQueryParams)1 DataQueryService (org.hisp.dhis.analytics.DataQueryService)1 DefaultDataQueryService (org.hisp.dhis.analytics.data.DefaultDataQueryService)1 IdentifiableObjectManager (org.hisp.dhis.common.IdentifiableObjectManager)1 DataElement (org.hisp.dhis.dataelement.DataElement)1 I18nManager (org.hisp.dhis.i18n.I18nManager)1 OrganisationUnitService (org.hisp.dhis.organisationunit.OrganisationUnitService)1 AclService (org.hisp.dhis.security.acl.AclService)1 SystemSettingManager (org.hisp.dhis.setting.SystemSettingManager)1 CurrentUserService (org.hisp.dhis.user.CurrentUserService)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1