Search in sources :

Example 1 with ZGetInfoResult

use of com.zimbra.client.ZGetInfoResult in project zm-mailbox by Zimbra.

the class TestUtil method createMountpoint.

/**
     * Creates a mountpoint between two mailboxes. The mountpoint gives the "to" user full rights on the folder.
     *
     * @param remoteMbox
     *            remote mailbox
     * @param remotePath
     *            remote folder path. Folder is created if it doesn't exist.
     * @param localMbox
     *            local mailbox
     * @param mountpointName
     *            the name of the mountpoint folder. The folder is created directly under the user root.
     */
public static ZMountpoint createMountpoint(ZMailbox remoteMbox, String remotePath, ZMailbox localMbox, String mountpointName) throws ServiceException {
    ZFolder remoteFolder = remoteMbox.getFolderByPath(remotePath);
    if (remoteFolder == null) {
        remoteFolder = createFolder(remoteMbox, remotePath);
    }
    ZGetInfoResult remoteInfo = remoteMbox.getAccountInfo(true);
    remoteMbox.modifyFolderGrant(remoteFolder.getId(), GranteeType.all, null, "rwidx", null);
    return localMbox.createMountpoint(Integer.toString(Mailbox.ID_FOLDER_USER_ROOT), mountpointName, null, null, null, OwnerBy.BY_ID, remoteInfo.getId(), SharedItemBy.BY_ID, remoteFolder.getId(), false);
}
Also used : ZGetInfoResult(com.zimbra.client.ZGetInfoResult) ZFolder(com.zimbra.client.ZFolder)

Example 2 with ZGetInfoResult

use of com.zimbra.client.ZGetInfoResult in project zm-mailbox by Zimbra.

the class TestZClient method testModifySignatures.

/**
     * Confirms that the {@code List} of signatures returned by {@link ZMailbox#getSignatures}
     * is modifiable (see bug 51842). 
     */
public void testModifySignatures() throws Exception {
    ZMailbox mbox = TestUtil.getZMailbox(USER_NAME);
    List<ZSignature> signatures = mbox.getSignatures();
    try {
        signatures.set(signatures.size(), null);
    } catch (IndexOutOfBoundsException e) {
    // Not UnsupportedOperationException, so we're good.
    }
    ZGetInfoResult info = mbox.getAccountInfo(true);
    signatures = info.getSignatures();
    try {
        signatures.set(signatures.size(), null);
    } catch (IndexOutOfBoundsException e) {
    // Not UnsupportedOperationException, so we're good.
    }
}
Also used : ZMailbox(com.zimbra.client.ZMailbox) ZGetInfoResult(com.zimbra.client.ZGetInfoResult) ZSignature(com.zimbra.client.ZSignature)

Aggregations

ZGetInfoResult (com.zimbra.client.ZGetInfoResult)2 ZFolder (com.zimbra.client.ZFolder)1 ZMailbox (com.zimbra.client.ZMailbox)1 ZSignature (com.zimbra.client.ZSignature)1