Search in sources :

Example 11 with OldPendingCommand

use of com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand 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);
}
Also used : PendingSetFlag(com.fsck.k9.controller.MessagingControllerCommands.PendingSetFlag) OldPendingCommand(com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand) Test(org.junit.Test)

Example 12 with OldPendingCommand

use of com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand 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);
}
Also used : PendingMoveOrCopy(com.fsck.k9.controller.MessagingControllerCommands.PendingMoveOrCopy) OldPendingCommand(com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand) Test(org.junit.Test)

Example 13 with OldPendingCommand

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

the class MigrationTo60Test method queueAppend.

OldPendingCommand queueAppend(String srcFolder, String uid) {
    OldPendingCommand command = new OldPendingCommand();
    command.command = PENDING_COMMAND_APPEND;
    command.arguments = new String[] { srcFolder, uid };
    return command;
}
Also used : OldPendingCommand(com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand)

Example 14 with OldPendingCommand

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

the class MigrationTo60Test method migrateEmptyTrash.

@Test
public void migrateEmptyTrash() {
    OldPendingCommand command = queueEmptyTrash();
    PendingCommand pendingCommand = MigrationTo60.migratePendingCommand(command);
    assertTrue(pendingCommand instanceof PendingEmptyTrash);
}
Also used : PendingEmptyTrash(com.fsck.k9.controller.MessagingControllerCommands.PendingEmptyTrash) PendingCommand(com.fsck.k9.controller.MessagingControllerCommands.PendingCommand) OldPendingCommand(com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand) OldPendingCommand(com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand) Test(org.junit.Test)

Example 15 with OldPendingCommand

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

the class MigrationTo60Test method queueMoveOrCopy.

OldPendingCommand queueMoveOrCopy(String srcFolder, String destFolder, boolean isCopy, String[] uids) {
    OldPendingCommand command = new OldPendingCommand();
    command.command = PENDING_COMMAND_MOVE_OR_COPY_BULK_NEW;
    int length = 4 + uids.length;
    command.arguments = new String[length];
    command.arguments[0] = srcFolder;
    command.arguments[1] = destFolder;
    command.arguments[2] = Boolean.toString(isCopy);
    command.arguments[3] = Boolean.toString(false);
    System.arraycopy(uids, 0, command.arguments, 4, 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