use of org.thoughtcrime.securesms.jobmanager.JobMigration.JobData in project Signal-Android by WhisperSystems.
the class RecipientIdJobMigrationTest method migrate_multiDeviceContactUpdateJob.
@Test
public void migrate_multiDeviceContactUpdateJob() throws Exception {
JobData testData = new JobData("MultiDeviceContactUpdateJob", "MultiDeviceContactUpdateJob", new Data.Builder().putBoolean("force_sync", false).putString("address", "+16101234567").build());
mockRecipientResolve("+16101234567", 1);
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
JobData converted = subject.migrate(testData);
assertEquals("MultiDeviceContactUpdateJob", converted.getFactoryKey());
assertEquals("MultiDeviceContactUpdateJob", converted.getQueueKey());
assertFalse(converted.getData().getBoolean("force_sync"));
assertFalse(converted.getData().hasString("address"));
assertEquals("1", converted.getData().getString("recipient"));
new MultiDeviceContactUpdateJob.Factory().create(mock(Job.Parameters.class), converted.getData());
}
use of org.thoughtcrime.securesms.jobmanager.JobMigration.JobData in project Signal-Android by WhisperSystems.
the class RecipientIdJobMigrationTest method migrate_pushMediaSendJob.
@Test
public void migrate_pushMediaSendJob() throws Exception {
JobData testData = new JobData("PushMediaSendJob", "+16101234567", new Data.Builder().putLong("message_id", 1).build());
mockRecipientResolve("+16101234567", 1);
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
JobData converted = subject.migrate(testData);
assertEquals("PushMediaSendJob", converted.getFactoryKey());
assertEquals(RecipientId.from(1).toQueueKey(), converted.getQueueKey());
assertEquals(1, converted.getData().getLong("message_id"));
new PushMediaSendJob.Factory().create(mock(Job.Parameters.class), converted.getData());
}
use of org.thoughtcrime.securesms.jobmanager.JobMigration.JobData in project Signal-Android by WhisperSystems.
the class RecipientIdJobMigrationTest method migrate_multiDeviceVerifiedUpdateJob.
@Test
public void migrate_multiDeviceVerifiedUpdateJob() throws Exception {
JobData testData = new JobData("MultiDeviceVerifiedUpdateJob", "__MULTI_DEVICE_VERIFIED_UPDATE__", new Data.Builder().putString("destination", "+16101234567").putString("identity_key", "abcd").putInt("verified_status", 1).putLong("timestamp", 123).build());
mockRecipientResolve("+16101234567", 1);
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
JobData converted = subject.migrate(testData);
assertEquals("MultiDeviceVerifiedUpdateJob", converted.getFactoryKey());
assertEquals("__MULTI_DEVICE_VERIFIED_UPDATE__", converted.getQueueKey());
assertEquals("abcd", converted.getData().getString("identity_key"));
assertEquals(1, converted.getData().getInt("verified_status"));
assertEquals(123, converted.getData().getLong("timestamp"));
assertEquals("1", converted.getData().getString("destination"));
new MultiDeviceVerifiedUpdateJob.Factory().create(mock(Job.Parameters.class), converted.getData());
}
use of org.thoughtcrime.securesms.jobmanager.JobMigration.JobData in project Signal-Android by WhisperSystems.
the class RecipientIdJobMigrationTest method migrate_multiDeviceViewOnceOpenJob.
@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());
}
use of org.thoughtcrime.securesms.jobmanager.JobMigration.JobData in project Signal-Android by WhisperSystems.
the class RecipientIdJobMigrationTest method migrate_directoryRefreshJob_nonNull.
@Test
public void migrate_directoryRefreshJob_nonNull() throws Exception {
JobData testData = new JobData("DirectoryRefreshJob", "DirectoryRefreshJob", new Data.Builder().putString("address", "+16101234567").putBoolean("notify_of_new_users", true).build());
mockRecipientResolve("+16101234567", 1);
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
JobData converted = subject.migrate(testData);
assertEquals("DirectoryRefreshJob", converted.getFactoryKey());
assertEquals("DirectoryRefreshJob", converted.getQueueKey());
assertTrue(converted.getData().getBoolean("notify_of_new_users"));
assertEquals("1", converted.getData().getString("recipient"));
assertFalse(converted.getData().hasString("address"));
new DirectoryRefreshJob.Factory().create(mock(Job.Parameters.class), converted.getData());
}
Aggregations