mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 20:29:52 +01:00
@@ -337,12 +337,12 @@ public class BlogManagerTest {
|
|||||||
// sharer adds invitee as contact
|
// sharer adds invitee as contact
|
||||||
contactId1 = contactManager0.addContact(author1,
|
contactId1 = contactManager0.addContact(author1,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
// invitee adds sharer back
|
// invitee adds sharer back
|
||||||
contactId0 = contactManager1.addContact(author0,
|
contactId0 = contactManager1.addContact(author0,
|
||||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -362,11 +362,11 @@ public class BlogSharingIntegrationTest extends BriarTestCase {
|
|||||||
// 1 and 2 are adding each other
|
// 1 and 2 are adding each other
|
||||||
contactManager1.addContact(author2,
|
contactManager1.addContact(author2,
|
||||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
contactManager2.addContact(author1,
|
contactManager2.addContact(author1,
|
||||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
assertEquals(3, blogManager1.getBlogs().size());
|
assertEquals(3, blogManager1.getBlogs().size());
|
||||||
|
|
||||||
@@ -489,11 +489,11 @@ public class BlogSharingIntegrationTest extends BriarTestCase {
|
|||||||
// 1 and 2 are adding each other
|
// 1 and 2 are adding each other
|
||||||
contactManager1.addContact(author2,
|
contactManager1.addContact(author2,
|
||||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
contactManager2.addContact(author1,
|
contactManager2.addContact(author1,
|
||||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
assertEquals(3, blogManager1.getBlogs().size());
|
assertEquals(3, blogManager1.getBlogs().size());
|
||||||
|
|
||||||
@@ -671,24 +671,24 @@ public class BlogSharingIntegrationTest extends BriarTestCase {
|
|||||||
// sharer adds invitee as contact
|
// sharer adds invitee as contact
|
||||||
contactId1 = contactManager0.addContact(author1,
|
contactId1 = contactManager0.addContact(author1,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
contact1 = contactManager0.getContact(contactId1);
|
contact1 = contactManager0.getContact(contactId1);
|
||||||
// sharer adds second contact
|
// sharer adds second contact
|
||||||
contactId2 = contactManager0.addContact(author2,
|
contactId2 = contactManager0.addContact(author2,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
contact2 = contactManager0.getContact(contactId2);
|
contact2 = contactManager0.getContact(contactId2);
|
||||||
// contacts add sharer back
|
// contacts add sharer back
|
||||||
contactId01 = contactManager1.addContact(author0,
|
contactId01 = contactManager1.addContact(author0,
|
||||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
contact01 = contactManager1.getContact(contactId01);
|
contact01 = contactManager1.getContact(contactId01);
|
||||||
contactId02 = contactManager2.addContact(author0,
|
contactId02 = contactManager2.addContact(author0,
|
||||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
contact02 = contactManager2.getContact(contactId02);
|
contact02 = contactManager2.getContact(contactId02);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -365,12 +365,12 @@ public class ForumManagerTest {
|
|||||||
// sharer adds invitee as contact
|
// sharer adds invitee as contact
|
||||||
contactId1 = contactManager0.addContact(author1,
|
contactId1 = contactManager0.addContact(author1,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
// invitee adds sharer back
|
// invitee adds sharer back
|
||||||
contactId0 = contactManager1.addContact(author0,
|
contactId0 = contactManager1.addContact(author0,
|
||||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1091,21 +1091,21 @@ public class ForumSharingIntegrationTest extends BriarTestCase {
|
|||||||
// sharer adds invitee as contact
|
// sharer adds invitee as contact
|
||||||
contactId1 = contactManager0.addContact(author1,
|
contactId1 = contactManager0.addContact(author1,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
// second sharer does the same
|
// second sharer does the same
|
||||||
contactId21 = contactManager2.addContact(author1,
|
contactId21 = contactManager2.addContact(author1,
|
||||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
// invitee adds sharers back
|
// invitee adds sharers back
|
||||||
contactId0 = contactManager1.addContact(author0,
|
contactId0 = contactManager1.addContact(author0,
|
||||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
contactId2 = contactManager1.addContact(author2,
|
contactId2 = contactManager1.addContact(author2,
|
||||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -164,20 +164,20 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
|||||||
// Add introducees as contacts
|
// Add introducees as contacts
|
||||||
contactId1 = contactManager0.addContact(author1,
|
contactId1 = contactManager0.addContact(author1,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
contactId2 = contactManager0.addContact(author2,
|
contactId2 = contactManager0.addContact(author2,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
// Add introducer back
|
// Add introducer back
|
||||||
contactId0 = contactManager1.addContact(author0,
|
contactId0 = contactManager1.addContact(author0,
|
||||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
ContactId contactId02 = contactManager2.addContact(author0,
|
ContactId contactId02 = contactManager2.addContact(author0,
|
||||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
assertTrue(contactId0.equals(contactId02));
|
assertTrue(contactId0.equals(contactId02));
|
||||||
|
|
||||||
@@ -238,6 +238,18 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
|||||||
assertTrue(contactManager2
|
assertTrue(contactManager2
|
||||||
.contactExists(author1.getId(), author2.getId()));
|
.contactExists(author1.getId(), author2.getId()));
|
||||||
|
|
||||||
|
// make sure that introduced contacts are not verified
|
||||||
|
for (Contact c : contactManager1.getActiveContacts()) {
|
||||||
|
if (c.getAuthor().equals(author2)) {
|
||||||
|
assertFalse(c.isVerified());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Contact c : contactManager2.getActiveContacts()) {
|
||||||
|
if (c.getAuthor().equals(author1)) {
|
||||||
|
assertFalse(c.isVerified());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
assertDefaultUiMessages();
|
assertDefaultUiMessages();
|
||||||
} finally {
|
} finally {
|
||||||
stopLifecycles();
|
stopLifecycles();
|
||||||
@@ -256,18 +268,18 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
|||||||
|
|
||||||
// Add introducees as contacts
|
// Add introducees as contacts
|
||||||
contactId1 = contactManager0.addContact(author1, author0.getId(),
|
contactId1 = contactManager0.addContact(author1, author0.getId(),
|
||||||
master, clock.currentTimeMillis(), true, true
|
master, clock.currentTimeMillis(), true, true, true
|
||||||
);
|
);
|
||||||
contactId2 = contactManager0.addContact(author2, author0.getId(),
|
contactId2 = contactManager0.addContact(author2, author0.getId(),
|
||||||
master, clock.currentTimeMillis(), true, true
|
master, clock.currentTimeMillis(), true, true, true
|
||||||
);
|
);
|
||||||
// Add introducer back
|
// Add introducer back
|
||||||
contactId0 = contactManager1.addContact(author0, author1.getId(),
|
contactId0 = contactManager1.addContact(author0, author1.getId(),
|
||||||
master, clock.currentTimeMillis(), true, true
|
master, clock.currentTimeMillis(), true, true, true
|
||||||
);
|
);
|
||||||
ContactId contactId02 = contactManager2.addContact(author0,
|
ContactId contactId02 = contactManager2.addContact(author0,
|
||||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
assertTrue(contactId0.equals(contactId02));
|
assertTrue(contactId0.equals(contactId02));
|
||||||
|
|
||||||
@@ -349,18 +361,18 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
|||||||
|
|
||||||
// Add introducees as contacts
|
// Add introducees as contacts
|
||||||
contactId1 = contactManager0.addContact(author1, author0.getId(),
|
contactId1 = contactManager0.addContact(author1, author0.getId(),
|
||||||
master, clock.currentTimeMillis(), true, true
|
master, clock.currentTimeMillis(), true, true, true
|
||||||
);
|
);
|
||||||
contactId2 = contactManager0.addContact(author2, author0.getId(),
|
contactId2 = contactManager0.addContact(author2, author0.getId(),
|
||||||
master, clock.currentTimeMillis(), true, true
|
master, clock.currentTimeMillis(), true, true, true
|
||||||
);
|
);
|
||||||
// Add introducer back
|
// Add introducer back
|
||||||
contactId0 = contactManager1.addContact(author0, author1.getId(),
|
contactId0 = contactManager1.addContact(author0, author1.getId(),
|
||||||
master, clock.currentTimeMillis(), false, true
|
master, clock.currentTimeMillis(), false, true, true
|
||||||
);
|
);
|
||||||
ContactId contactId02 = contactManager2.addContact(author0,
|
ContactId contactId02 = contactManager2.addContact(author0,
|
||||||
author2.getId(), master, clock.currentTimeMillis(), false,
|
author2.getId(), master, clock.currentTimeMillis(), false,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
assertTrue(contactId0.equals(contactId02));
|
assertTrue(contactId0.equals(contactId02));
|
||||||
|
|
||||||
@@ -437,18 +449,18 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
|||||||
|
|
||||||
// Add introducees as contacts
|
// Add introducees as contacts
|
||||||
contactId1 = contactManager0.addContact(author1, author0.getId(),
|
contactId1 = contactManager0.addContact(author1, author0.getId(),
|
||||||
master, clock.currentTimeMillis(), true, true
|
master, clock.currentTimeMillis(), true, true, true
|
||||||
);
|
);
|
||||||
contactId2 = contactManager0.addContact(author2, author0.getId(),
|
contactId2 = contactManager0.addContact(author2, author0.getId(),
|
||||||
master, clock.currentTimeMillis(), true, true
|
master, clock.currentTimeMillis(), true, true, true
|
||||||
);
|
);
|
||||||
// Add introducer back
|
// Add introducer back
|
||||||
contactId0 = contactManager1.addContact(author0, author1.getId(),
|
contactId0 = contactManager1.addContact(author0, author1.getId(),
|
||||||
master, clock.currentTimeMillis(), false, true
|
master, clock.currentTimeMillis(), false, true, true
|
||||||
);
|
);
|
||||||
ContactId contactId02 = contactManager2.addContact(author0,
|
ContactId contactId02 = contactManager2.addContact(author0,
|
||||||
author2.getId(), master, clock.currentTimeMillis(), false,
|
author2.getId(), master, clock.currentTimeMillis(), false,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
assertTrue(contactId0.equals(contactId02));
|
assertTrue(contactId0.equals(contactId02));
|
||||||
|
|
||||||
@@ -516,11 +528,11 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
|||||||
|
|
||||||
// Add introducee as contact
|
// Add introducee as contact
|
||||||
contactId1 = contactManager0.addContact(author1, author0.getId(),
|
contactId1 = contactManager0.addContact(author1, author0.getId(),
|
||||||
master, clock.currentTimeMillis(), true, true
|
master, clock.currentTimeMillis(), true, true, true
|
||||||
);
|
);
|
||||||
// Add introducer back
|
// Add introducer back
|
||||||
contactId0 = contactManager1.addContact(author0, author1.getId(),
|
contactId0 = contactManager1.addContact(author0, author1.getId(),
|
||||||
master, clock.currentTimeMillis(), true, true
|
master, clock.currentTimeMillis(), true, true, true
|
||||||
);
|
);
|
||||||
|
|
||||||
// listen to events
|
// listen to events
|
||||||
@@ -573,21 +585,21 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
|||||||
// Add introducees' authors as contacts
|
// Add introducees' authors as contacts
|
||||||
contactId1 = contactManager0.addContact(author1,
|
contactId1 = contactManager0.addContact(author1,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
contactId2 = contactManager0.addContact(author2,
|
contactId2 = contactManager0.addContact(author2,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
// Add introducer back
|
// Add introducer back
|
||||||
contactId0 = null;
|
contactId0 = null;
|
||||||
ContactId contactId01 = contactManager1.addContact(author0,
|
ContactId contactId01 = contactManager1.addContact(author0,
|
||||||
author1.getId(), master, clock.currentTimeMillis(), false,
|
author1.getId(), master, clock.currentTimeMillis(), false,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
ContactId contactId02 = contactManager1.addContact(author0,
|
ContactId contactId02 = contactManager1.addContact(author0,
|
||||||
author2.getId(), master, clock.currentTimeMillis(), false,
|
author2.getId(), master, clock.currentTimeMillis(), false,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
|
|
||||||
// listen to events
|
// listen to events
|
||||||
@@ -667,20 +679,20 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
|||||||
// Add introducees as contacts
|
// Add introducees as contacts
|
||||||
contactId1 = contactManager0.addContact(author1,
|
contactId1 = contactManager0.addContact(author1,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
contactId2 = contactManager0.addContact(author2,
|
contactId2 = contactManager0.addContact(author2,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
// Add introducer back
|
// Add introducer back
|
||||||
contactId0 = contactManager1.addContact(author0,
|
contactId0 = contactManager1.addContact(author0,
|
||||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
ContactId contactId02 = contactManager2.addContact(author0,
|
ContactId contactId02 = contactManager2.addContact(author0,
|
||||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
assertTrue(contactId0.equals(contactId02));
|
assertTrue(contactId0.equals(contactId02));
|
||||||
|
|
||||||
@@ -764,20 +776,20 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
|||||||
// Add introducees as contacts
|
// Add introducees as contacts
|
||||||
contactId1 = contactManager0.addContact(author1,
|
contactId1 = contactManager0.addContact(author1,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
contactId2 = contactManager0.addContact(author2,
|
contactId2 = contactManager0.addContact(author2,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
// Add introducer back
|
// Add introducer back
|
||||||
contactId0 = contactManager1.addContact(author0,
|
contactId0 = contactManager1.addContact(author0,
|
||||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
ContactId contactId02 = contactManager2.addContact(author0,
|
ContactId contactId02 = contactManager2.addContact(author0,
|
||||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
assertTrue(contactId0.equals(contactId02));
|
assertTrue(contactId0.equals(contactId02));
|
||||||
|
|
||||||
@@ -850,20 +862,20 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
|||||||
// Add introducees as contacts
|
// Add introducees as contacts
|
||||||
contactId1 = contactManager0.addContact(author1,
|
contactId1 = contactManager0.addContact(author1,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
contactId2 = contactManager0.addContact(author2,
|
contactId2 = contactManager0.addContact(author2,
|
||||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
// Add introducer back
|
// Add introducer back
|
||||||
contactId0 = contactManager1.addContact(author0,
|
contactId0 = contactManager1.addContact(author0,
|
||||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
ContactId contactId02 = contactManager2.addContact(author0,
|
ContactId contactId02 = contactManager2.addContact(author0,
|
||||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||||
true
|
true, true
|
||||||
);
|
);
|
||||||
assertTrue(contactId0.equals(contactId02));
|
assertTrue(contactId0.equals(contactId02));
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
|
|||||||
Author bobAuthor = new Author(bobId, "Bob",
|
Author bobAuthor = new Author(bobId, "Bob",
|
||||||
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
||||||
ContactId contactId = contactManager.addContact(bobAuthor, aliceId,
|
ContactId contactId = contactManager.addContact(bobAuthor, aliceId,
|
||||||
master, timestamp, true, true);
|
master, timestamp, true, true, true);
|
||||||
|
|
||||||
// Send Bob a message
|
// Send Bob a message
|
||||||
GroupId groupId = messagingManager.getConversationId(contactId);
|
GroupId groupId = messagingManager.getConversationId(contactId);
|
||||||
@@ -146,7 +146,7 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
|
|||||||
Author aliceAuthor = new Author(aliceId, "Alice",
|
Author aliceAuthor = new Author(aliceId, "Alice",
|
||||||
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
||||||
ContactId contactId = contactManager.addContact(aliceAuthor, bobId,
|
ContactId contactId = contactManager.addContact(aliceAuthor, bobId,
|
||||||
master, timestamp, false, true);
|
master, timestamp, false, true, true);
|
||||||
|
|
||||||
// Set up an event listener
|
// Set up an event listener
|
||||||
MessageListener listener = new MessageListener();
|
MessageListener listener = new MessageListener();
|
||||||
|
|||||||
@@ -8,13 +8,14 @@ public class Contact {
|
|||||||
private final ContactId id;
|
private final ContactId id;
|
||||||
private final Author author;
|
private final Author author;
|
||||||
private final AuthorId localAuthorId;
|
private final AuthorId localAuthorId;
|
||||||
private final boolean active;
|
private final boolean verified, active;
|
||||||
|
|
||||||
public Contact(ContactId id, Author author, AuthorId localAuthorId,
|
public Contact(ContactId id, Author author, AuthorId localAuthorId,
|
||||||
boolean active) {
|
boolean verified, boolean active) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.author = author;
|
this.author = author;
|
||||||
this.localAuthorId = localAuthorId;
|
this.localAuthorId = localAuthorId;
|
||||||
|
this.verified = verified;
|
||||||
this.active = active;
|
this.active = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,6 +31,10 @@ public class Contact {
|
|||||||
return localAuthorId;
|
return localAuthorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isVerified() {
|
||||||
|
return verified;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,16 +21,16 @@ public interface ContactManager {
|
|||||||
* local and remote pseudonyms, and returns an ID for the contact.
|
* local and remote pseudonyms, and returns an ID for the contact.
|
||||||
*/
|
*/
|
||||||
ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
||||||
SecretKey master, long timestamp, boolean alice, boolean active)
|
SecretKey master, long timestamp, boolean alice, boolean verified,
|
||||||
throws DbException;
|
boolean active) throws DbException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores a contact associated with the given local and remote pseudonyms,
|
* Stores a contact associated with the given local and remote pseudonyms,
|
||||||
* and returns an ID for the contact.
|
* and returns an ID for the contact.
|
||||||
*/
|
*/
|
||||||
ContactId addContact(Author remote, AuthorId local,
|
ContactId addContact(Author remote, AuthorId local,
|
||||||
SecretKey master, long timestamp, boolean alice, boolean active)
|
SecretKey master, long timestamp, boolean alice, boolean verified,
|
||||||
throws DbException;
|
boolean active) throws DbException;
|
||||||
|
|
||||||
/** Returns the contact with the given ID. */
|
/** Returns the contact with the given ID. */
|
||||||
Contact getContact(ContactId c) throws DbException;
|
Contact getContact(ContactId c) throws DbException;
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public interface DatabaseComponent {
|
|||||||
* and returns an ID for the contact.
|
* and returns an ID for the contact.
|
||||||
*/
|
*/
|
||||||
ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
||||||
boolean active) throws DbException;
|
boolean verified, boolean active) throws DbException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores a group.
|
* Stores a group.
|
||||||
@@ -423,6 +423,12 @@ public interface DatabaseComponent {
|
|||||||
*/
|
*/
|
||||||
void removeTransport(Transaction txn, TransportId t) throws DbException;
|
void removeTransport(Transaction txn, TransportId t) throws DbException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks the given contact as verified or unverified.
|
||||||
|
*/
|
||||||
|
void setContactVerified(Transaction txn, ContactId c, boolean verified)
|
||||||
|
throws DbException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks the given contact as active or inactive.
|
* Marks the given contact as active or inactive.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ public class ContactExchangeTaskImpl extends Thread
|
|||||||
Transaction txn = db.startTransaction(false);
|
Transaction txn = db.startTransaction(false);
|
||||||
try {
|
try {
|
||||||
contactId = contactManager.addContact(txn, remoteAuthor,
|
contactId = contactManager.addContact(txn, remoteAuthor,
|
||||||
localAuthor.getId(), master, timestamp, alice, true);
|
localAuthor.getId(), master, timestamp, alice, true, true);
|
||||||
transportPropertyManager.addRemoteProperties(txn, contactId,
|
transportPropertyManager.addRemoteProperties(txn, contactId,
|
||||||
remoteProperties);
|
remoteProperties);
|
||||||
txn.setComplete();
|
txn.setComplete();
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ class ContactManagerImpl implements ContactManager, RemoveIdentityHook {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
public ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
||||||
SecretKey master,long timestamp, boolean alice, boolean active)
|
SecretKey master,long timestamp, boolean alice, boolean verified,
|
||||||
throws DbException {
|
boolean active) throws DbException {
|
||||||
ContactId c = db.addContact(txn, remote, local, active);
|
ContactId c = db.addContact(txn, remote, local, verified, active);
|
||||||
keyManager.addContact(txn, c, master, timestamp, alice);
|
keyManager.addContact(txn, c, master, timestamp, alice);
|
||||||
Contact contact = db.getContact(txn, c);
|
Contact contact = db.getContact(txn, c);
|
||||||
for (AddContactHook hook : addHooks)
|
for (AddContactHook hook : addHooks)
|
||||||
@@ -60,13 +60,13 @@ class ContactManagerImpl implements ContactManager, RemoveIdentityHook {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContactId addContact(Author remote, AuthorId local, SecretKey master,
|
public ContactId addContact(Author remote, AuthorId local, SecretKey master,
|
||||||
long timestamp, boolean alice, boolean active)
|
long timestamp, boolean alice, boolean verified, boolean active)
|
||||||
throws DbException {
|
throws DbException {
|
||||||
ContactId c;
|
ContactId c;
|
||||||
Transaction txn = db.startTransaction(false);
|
Transaction txn = db.startTransaction(false);
|
||||||
try {
|
try {
|
||||||
c = addContact(txn, remote, local, master, timestamp, alice,
|
c = addContact(txn, remote, local, master, timestamp, alice,
|
||||||
active);
|
verified, active);
|
||||||
txn.setComplete();
|
txn.setComplete();
|
||||||
} finally {
|
} finally {
|
||||||
db.endTransaction(txn);
|
db.endTransaction(txn);
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ interface Database<T> {
|
|||||||
* Stores a contact associated with the given local and remote pseudonyms,
|
* Stores a contact associated with the given local and remote pseudonyms,
|
||||||
* and returns an ID for the contact.
|
* and returns an ID for the contact.
|
||||||
*/
|
*/
|
||||||
ContactId addContact(T txn, Author remote, AuthorId local, boolean active)
|
ContactId addContact(T txn, Author remote, AuthorId local, boolean verified,
|
||||||
throws DbException;
|
boolean active) throws DbException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores a group.
|
* Stores a group.
|
||||||
@@ -575,6 +575,12 @@ interface Database<T> {
|
|||||||
*/
|
*/
|
||||||
void resetExpiryTime(T txn, ContactId c, MessageId m) throws DbException;
|
void resetExpiryTime(T txn, ContactId c, MessageId m) throws DbException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks the given contact as verified or unverified.
|
||||||
|
*/
|
||||||
|
void setContactVerified(T txn, ContactId c, boolean verified)
|
||||||
|
throws DbException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks the given contact as active or inactive.
|
* Marks the given contact as active or inactive.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -152,7 +152,8 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ContactId addContact(Transaction transaction, Author remote,
|
public ContactId addContact(Transaction transaction, Author remote,
|
||||||
AuthorId local, boolean active) throws DbException {
|
AuthorId local, boolean verified, boolean active)
|
||||||
|
throws DbException {
|
||||||
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
||||||
T txn = unbox(transaction);
|
T txn = unbox(transaction);
|
||||||
if (!db.containsLocalAuthor(txn, local))
|
if (!db.containsLocalAuthor(txn, local))
|
||||||
@@ -161,7 +162,7 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
|||||||
throw new ContactExistsException();
|
throw new ContactExistsException();
|
||||||
if (db.containsContact(txn, remote.getId(), local))
|
if (db.containsContact(txn, remote.getId(), local))
|
||||||
throw new ContactExistsException();
|
throw new ContactExistsException();
|
||||||
ContactId c = db.addContact(txn, remote, local, active);
|
ContactId c = db.addContact(txn, remote, local, verified, active);
|
||||||
transaction.attach(new ContactAddedEvent(c, active));
|
transaction.attach(new ContactAddedEvent(c, active));
|
||||||
if (active) transaction.attach(new ContactStatusChangedEvent(c, true));
|
if (active) transaction.attach(new ContactStatusChangedEvent(c, true));
|
||||||
return c;
|
return c;
|
||||||
@@ -682,6 +683,16 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
|||||||
db.removeTransport(txn, t);
|
db.removeTransport(txn, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setContactVerified(Transaction transaction, ContactId c,
|
||||||
|
boolean verified) throws DbException {
|
||||||
|
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
||||||
|
T txn = unbox(transaction);
|
||||||
|
if (!db.containsContact(txn, c))
|
||||||
|
throw new NoSuchContactException();
|
||||||
|
db.setContactVerified(txn, c, verified);
|
||||||
|
transaction.attach(new ContactStatusChangedEvent(c, verified));
|
||||||
|
}
|
||||||
|
|
||||||
public void setContactActive(Transaction transaction, ContactId c,
|
public void setContactActive(Transaction transaction, ContactId c,
|
||||||
boolean active) throws DbException {
|
boolean active) throws DbException {
|
||||||
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ import static org.briarproject.db.ExponentialBackoff.calculateExpiry;
|
|||||||
*/
|
*/
|
||||||
abstract class JdbcDatabase implements Database<Connection> {
|
abstract class JdbcDatabase implements Database<Connection> {
|
||||||
|
|
||||||
private static final int SCHEMA_VERSION = 25;
|
private static final int SCHEMA_VERSION = 26;
|
||||||
private static final int MIN_SCHEMA_VERSION = 25;
|
private static final int MIN_SCHEMA_VERSION = 26;
|
||||||
|
|
||||||
private static final String CREATE_SETTINGS =
|
private static final String CREATE_SETTINGS =
|
||||||
"CREATE TABLE settings"
|
"CREATE TABLE settings"
|
||||||
@@ -93,6 +93,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
+ " name VARCHAR NOT NULL,"
|
+ " name VARCHAR NOT NULL,"
|
||||||
+ " publicKey BINARY NOT NULL,"
|
+ " publicKey BINARY NOT NULL,"
|
||||||
+ " localAuthorId HASH NOT NULL,"
|
+ " localAuthorId HASH NOT NULL,"
|
||||||
|
+ " verified BOOLEAN NOT NULL,"
|
||||||
+ " active BOOLEAN NOT NULL,"
|
+ " active BOOLEAN NOT NULL,"
|
||||||
+ " PRIMARY KEY (contactId),"
|
+ " PRIMARY KEY (contactId),"
|
||||||
+ " FOREIGN KEY (localAuthorId)"
|
+ " FOREIGN KEY (localAuthorId)"
|
||||||
@@ -456,20 +457,21 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ContactId addContact(Connection txn, Author remote, AuthorId local,
|
public ContactId addContact(Connection txn, Author remote, AuthorId local,
|
||||||
boolean active) throws DbException {
|
boolean verified, boolean active) throws DbException {
|
||||||
PreparedStatement ps = null;
|
PreparedStatement ps = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
// Create a contact row
|
// Create a contact row
|
||||||
String sql = "INSERT INTO contacts"
|
String sql = "INSERT INTO contacts"
|
||||||
+ " (authorId, name, publicKey, localAuthorId, active)"
|
+ " (authorId, name, publicKey, localAuthorId, verified, active)"
|
||||||
+ " VALUES (?, ?, ?, ?, ?)";
|
+ " VALUES (?, ?, ?, ?, ?, ?)";
|
||||||
ps = txn.prepareStatement(sql);
|
ps = txn.prepareStatement(sql);
|
||||||
ps.setBytes(1, remote.getId().getBytes());
|
ps.setBytes(1, remote.getId().getBytes());
|
||||||
ps.setString(2, remote.getName());
|
ps.setString(2, remote.getName());
|
||||||
ps.setBytes(3, remote.getPublicKey());
|
ps.setBytes(3, remote.getPublicKey());
|
||||||
ps.setBytes(4, local.getBytes());
|
ps.setBytes(4, local.getBytes());
|
||||||
ps.setBoolean(5, active);
|
ps.setBoolean(5, verified);
|
||||||
|
ps.setBoolean(6, active);
|
||||||
int affected = ps.executeUpdate();
|
int affected = ps.executeUpdate();
|
||||||
if (affected != 1) throw new DbStateException();
|
if (affected != 1) throw new DbStateException();
|
||||||
ps.close();
|
ps.close();
|
||||||
@@ -961,7 +963,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
String sql = "SELECT authorId, name, publicKey,"
|
String sql = "SELECT authorId, name, publicKey,"
|
||||||
+ " localAuthorId, active"
|
+ " localAuthorId, verified, active"
|
||||||
+ " FROM contacts"
|
+ " FROM contacts"
|
||||||
+ " WHERE contactId = ?";
|
+ " WHERE contactId = ?";
|
||||||
ps = txn.prepareStatement(sql);
|
ps = txn.prepareStatement(sql);
|
||||||
@@ -972,11 +974,12 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
String name = rs.getString(2);
|
String name = rs.getString(2);
|
||||||
byte[] publicKey = rs.getBytes(3);
|
byte[] publicKey = rs.getBytes(3);
|
||||||
AuthorId localAuthorId = new AuthorId(rs.getBytes(4));
|
AuthorId localAuthorId = new AuthorId(rs.getBytes(4));
|
||||||
boolean active = rs.getBoolean(5);
|
boolean verified = rs.getBoolean(5);
|
||||||
|
boolean active = rs.getBoolean(6);
|
||||||
rs.close();
|
rs.close();
|
||||||
ps.close();
|
ps.close();
|
||||||
Author author = new Author(authorId, name, publicKey);
|
Author author = new Author(authorId, name, publicKey);
|
||||||
return new Contact(c, author, localAuthorId, active);
|
return new Contact(c, author, localAuthorId, verified, active);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
tryToClose(rs);
|
tryToClose(rs);
|
||||||
tryToClose(ps);
|
tryToClose(ps);
|
||||||
@@ -990,7 +993,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
String sql = "SELECT contactId, authorId, name, publicKey,"
|
String sql = "SELECT contactId, authorId, name, publicKey,"
|
||||||
+ " localAuthorId, active"
|
+ " localAuthorId, verified, active"
|
||||||
+ " FROM contacts";
|
+ " FROM contacts";
|
||||||
ps = txn.prepareStatement(sql);
|
ps = txn.prepareStatement(sql);
|
||||||
rs = ps.executeQuery();
|
rs = ps.executeQuery();
|
||||||
@@ -1002,9 +1005,10 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
byte[] publicKey = rs.getBytes(4);
|
byte[] publicKey = rs.getBytes(4);
|
||||||
Author author = new Author(authorId, name, publicKey);
|
Author author = new Author(authorId, name, publicKey);
|
||||||
AuthorId localAuthorId = new AuthorId(rs.getBytes(5));
|
AuthorId localAuthorId = new AuthorId(rs.getBytes(5));
|
||||||
boolean active = rs.getBoolean(6);
|
boolean verified = rs.getBoolean(6);
|
||||||
|
boolean active = rs.getBoolean(7);
|
||||||
contacts.add(new Contact(contactId, author, localAuthorId,
|
contacts.add(new Contact(contactId, author, localAuthorId,
|
||||||
active));
|
verified, active));
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
ps.close();
|
ps.close();
|
||||||
@@ -2245,6 +2249,23 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setContactVerified(Connection txn, ContactId c,
|
||||||
|
boolean verified) throws DbException {
|
||||||
|
PreparedStatement ps = null;
|
||||||
|
try {
|
||||||
|
String sql = "UPDATE contacts SET verified = ? WHERE contactId = ?";
|
||||||
|
ps = txn.prepareStatement(sql);
|
||||||
|
ps.setBoolean(1, verified);
|
||||||
|
ps.setInt(2, c.getInt());
|
||||||
|
int affected = ps.executeUpdate();
|
||||||
|
if (affected < 0 || affected > 1) throw new DbStateException();
|
||||||
|
ps.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
tryToClose(ps);
|
||||||
|
throw new DbException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setContactActive(Connection txn, ContactId c, boolean active)
|
public void setContactActive(Connection txn, ContactId c, boolean active)
|
||||||
throws DbException {
|
throws DbException {
|
||||||
PreparedStatement ps = null;
|
PreparedStatement ps = null;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import static org.briarproject.api.identity.Author.Status.OURSELVES;
|
import static org.briarproject.api.identity.Author.Status.OURSELVES;
|
||||||
import static org.briarproject.api.identity.Author.Status.UNKNOWN;
|
import static org.briarproject.api.identity.Author.Status.UNKNOWN;
|
||||||
|
import static org.briarproject.api.identity.Author.Status.UNVERIFIED;
|
||||||
import static org.briarproject.api.identity.Author.Status.VERIFIED;
|
import static org.briarproject.api.identity.Author.Status.VERIFIED;
|
||||||
|
|
||||||
class IdentityManagerImpl implements IdentityManager {
|
class IdentityManagerImpl implements IdentityManager {
|
||||||
@@ -127,10 +128,12 @@ class IdentityManagerImpl implements IdentityManager {
|
|||||||
for (LocalAuthor a : db.getLocalAuthors(txn))
|
for (LocalAuthor a : db.getLocalAuthors(txn))
|
||||||
if (a.getId().equals(authorId)) return OURSELVES;
|
if (a.getId().equals(authorId)) return OURSELVES;
|
||||||
// Compare to the IDs of contacts' identities
|
// Compare to the IDs of contacts' identities
|
||||||
for (Contact c : db.getContacts(txn))
|
for (Contact c : db.getContacts(txn)) {
|
||||||
if (c.getAuthor().getId().equals(authorId)) return VERIFIED;
|
if (c.getAuthor().getId().equals(authorId)) {
|
||||||
|
if (c.isVerified()) return VERIFIED;
|
||||||
// TODO also handle UNVERIFIED when #261 is implemented
|
else return UNVERIFIED;
|
||||||
|
}
|
||||||
|
}
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ class IntroduceeManager {
|
|||||||
localState.getRaw(PUBLIC_KEY));
|
localState.getRaw(PUBLIC_KEY));
|
||||||
ContactId contactId = contactManager
|
ContactId contactId = contactManager
|
||||||
.addContact(txn, remoteAuthor, localAuthorId, secretKey,
|
.addContact(txn, remoteAuthor, localAuthorId, secretKey,
|
||||||
timestamp, alice, false);
|
timestamp, alice, false, false);
|
||||||
|
|
||||||
// Update local state with ContactId, so we know what to activate
|
// Update local state with ContactId, so we know what to activate
|
||||||
localState.put(ADDED_CONTACT_ID, contactId.getInt());
|
localState.put(ADDED_CONTACT_ID, contactId.getInt());
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class BlogManagerImplTest extends BriarTestCase {
|
|||||||
Collections.singletonList(contactId);
|
Collections.singletonList(contactId);
|
||||||
|
|
||||||
Contact contact = new Contact(contactId, blog2.getAuthor(),
|
Contact contact = new Contact(contactId, blog2.getAuthor(),
|
||||||
blog1.getAuthor().getId(), true);
|
blog1.getAuthor().getId(), true, true);
|
||||||
final Collection<Contact> contacts = Collections.singletonList(contact);
|
final Collection<Contact> contacts = Collections.singletonList(contact);
|
||||||
|
|
||||||
context.checking(new Expectations() {{
|
context.checking(new Expectations() {{
|
||||||
@@ -132,7 +132,7 @@ public class BlogManagerImplTest extends BriarTestCase {
|
|||||||
|
|
||||||
final ContactId contactId = new ContactId(0);
|
final ContactId contactId = new ContactId(0);
|
||||||
Contact contact = new Contact(contactId, blog2.getAuthor(),
|
Contact contact = new Contact(contactId, blog2.getAuthor(),
|
||||||
blog1.getAuthor().getId(), true);
|
blog1.getAuthor().getId(), true, true);
|
||||||
|
|
||||||
context.checking(new Expectations() {{
|
context.checking(new Expectations() {{
|
||||||
oneOf(blogFactory).createPersonalBlog(blog2.getAuthor());
|
oneOf(blogFactory).createPersonalBlog(blog2.getAuthor());
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
|||||||
transportId = new TransportId("id");
|
transportId = new TransportId("id");
|
||||||
maxLatency = Integer.MAX_VALUE;
|
maxLatency = Integer.MAX_VALUE;
|
||||||
contactId = new ContactId(234);
|
contactId = new ContactId(234);
|
||||||
contact = new Contact(contactId, author, localAuthorId, true);
|
contact = new Contact(contactId, author, localAuthorId, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DatabaseComponent createDatabaseComponent(Database<Object> database,
|
private DatabaseComponent createDatabaseComponent(Database<Object> database,
|
||||||
@@ -149,7 +149,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
|||||||
will(returnValue(false));
|
will(returnValue(false));
|
||||||
oneOf(database).containsContact(txn, authorId, localAuthorId);
|
oneOf(database).containsContact(txn, authorId, localAuthorId);
|
||||||
will(returnValue(false));
|
will(returnValue(false));
|
||||||
oneOf(database).addContact(txn, author, localAuthorId, true);
|
oneOf(database).addContact(txn, author, localAuthorId, true, true);
|
||||||
will(returnValue(contactId));
|
will(returnValue(contactId));
|
||||||
oneOf(eventBus).broadcast(with(any(ContactAddedEvent.class)));
|
oneOf(eventBus).broadcast(with(any(ContactAddedEvent.class)));
|
||||||
oneOf(eventBus).broadcast(with(any(
|
oneOf(eventBus).broadcast(with(any(
|
||||||
@@ -201,7 +201,8 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
|||||||
try {
|
try {
|
||||||
db.addLocalAuthor(transaction, localAuthor);
|
db.addLocalAuthor(transaction, localAuthor);
|
||||||
assertEquals(contactId,
|
assertEquals(contactId,
|
||||||
db.addContact(transaction, author, localAuthorId, true));
|
db.addContact(transaction, author, localAuthorId, true,
|
||||||
|
true));
|
||||||
assertEquals(Collections.singletonList(contact),
|
assertEquals(Collections.singletonList(contact),
|
||||||
db.getContacts(transaction));
|
db.getContacts(transaction));
|
||||||
db.addGroup(transaction, group); // First time - listeners called
|
db.addGroup(transaction, group); // First time - listeners called
|
||||||
@@ -519,7 +520,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
|||||||
|
|
||||||
Transaction transaction = db.startTransaction(false);
|
Transaction transaction = db.startTransaction(false);
|
||||||
try {
|
try {
|
||||||
db.addContact(transaction, author, localAuthorId, true);
|
db.addContact(transaction, author, localAuthorId, true, true);
|
||||||
fail();
|
fail();
|
||||||
} catch (NoSuchLocalAuthorException expected) {
|
} catch (NoSuchLocalAuthorException expected) {
|
||||||
// Expected
|
// Expected
|
||||||
@@ -815,7 +816,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
|||||||
will(returnValue(false));
|
will(returnValue(false));
|
||||||
oneOf(database).containsContact(txn, authorId, localAuthorId);
|
oneOf(database).containsContact(txn, authorId, localAuthorId);
|
||||||
will(returnValue(false));
|
will(returnValue(false));
|
||||||
oneOf(database).addContact(txn, author, localAuthorId, true);
|
oneOf(database).addContact(txn, author, localAuthorId, true, true);
|
||||||
will(returnValue(contactId));
|
will(returnValue(contactId));
|
||||||
oneOf(eventBus).broadcast(with(any(ContactAddedEvent.class)));
|
oneOf(eventBus).broadcast(with(any(ContactAddedEvent.class)));
|
||||||
oneOf(eventBus).broadcast(with(any(
|
oneOf(eventBus).broadcast(with(any(
|
||||||
@@ -838,7 +839,8 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
|||||||
try {
|
try {
|
||||||
db.addLocalAuthor(transaction, localAuthor);
|
db.addLocalAuthor(transaction, localAuthor);
|
||||||
assertEquals(contactId,
|
assertEquals(contactId,
|
||||||
db.addContact(transaction, author, localAuthorId, true));
|
db.addContact(transaction, author, localAuthorId, true,
|
||||||
|
true));
|
||||||
transaction.setComplete();
|
transaction.setComplete();
|
||||||
} finally {
|
} finally {
|
||||||
db.endTransaction(transaction);
|
db.endTransaction(transaction);
|
||||||
@@ -1569,7 +1571,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
|||||||
|
|
||||||
Transaction transaction = db.startTransaction(false);
|
Transaction transaction = db.startTransaction(false);
|
||||||
try {
|
try {
|
||||||
db.addContact(transaction, author, localAuthorId, true);
|
db.addContact(transaction, author, localAuthorId, true, true);
|
||||||
fail();
|
fail();
|
||||||
} catch (ContactExistsException expected) {
|
} catch (ContactExistsException expected) {
|
||||||
// Expected
|
// Expected
|
||||||
@@ -1606,7 +1608,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
|||||||
|
|
||||||
Transaction transaction = db.startTransaction(false);
|
Transaction transaction = db.startTransaction(false);
|
||||||
try {
|
try {
|
||||||
db.addContact(transaction, author, localAuthorId, true);
|
db.addContact(transaction, author, localAuthorId, true, true);
|
||||||
fail();
|
fail();
|
||||||
} catch (ContactExistsException expected) {
|
} catch (ContactExistsException expected) {
|
||||||
// Expected
|
// Expected
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
assertFalse(db.containsContact(txn, contactId));
|
assertFalse(db.containsContact(txn, contactId));
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
assertTrue(db.containsContact(txn, contactId));
|
assertTrue(db.containsContact(txn, contactId));
|
||||||
assertFalse(db.containsGroup(txn, groupId));
|
assertFalse(db.containsGroup(txn, groupId));
|
||||||
db.addGroup(txn, group);
|
db.addGroup(txn, group);
|
||||||
@@ -174,7 +174,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact, a group and a message
|
// Add a contact, a group and a message
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addGroup(txn, group);
|
db.addGroup(txn, group);
|
||||||
db.addVisibility(txn, contactId, groupId);
|
db.addVisibility(txn, contactId, groupId);
|
||||||
db.addMessage(txn, message, DELIVERED, true);
|
db.addMessage(txn, message, DELIVERED, true);
|
||||||
@@ -212,7 +212,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact, a group and an unvalidated message
|
// Add a contact, a group and an unvalidated message
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addGroup(txn, group);
|
db.addGroup(txn, group);
|
||||||
db.addVisibility(txn, contactId, groupId);
|
db.addVisibility(txn, contactId, groupId);
|
||||||
db.addMessage(txn, message, UNKNOWN, true);
|
db.addMessage(txn, message, UNKNOWN, true);
|
||||||
@@ -267,7 +267,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact, a group and an unshared message
|
// Add a contact, a group and an unshared message
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addGroup(txn, group);
|
db.addGroup(txn, group);
|
||||||
db.addVisibility(txn, contactId, groupId);
|
db.addVisibility(txn, contactId, groupId);
|
||||||
db.addMessage(txn, message, DELIVERED, false);
|
db.addMessage(txn, message, DELIVERED, false);
|
||||||
@@ -306,7 +306,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact, a group and a message
|
// Add a contact, a group and a message
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addGroup(txn, group);
|
db.addGroup(txn, group);
|
||||||
db.addVisibility(txn, contactId, groupId);
|
db.addVisibility(txn, contactId, groupId);
|
||||||
db.addMessage(txn, message, DELIVERED, true);
|
db.addMessage(txn, message, DELIVERED, true);
|
||||||
@@ -333,7 +333,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact and a group
|
// Add a contact and a group
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addGroup(txn, group);
|
db.addGroup(txn, group);
|
||||||
db.addVisibility(txn, contactId, groupId);
|
db.addVisibility(txn, contactId, groupId);
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact, a group and a message
|
// Add a contact, a group and a message
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addGroup(txn, group);
|
db.addGroup(txn, group);
|
||||||
db.addVisibility(txn, contactId, groupId);
|
db.addVisibility(txn, contactId, groupId);
|
||||||
db.addMessage(txn, message, DELIVERED, true);
|
db.addMessage(txn, message, DELIVERED, true);
|
||||||
@@ -534,7 +534,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact and a group
|
// Add a contact and a group
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addGroup(txn, group);
|
db.addGroup(txn, group);
|
||||||
db.addVisibility(txn, contactId, groupId);
|
db.addVisibility(txn, contactId, groupId);
|
||||||
|
|
||||||
@@ -554,7 +554,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact
|
// Add a contact
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
|
|
||||||
// The group is not in the database
|
// The group is not in the database
|
||||||
assertFalse(db.containsVisibleMessage(txn, contactId, messageId));
|
assertFalse(db.containsVisibleMessage(txn, contactId, messageId));
|
||||||
@@ -572,7 +572,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact, a group and a message
|
// Add a contact, a group and a message
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addGroup(txn, group);
|
db.addGroup(txn, group);
|
||||||
db.addMessage(txn, message, DELIVERED, true);
|
db.addMessage(txn, message, DELIVERED, true);
|
||||||
db.addStatus(txn, contactId, messageId, false, false);
|
db.addStatus(txn, contactId, messageId, false, false);
|
||||||
@@ -592,7 +592,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact and a group
|
// Add a contact and a group
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addGroup(txn, group);
|
db.addGroup(txn, group);
|
||||||
|
|
||||||
// The group should not be visible to the contact
|
// The group should not be visible to the contact
|
||||||
@@ -628,7 +628,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact and the groups
|
// Add a contact and the groups
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
for (Group g : groups) db.addGroup(txn, g);
|
for (Group g : groups) db.addGroup(txn, g);
|
||||||
|
|
||||||
// Make the groups visible to the contact
|
// Make the groups visible to the contact
|
||||||
@@ -661,7 +661,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add the contact, the transport and the transport keys
|
// Add the contact, the transport and the transport keys
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addTransport(txn, transportId, 123);
|
db.addTransport(txn, transportId, 123);
|
||||||
db.addTransportKeys(txn, contactId, keys);
|
db.addTransportKeys(txn, contactId, keys);
|
||||||
|
|
||||||
@@ -723,7 +723,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add the contact, transport and transport keys
|
// Add the contact, transport and transport keys
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addTransport(txn, transportId, 123);
|
db.addTransport(txn, transportId, 123);
|
||||||
db.updateTransportKeys(txn, Collections.singletonMap(contactId, keys));
|
db.updateTransportKeys(txn, Collections.singletonMap(contactId, keys));
|
||||||
|
|
||||||
@@ -759,7 +759,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add the contact, transport and transport keys
|
// Add the contact, transport and transport keys
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addTransport(txn, transportId, 123);
|
db.addTransport(txn, transportId, 123);
|
||||||
db.updateTransportKeys(txn, Collections.singletonMap(contactId, keys));
|
db.updateTransportKeys(txn, Collections.singletonMap(contactId, keys));
|
||||||
|
|
||||||
@@ -796,7 +796,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
|
|
||||||
// Add a contact associated with the local author
|
// Add a contact associated with the local author
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
contacts = db.getContacts(txn, localAuthorId);
|
contacts = db.getContacts(txn, localAuthorId);
|
||||||
assertEquals(Collections.singletonList(contactId), contacts);
|
assertEquals(Collections.singletonList(contactId), contacts);
|
||||||
|
|
||||||
@@ -818,7 +818,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact - initially there should be no offered messages
|
// Add a contact - initially there should be no offered messages
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
assertEquals(0, db.countOfferedMessages(txn, contactId));
|
assertEquals(0, db.countOfferedMessages(txn, contactId));
|
||||||
|
|
||||||
// Add some offered messages and count them
|
// Add some offered messages and count them
|
||||||
@@ -1377,7 +1377,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact
|
// Add a contact
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
|
|
||||||
// Add a group and make it visible to the contact
|
// Add a group and make it visible to the contact
|
||||||
db.addGroup(txn, group);
|
db.addGroup(txn, group);
|
||||||
@@ -1454,7 +1454,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact and a group
|
// Add a contact and a group
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addGroup(txn, group);
|
db.addGroup(txn, group);
|
||||||
|
|
||||||
// The group should not be visible to the contact
|
// The group should not be visible to the contact
|
||||||
@@ -1487,8 +1487,10 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
db.addLocalAuthor(txn, localAuthor1);
|
db.addLocalAuthor(txn, localAuthor1);
|
||||||
|
|
||||||
// Add the same contact for each local pseudonym
|
// Add the same contact for each local pseudonym
|
||||||
ContactId contactId = db.addContact(txn, author, localAuthorId, true);
|
ContactId contactId =
|
||||||
ContactId contactId1 = db.addContact(txn, author, localAuthorId1, true);
|
db.addContact(txn, author, localAuthorId, true, true);
|
||||||
|
ContactId contactId1 =
|
||||||
|
db.addContact(txn, author, localAuthorId1, true, true);
|
||||||
|
|
||||||
// The contacts should be distinct
|
// The contacts should be distinct
|
||||||
assertNotEquals(contactId, contactId1);
|
assertNotEquals(contactId, contactId1);
|
||||||
@@ -1508,7 +1510,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact, a group and a message
|
// Add a contact, a group and a message
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
db.addGroup(txn, group);
|
db.addGroup(txn, group);
|
||||||
db.addVisibility(txn, contactId, groupId);
|
db.addVisibility(txn, contactId, groupId);
|
||||||
db.addMessage(txn, message, DELIVERED, true);
|
db.addMessage(txn, message, DELIVERED, true);
|
||||||
@@ -1554,7 +1556,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
|||||||
// Add a contact
|
// Add a contact
|
||||||
db.addLocalAuthor(txn, localAuthor);
|
db.addLocalAuthor(txn, localAuthor);
|
||||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||||
true));
|
true, true));
|
||||||
|
|
||||||
// The contact should be active
|
// The contact should be active
|
||||||
Contact contact = db.getContact(txn, contactId);
|
Contact contact = db.getContact(txn, contactId);
|
||||||
|
|||||||
@@ -115,20 +115,23 @@ public class IntroduceeManagerTest extends BriarTestCase {
|
|||||||
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
||||||
AuthorId localAuthorId = new AuthorId(TestUtils.getRandomId());
|
AuthorId localAuthorId = new AuthorId(TestUtils.getRandomId());
|
||||||
ContactId contactId0 = new ContactId(234);
|
ContactId contactId0 = new ContactId(234);
|
||||||
introducer = new Contact(contactId0, author0, localAuthorId, true);
|
introducer =
|
||||||
|
new Contact(contactId0, author0, localAuthorId, true, true);
|
||||||
|
|
||||||
AuthorId authorId1 = new AuthorId(TestUtils.getRandomId());
|
AuthorId authorId1 = new AuthorId(TestUtils.getRandomId());
|
||||||
Author author1 = new Author(authorId1, "Introducee1",
|
Author author1 = new Author(authorId1, "Introducee1",
|
||||||
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
||||||
AuthorId localAuthorId1 = new AuthorId(TestUtils.getRandomId());
|
AuthorId localAuthorId1 = new AuthorId(TestUtils.getRandomId());
|
||||||
ContactId contactId1 = new ContactId(234);
|
ContactId contactId1 = new ContactId(234);
|
||||||
introducee1 = new Contact(contactId1, author1, localAuthorId1, true);
|
introducee1 =
|
||||||
|
new Contact(contactId1, author1, localAuthorId1, true, true);
|
||||||
|
|
||||||
AuthorId authorId2 = new AuthorId(TestUtils.getRandomId());
|
AuthorId authorId2 = new AuthorId(TestUtils.getRandomId());
|
||||||
Author author2 = new Author(authorId2, "Introducee2",
|
Author author2 = new Author(authorId2, "Introducee2",
|
||||||
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
||||||
ContactId contactId2 = new ContactId(235);
|
ContactId contactId2 = new ContactId(235);
|
||||||
introducee2 = new Contact(contactId2, author2, localAuthorId, true);
|
introducee2 =
|
||||||
|
new Contact(contactId2, author2, localAuthorId, true, true);
|
||||||
|
|
||||||
clientId = IntroductionManagerImpl.CLIENT_ID;
|
clientId = IntroductionManagerImpl.CLIENT_ID;
|
||||||
localGroup1 = new Group(new GroupId(TestUtils.getRandomId()),
|
localGroup1 = new Group(new GroupId(TestUtils.getRandomId()),
|
||||||
|
|||||||
@@ -85,14 +85,16 @@ public class IntroducerManagerTest extends BriarTestCase {
|
|||||||
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
||||||
AuthorId localAuthorId1 = new AuthorId(TestUtils.getRandomId());
|
AuthorId localAuthorId1 = new AuthorId(TestUtils.getRandomId());
|
||||||
ContactId contactId1 = new ContactId(234);
|
ContactId contactId1 = new ContactId(234);
|
||||||
introducee1 = new Contact(contactId1, author1, localAuthorId1, true);
|
introducee1 =
|
||||||
|
new Contact(contactId1, author1, localAuthorId1, true, true);
|
||||||
|
|
||||||
AuthorId authorId2 = new AuthorId(TestUtils.getRandomId());
|
AuthorId authorId2 = new AuthorId(TestUtils.getRandomId());
|
||||||
Author author2 = new Author(authorId2, "Introducee2",
|
Author author2 = new Author(authorId2, "Introducee2",
|
||||||
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
||||||
AuthorId localAuthorId2 = new AuthorId(TestUtils.getRandomId());
|
AuthorId localAuthorId2 = new AuthorId(TestUtils.getRandomId());
|
||||||
ContactId contactId2 = new ContactId(235);
|
ContactId contactId2 = new ContactId(235);
|
||||||
introducee2 = new Contact(contactId2, author2, localAuthorId2, true);
|
introducee2 =
|
||||||
|
new Contact(contactId2, author2, localAuthorId2, true, true);
|
||||||
|
|
||||||
localGroup0 = new Group(new GroupId(TestUtils.getRandomId()),
|
localGroup0 = new Group(new GroupId(TestUtils.getRandomId()),
|
||||||
getClientId(), new byte[0]);
|
getClientId(), new byte[0]);
|
||||||
|
|||||||
@@ -77,14 +77,16 @@ public class IntroductionManagerImplTest extends BriarTestCase {
|
|||||||
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
||||||
AuthorId localAuthorId1 = new AuthorId(TestUtils.getRandomId());
|
AuthorId localAuthorId1 = new AuthorId(TestUtils.getRandomId());
|
||||||
ContactId contactId1 = new ContactId(234);
|
ContactId contactId1 = new ContactId(234);
|
||||||
introducee1 = new Contact(contactId1, author1, localAuthorId1, true);
|
introducee1 =
|
||||||
|
new Contact(contactId1, author1, localAuthorId1, true, true);
|
||||||
|
|
||||||
AuthorId authorId2 = new AuthorId(TestUtils.getRandomId());
|
AuthorId authorId2 = new AuthorId(TestUtils.getRandomId());
|
||||||
Author author2 = new Author(authorId2, "Introducee2",
|
Author author2 = new Author(authorId2, "Introducee2",
|
||||||
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
||||||
AuthorId localAuthorId2 = new AuthorId(TestUtils.getRandomId());
|
AuthorId localAuthorId2 = new AuthorId(TestUtils.getRandomId());
|
||||||
ContactId contactId2 = new ContactId(235);
|
ContactId contactId2 = new ContactId(235);
|
||||||
introducee2 = new Contact(contactId2, author2, localAuthorId2, true);
|
introducee2 =
|
||||||
|
new Contact(contactId2, author2, localAuthorId2, true, true);
|
||||||
|
|
||||||
ClientId clientId = new ClientId(TestUtils.getRandomId());
|
ClientId clientId = new ClientId(TestUtils.getRandomId());
|
||||||
localGroup0 = new Group(new GroupId(TestUtils.getRandomId()),
|
localGroup0 = new Group(new GroupId(TestUtils.getRandomId()),
|
||||||
|
|||||||
Reference in New Issue
Block a user