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());
}
}
Aggregations