use of com.zimbra.cs.mailbox.DeliveryOptions in project zm-mailbox by Zimbra.
the class TestUtil method addMessage.
public static Message addMessage(Mailbox mbox, int folderId, String subject, long timestamp) throws Exception {
String message = getTestMessage(subject, null, null, new Date(timestamp));
ParsedMessage pm = new ParsedMessage(message.getBytes(), timestamp, false);
DeliveryOptions dopt = new DeliveryOptions().setFolderId(folderId).setFlags(Flag.BITMASK_UNREAD);
return mbox.addMessage(null, pm, dopt, null);
}
use of com.zimbra.cs.mailbox.DeliveryOptions in project zm-mailbox by Zimbra.
the class TestRemoteImapMailboxStore method testGetCurrentModseq.
@Test
public void testGetCurrentModseq() throws Exception {
Mailbox mbox = TestUtil.getMailbox(USER_NAME);
Folder folder = mbox.createFolder(null, NAME_PREFIX, new Folder.FolderOptions().setDefaultView(MailItem.Type.MESSAGE));
int folderId = folder.getId();
ItemIdentifier folderIdent = folder.getFolderItemIdentifier();
ZMailbox zmbox = TestUtil.getZMailbox(USER_NAME);
RemoteImapMailboxStore remoteStore = new RemoteImapMailboxStore(zmbox, TestUtil.getAccount(USER_NAME).getId());
Assert.assertEquals("Before adding a message, remoteStore.getCurrentMODSEQ returns value different from folder.getImapMODSEQ", remoteStore.getCurrentMODSEQ(folderIdent), folder.getImapMODSEQ());
int oldModSeq = remoteStore.getCurrentMODSEQ(folderIdent);
// add a message to the folder
DeliveryOptions dopt = new DeliveryOptions().setFolderId(folderId).setFlags(Flag.BITMASK_UNREAD);
String message = TestUtil.getTestMessage(NAME_PREFIX, mbox.getAccount().getName(), "someone@zimbra.com", "nothing here", new Date(System.currentTimeMillis()));
ParsedMessage pm = new ParsedMessage(message.getBytes(), System.currentTimeMillis(), false);
mbox.addMessage(null, pm, dopt, null);
zmbox.noOp();
folder = mbox.getFolderById(null, folderId);
Assert.assertEquals("After adding a message, remoteStore.getCurrentMODSEQ returns value different from folder.getImapMODSEQ", remoteStore.getCurrentMODSEQ(folderIdent), folder.getImapMODSEQ());
Assert.assertFalse("Modseq should have changed after adding a message", remoteStore.getCurrentMODSEQ(folderIdent) == oldModSeq);
}
use of com.zimbra.cs.mailbox.DeliveryOptions in project zm-mailbox by Zimbra.
the class TestParsedMessage method runAddMessageTest.
private void runAddMessageTest(String originalMsg, ParsedMessage pm) throws Exception {
Mailbox mbox = TestUtil.getMailbox(SENDER_NAME);
DeliveryOptions dopt = new DeliveryOptions().setFolderId(Mailbox.ID_FOLDER_INBOX);
Message msg = mbox.addMessage(null, pm, dopt, null);
Assert.assertEquals(originalMsg, new String(ByteUtil.getContent(msg.getContentStream(), 0)));
}
Aggregations