use of org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder in project dhis2-core by dhis2.
the class DataApprovalStoreIntegrationTest method setUpTest.
// -------------------------------------------------------------------------
// Set up/tear down
// -------------------------------------------------------------------------
@Override
public void setUpTest() throws Exception {
dataApprovalStore = new HibernateDataApprovalStore(sessionFactory, jdbcTemplate, publisher, cacheProvider, periodService, periodStore, currentUserService, categoryService, systemSettingManager, new PostgreSQLStatementBuilder());
// ---------------------------------------------------------------------
// Add supporting data
// ---------------------------------------------------------------------
level1 = new DataApprovalLevel("01", 1, null);
dataApprovalLevelService.addDataApprovalLevel(level1);
userApprovalLevels = ListUtils.newList(level1);
PeriodType periodType = PeriodType.getPeriodTypeByName("Monthly");
workflowA = new DataApprovalWorkflow("workflowA1", periodType, newHashSet(level1));
dataApprovalService.addWorkflow(workflowA);
sourceA = createOrganisationUnit('A');
sourceA.setHierarchyLevel(1);
organisationUnitService.addOrganisationUnit(sourceA);
dataSetA = createDataSet('A', new MonthlyPeriodType(), categoryComboA);
dataSetA.assignWorkflow(workflowA);
dataSetA.addOrganisationUnit(sourceA);
dataSetService.addDataSet(dataSetA);
periodJan = createPeriod("202001");
periodFeb = createPeriod("202002");
periodMay = createPeriod("202005");
periodJun = createPeriod("202006");
periodService.addPeriod(periodJan);
periodService.addPeriod(periodFeb);
periodService.addPeriod(periodMay);
periodService.addPeriod(periodJun);
userA = createUser('A');
userB = createUser('B');
userA.addOrganisationUnit(sourceA);
userB.addOrganisationUnit(sourceA);
userService.addUser(userA);
userService.addUser(userB);
userGroupA = createUserGroup('A', Sets.newHashSet(userA));
userGroupB = createUserGroup('B', Sets.newHashSet(userB));
userGroupService.addUserGroup(userGroupA);
userGroupService.addUserGroup(userGroupB);
userA.getGroups().add(userGroupA);
userB.getGroups().add(userGroupB);
userService.updateUser(userA);
userService.updateUser(userB);
categoryOptionA = createCategoryOption('A');
categoryOptionB = createCategoryOption('B');
categoryOptionA.setPublicAccess("--------");
categoryOptionB.setPublicAccess("--------");
categoryService.addCategoryOption(categoryOptionA);
categoryService.addCategoryOption(categoryOptionB);
categoryA = createCategory('A', categoryOptionA, categoryOptionB);
categoryService.addCategory(categoryA);
categoryComboA = createCategoryCombo('A', categoryA);
categoryService.addCategoryCombo(categoryComboA);
categoryOptionCombo = createCategoryOptionCombo(categoryComboA, categoryOptionA, categoryOptionB);
categoryOptionCombo.setName("categoryOptionCombo");
categoryOptionCombo.setUid("optComboUid");
categoryService.addCategoryOptionCombo(categoryOptionCombo);
categoryComboA.getOptionCombos().add(categoryOptionCombo);
categoryService.updateCategoryCombo(categoryComboA);
}
use of org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder in project dhis2-core by dhis2.
the class ProgramSqlGeneratorVariablesTest method setUp.
@BeforeEach
public void setUp() {
statementBuilder = new PostgreSQLStatementBuilder();
eventIndicator = new ProgramIndicator();
eventIndicator.setAnalyticsType(AnalyticsType.EVENT);
enrollmentIndicator = makeEnrollmentProgramIndicator();
}
use of org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder in project dhis2-core by dhis2.
the class AbstractJdbcEventAnalyticsManagerTest method setUp.
@BeforeEach
public void setUp() {
StatementBuilder statementBuilder = new PostgreSQLStatementBuilder();
DefaultProgramIndicatorSubqueryBuilder programIndicatorSubqueryBuilder = new DefaultProgramIndicatorSubqueryBuilder(programIndicatorService);
subject = new JdbcEventAnalyticsManager(jdbcTemplate, statementBuilder, programIndicatorService, programIndicatorSubqueryBuilder, new EventTimeFieldSqlRenderer(statementBuilder), executionPlanStore);
// data init
programA = createProgram('A');
dataElementA = createDataElement('A', ValueType.INTEGER, AggregationType.SUM);
dataElementA.setUid("fWIAEtYVEGk");
}
use of org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder in project dhis2-core by dhis2.
the class EnrollmentAnalyticsManagerTest method setUp.
@BeforeEach
public void setUp() {
when(jdbcTemplate.queryForRowSet(anyString())).thenReturn(this.rowSet);
StatementBuilder statementBuilder = new PostgreSQLStatementBuilder();
DefaultProgramIndicatorSubqueryBuilder programIndicatorSubqueryBuilder = new DefaultProgramIndicatorSubqueryBuilder(programIndicatorService);
subject = new JdbcEnrollmentAnalyticsManager(jdbcTemplate, statementBuilder, programIndicatorService, programIndicatorSubqueryBuilder, new EnrollmentTimeFieldSqlRenderer(statementBuilder), executionPlanStore);
}
use of org.hisp.dhis.jdbc.statementbuilder.PostgreSQLStatementBuilder in project dhis2-core by dhis2.
the class ProgramSqlGeneratorFunctionsTest method setUp.
@BeforeEach
public void setUp() {
dataElementA = createDataElement('A');
dataElementA.setDomainType(DataElementDomain.TRACKER);
dataElementA.setUid("DataElmentA");
dataElementB = createDataElement('B');
dataElementB.setDomainType(DataElementDomain.TRACKER);
dataElementB.setUid("DataElmentB");
dataElementC = createDataElement('C');
dataElementC.setDomainType(DataElementDomain.TRACKER);
dataElementC.setUid("DataElmentC");
dataElementC.setValueType(ValueType.DATE);
dataElementD = createDataElement('D');
dataElementD.setDomainType(DataElementDomain.TRACKER);
dataElementD.setUid("DataElmentD");
dataElementD.setValueType(ValueType.DATE);
attributeA = createTrackedEntityAttribute('A', ValueType.NUMBER);
attributeA.setUid("Attribute0A");
OrganisationUnit organisationUnit = createOrganisationUnit('A');
programStageA = new ProgramStage("StageA", programA);
programStageA.setSortOrder(1);
programStageA.setUid("ProgrmStagA");
programStageB = new ProgramStage("StageB", programA);
programStageB.setSortOrder(2);
programStageB.setUid("ProgrmStagB");
Set<ProgramStage> programStages = new HashSet<>();
programStages.add(programStageA);
programStages.add(programStageB);
programA = createProgram('A', new HashSet<>(), organisationUnit);
programA.setUid("Program000A");
programA.setProgramStages(programStages);
statementBuilder = new PostgreSQLStatementBuilder();
programIndicator = new ProgramIndicator();
programIndicator.setProgram(programA);
programIndicator.setAnalyticsType(AnalyticsType.EVENT);
relTypeA = new RelationshipType();
relTypeA.setUid("RelatnTypeA");
}
Aggregations