@Test public void testOrderPositions() { initialize(); logon(getUser(TEST_FINANCE_USER)); final AuftragDO auftrag = new AuftragDO() .addPosition(new AuftragsPositionDO().setTask(getTask("TBT-5.1")).setTitel("Pos 1")) .addPosition( new AuftragsPositionDO().setTask(getTask("TBT-5.2.1.1")).setTitel("Pos 2")); auftragDao.save(auftrag.setNummer(auftragDao.getNextNumber(auftrag))); logon(getUser(TEST_USER)); TimesheetDO sheet = createNewSheet(); save( sheet.setTask(getTask("TBT-5")), "timesheet.error.taskNotBookable.orderPositionsFoundInSubTasks"); timesheetDao.save(sheet.setTask(getTask("TBT-5.1"))); timesheetDao.save(createNewSheet().setTask(getTask("TBT-5.1.1"))); timesheetDao.save(createNewSheet().setTask(getTask("TBT-5.1.2"))); sheet = createNewSheet(); save( sheet.setTask(getTask("TBT-5.2")), "timesheet.error.taskNotBookable.orderPositionsFoundInSubTasks"); save( sheet.setTask(getTask("TBT-5.2.1")), "timesheet.error.taskNotBookable.orderPositionsFoundInSubTasks"); timesheetDao.save(sheet.setTask(getTask("TBT-5.2.1.1"))); }
private void save(final TimesheetDO sheet, final String expectedErrorMsgKey) { try { timesheetDao.save(sheet); fail("AccessException expected: " + expectedErrorMsgKey); } catch (final AccessException ex) { assertEquals(expectedErrorMsgKey, ex.getI18nKey()); } }
@Test public void testTaskStatus() { initialize(); final PFUserDO user = getUser(TEST_USER); logon(user); TimesheetDO sheet = createNewSheet().setTask(getTask("TBT-1")); timesheetDao.save(sheet); sheet = createNewSheet().setTask(getTask("TBT-1.1")); save(sheet, "timesheet.error.taskNotBookable.taskNotOpened"); save(sheet.setTask(getTask("TBT-1.2")), "timesheet.error.taskNotBookable.taskDeleted"); save(sheet.setTask(getTask("TBT-1.2.1")), "timesheet.error.taskNotBookable.taskDeleted"); }
@Test public void testTimesheetBookingStatus() { initialize(); logon(getUser(TEST_USER)); TimesheetDO sheet = createNewSheet().setTask(getTask("TBT-2")); save(sheet, "timesheet.error.taskNotBookable.treeClosedForBooking"); save(sheet.setTask(getTask("TBT-2.1")), "timesheet.error.taskNotBookable.treeClosedForBooking"); save( sheet.setTask(getTask("TBT-3")), "timesheet.error.taskNotBookable.onlyLeafsAllowedForBooking"); save( sheet.setTask(getTask("TBT-3.1")), "timesheet.error.taskNotBookable.onlyLeafsAllowedForBooking"); timesheetDao.save(sheet.setTask(getTask("TBT-3.2"))); // Leaf task node. timesheetDao.save(createNewSheet().setTask(getTask("TBT-3.1.1"))); // Leaf task node. timesheetDao.save(createNewSheet().setTask(getTask("TBT-3.1.2"))); // Leaf task node. sheet = createNewSheet(); save(sheet.setTask(getTask("TBT-4")), "timesheet.error.taskNotBookable.taskClosedForBooking"); save( sheet.setTask(getTask("TBT-4.1")), "timesheet.error.taskNotBookable.taskClosedForBooking"); // Inherited (not opened) timesheetDao.save(sheet.setTask(getTask("TBT-4.1.1"))); // Opened for booking. }