Search in sources :

Example 1 with ZClientException

use of com.zimbra.common.zclient.ZClientException in project zm-mailbox by Zimbra.

the class TestMaxMessageSize method testUploadMaxSize.

@Test
public void testUploadMaxSize() throws Exception {
    /*
         * bug 27610, default file upload size for messages is now limited by zimbraMtaMaxMessageSize
         */
    // TestUtil.setServerAttr(Provisioning.A_zimbraFileUploadMaxSize, "900");
    setMaxMessageSize(900);
    // Upload an attachment that exceeds the max size
    Map<String, byte[]> attachments = new HashMap<String, byte[]>();
    attachments.put("file1.exe", new byte[1000]);
    ZMailbox mbox = TestUtil.getZMailbox(USER_NAME);
    try {
        mbox.uploadAttachments(attachments, 5000);
        Assert.fail("Attachment upload should have failed");
    } catch (ZClientException e) {
        Assert.assertEquals(ZClientException.UPLOAD_SIZE_LIMIT_EXCEEDED, e.getCode());
    }
}
Also used : ZMailbox(com.zimbra.client.ZMailbox) HashMap(java.util.HashMap) ZClientException(com.zimbra.common.zclient.ZClientException) Test(org.junit.Test)

Aggregations

ZMailbox (com.zimbra.client.ZMailbox)1 ZClientException (com.zimbra.common.zclient.ZClientException)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1