use of com.zimbra.cs.datasource.imap.ImapAppender in project zm-mailbox by Zimbra.
the class TestImapClient method testGMailAppend.
@Ignore("deprecated")
public void testGMailAppend() throws Exception {
ImapConfig config = new ImapConfig();
config.getLogger().setLevel(Log.Level.trace);
config.setHost("imap.gmail.com");
config.setSecurity(MailConfig.Security.SSL);
config.setSSLSocketFactory(SSLUtil.getDummySSLContext().getSocketFactory());
config.setAuthenticationId("dacztest");
config.setMaxLiteralTraceSize(999999);
connection = new ImapConnection(config);
connection.connect();
connection.login("test1234");
MimeMessage mm = newTestMessage(new Random().nextInt());
// Append and find unique message
ImapAppender appender = new ImapAppender(connection, "INBOX");
long uid1 = appender.appendMessage(getBytes(mm), null);
System.out.println("XXX uid1 = " + uid1);
assertTrue("uid1 not found", uid1 > 0);
// Now append message again and make sure we can find the de-duped copy
long uid2 = appender.appendMessage(getBytes(mm), null);
assertTrue("uid2 not found", uid2 > 0);
assertEquals(uid1, uid2);
connection.close();
}
Aggregations