Search in sources :

Example 21 with PendingCommand

use of com.fsck.k9.controller.MessagingControllerCommands.PendingCommand in project k-9 by k9mail.

the class MigrationTo60Test method migrateMoveOrCopy_withOldFormat.

@Test
public void migrateMoveOrCopy_withOldFormat() {
    OldPendingCommand command = queueMoveOrCopyOld(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 22 with PendingCommand

use of com.fsck.k9.controller.MessagingControllerCommands.PendingCommand in project k-9 by k9mail.

the class MigrationTo60Test method migrateSetFlag.

@Test
public void migrateSetFlag() {
    OldPendingCommand command = queueSetFlagBulk(SOURCE_FOLDER, FLAG_STATE, FLAG, UID_ARRAY);
    PendingSetFlag pendingCommand = (PendingSetFlag) MigrationTo60.migratePendingCommand(command);
    assertEquals(SOURCE_FOLDER, pendingCommand.folder);
    assertEquals(FLAG_STATE, pendingCommand.newState);
    assertEquals(FLAG, pendingCommand.flag);
    assertEquals(asList(UID_ARRAY), pendingCommand.uids);
}
Also used : PendingSetFlag(com.fsck.k9.controller.MessagingControllerCommands.PendingSetFlag) OldPendingCommand(com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand) Test(org.junit.Test)

Example 23 with PendingCommand

use of com.fsck.k9.controller.MessagingControllerCommands.PendingCommand in project k-9 by k9mail.

the class MigrationTo60Test method migrateMoveOrCopy_withUidMap.

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

Example 24 with PendingCommand

use of com.fsck.k9.controller.MessagingControllerCommands.PendingCommand in project k-9 by k9mail.

the class PendingCommandSerializerTest method testSerializeDeserialize__withArguments.

@Test
public void testSerializeDeserialize__withArguments() {
    PendingCommand pendingCommand = PendingAppend.create(SOURCE_FOLDER, UID);
    String serializedCommand = pendingCommandSerializer.serialize(pendingCommand);
    PendingAppend unserializedCommand = (PendingAppend) pendingCommandSerializer.unserialize(DATABASE_ID, pendingCommand.getCommandName(), serializedCommand);
    assertEquals(DATABASE_ID, unserializedCommand.databaseId);
    assertEquals(SOURCE_FOLDER, unserializedCommand.folder);
    assertEquals(UID, unserializedCommand.uid);
}
Also used : PendingAppend(com.fsck.k9.controller.MessagingControllerCommands.PendingAppend) PendingCommand(com.fsck.k9.controller.MessagingControllerCommands.PendingCommand) Test(org.junit.Test)

Example 25 with PendingCommand

use of com.fsck.k9.controller.MessagingControllerCommands.PendingCommand in project k-9 by k9mail.

the class PendingCommandSerializerTest method testSerializeDeserialize__withComplexArguments.

@Test
public void testSerializeDeserialize__withComplexArguments() {
    PendingCommand pendingCommand = PendingMoveOrCopy.create(SOURCE_FOLDER, DEST_FOLDER, IS_COPY, UID_MAP);
    String serializedCommand = pendingCommandSerializer.serialize(pendingCommand);
    PendingMoveOrCopy unserializedCommand = (PendingMoveOrCopy) pendingCommandSerializer.unserialize(DATABASE_ID, pendingCommand.getCommandName(), serializedCommand);
    assertEquals(DATABASE_ID, unserializedCommand.databaseId);
    assertEquals(SOURCE_FOLDER, unserializedCommand.srcFolder);
    assertEquals(DEST_FOLDER, unserializedCommand.destFolder);
    assertEquals(UID_MAP, unserializedCommand.newUidMap);
}
Also used : PendingMoveOrCopy(com.fsck.k9.controller.MessagingControllerCommands.PendingMoveOrCopy) PendingCommand(com.fsck.k9.controller.MessagingControllerCommands.PendingCommand) Test(org.junit.Test)

Aggregations

PendingCommand (com.fsck.k9.controller.MessagingControllerCommands.PendingCommand)14 Test (org.junit.Test)14 OldPendingCommand (com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand)10 PendingMoveOrCopy (com.fsck.k9.controller.MessagingControllerCommands.PendingMoveOrCopy)5 PendingSetFlag (com.fsck.k9.controller.MessagingControllerCommands.PendingSetFlag)4 MessagingException (com.fsck.k9.mail.MessagingException)4 LocalStore (com.fsck.k9.mailstore.LocalStore)4 LocalFolder (com.fsck.k9.mailstore.LocalFolder)3 ContentValues (android.content.ContentValues)2 PendingAppend (com.fsck.k9.controller.MessagingControllerCommands.PendingAppend)2 PendingEmptyTrash (com.fsck.k9.controller.MessagingControllerCommands.PendingEmptyTrash)2 Flag (com.fsck.k9.mail.Flag)2 Message (com.fsck.k9.mail.Message)2 MimeMessage (com.fsck.k9.mail.internet.MimeMessage)2 LocalMessage (com.fsck.k9.mailstore.LocalMessage)2 UnavailableStorageException (com.fsck.k9.mailstore.UnavailableStorageException)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 SuppressLint (android.annotation.SuppressLint)1 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)1