Move from ACI to a generic ServiceId.

This commit is contained in:
Greyson Parrelli
2022-02-17 15:55:54 -05:00
parent 9f1deda220
commit 7ca2420287
110 changed files with 841 additions and 824 deletions

View File

@@ -26,6 +26,7 @@ import org.signal.storageservice.protos.groups.local.DecryptedMember;
import org.signal.storageservice.protos.groups.local.DecryptedPendingMember;
import org.thoughtcrime.securesms.testutil.MainThreadUtil;
import org.whispersystems.signalservice.api.push.ACI;
import org.whispersystems.signalservice.api.push.ServiceId;
import org.whispersystems.signalservice.api.util.UuidUtil;
import java.util.Arrays;
@@ -1351,14 +1352,14 @@ public final class GroupsV2UpdateMessageProducerTest {
}
private void assertSingleChangeMentioning(DecryptedGroupChange change, List<UUID> expectedMentions) {
List<ACI> expectedMentionAcis = expectedMentions.stream().map(ACI::from).collect(Collectors.toList());
List<ServiceId> expectedMentionSids = expectedMentions.stream().map(ServiceId::from).collect(Collectors.toList());
List<UpdateDescription> changes = producer.describeChanges(null, change);
assertThat(changes.size(), is(1));
UpdateDescription description = changes.get(0);
assertThat(description.getMentioned(), is(expectedMentionAcis));
assertThat(description.getMentioned(), is(expectedMentionSids));
if (expectedMentions.isEmpty()) {
assertTrue(description.isStringStatic());
@@ -1397,8 +1398,8 @@ public final class GroupsV2UpdateMessageProducerTest {
}
private static @NonNull GroupsV2UpdateMessageProducer.DescribeMemberStrategy createDescriber(@NonNull Map<UUID, String> map) {
return aci -> {
String name = map.get(aci.uuid());
return serviceId -> {
String name = map.get(serviceId.uuid());
assertNotNull(name);
return name;
};

View File

@@ -266,7 +266,7 @@ public final class RecipientIdCacheTest {
Recipient mock = mock(Recipient.class);
when(mock.getId()).thenReturn(recipientId);
when(mock.getAci()).thenReturn(Optional.fromNullable(aci));
when(mock.getServiceId()).thenReturn(Optional.fromNullable(aci));
when(mock.getE164()).thenReturn(Optional.fromNullable(e164));
return mock;

View File

@@ -27,10 +27,8 @@ import org.whispersystems.signalservice.api.storage.StorageId;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
@@ -57,7 +55,7 @@ public final class StorageSyncHelperTest {
private static final Recipient SELF = mock(Recipient.class);
static {
when(SELF.getAci()).thenReturn(Optional.of(ACI_SELF));
when(SELF.getServiceId()).thenReturn(Optional.of(ACI_SELF));
when(SELF.getE164()).thenReturn(Optional.of(E164_SELF));
when(SELF.resolve()).thenReturn(SELF);
}