Search in sources :

Example 1 with CreateMountpointResponse

use of com.zimbra.soap.mail.message.CreateMountpointResponse in project zm-mailbox by Zimbra.

the class TestCalDav method createCalendarMountPoint.

public static CreateMountpointResponse createCalendarMountPoint(ZMailbox mboxSharee, Account sharer) throws ServiceException {
    NewMountpointSpec mpSpec = new NewMountpointSpec("Shared Calendar");
    mpSpec.setFlags("#");
    mpSpec.setRemoteId(Mailbox.ID_FOLDER_CALENDAR);
    mpSpec.setColor((byte) 4);
    mpSpec.setOwnerId(sharer.getId());
    mpSpec.setFolderId(Integer.valueOf(Mailbox.ID_FOLDER_USER_ROOT).toString());
    mpSpec.setDefaultView(MailItem.Type.APPOINTMENT.toString());
    CreateMountpointRequest createMpReq = new CreateMountpointRequest(mpSpec);
    CreateMountpointResponse createMpResp = mboxSharee.invokeJaxb(createMpReq);
    assertNotNull(String.format("CreateMountPointResponse for %s's Calendar on mbox %s", sharer.getName(), mboxSharee.getName()), createMpResp);
    return createMpResp;
}
Also used : CreateMountpointResponse(com.zimbra.soap.mail.message.CreateMountpointResponse) CreateMountpointRequest(com.zimbra.soap.mail.message.CreateMountpointRequest) NewMountpointSpec(com.zimbra.soap.mail.type.NewMountpointSpec)

Example 2 with CreateMountpointResponse

use of com.zimbra.soap.mail.message.CreateMountpointResponse in project zm-mailbox by Zimbra.

the class TestInvite method testBug86864DelegateInboxInviteLooksLikeInvite.

public void testBug86864DelegateInboxInviteLooksLikeInvite() throws Exception {
    TestUtil.createAccount(ORGANIZER);
    Account attendee = TestUtil.createAccount(ATTENDEE);
    Account delegate = TestUtil.createAccount(DELEGATE);
    ZMailbox mboxOrganizer = TestUtil.getZMailbox(ORGANIZER);
    ZMailbox mboxAttendee = TestUtil.getZMailbox(ATTENDEE);
    ZMailbox mboxDelegate = TestUtil.getZMailbox(DELEGATE);
    String subject = NAME_PREFIX + " for testing treatment at delegate inbox";
    Date startDate = new Date(System.currentTimeMillis() + Constants.MILLIS_PER_DAY);
    Date endDate = new Date(startDate.getTime() + Constants.MILLIS_PER_HOUR);
    String calendarId = Integer.valueOf(Mailbox.ID_FOLDER_CALENDAR).toString();
    FolderActionSelector action = new FolderActionSelector(calendarId, /* id */
    "grant");
    ActionGrantSelector grant = new ActionGrantSelector("rwidxa", /* perm */
    "usr");
    grant.setDisplayName(delegate.getName());
    grant.setPassword("");
    action.setGrant(grant);
    FolderActionRequest folderActionReq = new FolderActionRequest(action);
    FolderActionResponse folderActionResp = mboxAttendee.invokeJaxb(folderActionReq);
    assertNotNull("null FolderAction Response used to share folder", folderActionResp);
    ModifyPrefsRequest modPrefsReq = new ModifyPrefsRequest();
    Pref fwdInvitesPref = Pref.createPrefWithNameAndValue(ZAttrProvisioning.A_zimbraPrefCalendarForwardInvitesTo, delegate.getName());
    modPrefsReq.addPref(fwdInvitesPref);
    Pref noAutoAddPref = Pref.createPrefWithNameAndValue(ZAttrProvisioning.A_zimbraPrefCalendarAutoAddInvites, Boolean.FALSE.toString().toUpperCase());
    modPrefsReq.addPref(noAutoAddPref);
    ModifyPrefsResponse modPrefsResp = mboxAttendee.invokeJaxb(modPrefsReq);
    assertNotNull("null ModifyPrefs Response for forwarding calendar invites/no auto-add", modPrefsResp);
    NewMountpointSpec mpSpec = new NewMountpointSpec("Shared Calendar");
    mpSpec.setFlags("#");
    mpSpec.setRemoteId(Mailbox.ID_FOLDER_CALENDAR);
    mpSpec.setColor((byte) 4);
    mpSpec.setOwnerId(attendee.getId());
    mpSpec.setFolderId(Integer.valueOf(Mailbox.ID_FOLDER_USER_ROOT).toString());
    mpSpec.setDefaultView(MailItem.Type.APPOINTMENT.toString());
    CreateMountpointRequest createMpReq = new CreateMountpointRequest(mpSpec);
    CreateMountpointResponse createMpResp = mboxDelegate.invokeJaxb(createMpReq);
    assertNotNull("null ModifyPrefs Response for forwarding calendar invites", createMpResp);
    TestUtil.createAppointment(mboxOrganizer, subject, attendee.getName(), startDate, endDate);
    ZMessage inviteMsg = TestUtil.waitForMessage(mboxDelegate, "in:inbox " + subject);
    assertNotNull("null inviteMsg in delegate inbox", inviteMsg);
    MsgSpec msgSpec = new MsgSpec(inviteMsg.getId());
    msgSpec.setWantHtml(true);
    msgSpec.setNeedCanExpand(true);
    msgSpec.setMaxInlinedLength(250000);
    GetMsgRequest getMsgReq = new GetMsgRequest(msgSpec);
    GetMsgResponse getMsgResp = mboxDelegate.invokeJaxb(getMsgReq);
    assertNotNull("null GetMsgResponse in delegate inbox", getMsgResp);
    MsgWithGroupInfo msg = getMsgResp.getMsg();
    assertNotNull("null message in GetMsgResponse in delegate inbox", msg);
    InviteWithGroupInfo invite = msg.getInvite();
    assertNotNull("null invite in message in GetMsgResponse in delegate inbox regression to Bug 86864?", invite);
}
Also used : ZMessage(com.zimbra.client.ZMessage) Account(com.zimbra.cs.account.Account) CreateMountpointRequest(com.zimbra.soap.mail.message.CreateMountpointRequest) Pref(com.zimbra.soap.account.type.Pref) FolderActionResponse(com.zimbra.soap.mail.message.FolderActionResponse) GetMsgRequest(com.zimbra.soap.mail.message.GetMsgRequest) InviteWithGroupInfo(com.zimbra.soap.mail.type.InviteWithGroupInfo) ModifyPrefsRequest(com.zimbra.soap.account.message.ModifyPrefsRequest) MsgSpec(com.zimbra.soap.mail.type.MsgSpec) Date(java.util.Date) ActionGrantSelector(com.zimbra.soap.mail.type.ActionGrantSelector) FolderActionSelector(com.zimbra.soap.mail.type.FolderActionSelector) CreateMountpointResponse(com.zimbra.soap.mail.message.CreateMountpointResponse) ZMailbox(com.zimbra.client.ZMailbox) FolderActionRequest(com.zimbra.soap.mail.message.FolderActionRequest) MsgWithGroupInfo(com.zimbra.soap.mail.type.MsgWithGroupInfo) GetMsgResponse(com.zimbra.soap.mail.message.GetMsgResponse) ModifyPrefsResponse(com.zimbra.soap.account.message.ModifyPrefsResponse) NewMountpointSpec(com.zimbra.soap.mail.type.NewMountpointSpec)

Example 3 with CreateMountpointResponse

use of com.zimbra.soap.mail.message.CreateMountpointResponse in project zm-mailbox by Zimbra.

the class TestJaxbProvisioning method createMountpoint.

public void createMountpoint(Account acct, String localFolderName, String defaultView, String remoteZimbraId, String remoteFolderId) {
    NewMountpointSpec folderSpec = new NewMountpointSpec(localFolderName);
    folderSpec.setFolderId("1");
    folderSpec.setDefaultView(defaultView);
    folderSpec.setOwnerId(remoteZimbraId);
    folderSpec.setRemoteId(Integer.parseInt(remoteFolderId.substring(remoteFolderId.indexOf(':') + 1)));
    CreateMountpointRequest req = new CreateMountpointRequest(folderSpec);
    try {
        CreateMountpointResponse resp = prov.invokeJaxbOnTargetAccount(req, acct.getId());
        Assert.assertNotNull(String.format("CreateMountpointResponse for account %s folder %s", acct.getName(), localFolderName), resp);
    } catch (ServiceException e) {
        Assert.fail("Unexpected exception while creating mountpoint " + e);
    }
}
Also used : CreateMountpointResponse(com.zimbra.soap.mail.message.CreateMountpointResponse) CreateMountpointRequest(com.zimbra.soap.mail.message.CreateMountpointRequest) ServiceException(com.zimbra.common.service.ServiceException) NewMountpointSpec(com.zimbra.soap.mail.type.NewMountpointSpec)

Aggregations

CreateMountpointRequest (com.zimbra.soap.mail.message.CreateMountpointRequest)3 CreateMountpointResponse (com.zimbra.soap.mail.message.CreateMountpointResponse)3 NewMountpointSpec (com.zimbra.soap.mail.type.NewMountpointSpec)3 ZMailbox (com.zimbra.client.ZMailbox)1 ZMessage (com.zimbra.client.ZMessage)1 ServiceException (com.zimbra.common.service.ServiceException)1 Account (com.zimbra.cs.account.Account)1 ModifyPrefsRequest (com.zimbra.soap.account.message.ModifyPrefsRequest)1 ModifyPrefsResponse (com.zimbra.soap.account.message.ModifyPrefsResponse)1 Pref (com.zimbra.soap.account.type.Pref)1 FolderActionRequest (com.zimbra.soap.mail.message.FolderActionRequest)1 FolderActionResponse (com.zimbra.soap.mail.message.FolderActionResponse)1 GetMsgRequest (com.zimbra.soap.mail.message.GetMsgRequest)1 GetMsgResponse (com.zimbra.soap.mail.message.GetMsgResponse)1 ActionGrantSelector (com.zimbra.soap.mail.type.ActionGrantSelector)1 FolderActionSelector (com.zimbra.soap.mail.type.FolderActionSelector)1 InviteWithGroupInfo (com.zimbra.soap.mail.type.InviteWithGroupInfo)1 MsgSpec (com.zimbra.soap.mail.type.MsgSpec)1 MsgWithGroupInfo (com.zimbra.soap.mail.type.MsgWithGroupInfo)1 Date (java.util.Date)1