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, Map<String, String> uidMap) {
OldPendingCommand command = new OldPendingCommand();
command.command = PENDING_COMMAND_MOVE_OR_COPY_BULK_NEW;
int length = 4 + uidMap.keySet().size() + uidMap.values().size();
command.arguments = new String[length];
command.arguments[0] = srcFolder;
command.arguments[1] = destFolder;
command.arguments[2] = Boolean.toString(isCopy);
command.arguments[3] = Boolean.toString(true);
Set<String> strings = uidMap.keySet();
System.arraycopy(strings.toArray(new String[strings.size()]), 0, command.arguments, 4, uidMap.keySet().size());
Collection<String> values = uidMap.values();
System.arraycopy(values.toArray(new String[values.size()]), 0, command.arguments, 4 + uidMap.keySet().size(), uidMap.values().size());
return command;
}
use of com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand in project k-9 by k9mail.
the class MigrationTo60Test method migrateMarkAllMessagesRead.
@Test
public void migrateMarkAllMessagesRead() {
OldPendingCommand command = queueMarkAllMessagesRead(SOURCE_FOLDER);
PendingMarkAllAsRead pendingCommand = (PendingMarkAllAsRead) MigrationTo60.migratePendingCommand(command);
assertEquals(SOURCE_FOLDER, pendingCommand.folder);
}
use of com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand 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);
}
use of com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand 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);
}
use of com.fsck.k9.mailstore.migrations.MigrationTo60.OldPendingCommand 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);
}
Aggregations