use of com.zimbra.cs.mailclient.imap.Body in project zm-mailbox by Zimbra.
the class TestImapClient method testAppend.
@Test
public void testAppend() throws Exception {
login();
MailboxInfo mb = connection.select("INBOX");
long exists = mb.getExists();
Date date = new Date((System.currentTimeMillis() / 1000) * 1000);
Flags flags = Flags.fromSpec("fs");
AppendResult res = connection.append("INBOX", Flags.fromSpec("fs"), date, new Literal(Ascii.getBytes(MESSAGE)));
assertNotNull(res);
mb = connection.select("INBOX");
assertEquals(1, mb.getExists() - exists);
MessageData md = connection.uidFetch(res.getUid(), "(FLAGS BODY.PEEK[] INTERNALDATE)");
assertNotNull(md);
assertEquals(date, md.getInternalDate());
assertEquals(res.getUid(), md.getUid());
assertEquals(flags, md.getFlags());
Body[] parts = md.getBodySections();
assertNotNull(parts);
assertEquals(1, parts.length);
}
use of com.zimbra.cs.mailclient.imap.Body in project zm-mailbox by Zimbra.
the class TestImap method fetchBody.
private byte[] fetchBody(long uid) throws IOException {
MessageData md = connection.uidFetch(uid, "(BODY.PEEK[])");
assertNotNull("message not found", md);
assertEquals(uid, md.getUid());
Body[] bs = md.getBodySections();
assertNotNull(bs);
assertEquals(1, bs.length);
return bs[0].getImapData().getBytes();
}
Aggregations