Search in sources :

Example 21 with AppendResult

use of com.zimbra.cs.mailclient.imap.AppendResult in project zm-mailbox by Zimbra.

the class TestRemoteImapMultiServer method testAppend.

@Ignore("requires SELECT to work")
public void testAppend() throws Exception {
    connection = connect(imapServer);
    connection.login(PASS);
    Assert.assertTrue("IMAP connection is not authenticated", connection.isAuthenticated());
    assertTrue(connection.hasCapability("UIDPLUS"));
    Flags flags = Flags.fromSpec("afs");
    Date date = new Date(System.currentTimeMillis());
    Literal msg = SharedImapTests.message(100000);
    try {
        AppendResult res = connection.append("INBOX", flags, date, msg);
        assertNotNull(res);
        byte[] b = fetchBody(res.getUid());
        assertArrayEquals("content mismatch", msg.getBytes(), b);
    } finally {
        msg.dispose();
    }
}
Also used : Literal(com.zimbra.cs.mailclient.imap.Literal) AppendResult(com.zimbra.cs.mailclient.imap.AppendResult) Flags(com.zimbra.cs.mailclient.imap.Flags) Date(java.sql.Date) Ignore(org.junit.Ignore)

Aggregations

AppendResult (com.zimbra.cs.mailclient.imap.AppendResult)21 Test (org.junit.Test)12 Literal (com.zimbra.cs.mailclient.imap.Literal)11 AppendMessage (com.zimbra.cs.mailclient.imap.AppendMessage)9 Flags (com.zimbra.cs.mailclient.imap.Flags)7 Date (java.util.Date)7 MessageData (com.zimbra.cs.mailclient.imap.MessageData)6 MailboxInfo (com.zimbra.cs.mailclient.imap.MailboxInfo)5 Date (java.sql.Date)4 ZMailbox (com.zimbra.client.ZMailbox)3 ZTag (com.zimbra.client.ZTag)2 CommandFailedException (com.zimbra.cs.mailclient.CommandFailedException)2 IOException (java.io.IOException)2 MessagingException (javax.mail.MessagingException)2 ZFolder (com.zimbra.client.ZFolder)1 ServiceException (com.zimbra.common.service.ServiceException)1 MailException (com.zimbra.cs.mailclient.MailException)1 Body (com.zimbra.cs.mailclient.imap.Body)1 CopyResult (com.zimbra.cs.mailclient.imap.CopyResult)1 ImapRequest (com.zimbra.cs.mailclient.imap.ImapRequest)1