@Test public void migrate_multiDeviceReadUpdateJob_twoIds() throws Exception { OldSerializableSyncMessageId id1 = new OldSerializableSyncMessageId("+16101234567", 1); OldSerializableSyncMessageId id2 = new OldSerializableSyncMessageId("+16101112222", 2); JobData testData = new JobData("MultiDeviceReadUpdateJob", null, new Data.Builder().putStringArray("message_ids", new String[]{ JsonUtils.toJson(id1), JsonUtils.toJson(id2) }).build()); mockRecipientResolve("+16101234567", 1); mockRecipientResolve("+16101112222", 2); RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class)); JobData converted = subject.migrate(testData); assertEquals("MultiDeviceReadUpdateJob", converted.getFactoryKey()); assertNull(converted.getQueueKey()); String[] updated = converted.getData().getStringArray("message_ids"); assertEquals(2, updated.length); assertEquals(JsonUtils.toJson(new NewSerializableSyncMessageId("1", 1)), updated[0]); assertEquals(JsonUtils.toJson(new NewSerializableSyncMessageId("2", 2)), updated[1]); new MultiDeviceReadUpdateJob.Factory().create(mock(Job.Parameters.class), converted.getData()); }
@Override protected @NonNull JobData migrate(@NonNull JobData jobData) { switch(jobData.getFactoryKey()) { case "MultiDeviceContactUpdateJob": return migrateMultiDeviceContactUpdateJob(jobData); case "MultiDeviceRevealUpdateJob": return migrateMultiDeviceViewOnceOpenJob(jobData); case "RequestGroupInfoJob": return migrateRequestGroupInfoJob(jobData); case "SendDeliveryReceiptJob": return migrateSendDeliveryReceiptJob(jobData); case "MultiDeviceVerifiedUpdateJob": return migrateMultiDeviceVerifiedUpdateJob(jobData); case "RetrieveProfileJob": return migrateRetrieveProfileJob(jobData); case "PushGroupSendJob": return migratePushGroupSendJob(jobData); case "PushGroupUpdateJob": return migratePushGroupUpdateJob(jobData); case "DirectoryRefreshJob": return migrateDirectoryRefreshJob(jobData); case "RetrieveProfileAvatarJob": return migrateRetrieveProfileAvatarJob(jobData); case "MultiDeviceReadUpdateJob": return migrateMultiDeviceReadUpdateJob(jobData); case "PushTextSendJob": return migratePushTextSendJob(jobData); case "PushMediaSendJob": return migratePushMediaSendJob(jobData); case "SmsSendJob": return migrateSmsSendJob(jobData); default: return jobData; } }
RecipientIdJobMigration extends JobMigration { @Override protected @NonNull JobData migrate(@NonNull JobData jobData) { switch(jobData.getFactoryKey()) { case "MultiDeviceContactUpdateJob": return migrateMultiDeviceContactUpdateJob(jobData); case "MultiDeviceRevealUpdateJob": return migrateMultiDeviceViewOnceOpenJob(jobData); case "RequestGroupInfoJob": return migrateRequestGroupInfoJob(jobData); case "SendDeliveryReceiptJob": return migrateSendDeliveryReceiptJob(jobData); case "MultiDeviceVerifiedUpdateJob": return migrateMultiDeviceVerifiedUpdateJob(jobData); case "RetrieveProfileJob": return migrateRetrieveProfileJob(jobData); case "PushGroupSendJob": return migratePushGroupSendJob(jobData); case "PushGroupUpdateJob": return migratePushGroupUpdateJob(jobData); case "DirectoryRefreshJob": return migrateDirectoryRefreshJob(jobData); case "RetrieveProfileAvatarJob": return migrateRetrieveProfileAvatarJob(jobData); case "MultiDeviceReadUpdateJob": return migrateMultiDeviceReadUpdateJob(jobData); case "PushTextSendJob": return migratePushTextSendJob(jobData); case "PushMediaSendJob": return migratePushMediaSendJob(jobData); case "SmsSendJob": return migrateSmsSendJob(jobData); default: return jobData; } } }
RecipientIdJobMigration extends JobMigration { @Override protected @NonNull JobData migrate(@NonNull JobData jobData) { switch(jobData.getFactoryKey()) { case "MultiDeviceContactUpdateJob": return migrateMultiDeviceContactUpdateJob(jobData); case "MultiDeviceRevealUpdateJob": return migrateMultiDeviceViewOnceOpenJob(jobData); case "RequestGroupInfoJob": return migrateRequestGroupInfoJob(jobData); case "SendDeliveryReceiptJob": return migrateSendDeliveryReceiptJob(jobData); case "MultiDeviceVerifiedUpdateJob": return migrateMultiDeviceVerifiedUpdateJob(jobData); case "RetrieveProfileJob": return migrateRetrieveProfileJob(jobData); case "PushGroupSendJob": return migratePushGroupSendJob(jobData); case "PushGroupUpdateJob": return migratePushGroupUpdateJob(jobData); case "DirectoryRefreshJob": return migrateDirectoryRefreshJob(jobData); case "RetrieveProfileAvatarJob": return migrateRetrieveProfileAvatarJob(jobData); case "MultiDeviceReadUpdateJob": return migrateMultiDeviceReadUpdateJob(jobData); case "PushTextSendJob": return migratePushTextSendJob(jobData); case "PushMediaSendJob": return migratePushMediaSendJob(jobData); case "SmsSendJob": return migrateSmsSendJob(jobData); default: return jobData; } } RecipientIdJobMigration(@NonNull Application application); }
RecipientIdJobMigration extends JobMigration { @Override protected @NonNull JobData migrate(@NonNull JobData jobData) { switch(jobData.getFactoryKey()) { case "MultiDeviceContactUpdateJob": return migrateMultiDeviceContactUpdateJob(jobData); case "MultiDeviceRevealUpdateJob": return migrateMultiDeviceViewOnceOpenJob(jobData); case "RequestGroupInfoJob": return migrateRequestGroupInfoJob(jobData); case "SendDeliveryReceiptJob": return migrateSendDeliveryReceiptJob(jobData); case "MultiDeviceVerifiedUpdateJob": return migrateMultiDeviceVerifiedUpdateJob(jobData); case "RetrieveProfileJob": return migrateRetrieveProfileJob(jobData); case "PushGroupSendJob": return migratePushGroupSendJob(jobData); case "PushGroupUpdateJob": return migratePushGroupUpdateJob(jobData); case "DirectoryRefreshJob": return migrateDirectoryRefreshJob(jobData); case "RetrieveProfileAvatarJob": return migrateRetrieveProfileAvatarJob(jobData); case "MultiDeviceReadUpdateJob": return migrateMultiDeviceReadUpdateJob(jobData); case "PushTextSendJob": return migratePushTextSendJob(jobData); case "PushMediaSendJob": return migratePushMediaSendJob(jobData); case "SmsSendJob": return migrateSmsSendJob(jobData); default: return jobData; } } RecipientIdJobMigration(@NonNull Application application);  }
RecipientIdJobMigration extends JobMigration { @Override protected @NonNull JobData migrate(@NonNull JobData jobData) { switch(jobData.getFactoryKey()) { case "MultiDeviceContactUpdateJob": return migrateMultiDeviceContactUpdateJob(jobData); case "MultiDeviceRevealUpdateJob": return migrateMultiDeviceViewOnceOpenJob(jobData); case "RequestGroupInfoJob": return migrateRequestGroupInfoJob(jobData); case "SendDeliveryReceiptJob": return migrateSendDeliveryReceiptJob(jobData); case "MultiDeviceVerifiedUpdateJob": return migrateMultiDeviceVerifiedUpdateJob(jobData); case "RetrieveProfileJob": return migrateRetrieveProfileJob(jobData); case "PushGroupSendJob": return migratePushGroupSendJob(jobData); case "PushGroupUpdateJob": return migratePushGroupUpdateJob(jobData); case "DirectoryRefreshJob": return migrateDirectoryRefreshJob(jobData); case "RetrieveProfileAvatarJob": return migrateRetrieveProfileAvatarJob(jobData); case "MultiDeviceReadUpdateJob": return migrateMultiDeviceReadUpdateJob(jobData); case "PushTextSendJob": return migratePushTextSendJob(jobData); case "PushMediaSendJob": return migratePushMediaSendJob(jobData); case "SmsSendJob": return migrateSmsSendJob(jobData); default: return jobData; } } RecipientIdJobMigration(@NonNull Application application);   }