use of com.zimbra.cs.mailclient.imap.AppendMessage in project zm-mailbox by Zimbra.
the class TestImap method testMultiappend.
@Test
public void testMultiappend() throws Exception {
assertTrue(connection.hasCapability("MULTIAPPEND"));
assertTrue(connection.hasCapability("UIDPLUS"));
AppendMessage msg1 = new AppendMessage(null, null, literal("test 1"));
AppendMessage msg2 = new AppendMessage(null, null, literal("test 2"));
AppendResult res = connection.append("INBOX", msg1, msg2);
assertNotNull(res);
assertEquals("expecting 2 uids", 2, res.getUids().length);
}
use of com.zimbra.cs.mailclient.imap.AppendMessage in project zm-mailbox by Zimbra.
the class TestImap method testCatenateSimple.
@Test
public void testCatenateSimple() throws Exception {
assertTrue(connection.hasCapability("CATENATE"));
assertTrue(connection.hasCapability("UIDPLUS"));
String part1 = simpleMessage("test message");
String part2 = "more text\r\n";
AppendMessage am = new AppendMessage(null, null, literal(part1), literal(part2));
AppendResult res = connection.append("INBOX", am);
connection.select("INBOX");
byte[] body = fetchBody(res.getUid());
assertArrayEquals("content mismatch", bytes(part1 + part2), body);
}
use of com.zimbra.cs.mailclient.imap.AppendMessage in project zm-mailbox by Zimbra.
the class TestImap method testCatenateUrl.
@Test
public void testCatenateUrl() throws Exception {
assertTrue(connection.hasCapability("CATENATE"));
assertTrue(connection.hasCapability("UIDPLUS"));
String msg1 = simpleMessage("test message");
AppendResult res1 = connection.append("INBOX", null, null, literal(msg1));
String s1 = "first part\r\n";
String s2 = "second part\r\n";
String msg2 = msg1 + s1 + s2;
AppendMessage am = new AppendMessage(null, null, url("INBOX", res1), literal(s1), literal(s2));
AppendResult res2 = connection.append("INBOX", am);
connection.select("INBOX");
byte[] b2 = fetchBody(res2.getUid());
assertArrayEquals("content mismatch", bytes(msg2), b2);
}
Aggregations