[bramble] Add support for contact aliases

Foundation for #41
This commit is contained in:
Torsten Grote
2018-10-24 18:10:53 -03:00
parent 22eed91019
commit 8fc622f85d
23 changed files with 312 additions and 46 deletions

View File

@@ -124,7 +124,7 @@ public class BlogManagerImplTest extends BriarTestCase {
ContactId contactId = new ContactId(0);
Contact contact = new Contact(contactId, blog2.getAuthor(),
blog1.getAuthor().getId(), true, true);
blog1.getAuthor().getId(), getRandomString(5), true, true);
context.checking(new Expectations() {{
oneOf(blogFactory).createBlog(blog2.getAuthor());
@@ -146,7 +146,7 @@ public class BlogManagerImplTest extends BriarTestCase {
ContactId contactId = new ContactId(0);
Contact contact = new Contact(contactId, blog2.getAuthor(),
blog1.getAuthor().getId(), true, true);
blog1.getAuthor().getId(), getRandomString(5), true, true);
context.checking(new Expectations() {{
oneOf(blogFactory).createBlog(blog2.getAuthor());

View File

@@ -83,7 +83,7 @@ abstract class AbstractProtocolEngineTest extends BrambleMockTestCase {
BdfDictionary.of(new BdfEntry("me", "ta"));
final ContactId contactId = new ContactId(5);
final Contact contact = new Contact(contactId, author,
new AuthorId(getRandomId()), true, true);
new AuthorId(getRandomId()), getRandomString(5), true, true);
final InviteMessage inviteMessage =
new InviteMessage(new MessageId(getRandomId()), contactGroupId,

View File

@@ -100,7 +100,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
private final ContactId contactId = new ContactId(0);
private final Author author = getAuthor();
private final Contact contact = new Contact(contactId, author,
new AuthorId(getRandomId()), true, true);
new AuthorId(getRandomId()), getRandomString(5), true, true);
private final Group localGroup = getGroup(CLIENT_ID, MAJOR_VERSION);
private final Group contactGroup = getGroup(CLIENT_ID, MAJOR_VERSION);
private final Group privateGroup = getGroup(CLIENT_ID, MAJOR_VERSION);
@@ -845,9 +845,9 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
@Test
public void testRemovingGroupEndsSessions() throws Exception {
Contact contact2 = new Contact(new ContactId(2), author,
author.getId(), true, true);
author.getId(), getRandomString(5), true, true);
Contact contact3 = new Contact(new ContactId(3), author,
author.getId(), true, true);
author.getId(), getRandomString(5), true, true);
Collection<Contact> contacts =
Arrays.asList(contact, contact2, contact3);

View File

@@ -331,7 +331,7 @@ public class InviteeProtocolEngineTest extends AbstractProtocolEngineTest {
signature);
Author notCreator = getAuthor();
Contact notCreatorContact = new Contact(contactId, notCreator,
localAuthor.getId(), true, true);
localAuthor.getId(), getRandomString(5), true, true);
expectGetContactId();
context.checking(new Expectations() {{

View File

@@ -38,6 +38,7 @@ import static org.briarproject.bramble.test.TestUtils.getGroup;
import static org.briarproject.bramble.test.TestUtils.getLocalAuthor;
import static org.briarproject.bramble.test.TestUtils.getMessage;
import static org.briarproject.bramble.test.TestUtils.getRandomId;
import static org.briarproject.bramble.util.StringUtils.getRandomString;
import static org.briarproject.briar.api.blog.BlogSharingManager.CLIENT_ID;
import static org.briarproject.briar.api.blog.BlogSharingManager.MAJOR_VERSION;
import static org.briarproject.briar.sharing.SharingConstants.GROUP_KEY_CONTACT_ID;
@@ -63,7 +64,8 @@ public class BlogSharingManagerImplTest extends BrambleMockTestCase {
private final ContactId contactId = new ContactId(0);
private final Author author = getAuthor();
private final Contact contact =
new Contact(contactId, author, localAuthor.getId(), true, true);
new Contact(contactId, author, localAuthor.getId(),
getRandomString(5), true, true);
private final Collection<Contact> contacts =
Collections.singletonList(contact);
private final Group localGroup = getGroup(CLIENT_ID, MAJOR_VERSION);