use of com.fsck.k9.controller.MessagingControllerCommands.PendingCommand in project k-9 by k9mail.
the class MigrationTo60Test method migrateSetFlag_oldFormat.
@Test
public void migrateSetFlag_oldFormat() {
OldPendingCommand command = queueSetFlagOld(SOURCE_FOLDER, FLAG_STATE, FLAG, UID);
PendingSetFlag pendingCommand = (PendingSetFlag) MigrationTo60.migratePendingCommand(command);
assertEquals(SOURCE_FOLDER, pendingCommand.folder);
assertEquals(FLAG_STATE, pendingCommand.newState);
assertEquals(FLAG, pendingCommand.flag);
assertEquals(Collections.singletonList(UID), pendingCommand.uids);
}
use of com.fsck.k9.controller.MessagingControllerCommands.PendingCommand in project k-9 by k9mail.
the class MigrationTo60Test method migrateMoveOrCopy_withUidArray.
@Test
public void migrateMoveOrCopy_withUidArray() {
OldPendingCommand command = queueMoveOrCopy(SOURCE_FOLDER, DEST_FOLDER, IS_COPY, UID_ARRAY);
PendingMoveOrCopy pendingCommand = (PendingMoveOrCopy) MigrationTo60.migratePendingCommand(command);
assertEquals(SOURCE_FOLDER, pendingCommand.srcFolder);
assertEquals(DEST_FOLDER, pendingCommand.destFolder);
assertEquals(IS_COPY, pendingCommand.isCopy);
assertEquals(asList(UID_ARRAY), pendingCommand.uids);
assertNull(pendingCommand.newUidMap);
}
use of com.fsck.k9.controller.MessagingControllerCommands.PendingCommand in project k-9 by k9mail.
the class PendingCommandSerializerTest method testDeserialize__withUnknownCommandName__shouldFail.
@Test(expected = IllegalArgumentException.class)
public void testDeserialize__withUnknownCommandName__shouldFail() {
PendingCommand pendingCommand = PendingEmptyTrash.create();
String serializedCommand = pendingCommandSerializer.serialize(pendingCommand);
pendingCommandSerializer.unserialize(DATABASE_ID, "BAD_COMMAND_NAME", serializedCommand);
}
use of com.fsck.k9.controller.MessagingControllerCommands.PendingCommand in project k-9 by k9mail.
the class PendingCommandSerializerTest method testSerializeDeserialize__withoutArguments.
@Test
public void testSerializeDeserialize__withoutArguments() {
PendingCommand pendingCommand = PendingEmptyTrash.create();
String serializedCommand = pendingCommandSerializer.serialize(pendingCommand);
PendingEmptyTrash unserializedCommand = (PendingEmptyTrash) pendingCommandSerializer.unserialize(DATABASE_ID, pendingCommand.getCommandName(), serializedCommand);
assertEquals(DATABASE_ID, unserializedCommand.databaseId);
}
use of com.fsck.k9.controller.MessagingControllerCommands.PendingCommand in project k-9 by k9mail.
the class MessagingController method moveOrDeleteSentMessage.
private void moveOrDeleteSentMessage(Account account, LocalStore localStore, LocalFolder localFolder, LocalMessage message) throws MessagingException {
if (!account.hasSentFolder()) {
Timber.i("Account does not have a sent mail folder; deleting sent message");
message.setFlag(Flag.DELETED, true);
} else {
LocalFolder localSentFolder = localStore.getFolder(account.getSentFolderName());
Timber.i("Moving sent message to folder '%s' (%d)", account.getSentFolderName(), localSentFolder.getId());
localFolder.moveMessages(Collections.singletonList(message), localSentFolder);
Timber.i("Moved sent message to folder '%s' (%d)", account.getSentFolderName(), localSentFolder.getId());
PendingCommand command = PendingAppend.create(localSentFolder.getName(), message.getUid());
queuePendingCommand(account, command);
processPendingCommands(account);
}
}
Aggregations