Search in sources :

Example 6 with PostgreSQLStatementBuilder

use of org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder in project dhis2-core by dhis2.

the class ProgramSqlGeneratorItemsTest method setUp.

@BeforeEach
public void setUp() {
    dataElementA = createDataElement('A');
    dataElementA.setDomainType(DataElementDomain.TRACKER);
    dataElementA.setUid("DataElmentA");
    attributeA = createTrackedEntityAttribute('A', ValueType.NUMBER);
    attributeA.setUid("Attribute0A");
    constantA = new Constant("Constant A", 123.456);
    constantA.setUid("constant00A");
    constantMap = new ImmutableMap.Builder<String, Constant>().put("constant00A", new Constant("constant", 123.456)).build();
    OrganisationUnit organisationUnit = createOrganisationUnit('A');
    programStageA = new ProgramStage("StageA", programA);
    programStageA.setSortOrder(1);
    programStageA.setUid("ProgrmStagA");
    programA = createProgram('A', new HashSet<>(), organisationUnit);
    programA.setUid("Program000A");
    statementBuilder = new PostgreSQLStatementBuilder();
    programIndicator = new ProgramIndicator();
    programIndicator.setProgram(programA);
    programIndicator.setAnalyticsType(AnalyticsType.EVENT);
}
Also used : OrganisationUnit(org.hisp.dhis.organisationunit.OrganisationUnit) Constant(org.hisp.dhis.constant.Constant) AntlrParserUtils.castString(org.hisp.dhis.antlr.AntlrParserUtils.castString) PostgreSQLStatementBuilder(org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder) ImmutableMap(com.google.common.collect.ImmutableMap) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with PostgreSQLStatementBuilder

use of org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder in project dhis2-core by dhis2.

the class JdbcEventStoreTest method setUp.

@BeforeEach
public void setUp() {
    when(jdbcTemplate.queryForRowSet(anyString())).thenReturn(this.rowSet);
    when(jdbcTemplate.getDataSource()).thenReturn(mock(DataSource.class));
    ObjectMapper objectMapper = new ObjectMapper();
    subject = new JdbcEventStore(new PostgreSQLStatementBuilder(), jdbcTemplate, objectMapper, currentUserService, manager, env, eventStore, skipLockedProvider);
}
Also used : PostgreSQLStatementBuilder(org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DataSource(javax.sql.DataSource) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 8 with PostgreSQLStatementBuilder

use of org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder in project dhis2-core by dhis2.

the class JdbcEventAnalyticsTableManagerTest method setUp.

@BeforeEach
public void setUp() {
    statementBuilder = new PostgreSQLStatementBuilder();
    today = Date.from(LocalDate.of(2019, 7, 6).atStartOfDay(ZoneId.systemDefault()).toInstant());
    subject = new JdbcEventAnalyticsTableManager(idObjectManager, organisationUnitService, categoryService, systemSettingManager, mock(DataApprovalLevelService.class), mock(ResourceTableService.class), mock(AnalyticsTableHookService.class), statementBuilder, mock(PartitionManager.class), databaseInfo, jdbcTemplate);
}
Also used : PostgreSQLStatementBuilder(org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 9 with PostgreSQLStatementBuilder

use of org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder in project dhis2-core by dhis2.

the class EventsAnalyticsManagerTest method setUp.

@BeforeEach
public void setUp() {
    StatementBuilder statementBuilder = new PostgreSQLStatementBuilder();
    EventTimeFieldSqlRenderer timeCoordinateSelector = new EventTimeFieldSqlRenderer(statementBuilder);
    ProgramIndicatorService programIndicatorService = mock(ProgramIndicatorService.class);
    DefaultProgramIndicatorSubqueryBuilder programIndicatorSubqueryBuilder = new DefaultProgramIndicatorSubqueryBuilder(programIndicatorService);
    subject = new JdbcEventAnalyticsManager(jdbcTemplate, statementBuilder, programIndicatorService, programIndicatorSubqueryBuilder, timeCoordinateSelector, executionPlanStore);
    when(jdbcTemplate.queryForRowSet(anyString())).thenReturn(this.rowSet);
}
Also used : PostgreSQLStatementBuilder(org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder) StatementBuilder(org.hisp.dhis.jdbc.StatementBuilder) DefaultProgramIndicatorSubqueryBuilder(org.hisp.dhis.analytics.event.data.programindicator.DefaultProgramIndicatorSubqueryBuilder) PostgreSQLStatementBuilder(org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder) ProgramIndicatorService(org.hisp.dhis.program.ProgramIndicatorService) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

PostgreSQLStatementBuilder (org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder)9 BeforeEach (org.junit.jupiter.api.BeforeEach)8 DefaultProgramIndicatorSubqueryBuilder (org.hisp.dhis.analytics.event.data.programindicator.DefaultProgramIndicatorSubqueryBuilder)3 StatementBuilder (org.hisp.dhis.jdbc.StatementBuilder)3 HashSet (java.util.HashSet)2 LinkedHashSet (java.util.LinkedHashSet)2 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 DataSource (javax.sql.DataSource)1 AntlrParserUtils.castString (org.hisp.dhis.antlr.AntlrParserUtils.castString)1 Constant (org.hisp.dhis.constant.Constant)1 HibernateDataApprovalStore (org.hisp.dhis.dataapproval.hibernate.HibernateDataApprovalStore)1 MonthlyPeriodType (org.hisp.dhis.period.MonthlyPeriodType)1 PeriodType (org.hisp.dhis.period.PeriodType)1 ProgramIndicatorService (org.hisp.dhis.program.ProgramIndicatorService)1 RelationshipType (org.hisp.dhis.relationship.RelationshipType)1