use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupChangeUtil_resolveConflict_decryptedOnly_Test method field_21__no_announcement_change_is_removed.
@Test
public void field_21__no_announcement_change_is_removed() {
DecryptedGroup groupState = DecryptedGroup.newBuilder().setIsAnnouncementGroup(EnabledState.ENABLED).build();
DecryptedGroupChange decryptedChange = DecryptedGroupChange.newBuilder().setNewIsAnnouncementGroup(EnabledState.ENABLED).build();
DecryptedGroupChange resolvedChanges = GroupChangeUtil.resolveConflict(groupState, decryptedChange).build();
assertTrue(DecryptedGroupUtil.changeIsEmpty(resolvedChanges));
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupChangeUtil_resolveConflict_decryptedOnly_Test method field_11__avatar_change_is_preserved.
@Test
public void field_11__avatar_change_is_preserved() {
DecryptedGroup groupState = DecryptedGroup.newBuilder().setAvatar("Existing avatar").build();
DecryptedGroupChange decryptedChange = DecryptedGroupChange.newBuilder().setNewAvatar(DecryptedString.newBuilder().setValue("New avatar").build()).build();
DecryptedGroupChange resolvedChanges = GroupChangeUtil.resolveConflict(groupState, decryptedChange).build();
assertEquals(decryptedChange, resolvedChanges);
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupChangeUtil_resolveConflict_decryptedOnly_Test method field_3__changes_to_add_existing_members_are_excluded.
@Test
public void field_3__changes_to_add_existing_members_are_excluded() {
UUID member1 = UUID.randomUUID();
UUID member2 = UUID.randomUUID();
UUID member3 = UUID.randomUUID();
DecryptedGroup groupState = DecryptedGroup.newBuilder().addMembers(member(member1)).addMembers(member(member3)).build();
DecryptedGroupChange decryptedChange = DecryptedGroupChange.newBuilder().addNewMembers(member(member1)).addNewMembers(member(member2)).addNewMembers(member(member3)).build();
DecryptedGroupChange resolvedChanges = GroupChangeUtil.resolveConflict(groupState, decryptedChange).build();
DecryptedGroupChange expected = DecryptedGroupChange.newBuilder().addNewMembers(member(member2)).build();
assertEquals(expected, resolvedChanges);
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupChangeUtil_resolveConflict_decryptedOnly_Test method field_16__changes_to_add_requesting_members_when_full_members_are_removed.
@Test
public void field_16__changes_to_add_requesting_members_when_full_members_are_removed() {
UUID member1 = UUID.randomUUID();
UUID member2 = UUID.randomUUID();
UUID member3 = UUID.randomUUID();
ProfileKey profileKey2 = randomProfileKey();
DecryptedGroup groupState = DecryptedGroup.newBuilder().addMembers(member(member1)).addMembers(member(member3)).build();
DecryptedGroupChange decryptedChange = DecryptedGroupChange.newBuilder().addNewRequestingMembers(requestingMember(member1)).addNewRequestingMembers(requestingMember(member2, profileKey2)).addNewRequestingMembers(requestingMember(member3)).build();
DecryptedGroupChange resolvedChanges = GroupChangeUtil.resolveConflict(groupState, decryptedChange).build();
DecryptedGroupChange expected = DecryptedGroupChange.newBuilder().addNewRequestingMembers(requestingMember(member2, profileKey2)).build();
assertEquals(expected, resolvedChanges);
}
use of org.signal.storageservice.protos.groups.local.DecryptedGroup in project Signal-Android by WhisperSystems.
the class GroupChangeUtil_resolveConflict_decryptedOnly_Test method field_6__profile_key_changes.
@Test
public void field_6__profile_key_changes() {
UUID member1 = UUID.randomUUID();
UUID member2 = UUID.randomUUID();
UUID member3 = UUID.randomUUID();
UUID memberNotInGroup = UUID.randomUUID();
ProfileKey profileKey1 = randomProfileKey();
ProfileKey profileKey2 = randomProfileKey();
ProfileKey profileKey3 = randomProfileKey();
ProfileKey profileKey4 = randomProfileKey();
ProfileKey profileKey2b = randomProfileKey();
DecryptedGroup groupState = DecryptedGroup.newBuilder().addMembers(member(member1, profileKey1)).addMembers(member(member2, profileKey2)).addMembers(member(member3, profileKey3)).build();
DecryptedGroupChange decryptedChange = DecryptedGroupChange.newBuilder().addModifiedProfileKeys(member(member1, profileKey1)).addModifiedProfileKeys(member(member2, profileKey2b)).addModifiedProfileKeys(member(member3, profileKey3)).addModifiedProfileKeys(member(memberNotInGroup, profileKey4)).build();
DecryptedGroupChange resolvedChanges = GroupChangeUtil.resolveConflict(groupState, decryptedChange).build();
DecryptedGroupChange expected = DecryptedGroupChange.newBuilder().addModifiedProfileKeys(member(member2, profileKey2b)).build();
assertEquals(expected, resolvedChanges);
}
Aggregations