@Test public void migrate_multiDeviceViewOnceOpenJob() throws Exception { OldSerializableSyncMessageId oldId = new OldSerializableSyncMessageId("+16101234567", 1); JobData testData = new JobData("MultiDeviceRevealUpdateJob", null, new Data.Builder().putString("message_id", JsonUtils.toJson(oldId)).build()); mockRecipientResolve("+16101234567", 1); RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class)); JobData converted = subject.migrate(testData); assertEquals("MultiDeviceRevealUpdateJob", converted.getFactoryKey()); assertNull(converted.getQueueKey()); assertEquals(JsonUtils.toJson(new NewSerializableSyncMessageId("1", 1)), converted.getData().getString("message_id")); new MultiDeviceViewOnceOpenJob.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);   }