List of usage examples for org.apache.commons.lang.time DateUtils addDays
public static Date addDays(Date date, int amount)
From source file:org.kuali.kra.committee.web.CommitteeScheduleAddSeleniumTest.java
/** * Test the daily recurrence option for "every weekday". * //from w ww. j av a 2 s . c om * @throws Exception */ @Test public void testCommitteeScheduleDailyRecurranceOptionEveryWeekday() throws Exception { helper.createCommittee(); helper.clickCommitteeSchedulePage(); Date scheduleStartDate = new Date(); Date scheduleEndDate = DateUtils.addDays(scheduleStartDate, 3); helper.set(HELPER_SCHEDULE_START_DATE_ID, fullFormatter.format(scheduleStartDate)); helper.set(HELPER_TIME_ID, TIME); helper.set(HELPER_PLACE_ID, PLACE); helper.set(HELPER_RECURRENCE_TYPE_ID, RECURRENCE_TYPE_DAILY); helper.set(HELPER_DAILY_SCHEDULE_DAY_OPTION_ID, SCHEDULE_OPTION_WEEKDAY); helper.set(HELPER_DAILY_SCHEDULE_SCHEDULE_END_DATE_ID, fullFormatter.format(scheduleEndDate)); helper.click(ADD_EVENT_BUTTON); helper.assertNoPageErrors(); Date firstScheduleDate = DateUtils.addDays(scheduleStartDate, 0); Date firstDeadlineDate = DateUtils.addDays(firstScheduleDate, -1); Date secondScheduleDate = DateUtils.addDays(scheduleStartDate, 1); Date secondDeadlineDate = DateUtils.addDays(secondScheduleDate, -1); Date thirdScheduleDate = DateUtils.addDays(scheduleStartDate, 2); Date thirdDeadlineDate = DateUtils.addDays(thirdScheduleDate, -1); Date fourthScheduleDate = DateUtils.addDays(scheduleStartDate, 3); Date fourthDeadlineDate = DateUtils.addDays(fourthScheduleDate, -1); int tableRowCount = 3; if (isWeekday(firstScheduleDate)) { tableRowCount++; } if (isWeekday(secondScheduleDate)) { tableRowCount++; } if (isWeekday(thirdScheduleDate)) { tableRowCount++; } if (isWeekday(fourthScheduleDate)) { tableRowCount++; } helper.assertTableRowCount(TABLE_ID, tableRowCount); int index = 0; if (isWeekday(firstScheduleDate)) { helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, index), fullFormatter.format(firstScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, index + 2, 1, dayFormatter.format(firstScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, index), fullFormatter.format(firstDeadlineDate)); index++; } if (isWeekday(secondScheduleDate)) { helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, index), fullFormatter.format(secondScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, index + 2, 1, dayFormatter.format(secondScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, index), fullFormatter.format(secondDeadlineDate)); index++; } if (isWeekday(thirdScheduleDate)) { helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, index), fullFormatter.format(thirdScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, index + 2, 1, dayFormatter.format(thirdScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, index), fullFormatter.format(thirdDeadlineDate)); index++; } if (isWeekday(fourthScheduleDate)) { helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, index), fullFormatter.format(fourthScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, index + 2, 1, dayFormatter.format(fourthScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, index), fullFormatter.format(fourthDeadlineDate)); } }
From source file:org.kuali.kra.committee.web.CommitteeScheduleAddSeleniumTest.java
/** * Test the weekly recurrence option for "every Monday". * //from w w w .j ava2 s . c om * @throws Exception */ @Test public void testCommitteeScheduleWeeklyRecurranceMonday() throws Exception { helper.createCommittee(); helper.clickCommitteeSchedulePage(); Date scheduleStartDate = new Date(); Date scheduleEndDate = DateUtils.addDays(scheduleStartDate, 7); helper.set(HELPER_SCHEDULE_START_DATE_ID, fullFormatter.format(scheduleStartDate)); helper.set(HELPER_TIME_ID, TIME); helper.set(HELPER_PLACE_ID, PLACE); helper.set(HELPER_RECURRENCE_TYPE_ID, RECURRENCE_TYPE_WEEKLY); helper.set(HELPER_WEEKLY_SCHEDULE_SCHEDULE_END_DATE_ID, fullFormatter.format(scheduleEndDate)); helper.click(ADD_EVENT_BUTTON); helper.assertNoPageErrors(); Date scheduleMonday = getMonday(scheduleStartDate); Date deadlineDateMonday = DateUtils.addDays(scheduleMonday, -1); if (DateUtils.isSameDay(scheduleStartDate, scheduleMonday)) { Date scheduleNextMonday = DateUtils.addDays(scheduleMonday, 7); Date deadlineDateNextMonday = DateUtils.addDays(scheduleNextMonday, -1); helper.assertTableRowCount(TABLE_ID, 5); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(scheduleMonday)); helper.assertTableCellValueContains(TABLE_ID, 2, 1, dayFormatter.format(scheduleMonday).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(deadlineDateMonday)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 1), fullFormatter.format(scheduleNextMonday)); helper.assertTableCellValueContains(TABLE_ID, 3, 1, dayFormatter.format(scheduleNextMonday).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 1), fullFormatter.format(deadlineDateNextMonday)); } else { helper.assertTableRowCount(TABLE_ID, 4); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(scheduleMonday)); helper.assertTableCellValueContains(TABLE_ID, 2, 1, dayFormatter.format(scheduleMonday).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(deadlineDateMonday)); } }
From source file:org.kuali.kra.committee.web.CommitteeScheduleAddSeleniumTest.java
/** * Test the monthly recurrence option for "x day and x month". * /*from ww w. ja va 2 s . co m*/ * @throws Exception */ @Test public void testCommitteeScheduleMonthlyRecurranceOptionXDayAndXMonth() throws Exception { helper.createCommittee(); helper.clickCommitteeSchedulePage(); Date scheduleStartDate = new Date(); Date scheduleEndDate = DateUtils.addDays(scheduleStartDate, 7); Date scheduleDeadlineDate = DateUtils.addDays(scheduleStartDate, -1); helper.set(HELPER_SCHEDULE_START_DATE_ID, fullFormatter.format(scheduleStartDate)); helper.set(HELPER_TIME_ID, TIME); helper.set(HELPER_PLACE_ID, PLACE); helper.set(HELPER_RECURRENCE_TYPE_ID, RECURRENCE_TYPE_MONTHLY); helper.set(HELPER_MONTHLY_SCHEDULE_MONTH_OPTION_ID, SCHEDULE_OPTION_XDAYANDXMONTH); helper.set(HELPER_MONTHLY_SCHEDULE_DAY_ID, dayOfMonthFormatter.format(scheduleStartDate)); helper.set(HELPER_MONTHLY_SCHEDULE_SCHEDULE_END_DATE_ID, fullFormatter.format(scheduleEndDate)); helper.click(ADD_EVENT_BUTTON); helper.assertNoPageErrors(); helper.assertTableRowCount(TABLE_ID, 4); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(scheduleStartDate)); helper.assertTableCellValueContains(TABLE_ID, 2, 1, dayFormatter.format(scheduleStartDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(scheduleDeadlineDate)); }
From source file:org.kuali.kra.committee.web.CommitteeScheduleAddSeleniumTest.java
/** * Test the monthly recurrence option for "x day of the week and x month". * //from w w w . java 2 s . c om * @throws Exception */ @Test public void testCommitteeScheduleMonthlyRecurranceOptionXDayOfWeekAndXMonth() throws Exception { helper.createCommittee(); helper.clickCommitteeSchedulePage(); Date scheduleStartDate = DateUtils.truncate(new Date(), Calendar.MONTH); Date scheduleEndDate = DateUtils.addDays(scheduleStartDate, 10); helper.set(HELPER_SCHEDULE_START_DATE_ID, fullFormatter.format(scheduleStartDate)); helper.set(HELPER_TIME_ID, TIME); helper.set(HELPER_PLACE_ID, PLACE); helper.set(HELPER_RECURRENCE_TYPE_ID, RECURRENCE_TYPE_MONTHLY); helper.set(HELPER_MONTHLY_SCHEDULE_MONTH_OPTION_ID, SCHEDULE_OPTION_XDAYOFWEEKANDXMONTH); helper.set(HELPER_MONTHLY_SCHEDULE_SCHEDULE_END_DATE_ID, fullFormatter.format(scheduleEndDate)); helper.click(ADD_EVENT_BUTTON); helper.assertNoPageErrors(); Date scheduleMonday = getMonday(scheduleStartDate); Date deadlineDateMonday = DateUtils.addDays(scheduleMonday, -1); helper.assertTableRowCount(TABLE_ID, 4); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(scheduleMonday)); helper.assertTableCellValueContains(TABLE_ID, 2, 1, dayFormatter.format(scheduleMonday).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(deadlineDateMonday)); }
From source file:org.kuali.kra.committee.web.CommitteeScheduleAddSeleniumTest.java
/** * Test the yearly recurrence option for "every x day". * /*from ww w . ja va2 s. c o m*/ * @throws Exception */ @Test public void testCommitteeScheduleYearlyRecurranceOptionEveryXDay() throws Exception { helper.createCommittee(); helper.clickCommitteeSchedulePage(); Date scheduleStartDate = new Date(); Date scheduleEndDate = DateUtils.addDays(scheduleStartDate, 10); Date scheduleDeadlineDate = DateUtils.addDays(scheduleStartDate, -1); helper.set(HELPER_SCHEDULE_START_DATE_ID, fullFormatter.format(scheduleStartDate)); helper.set(HELPER_TIME_ID, TIME); helper.set(HELPER_PLACE_ID, PLACE); helper.set(HELPER_RECURRENCE_TYPE_ID, RECURRENCE_TYPE_YEARLY); helper.set(HELPER_YEARLY_SCHEDULE_YEAR_OPTION_ID, SCHEDULE_OPTION_XDAY); helper.set(HELPER_YEARLY_SCHEDULE_SELECTED_OPTION_1_MONTH_ID, monthFormatter.format(scheduleStartDate).toUpperCase()); helper.set(HELPER_YEARLY_SCHEDULE_DAY_ID, dayOfMonthFormatter.format(scheduleStartDate)); helper.set(HELPER_YEARLY_SCHEDULE_SCHEDULE_END_DATE_ID, fullFormatter.format(scheduleEndDate)); helper.click(ADD_EVENT_BUTTON); helper.assertNoPageErrors(); helper.assertTableRowCount(TABLE_ID, 4); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(scheduleStartDate)); helper.assertTableCellValueContains(TABLE_ID, 2, 1, dayFormatter.format(scheduleStartDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(scheduleDeadlineDate)); }
From source file:org.kuali.kra.committee.web.CommitteeScheduleAddSeleniumTest.java
/** * Test the yearly recurrence option for complex schedules. * //from w w w .ja va2 s .c o m * @throws Exception */ @Test public void testCommitteeScheduleYearlyRecurranceOptionCmplx() throws Exception { helper.createCommittee(); helper.clickCommitteeSchedulePage(); Date scheduleStartDate = DateUtils.truncate(new Date(), Calendar.MONTH); Date scheduleEndDate = DateUtils.addDays(scheduleStartDate, 10); helper.set(HELPER_SCHEDULE_START_DATE_ID, fullFormatter.format(scheduleStartDate)); helper.set(HELPER_TIME_ID, TIME); helper.set(HELPER_PLACE_ID, PLACE); helper.set(HELPER_RECURRENCE_TYPE_ID, RECURRENCE_TYPE_YEARLY); helper.set(HELPER_YEARLY_SCHEDULE_YEAR_OPTION_ID, SCHEDULE_OPTION_CMPLX); helper.set(HELPER_YEARLY_SCHEDULE_SELECTED_OPTION_2_MONTH_ID, monthFormatter.format(scheduleStartDate).toUpperCase()); helper.set(HELPER_YEARLY_SCHEDULE_SCHEDULE_END_DATE_ID, fullFormatter.format(scheduleEndDate)); helper.click(ADD_EVENT_BUTTON); helper.assertNoPageErrors(); Date scheduleMonday = getMonday(scheduleStartDate); Date deadlineDateMonday = DateUtils.addDays(scheduleMonday, -1); helper.assertTableRowCount(TABLE_ID, 4); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(scheduleMonday)); helper.assertTableCellValueContains(TABLE_ID, 2, 1, dayFormatter.format(scheduleMonday).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(deadlineDateMonday)); }
From source file:org.kuali.kra.committee.web.CommitteeScheduleFilterSeleniumTest.java
/** * Test the filter capability.//from w w w . jav a 2 s .co m * * @throws Exception */ @Test public void testFilter() throws Exception { helper.createCommittee(); helper.clickCommitteeSchedulePage(); Date scheduleStartDate = DateUtils.addDays(new Date(), -1); Date filterEndDate = DateUtils.addDays(scheduleStartDate, 1); Date scheduleEndDate = DateUtils.addDays(scheduleStartDate, 2); helper.set(HELPER_SCHEDULE_START_DATE_ID, fullFormatter.format(scheduleStartDate)); helper.set(HELPER_TIME_ID, TIME); helper.set(HELPER_PLACE_ID, PLACE); helper.set(HELPER_RECURRENCE_TYPE_ID, RECURRENCE_TYPE); helper.set(HELPER_DAILY_SCHEDULE_SCHEDULE_END_DATE_ID, fullFormatter.format(scheduleEndDate)); helper.click(ADD_EVENT_BUTTON); helper.assertNoPageErrors(); Date firstScheduleDate = DateUtils.addDays(scheduleStartDate, 0); Date firstDeadlineDate = DateUtils.addDays(firstScheduleDate, -1); Date secondScheduleDate = DateUtils.addDays(scheduleStartDate, 1); Date secondDeadlineDate = DateUtils.addDays(secondScheduleDate, -1); Date thirdScheduleDate = DateUtils.addDays(scheduleStartDate, 2); Date thirdDeadlineDate = DateUtils.addDays(thirdScheduleDate, -1); helper.assertTableRowCount(TABLE_ID, 6); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(firstScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 2, 1, dayFormatter.format(firstScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(firstDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 1), fullFormatter.format(secondScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 3, 1, dayFormatter.format(secondScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 1), fullFormatter.format(secondDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 2), fullFormatter.format(thirdScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 4, 1, dayFormatter.format(thirdScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 2), fullFormatter.format(thirdDeadlineDate)); helper.set(HELPER_FILTER_START_DATE_ID, fullFormatter.format(scheduleStartDate)); helper.set(HELPER_FILTER_END_DATE_ID, fullFormatter.format(filterEndDate)); helper.click(FILTER_COMMITTEE_SCHEDULE_DATES_BUTTON); helper.assertTableRowCount(TABLE_ID, 5); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(firstScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 2, 1, dayFormatter.format(firstScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(firstDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 1), fullFormatter.format(secondScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 3, 1, dayFormatter.format(secondScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 1), fullFormatter.format(secondDeadlineDate)); helper.click(RESET_COMMITTEE_SCHEDULE_DATES_BUTTON); helper.assertTableRowCount(TABLE_ID, 6); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(firstScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 2, 1, dayFormatter.format(firstScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(firstDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 1), fullFormatter.format(secondScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 3, 1, dayFormatter.format(secondScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 1), fullFormatter.format(secondDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 2), fullFormatter.format(thirdScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 4, 1, dayFormatter.format(thirdScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 2), fullFormatter.format(thirdDeadlineDate)); }
From source file:org.kuali.kra.committee.web.CommitteeSchedulePanelSeleniumTest.java
/** * Test the addition items in the schedule. * //from w ww.ja va2 s . co m * @throws Exception */ @Test public void testAddToSchedule() throws Exception { helper.createCommittee(); helper.clickCommitteeSchedulePage(); Date scheduleStartDate = DateUtils.addDays(new Date(), -1); Date scheduleEndDate = DateUtils.addDays(scheduleStartDate, 2); helper.set(HELPER_SCHEDULE_START_DATE_ID, fullFormatter.format(scheduleStartDate)); helper.set(HELPER_TIME_ID, TIME); helper.set(HELPER_PLACE_ID, PLACE); helper.set(HELPER_RECURRENCE_TYPE_ID, RECURRENCE_TYPE); helper.set(HELPER_DAILY_SCHEDULE_SCHEDULE_END_DATE_ID, fullFormatter.format(scheduleEndDate)); helper.click(ADD_EVENT_BUTTON); helper.assertNoPageErrors(); Date firstScheduleDate = DateUtils.addDays(scheduleStartDate, 0); Date firstDeadlineDate = DateUtils.addDays(firstScheduleDate, -1); Date secondScheduleDate = DateUtils.addDays(scheduleStartDate, 1); Date secondDeadlineDate = DateUtils.addDays(secondScheduleDate, -1); Date thirdScheduleDate = DateUtils.addDays(scheduleStartDate, 2); Date thirdDeadlineDate = DateUtils.addDays(thirdScheduleDate, -1); helper.assertTableRowCount(TABLE_ID, 6); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(firstScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 2, 1, dayFormatter.format(firstScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(firstDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 1), fullFormatter.format(secondScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 3, 1, dayFormatter.format(secondScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 1), fullFormatter.format(secondDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 2), fullFormatter.format(thirdScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 4, 1, dayFormatter.format(thirdScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 2), fullFormatter.format(thirdDeadlineDate)); Date newScheduleDate = DateUtils.addDays(new Date(), 5); Date newDeadlineDate = DateUtils.addDays(newScheduleDate, -1); helper.set(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(newScheduleDate)); helper.set(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(newDeadlineDate)); helper.set(String.format(LIST_SCHEDULE_STATUS_CODE_ID, 0), SCHEDULE_STATUS_CODE); helper.set(String.format(LIST_PLACE_ID, 0), PLACE); helper.set(String.format(LIST_VIEW_TIME_TIME_ID, 0), TIME); helper.saveDocument(); helper.assertNoPageErrors(); helper.assertTableRowCount(TABLE_ID, 6); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 2), fullFormatter.format(newScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 4, 1, dayFormatter.format(newScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 2), fullFormatter.format(newDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_STATUS_CODE_ID, 2), SCHEDULE_STATUS_CODE); helper.assertElementContains(String.format(LIST_PLACE_ID, 2), PLACE); helper.assertElementContains(String.format(LIST_VIEW_TIME_TIME_ID, 2), TIME); }
From source file:org.kuali.kra.committee.web.CommitteeSchedulePanelSeleniumTest.java
/** * Test the deletion of an item in the schedule. * // ww w . j a v a2s .c o m * @throws Exception */ @Test public void testDeleteFromSchedule() throws Exception { helper.createCommittee(); helper.clickCommitteeSchedulePage(); Date scheduleStartDate = DateUtils.addDays(new Date(), -1); Date scheduleEndDate = DateUtils.addDays(scheduleStartDate, 3); helper.set(HELPER_SCHEDULE_START_DATE_ID, fullFormatter.format(scheduleStartDate)); helper.set(HELPER_TIME_ID, TIME); helper.set(HELPER_PLACE_ID, PLACE); helper.set(HELPER_RECURRENCE_TYPE_ID, RECURRENCE_TYPE); helper.set(HELPER_DAILY_SCHEDULE_SCHEDULE_END_DATE_ID, fullFormatter.format(scheduleEndDate)); helper.click(ADD_EVENT_BUTTON); helper.assertNoPageErrors(); Date firstScheduleDate = DateUtils.addDays(scheduleStartDate, 0); Date firstDeadlineDate = DateUtils.addDays(firstScheduleDate, -1); Date secondScheduleDate = DateUtils.addDays(scheduleStartDate, 1); Date secondDeadlineDate = DateUtils.addDays(secondScheduleDate, -1); Date thirdScheduleDate = DateUtils.addDays(scheduleStartDate, 2); Date thirdDeadlineDate = DateUtils.addDays(thirdScheduleDate, -1); Date fourthScheduleDate = DateUtils.addDays(scheduleStartDate, 3); Date fourthDeadlineDate = DateUtils.addDays(fourthScheduleDate, -1); helper.assertTableRowCount(TABLE_ID, 7); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(firstScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 2, 1, dayFormatter.format(firstScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(firstDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 1), fullFormatter.format(secondScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 3, 1, dayFormatter.format(secondScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 1), fullFormatter.format(secondDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 2), fullFormatter.format(thirdScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 4, 1, dayFormatter.format(thirdScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 2), fullFormatter.format(thirdDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 3), fullFormatter.format(fourthScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 5, 1, dayFormatter.format(fourthScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 3), fullFormatter.format(fourthDeadlineDate)); helper.set(String.format(LIST_SELECTED_ID, 1), SELECTED); helper.click(DELETE_COMMITTEE_SCHEDULE_BUTTON); helper.clickYesAnswer(); helper.saveDocument(); helper.assertNoPageErrors(); helper.assertTableRowCount(TABLE_ID, 6); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(firstScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 2, 1, dayFormatter.format(firstScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(firstDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 1), fullFormatter.format(thirdScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 3, 1, dayFormatter.format(thirdScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 1), fullFormatter.format(thirdDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 2), fullFormatter.format(fourthScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 4, 1, dayFormatter.format(fourthScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 2), fullFormatter.format(fourthDeadlineDate)); }
From source file:org.kuali.kra.committee.web.CommitteeScheduleRuleSeleniumTest.java
/** * Test the date conflict rule.//from w w w . j a va 2 s . c o m * * @throws Exception */ @Test public void testSchedulePanelDateConflict() throws Exception { helper.createCommittee(); helper.clickCommitteeSchedulePage(); Date scheduleStartDate = DateUtils.addDays(new Date(), -1); Date scheduleEndDate = DateUtils.addDays(scheduleStartDate, 2); helper.set(HELPER_SCHEDULE_START_DATE_ID, fullFormatter.format(scheduleStartDate)); helper.set(HELPER_TIME_ID, TIME); helper.set(HELPER_PLACE_ID, PLACE); helper.set(HELPER_RECURRENCE_TYPE_ID, RECURRENCE_TYPE); helper.set(HELPER_DAILY_SCHEDULE_SCHEDULE_END_DATE_ID, fullFormatter.format(scheduleEndDate)); helper.click(ADD_EVENT_BUTTON); helper.assertNoPageErrors(); Date firstScheduleDate = DateUtils.addDays(scheduleStartDate, 0); Date firstDeadlineDate = DateUtils.addDays(firstScheduleDate, -1); Date secondScheduleDate = DateUtils.addDays(scheduleStartDate, 1); Date secondDeadlineDate = DateUtils.addDays(secondScheduleDate, -1); Date thirdScheduleDate = DateUtils.addDays(scheduleStartDate, 2); Date thirdDeadlineDate = DateUtils.addDays(thirdScheduleDate, -1); helper.assertTableRowCount(TABLE_ID, 6); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(firstScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 2, 1, dayFormatter.format(firstScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 0), fullFormatter.format(firstDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 1), fullFormatter.format(secondScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 3, 1, dayFormatter.format(secondScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 1), fullFormatter.format(secondDeadlineDate)); helper.assertElementContains(String.format(LIST_SCHEDULE_DATE_ID, 2), fullFormatter.format(thirdScheduleDate)); helper.assertTableCellValueContains(TABLE_ID, 4, 1, dayFormatter.format(thirdScheduleDate).toUpperCase()); helper.assertElementContains(String.format(LIST_PROTOCOL_SUB_DEADLINE_ID, 2), fullFormatter.format(thirdDeadlineDate)); Date newScheduleDate = DateUtils.addDays(scheduleStartDate, 1); helper.set(String.format(LIST_SCHEDULE_DATE_ID, 0), fullFormatter.format(newScheduleDate)); helper.saveDocument(); helper.assertPageErrors(); helper.assertError(ERROR_TAB_ID, errorFormatter.format(newScheduleDate) + ERROR_CONFLICT); }