/** * Create an all-day appointment on the server * * @param account The appointment organizer * @param date The appointment start date * @param duration The appointment duration (in days) * @param subject The appointment subject * @param content The appointment text content * @param location The appointment location (null if none) * @param attendees A list of attendees (null for none) * @return * @throws HarnessException */ public static AppointmentItem createAppointmentAllDay( ZimbraAccount account, Calendar date, int duration, String subject, String content, String location, List<ZimbraAccount> attendees) throws HarnessException { // If location is null, don't specify the loc attribute String loc = (location == null ? "" : "loc='" + location + "'"); // Convert the calendar to a ZDate ZDate start = new ZDate( date.get(Calendar.YEAR), date.get(Calendar.MONTH) + 1, date.get(Calendar.DAY_OF_MONTH), 12, 0, 0); account.soapSend( "<CreateAppointmentRequest xmlns='urn:zimbraMail'>" + "<m l='10'>" + "<inv>" + "<comp allDay='1' name='" + subject + "' " + loc + " draft='0' status='CONF' class='PUB' transp='O' fb='F'>" + "<s d='" + start.toYYYYMMDD() + "'/>" + "<e d='" + start.addDays(duration > 0 ? duration - 1 : 0).toYYYYMMDD() + "'/>" + "<or a='" + account.EmailAddress + "'/>" + "</comp>" + "</inv>" + "<su>" + subject + "</su>" + "<mp ct='text/plain'>" + "<content>" + content + "</content>" + "</mp>" + "</m>" + "</CreateAppointmentRequest>"); AppointmentItem result = AppointmentItem.importFromSOAP( account, "subject:(" + subject + ")", start.addDays(-7), start.addDays(7)); return (result); }
@Bugs(ids = "69132") @Test( description = "Cancel meeting using context menu", groups = {"functional"}) public void CancelMeeting_01() throws HarnessException { // -- Data setup // Creating object for meeting data String tz, apptSubject, apptBody, apptAttendee1; tz = ZTimeZone.TimeZoneEST.getID(); apptSubject = ZimbraSeleniumProperties.getUniqueString(); apptBody = ZimbraSeleniumProperties.getUniqueString(); apptAttendee1 = ZimbraAccount.AccountA().EmailAddress; // Absolute dates in UTC zone Calendar now = this.calendarWeekDayUTC; ZDate startUTC = new ZDate( now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 12, 0, 0); ZDate endUTC = new ZDate( now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, now.get(Calendar.DAY_OF_MONTH), 14, 0, 0); app.zGetActiveAccount() .soapSend( "<CreateAppointmentRequest xmlns='urn:zimbraMail'>" + "<m>" + "<inv method='REQUEST' type='event' status='CONF' draft='0' class='PUB' fb='B' transp='O' allDay='0' name='" + apptSubject + "'>" + "<s d='" + startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() + "' tz='" + tz + "'/>" + "<e d='" + endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() + "' tz='" + tz + "'/>" + "<or a='" + app.zGetActiveAccount().EmailAddress + "'/>" + "<at role='REQ' ptst='NE' rsvp='1' a='" + apptAttendee1 + "' d='2'/>" + "</inv>" + "<e a='" + apptAttendee1 + "' t='t'/>" + "<mp content-type='text/plain'>" + "<content>" + apptBody + "</content>" + "</mp>" + "<su>" + apptSubject + "</su>" + "</m>" + "</CreateAppointmentRequest>"); String apptId = app.zGetActiveAccount().soapSelectValue("//mail:CreateAppointmentResponse", "apptId"); // -- GUI actions // Refresh the view app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH); // Select the appointment app.zPageCalendar.zListItem(Action.A_LEFTCLICK, apptSubject); // Right Click -> Delete context menu DialogWarning dialog = (DialogWarning) app.zPageCalendar.zListItem(Action.A_RIGHTCLICK, Button.O_CANCEL_MENU, apptSubject); // Click Send Cancellation dialog.zClickButton(Button.B_SEND_CANCELLATION); // -- Verification // Verify the meeting disappears from the view ZAssert.assertEquals( app.zPageCalendar.sIsElementPresent(app.zPageCalendar.zGetApptLocator(apptSubject)), false, "Verify meeting is deleted from organizer's calendar"); // Verify meeting is deleted from attendee's calendar // AppointmentItem canceledAppt = AppointmentItem.importFromSOAP(ZimbraAccount.AccountA(), // "subject:("+ apptSubject +")", startUTC, endUTC); AppointmentItem canceledAppt = AppointmentItem.importFromSOAP(ZimbraAccount.AccountA(), "subject:(" + apptSubject + ")"); ZAssert.assertNull(canceledAppt, "Verify meeting is deleted from attendee's calendar"); }
/** * Create a single-day appointment on the server * * @param account Appointment Organizer * @param start Start time of the appointment, which will be rounded to the nearest hour * @param duration Duration of the appointment, in minutes * @param timezone Timezone of the appointment (null if default) * @param subject Subject of the appointment * @param content Content of the appointment (text) * @param location Location of the appointment (null if none) * @param attendees List of attendees for the appointment * @return * @throws HarnessException */ public static AppointmentItem createAppointmentSingleDay( ZimbraAccount account, Calendar start, int duration, TimeZone tz, String subject, String content, String location, List<ZimbraAccount> attendees) throws HarnessException { // If location is null, don't specify the loc attribute String loc = (location == null ? "" : "loc='" + location + "'"); // TODO: determine the timezone String timezoneString = ZTimeZone.TimeZoneEST.getID(); // Convert the calendar to a ZDate ZDate beginning = new ZDate( start.get(Calendar.YEAR), start.get(Calendar.MONTH) + 1, start.get(Calendar.DAY_OF_MONTH), start.get(Calendar.HOUR_OF_DAY), 0, 0); ZDate ending = beginning.addMinutes(duration); account.soapSend( "<CreateAppointmentRequest xmlns='urn:zimbraMail'>" + "<m l='10'>" + "<inv>" + "<comp name='" + subject + "' " + loc + " draft='0' status='CONF' class='PUB' transp='O' fb='B'>" + "<s d='" + beginning.toTimeZone(timezoneString).toYYYYMMDDTHHMMSS() + "' tz='" + timezoneString + "'/>" + "<e d='" + ending.toTimeZone(timezoneString).toYYYYMMDDTHHMMSS() + "' tz='" + timezoneString + "'/>" + "<or a='" + account.EmailAddress + "'/>" + "</comp>" + "</inv>" + "<su>" + subject + "</su>" + "<mp ct='text/plain'>" + "<content>" + content + "</content>" + "</mp>" + "</m>" + "</CreateAppointmentRequest>"); AppointmentItem result = AppointmentItem.importFromSOAP( account, "subject:(" + subject + ")", beginning.addDays(-7), beginning.addDays(7)); return (result); }