use of org.hisp.dhis.dataapproval.hibernate.HibernateDataApprovalStore 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);
}
Aggregations