Search in sources :

Example 6 with OldPendingCommand

use of com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand in project k-9 by k9mail.

the class MigrationTo60Test method migrateMoveOrCopy__withEvenOlderFormat.

@Test
public void migrateMoveOrCopy__withEvenOlderFormat() {
    OldPendingCommand command = queueMoveOrCopyEvenOlder(SOURCE_FOLDER, DEST_FOLDER, UID, IS_COPY);
    PendingMoveOrCopy pendingCommand = (PendingMoveOrCopy) MigrationTo60.migratePendingCommand(command);
    assertEquals(SOURCE_FOLDER, pendingCommand.srcFolder);
    assertEquals(DEST_FOLDER, pendingCommand.destFolder);
    assertEquals(IS_COPY, pendingCommand.isCopy);
    assertEquals(Collections.singletonList(UID), pendingCommand.uids);
    assertNull(pendingCommand.newUidMap);
}
Also used : PendingMoveOrCopy(com.fsck.k9.controller.MessagingControllerCommands.PendingMoveOrCopy) OldPendingCommand(com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand) Test(org.junit.Test)

Example 7 with OldPendingCommand

use of com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand in project k-9 by k9mail.

the class MigrationTo60Test method queueEmptyTrash.

OldPendingCommand queueEmptyTrash() {
    OldPendingCommand command = new OldPendingCommand();
    command.command = PENDING_COMMAND_EMPTY_TRASH;
    command.arguments = new String[0];
    return command;
}
Also used : OldPendingCommand(com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand)

Example 8 with OldPendingCommand

use of com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand in project k-9 by k9mail.

the class MigrationTo60Test method queueSetFlagOld.

OldPendingCommand queueSetFlagOld(String folderName, boolean newState, Flag flag, String uid) {
    OldPendingCommand command = new OldPendingCommand();
    command.command = PENDING_COMMAND_SET_FLAG;
    command.arguments = new String[4];
    command.arguments[0] = folderName;
    command.arguments[1] = uid;
    command.arguments[2] = Boolean.toString(newState);
    command.arguments[3] = flag.toString();
    return command;
}
Also used : OldPendingCommand(com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand)

Example 9 with OldPendingCommand

use of com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand in project k-9 by k9mail.

the class MigrationTo60Test method migrateAppend.

@Test
public void migrateAppend() {
    OldPendingCommand command = queueAppend(SOURCE_FOLDER, UID);
    PendingAppend pendingCommand = (PendingAppend) MigrationTo60.migratePendingCommand(command);
    assertEquals(SOURCE_FOLDER, pendingCommand.folder);
    assertEquals(UID, pendingCommand.uid);
}
Also used : PendingAppend(com.fsck.k9.controller.MessagingControllerCommands.PendingAppend) OldPendingCommand(com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand) Test(org.junit.Test)

Example 10 with OldPendingCommand

use of com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand in project k-9 by k9mail.

the class MigrationTo60Test method queueSetFlagBulk.

OldPendingCommand queueSetFlagBulk(String folderName, boolean newState, Flag flag, String[] uids) {
    OldPendingCommand command = new OldPendingCommand();
    command.command = PENDING_COMMAND_SET_FLAG_BULK;
    int length = 3 + uids.length;
    command.arguments = new String[length];
    command.arguments[0] = folderName;
    command.arguments[1] = Boolean.toString(newState);
    command.arguments[2] = flag.toString();
    System.arraycopy(uids, 0, command.arguments, 3, uids.length);
    return command;
}
Also used : OldPendingCommand(com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand)

Aggregations

OldPendingCommand (com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand)20 Test (org.junit.Test)10 PendingMoveOrCopy (com.fsck.k9.controller.MessagingControllerCommands.PendingMoveOrCopy)4 PendingSetFlag (com.fsck.k9.controller.MessagingControllerCommands.PendingSetFlag)4 PendingCommand (com.fsck.k9.controller.MessagingControllerCommands.PendingCommand)2 Flag (com.fsck.k9.mail.Flag)2 ArrayList (java.util.ArrayList)2 ContentValues (android.content.ContentValues)1 PendingAppend (com.fsck.k9.controller.MessagingControllerCommands.PendingAppend)1 PendingEmptyTrash (com.fsck.k9.controller.MessagingControllerCommands.PendingEmptyTrash)1 PendingExpunge (com.fsck.k9.controller.MessagingControllerCommands.PendingExpunge)1 PendingMarkAllAsRead (com.fsck.k9.controller.MessagingControllerCommands.PendingMarkAllAsRead)1 PendingCommandSerializer (com.fsck.k9.controller.PendingCommandSerializer)1