mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-26 04:33:36 +00:00
Fix sepa badge redemption job.
This commit is contained in:
@@ -99,7 +99,7 @@ public class JobMigratorTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NonNull JobData migrate(@NonNull JobData jobData) {
|
||||
public @NonNull JobData migrate(@NonNull JobData jobData) {
|
||||
return jobData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ public class RecipientIdFollowUpJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_sendDeliveryReceiptJob_good() throws Exception {
|
||||
JobData testData = new JobData("SendDeliveryReceiptJob", null, new JsonJobData.Builder().putString("recipient", "1")
|
||||
.putLong("message_id", 1)
|
||||
.putLong("timestamp", 2)
|
||||
.serialize());
|
||||
JobData testData = new JobData("SendDeliveryReceiptJob", null, -1, -1, new JsonJobData.Builder().putString("recipient", "1")
|
||||
.putLong("message_id", 1)
|
||||
.putLong("timestamp", 2)
|
||||
.serialize());
|
||||
RecipientIdFollowUpJobMigration subject = new RecipientIdFollowUpJobMigration();
|
||||
JobData converted = subject.migrate(testData);
|
||||
|
||||
@@ -50,8 +50,8 @@ public class RecipientIdFollowUpJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_sendDeliveryReceiptJob_bad() throws Exception {
|
||||
JobData testData = new JobData("SendDeliveryReceiptJob", null, new JsonJobData.Builder().putString("recipient", "1")
|
||||
.serialize());
|
||||
JobData testData = new JobData("SendDeliveryReceiptJob", null, -1, -1, new JsonJobData.Builder().putString("recipient", "1")
|
||||
.serialize());
|
||||
RecipientIdFollowUpJobMigration subject = new RecipientIdFollowUpJobMigration();
|
||||
JobData converted = subject.migrate(testData);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class RecipientIdJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_multiDeviceContactUpdateJob() throws Exception {
|
||||
JobData testData = new JobData("MultiDeviceContactUpdateJob", "MultiDeviceContactUpdateJob", new JsonJobData.Builder().putBoolean("force_sync", false).putString("address", "+16101234567").serialize());
|
||||
JobData testData = new JobData("MultiDeviceContactUpdateJob", "MultiDeviceContactUpdateJob", -1, -1, new JsonJobData.Builder().putBoolean("force_sync", false).putString("address", "+16101234567").serialize());
|
||||
mockRecipientResolve("+16101234567", 1);
|
||||
|
||||
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
|
||||
@@ -68,7 +68,7 @@ public class RecipientIdJobMigrationTest {
|
||||
@Test
|
||||
public void migrate_multiDeviceViewOnceOpenJob() throws Exception {
|
||||
OldSerializableSyncMessageId oldId = new OldSerializableSyncMessageId("+16101234567", 1);
|
||||
JobData testData = new JobData("MultiDeviceRevealUpdateJob", null, new JsonJobData.Builder().putString("message_id", JsonUtils.toJson(oldId)).serialize());
|
||||
JobData testData = new JobData("MultiDeviceRevealUpdateJob", null, -1, -1, new JsonJobData.Builder().putString("message_id", JsonUtils.toJson(oldId)).serialize());
|
||||
mockRecipientResolve("+16101234567", 1);
|
||||
|
||||
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
|
||||
@@ -84,10 +84,10 @@ public class RecipientIdJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_sendDeliveryReceiptJob() throws Exception {
|
||||
JobData testData = new JobData("SendDeliveryReceiptJob", null, new JsonJobData.Builder().putString("address", "+16101234567")
|
||||
.putLong("message_id", 1)
|
||||
.putLong("timestamp", 2)
|
||||
.serialize());
|
||||
JobData testData = new JobData("SendDeliveryReceiptJob", null, -1, -1, new JsonJobData.Builder().putString("address", "+16101234567")
|
||||
.putLong("message_id", 1)
|
||||
.putLong("timestamp", 2)
|
||||
.serialize());
|
||||
mockRecipientResolve("+16101234567", 1);
|
||||
|
||||
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
|
||||
@@ -105,11 +105,11 @@ public class RecipientIdJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_multiDeviceVerifiedUpdateJob() throws Exception {
|
||||
JobData testData = new JobData("MultiDeviceVerifiedUpdateJob", "__MULTI_DEVICE_VERIFIED_UPDATE__", new JsonJobData.Builder().putString("destination", "+16101234567")
|
||||
.putString("identity_key", "abcd")
|
||||
.putInt("verified_status", 1)
|
||||
.putLong("timestamp", 123)
|
||||
.serialize());
|
||||
JobData testData = new JobData("MultiDeviceVerifiedUpdateJob", "__MULTI_DEVICE_VERIFIED_UPDATE__", -1, -1, new JsonJobData.Builder().putString("destination", "+16101234567")
|
||||
.putString("identity_key", "abcd")
|
||||
.putInt("verified_status", 1)
|
||||
.putLong("timestamp", 123)
|
||||
.serialize());
|
||||
mockRecipientResolve("+16101234567", 1);
|
||||
|
||||
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
|
||||
@@ -128,9 +128,9 @@ public class RecipientIdJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_pushGroupSendJob_null() throws Exception {
|
||||
JobData testData = new JobData("PushGroupSendJob", "someGroupId", new JsonJobData.Builder().putString("filter_address", null)
|
||||
.putLong("message_id", 123)
|
||||
.serialize());
|
||||
JobData testData = new JobData("PushGroupSendJob", "someGroupId", -1, -1, new JsonJobData.Builder().putString("filter_address", null)
|
||||
.putLong("message_id", 123)
|
||||
.serialize());
|
||||
mockRecipientResolve("someGroupId", 5);
|
||||
|
||||
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
|
||||
@@ -147,9 +147,9 @@ public class RecipientIdJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_pushGroupSendJob_nonNull() throws Exception {
|
||||
JobData testData = new JobData("PushGroupSendJob", "someGroupId", new JsonJobData.Builder().putString("filter_address", "+16101234567")
|
||||
.putLong("message_id", 123)
|
||||
.serialize());
|
||||
JobData testData = new JobData("PushGroupSendJob", "someGroupId", -1, -1, new JsonJobData.Builder().putString("filter_address", "+16101234567")
|
||||
.putLong("message_id", 123)
|
||||
.serialize());
|
||||
mockRecipientResolve("+16101234567", 1);
|
||||
mockRecipientResolve("someGroupId", 5);
|
||||
|
||||
@@ -167,7 +167,7 @@ public class RecipientIdJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_directoryRefreshJob_null() throws Exception {
|
||||
JobData testData = new JobData("DirectoryRefreshJob", "DirectoryRefreshJob", new JsonJobData.Builder().putString("address", null).putBoolean("notify_of_new_users", true).serialize());
|
||||
JobData testData = new JobData("DirectoryRefreshJob", "DirectoryRefreshJob", -1, -1, new JsonJobData.Builder().putString("address", null).putBoolean("notify_of_new_users", true).serialize());
|
||||
|
||||
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
|
||||
JobData converted = subject.migrate(testData);
|
||||
@@ -184,7 +184,7 @@ public class RecipientIdJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_directoryRefreshJob_nonNull() throws Exception {
|
||||
JobData testData = new JobData("DirectoryRefreshJob", "DirectoryRefreshJob", new JsonJobData.Builder().putString("address", "+16101234567").putBoolean("notify_of_new_users", true).serialize());
|
||||
JobData testData = new JobData("DirectoryRefreshJob", "DirectoryRefreshJob", -1, -1, new JsonJobData.Builder().putString("address", "+16101234567").putBoolean("notify_of_new_users", true).serialize());
|
||||
mockRecipientResolve("+16101234567", 1);
|
||||
|
||||
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
|
||||
@@ -202,7 +202,7 @@ public class RecipientIdJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_retrieveProfileAvatarJob() throws Exception {
|
||||
JobData testData = new JobData("RetrieveProfileAvatarJob", "RetrieveProfileAvatarJob+16101234567", new JsonJobData.Builder().putString("address", "+16101234567").putString("profile_avatar", "abc").serialize());
|
||||
JobData testData = new JobData("RetrieveProfileAvatarJob", "RetrieveProfileAvatarJob+16101234567", -1, -1, new JsonJobData.Builder().putString("address", "+16101234567").putString("profile_avatar", "abc").serialize());
|
||||
mockRecipientResolve("+16101234567", 1);
|
||||
|
||||
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
|
||||
@@ -219,7 +219,7 @@ public class RecipientIdJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_multiDeviceReadUpdateJob_empty() throws Exception {
|
||||
JobData testData = new JobData("MultiDeviceReadUpdateJob", null, new JsonJobData.Builder().putStringArray("message_ids", new String[0]).serialize());
|
||||
JobData testData = new JobData("MultiDeviceReadUpdateJob", null, -1, -1, new JsonJobData.Builder().putStringArray("message_ids", new String[0]).serialize());
|
||||
|
||||
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
|
||||
JobData converted = subject.migrate(testData);
|
||||
@@ -237,7 +237,7 @@ public class RecipientIdJobMigrationTest {
|
||||
OldSerializableSyncMessageId id1 = new OldSerializableSyncMessageId("+16101234567", 1);
|
||||
OldSerializableSyncMessageId id2 = new OldSerializableSyncMessageId("+16101112222", 2);
|
||||
|
||||
JobData testData = new JobData("MultiDeviceReadUpdateJob", null, new JsonJobData.Builder().putStringArray("message_ids", new String[]{ JsonUtils.toJson(id1), JsonUtils.toJson(id2) }).serialize());
|
||||
JobData testData = new JobData("MultiDeviceReadUpdateJob", null, -1, -1, new JsonJobData.Builder().putStringArray("message_ids", new String[]{ JsonUtils.toJson(id1), JsonUtils.toJson(id2) }).serialize());
|
||||
mockRecipientResolve("+16101234567", 1);
|
||||
mockRecipientResolve("+16101112222", 2);
|
||||
|
||||
@@ -259,7 +259,7 @@ public class RecipientIdJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_pushMediaSendJob() throws Exception {
|
||||
JobData testData = new JobData("PushMediaSendJob", "+16101234567", new JsonJobData.Builder().putLong("message_id", 1).serialize());
|
||||
JobData testData = new JobData("PushMediaSendJob", "+16101234567", -1, -1, new JsonJobData.Builder().putLong("message_id", 1).serialize());
|
||||
mockRecipientResolve("+16101234567", 1);
|
||||
|
||||
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
|
||||
@@ -275,7 +275,7 @@ public class RecipientIdJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_smsSendJob_nonNull() throws Exception {
|
||||
JobData testData = new JobData("SmsSendJob", "+16101234567", new JsonJobData.Builder().putLong("message_id", 1).putInt("run_attempt", 0).serialize());
|
||||
JobData testData = new JobData("SmsSendJob", "+16101234567", -1, -1, new JsonJobData.Builder().putLong("message_id", 1).putInt("run_attempt", 0).serialize());
|
||||
mockRecipientResolve("+16101234567", 1);
|
||||
|
||||
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
|
||||
@@ -292,7 +292,7 @@ public class RecipientIdJobMigrationTest {
|
||||
|
||||
@Test
|
||||
public void migrate_smsSendJob_null() throws Exception {
|
||||
JobData testData = new JobData("SmsSendJob", null, new JsonJobData.Builder().putLong("message_id", 1).putInt("run_attempt", 0).serialize());
|
||||
JobData testData = new JobData("SmsSendJob", null, -1, -1, new JsonJobData.Builder().putLong("message_id", 1).putInt("run_attempt", 0).serialize());
|
||||
mockRecipientResolve("+16101234567", 1);
|
||||
|
||||
RecipientIdJobMigration subject = new RecipientIdJobMigration(mock(Application.class));
|
||||
|
||||
@@ -26,6 +26,8 @@ public class SendReadReceiptsJobMigrationTest {
|
||||
SendReadReceiptJob job = new SendReadReceiptJob(1, RecipientId.from(2), new ArrayList<>(), new ArrayList<>());
|
||||
JobMigration.JobData jobData = new JobMigration.JobData(job.getFactoryKey(),
|
||||
"asdf",
|
||||
-1,
|
||||
-1,
|
||||
new JsonJobData.Builder()
|
||||
.putString("recipient", RecipientId.from(2).serialize())
|
||||
.putLongArray("message_ids", new long[]{1, 2, 3, 4, 5})
|
||||
@@ -49,6 +51,8 @@ public class SendReadReceiptsJobMigrationTest {
|
||||
SendReadReceiptJob job = new SendReadReceiptJob(1, RecipientId.from(2), new ArrayList<>(), new ArrayList<>());
|
||||
JobMigration.JobData jobData = new JobMigration.JobData(job.getFactoryKey(),
|
||||
"asdf",
|
||||
-1,
|
||||
-1,
|
||||
new JsonJobData.Builder()
|
||||
.putString("recipient", RecipientId.from(2).serialize())
|
||||
.putLongArray("message_ids", new long[]{})
|
||||
@@ -66,7 +70,7 @@ public class SendReadReceiptsJobMigrationTest {
|
||||
public void givenSendReadReceiptJobDataWithThreadId_whenIMigrate_thenIDoNotReplace() {
|
||||
// GIVEN
|
||||
SendReadReceiptJob job = new SendReadReceiptJob(1, RecipientId.from(2), new ArrayList<>(), new ArrayList<>());
|
||||
JobMigration.JobData jobData = new JobMigration.JobData(job.getFactoryKey(), "asdf", job.serialize());
|
||||
JobMigration.JobData jobData = new JobMigration.JobData(job.getFactoryKey(), "asdf", -1, -1, job.serialize());
|
||||
|
||||
// WHEN
|
||||
JobMigration.JobData result = testSubject.migrate(jobData);
|
||||
@@ -78,7 +82,7 @@ public class SendReadReceiptsJobMigrationTest {
|
||||
@Test
|
||||
public void givenSomeOtherJobDataWithThreadId_whenIMigrate_thenIDoNotReplace() {
|
||||
// GIVEN
|
||||
JobMigration.JobData jobData = new JobMigration.JobData("SomeOtherJob", "asdf", new JsonJobData.Builder().putLong("thread", 1).serialize());
|
||||
JobMigration.JobData jobData = new JobMigration.JobData("SomeOtherJob", "asdf", -1, -1, new JsonJobData.Builder().putLong("thread", 1).serialize());
|
||||
|
||||
// WHEN
|
||||
JobMigration.JobData result = testSubject.migrate(jobData);
|
||||
@@ -90,7 +94,7 @@ public class SendReadReceiptsJobMigrationTest {
|
||||
@Test
|
||||
public void givenSomeOtherJobDataWithoutThreadId_whenIMigrate_thenIDoNotReplace() {
|
||||
// GIVEN
|
||||
JobMigration.JobData jobData = new JobMigration.JobData("SomeOtherJob", "asdf", new JsonJobData.Builder().serialize());
|
||||
JobMigration.JobData jobData = new JobMigration.JobData("SomeOtherJob", "asdf", -1, -1, new JsonJobData.Builder().serialize());
|
||||
|
||||
// WHEN
|
||||
JobMigration.JobData result = testSubject.migrate(jobData);
|
||||
|
||||
@@ -30,6 +30,8 @@ public class SenderKeyDistributionSendJobRecipientMigrationTest {
|
||||
// GIVEN
|
||||
JobMigration.JobData jobData = new JobMigration.JobData(SenderKeyDistributionSendJob.KEY,
|
||||
"asdf",
|
||||
-1,
|
||||
-1,
|
||||
new JsonJobData.Builder()
|
||||
.putString("recipient_id", RecipientId.from(1).serialize())
|
||||
.putBlobAsString("group_id", GROUP_ID.getDecodedId())
|
||||
@@ -53,6 +55,8 @@ public class SenderKeyDistributionSendJobRecipientMigrationTest {
|
||||
// GIVEN
|
||||
JobMigration.JobData jobData = new JobMigration.JobData(SenderKeyDistributionSendJob.KEY,
|
||||
"asdf",
|
||||
-1,
|
||||
-1,
|
||||
new JsonJobData.Builder()
|
||||
.putString("recipient_id", RecipientId.from(1).serialize())
|
||||
.putBlobAsString("group_id", GROUP_ID.getDecodedId())
|
||||
@@ -70,6 +74,8 @@ public class SenderKeyDistributionSendJobRecipientMigrationTest {
|
||||
// GIVEN
|
||||
JobMigration.JobData jobData = new JobMigration.JobData(SenderKeyDistributionSendJob.KEY,
|
||||
"asdf",
|
||||
-1,
|
||||
-1,
|
||||
new JsonJobData.Builder()
|
||||
.putString("recipient_id", RecipientId.from(1).serialize())
|
||||
.serialize());
|
||||
|
||||
Reference in New Issue
Block a user