/**
   * 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);
  }
 /**
  * Get an AppointmentItem using start/end +/- 31 days
  *
  * @param account
  * @param query
  * @return
  * @throws HarnessException
  */
 public static AppointmentItem importFromSOAP(ZimbraAccount account, String query)
     throws HarnessException {
   Calendar now = Calendar.getInstance();
   ZDate date =
       new ZDate(
           now.get(Calendar.YEAR),
           now.get(Calendar.MONTH) + 1,
           now.get(Calendar.DAY_OF_MONTH),
           12,
           0,
           0);
   return (importFromSOAP(account, query, date.addDays(-31), date.addDays(31)));
 }
  @Test(
      description = "Measure the time to load the Calendar, month view, 1 appointment",
      groups = {"performance"})
  public void ZmCalendarApp_02() throws HarnessException {

    // Create an appointment
    String subject = "subject" + ZimbraSeleniumProperties.getUniqueString();
    AppointmentItem.createAppointmentSingleDay(
        app.zGetActiveAccount(),
        Calendar.getInstance(),
        60,
        null,
        subject,
        "content" + ZimbraSeleniumProperties.getUniqueString(),
        "location" + ZimbraSeleniumProperties.getUniqueString(),
        null);

    // Start the perf token
    PerfToken token =
        PerfMetrics.startTimestamp(
            PerfKey.ZmCalendarApp, "Load the calendar app, month view, 1 appointment");

    // Go to calendar
    // app.zPageCalendar.zNavigateTo();
    app.zPageCalendar.zClickAt("css=td[id='zb__App__Calendar_title']", "");

    PerfMetrics.waitTimestamp(token);

    // Wait for the app to load
    app.zPageCalendar.zWaitForActive();
  }
示例#4
0
	@Bugs(ids = "69132")
	@Test(	description = "View a basic all-day appointment in the work week view",
			groups = { "smoke" })
	public void GetAllDayAppointment_01() throws HarnessException {
		
		// Create the appointment on the server
		String apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString();
		String apptLocation = "location" + ZimbraSeleniumProperties.getUniqueString();
		String apptBody = "content" + ZimbraSeleniumProperties.getUniqueString();
		
		// 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);
		
		// EST timezone string
		String tz = ZTimeZone.TimeZoneEST.getID();

		// Create a meeting request from AccountA to the test account
		ZimbraAccount.AccountA().soapSend(
					"<CreateAppointmentRequest xmlns='urn:zimbraMail'>" +
						"<m>" +
							"<inv>" +
								"<comp status='CONF' fb='B' class='PUB' transp='O' allDay='1' name='"+ apptSubject +"' loc='"+ apptLocation +"'>" +
									"<s d='"+ startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() +"' tz='"+ tz +"'/>" +
									"<e d='"+ endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS() +"' tz='"+ tz +"'/>" +
									"<at role='REQ' ptst='NE' rsvp='1' a='"+ app.zGetActiveAccount().EmailAddress +"'/>" +
									"<or a='"+ ZimbraAccount.AccountA().EmailAddress + "'/>" +
								"</comp>" +
							"</inv>" +
							"<e a='"+ app.zGetActiveAccount().EmailAddress +"' t='t'/>" +
							"<su>"+ apptSubject + "</su>" +
							"<mp ct='text/plain'>" +
							"<content>"+ apptBody +"</content>" +
							"</mp>" +
						"</m>" +
					"</CreateAppointmentRequest>");
		
		AppointmentItem appt = AppointmentItem.importFromSOAP(app.zGetActiveAccount(), "subject:("+ apptSubject +")", startUTC.addDays(-7), endUTC.addDays(7));
		ZAssert.assertNotNull(appt, "Verify the new appointment is created");

		app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);
		
		//wait for the appointment displayed in the view
		ZAssert.assertEquals(app.zPageCalendar.sIsElementPresent(app.zPageCalendar.zGetReadOnlyAllDayApptLocator(apptSubject)), true, "Verify all-day appointment is deleted");
		
	}
  @Test(
      description = "Measure the time to load the Calendar, month view, 100 appointment",
      groups = {"performance"})
  public void ZmCalendarApp_03() throws HarnessException {

    // What is today?
    Calendar today = Calendar.getInstance();

    // Import 100 appointments using Calendar.ics and REST
    String filename =
        ZimbraSeleniumProperties.getBaseDirectory() + "/data/public/ics/calendar05/Calendar.ics";
    File file = null;

    // Modify the ICS in two ways:
    // 1. Make the current account the organizer
    // 2. Make the dates equal to this month
    file =
        RestUtil.FileUtils.replaceInFile(
            "*****@*****.**", app.zGetActiveAccount().EmailAddress, new File(filename));
    file =
        RestUtil.FileUtils.replaceInFile(
            "201111", (new SimpleDateFormat("yyyyMM")).format(today.getTime()), file);

    RestUtil rest = new RestUtil();
    rest.setAuthentication(app.zGetActiveAccount());
    rest.setPath("/service/home/~/Calendar");
    rest.setQueryParameter("fmt", "ics");
    rest.setUploadFile(file);
    rest.doPost();

    // Start the perf token
    PerfToken token =
        PerfMetrics.startTimestamp(
            PerfKey.ZmCalendarApp, "Load the calendar app, month view, 100 appointment");

    // Go to calendar
    // app.zPageCalendar.zNavigateTo();
    app.zPageCalendar.zClickAt("css=td[id='zb__App__Calendar_title']", "");

    PerfMetrics.waitTimestamp(token);

    // Wait for the app to load
    app.zPageCalendar.zWaitForActive();
  }
示例#6
0
  @Bugs(ids = "69132")
  @Test(
      description = "View a multi-day appointment in the month view",
      groups = {"functional"})
  public void GetAppointment_02() throws HarnessException {

    // Create an appointment on the server
    String subject = "appointment" + ZimbraSeleniumProperties.getUniqueString();

    AppointmentItem.createAppointmentAllDay(
        app.zGetActiveAccount(),
        Calendar.getInstance(),
        2,
        subject,
        "content" + ZimbraSeleniumProperties.getUniqueString(),
        "location" + ZimbraSeleniumProperties.getUniqueString(),
        null);

    // Refresh the calendar
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);

    // Verify appointment displayed in month view
    ZAssert.assertEquals(
        app.zPageCalendar.sIsElementPresent(app.zPageCalendar.zGetAllDayApptLocator(subject)),
        true,
        "Verify appointment present in month view");

    // Below code works fine for single-day all day but for multi-day all day appointment it fails
    // because it finds empty cell

    // List<AppointmentItem> items = app.zPageCalendar.zListGetAppointments();
    // ZAssert.assertNotNull(items, "Get the list of appointments");

    // Verify the appointment is in the view
    // AppointmentItem found = null;
    // for(AppointmentItem item : items) {
    //	if ( item.getSubject().equals(subject) ) {
    //		found = item;
    //		break;
    //	}
    // }

    // ZAssert.assertNotNull(found, "Verify the new appointment appears in the view");

  }
示例#7
0
  @Bugs(ids = "69132")
  @Test(
      description = "View a basic appointment in the month view",
      groups = {"functional"})
  public void GetAppointment_01() throws HarnessException {

    // Create an appointment on the server
    String subject = "appointment" + ZimbraSeleniumProperties.getUniqueString();

    AppointmentItem.createAppointmentAllDay(
        app.zGetActiveAccount(),
        Calendar.getInstance(),
        1,
        subject,
        "content" + ZimbraSeleniumProperties.getUniqueString(),
        "location" + ZimbraSeleniumProperties.getUniqueString(),
        null);

    // Refresh the calendar
    app.zPageCalendar.zToolbarPressButton(Button.B_REFRESH);

    // Get the list of appointments in the current view
    List<AppointmentItem> items = app.zPageCalendar.zListGetAppointments();
    ZAssert.assertNotNull(items, "Get the list of appointments");

    // Verify the appointment is in the view
    AppointmentItem found = null;
    for (AppointmentItem item : items) {
      if (item.getSubject().equals(subject)) {
        found = item;
        break;
      }
    }

    ZAssert.assertNotNull(found, "Verify the new appointment appears in the view");
  }
示例#8
0
  @Bugs(ids = "69132")
  @Test(
      description = "View a basic appointment in the free busy view",
      groups = {"functional"})
  public void GetAppointment_01() throws HarnessException {

    // Create the appointment on the server
    // Create the message data to be sent
    String subject = "appointment" + ZimbraSeleniumProperties.getUniqueString();

    // Absolute dates in UTC zone
    Calendar now = Calendar.getInstance();
    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);

    // EST timezone string
    String tz = ZTimeZone.TimeZoneEST.getID();

    // Create an appointment
    app.zGetActiveAccount()
        .soapSend(
            "<CreateAppointmentRequest xmlns='urn:zimbraMail'>"
                + "<m>"
                + "<inv>"
                + "<comp status='CONF' fb='B' class='PUB' transp='O' allDay='0' name='"
                + subject
                + "' >"
                + "<s d='"
                + startUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + tz
                + "'/>"
                + "<e d='"
                + endUTC.toTimeZone(tz).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + tz
                + "'/>"
                + "<or a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</comp>"
                + "</inv>"
                + "<su>"
                + subject
                + "</su>"
                + "<mp ct='text/plain'>"
                + "<content>content</content>"
                + "</mp>"
                + "</m>"
                + "</CreateAppointmentRequest>");

    // -- GUI Actions

    // Go to F/B view
    SleepUtil.sleepMedium();
    app.zPageCalendar.zToolbarPressPulldown(Button.B_LISTVIEW, Button.O_LISTVIEW_FREEBUSY);

    // -- Verification

    // Verify the appointment appears on the page
    SleepUtil.sleepMedium(); // test fails without sleep because calendar view rendering takes time
    ZAssert.assertTrue(
        app.zPageCalendar.zGetApptLocatorFreeBusyView(
            app.zGetActiveAccount().EmailAddress, subject),
        "Verify attendee free/busy row exists");
  }
示例#9
0
  @Bugs(ids = "69132")
  @Test(
      description = "Accept a meeting using Accept button from invitation message",
      groups = {"smoke"})
  public void AcceptMeeting_01() throws HarnessException {

    // ------------------------ Test data ------------------------------------

    String apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString();

    Calendar now = Calendar.getInstance();
    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);

    // --------------- Creating invitation (organizer) ----------------------------

    ZimbraAccount.AccountA()
        .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(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<e d='"
                + endUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<or a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "'/>"
                + "<at role='REQ' ptst='NE' rsvp='1' a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</inv>"
                + "<e a='"
                + app.zGetActiveAccount().EmailAddress
                + "' t='t'/>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "<mp content-type='text/plain'>"
                + "<content>content</content>"
                + "</mp>"
                + "</m>"
                + "</CreateAppointmentRequest>");

    // --------------- Login to attendee & accept invitation
    // ----------------------------------------------------

    // Refresh the view
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Select the invitation
    DisplayMail display = (DisplayMail) app.zPageMail.zListItem(Action.A_LEFTCLICK, apptSubject);

    // Click Accept
    display.zPressButton(Button.B_ACCEPT);

    // ---------------- Verification at organizer & invitee side both
    // -------------------------------------

    // --- Check that the organizer shows the attendee as "ACCEPT" ---

    // Organizer: Search for the appointment (InvId)
    ZimbraAccount.AccountA()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='"
                + startUTC.addDays(-10).toMillis()
                + "' calExpandInstEnd='"
                + endUTC.addDays(10).toMillis()
                + "'>"
                + "<query>"
                + apptSubject
                + "</query>"
                + "</SearchRequest>");

    String organizerInvId = ZimbraAccount.AccountA().soapSelectValue("//mail:appt", "invId");

    // Get the appointment details
    ZimbraAccount.AccountA()
        .soapSend("<GetAppointmentRequest  xmlns='urn:zimbraMail' id='" + organizerInvId + "'/>");

    String attendeeStatus =
        ZimbraAccount.AccountA()
            .soapSelectValue(
                "//mail:at[@a='" + app.zGetActiveAccount().EmailAddress + "']", "ptst");

    // Verify attendee status shows as psts=AC
    ZAssert.assertEquals(attendeeStatus, "AC", "Verify that the attendee shows as 'ACCEPTED'");

    // --- Check that the attendee showing status as "ACCEPT" ---

    // Attendee: Search for the appointment (InvId)
    app.zGetActiveAccount()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='"
                + startUTC.addDays(-10).toMillis()
                + "' calExpandInstEnd='"
                + endUTC.addDays(10).toMillis()
                + "'>"
                + "<query>"
                + apptSubject
                + "</query>"
                + "</SearchRequest>");

    String attendeeInvId = app.zGetActiveAccount().soapSelectValue("//mail:appt", "invId");

    // Get the appointment details
    app.zGetActiveAccount()
        .soapSend("<GetAppointmentRequest  xmlns='urn:zimbraMail' id='" + attendeeInvId + "'/>");

    String myStatus =
        app.zGetActiveAccount()
            .soapSelectValue(
                "//mail:at[@a='" + app.zGetActiveAccount().EmailAddress + "']", "ptst");

    // Verify attendee status shows as psts=AC
    ZAssert.assertEquals(myStatus, "AC", "Verify that the attendee shows as 'ACCEPTED'");
  }
示例#10
0
  @Bugs(ids = "69132")
  @Test(
      description = "Accept meeting using 'Accept -> Edit Reply' and verify modified content",
      groups = {"functional"})
  public void AcceptMeeting_04() throws HarnessException {

    // ------------------------ Test data ------------------------------------

    String apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString();
    String modifiedBody = "modified" + ZimbraSeleniumProperties.getUniqueString();

    Calendar now = Calendar.getInstance();
    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);

    // --------------- Creating invitation (organizer) ----------------------------

    ZimbraAccount.AccountA()
        .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(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<e d='"
                + endUTC.toTimeZone(ZTimeZone.TimeZoneEST.getID()).toYYYYMMDDTHHMMSS()
                + "' tz='"
                + ZTimeZone.TimeZoneEST.getID()
                + "'/>"
                + "<or a='"
                + ZimbraAccount.AccountA().EmailAddress
                + "'/>"
                + "<at role='REQ' ptst='NE' rsvp='1' a='"
                + app.zGetActiveAccount().EmailAddress
                + "'/>"
                + "</inv>"
                + "<e a='"
                + app.zGetActiveAccount().EmailAddress
                + "' t='t'/>"
                + "<su>"
                + apptSubject
                + "</su>"
                + "<mp content-type='text/plain'>"
                + "<content>content</content>"
                + "</mp>"
                + "</m>"
                + "</CreateAppointmentRequest>");

    // --------------- Login to attendee & accept invitation
    // ----------------------------------------------------

    // Refresh the view
    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Select the invitation
    DisplayMail display = (DisplayMail) app.zPageMail.zListItem(Action.A_LEFTCLICK, apptSubject);

    // Click Accept -> Edit Reply , which will open a new reply compose
    FormMailNew editReply =
        (FormMailNew) display.zPressButtonPulldown(Button.B_ACCEPT, Button.O_ACCEPT_EDIT_REPLY);
    editReply.zFillField(Field.Body, modifiedBody);
    editReply.zSubmit();

    // ---------------- Verification at organizer & invitee side both
    // -------------------------------------

    // --- Check that the organizer shows the attendee as "ACCEPT" ---

    // Organizer: Search for the appointment (InvId)
    ZimbraAccount.AccountA()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='"
                + startUTC.addDays(-10).toMillis()
                + "' calExpandInstEnd='"
                + endUTC.addDays(10).toMillis()
                + "'>"
                + "<query>"
                + apptSubject
                + "</query>"
                + "</SearchRequest>");

    String organizerInvId = ZimbraAccount.AccountA().soapSelectValue("//mail:appt", "invId");

    // Get the appointment details
    ZimbraAccount.AccountA()
        .soapSend("<GetAppointmentRequest  xmlns='urn:zimbraMail' id='" + organizerInvId + "'/>");

    String attendeeStatus =
        ZimbraAccount.AccountA()
            .soapSelectValue(
                "//mail:at[@a='" + app.zGetActiveAccount().EmailAddress + "']", "ptst");

    // Verify attendee status shows as psts=AC
    ZAssert.assertEquals(attendeeStatus, "AC", "Verify that the attendee shows as 'ACCEPTED'");

    // --- Check that the attendee showing status as "ACCEPT" ---

    // Attendee: Search for the appointment (InvId)
    app.zGetActiveAccount()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='"
                + startUTC.addDays(-10).toMillis()
                + "' calExpandInstEnd='"
                + endUTC.addDays(10).toMillis()
                + "'>"
                + "<query>"
                + apptSubject
                + "</query>"
                + "</SearchRequest>");

    String attendeeInvId = app.zGetActiveAccount().soapSelectValue("//mail:appt", "invId");

    // Get the appointment details
    app.zGetActiveAccount()
        .soapSend("<GetAppointmentRequest  xmlns='urn:zimbraMail' id='" + attendeeInvId + "'/>");

    String myStatus =
        app.zGetActiveAccount()
            .soapSelectValue(
                "//mail:at[@a='" + app.zGetActiveAccount().EmailAddress + "']", "ptst");

    // Verify attendee status shows as psts=AC
    ZAssert.assertEquals(myStatus, "AC", "Verify that the attendee shows as 'ACCEPTED'");

    // Organizer: Search for the appointment response
    String inboxId =
        FolderItem.importFromSOAP(ZimbraAccount.AccountA(), FolderItem.SystemFolder.Inbox).getId();

    ZimbraAccount.AccountA()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='message'>"
                + "<query>inid:"
                + inboxId
                + " subject:("
                + apptSubject
                + ")</query>"
                + "</SearchRequest>");

    // Verify message body content
    String body = ZimbraAccount.AccountA().soapSelectValue("//mail:m/mail:fr", null);
    ZAssert.assertStringContains(body, modifiedBody, "Verify modified body value");
  }
示例#11
0
  @Bugs(ids = "69132")
  @Test(
      description = "Accept meeting - Verify organizer gets notification message",
      groups = {"functional"})
  public void AcceptMeeting_02() throws HarnessException {

    // ------------------------ Test data ------------------------------------

    String apptSubject = "appointment" + ZimbraSeleniumProperties.getUniqueString();
    Calendar now = Calendar.getInstance();
    ZDate startUTC =
        new ZDate(
            now.get(Calendar.YEAR),
            now.get(Calendar.MONTH) + 1,
            now.get(Calendar.DAY_OF_MONTH),
            12,
            0,
            0);

    // --------------- Creating invitation (organizer) ----------------------------

    this.SendCreateAppointmentRequest(apptSubject, startUTC);

    // --------------- Login to attendee & accept invitation
    // ----------------------------------------------------

    app.zPageMail.zToolbarPressButton(Button.B_GETMAIL);

    // Select the invitation
    DisplayMail display = (DisplayMail) app.zPageMail.zListItem(Action.A_LEFTCLICK, apptSubject);

    // Click Accept
    display.zPressButton(Button.B_ACCEPT);

    // ---------------- Verification at organizer & invitee side both
    // -------------------------------------

    // --- Check that the organizer shows the attendee as "ACCEPT" ---

    // Organizer: Search for the appointment response
    String inboxId =
        FolderItem.importFromSOAP(ZimbraAccount.AccountA(), FolderItem.SystemFolder.Inbox).getId();

    ZimbraAccount.AccountA()
        .soapSend(
            "<SearchRequest xmlns='urn:zimbraMail' types='message'>"
                + "<query>inid:"
                + inboxId
                + " subject:("
                + apptSubject
                + ")</query>"
                + "</SearchRequest>");

    String messageId = ZimbraAccount.AccountA().soapSelectValue("//mail:m", "id");

    // Get the appointment details
    ZimbraAccount.AccountA()
        .soapSend(
            "<GetMsgRequest  xmlns='urn:zimbraMail'>"
                + "<m id='"
                + messageId
                + "'/>"
                + "</GetMsgRequest>");
  }
示例#12
0
  /**
   * 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);
  }