mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 20:29:52 +01:00
Prepare private message retrieval through ConversationManager
This commit is contained in:
@@ -298,21 +298,17 @@ public class IntroductionIntegrationTest
|
||||
Group g1 = introductionManager0.getContactGroup(introducee1);
|
||||
Group g2 = introductionManager0.getContactGroup(introducee2);
|
||||
assertEquals(2,
|
||||
introductionManager0.getIntroductionMessages(contactId1From0)
|
||||
.size());
|
||||
introductionManager0.getMessages(contactId1From0).size());
|
||||
assertGroupCount(messageTracker0, g1.getId(), 2, 1);
|
||||
assertEquals(2,
|
||||
introductionManager0.getIntroductionMessages(contactId2From0)
|
||||
.size());
|
||||
introductionManager0.getMessages(contactId2From0).size());
|
||||
assertGroupCount(messageTracker0, g2.getId(), 2, 1);
|
||||
assertEquals(2,
|
||||
introductionManager1.getIntroductionMessages(contactId0From1)
|
||||
.size());
|
||||
introductionManager1.getMessages(contactId0From1).size());
|
||||
assertGroupCount(messageTracker1, g1.getId(), 2, 1);
|
||||
// introducee2 should also have the decline response of introducee1
|
||||
assertEquals(3,
|
||||
introductionManager2.getIntroductionMessages(contactId0From2)
|
||||
.size());
|
||||
introductionManager2.getMessages(contactId0From2).size());
|
||||
assertGroupCount(messageTracker2, g2.getId(), 3, 2);
|
||||
|
||||
assertFalse(listener0.aborted);
|
||||
@@ -363,16 +359,13 @@ public class IntroductionIntegrationTest
|
||||
.contactExists(author1.getId(), author2.getId()));
|
||||
|
||||
assertEquals(2,
|
||||
introductionManager0.getIntroductionMessages(contactId1From0)
|
||||
.size());
|
||||
introductionManager0.getMessages(contactId1From0).size());
|
||||
assertEquals(2,
|
||||
introductionManager0.getIntroductionMessages(contactId2From0)
|
||||
.size());
|
||||
introductionManager0.getMessages(contactId2From0).size());
|
||||
assertEquals(3,
|
||||
introductionManager1.getIntroductionMessages(contactId0From1)
|
||||
.size());
|
||||
introductionManager1.getMessages(contactId0From1).size());
|
||||
assertEquals(3,
|
||||
introductionManager2.getIntroductionMessages(contactId0From2)
|
||||
introductionManager2.getMessages(contactId0From2)
|
||||
.size());
|
||||
assertFalse(listener0.aborted);
|
||||
assertFalse(listener1.aborted);
|
||||
@@ -520,20 +513,16 @@ public class IntroductionIntegrationTest
|
||||
Group g1 = introductionManager0.getContactGroup(introducee1);
|
||||
Group g2 = introductionManager0.getContactGroup(introducee2);
|
||||
assertEquals(2,
|
||||
introductionManager0.getIntroductionMessages(contactId1From0)
|
||||
.size());
|
||||
introductionManager0.getMessages(contactId1From0).size());
|
||||
assertGroupCount(messageTracker0, g1.getId(), 2, 1);
|
||||
assertEquals(2,
|
||||
introductionManager0.getIntroductionMessages(contactId2From0)
|
||||
.size());
|
||||
introductionManager0.getMessages(contactId2From0).size());
|
||||
assertGroupCount(messageTracker0, g2.getId(), 2, 1);
|
||||
assertEquals(3,
|
||||
introductionManager1.getIntroductionMessages(contactId0From1)
|
||||
.size());
|
||||
introductionManager1.getMessages(contactId0From1).size());
|
||||
assertGroupCount(messageTracker1, g1.getId(), 3, 2);
|
||||
assertEquals(3,
|
||||
introductionManager2.getIntroductionMessages(contactId0From2)
|
||||
.size());
|
||||
introductionManager2.getMessages(contactId0From2).size());
|
||||
assertGroupCount(messageTracker2, g2.getId(), 3, 2);
|
||||
|
||||
assertFalse(listener0.aborted);
|
||||
@@ -557,8 +546,7 @@ public class IntroductionIntegrationTest
|
||||
assertFalse(listener1.requestReceived);
|
||||
|
||||
// make really sure we don't have that request
|
||||
assertTrue(introductionManager1.getIntroductionMessages(contactId0From1)
|
||||
.isEmpty());
|
||||
assertTrue(introductionManager1.getMessages(contactId0From1).isEmpty());
|
||||
|
||||
// The message was invalid, so no abort message was sent
|
||||
assertFalse(listener0.aborted);
|
||||
@@ -1101,22 +1089,19 @@ public class IntroductionIntegrationTest
|
||||
|
||||
private void assertDefaultUiMessages() throws DbException {
|
||||
Collection<PrivateMessageHeader> messages =
|
||||
introductionManager0.getIntroductionMessages(contactId1From0);
|
||||
introductionManager0.getMessages(contactId1From0);
|
||||
assertEquals(2, messages.size());
|
||||
assertMessagesAreAcked(messages);
|
||||
|
||||
messages = introductionManager0.getIntroductionMessages(
|
||||
contactId2From0);
|
||||
messages = introductionManager0.getMessages(contactId2From0);
|
||||
assertEquals(2, messages.size());
|
||||
assertMessagesAreAcked(messages);
|
||||
|
||||
messages = introductionManager1.getIntroductionMessages(
|
||||
contactId0From1);
|
||||
messages = introductionManager1.getMessages(contactId0From1);
|
||||
assertEquals(2, messages.size());
|
||||
assertMessagesAreAcked(messages);
|
||||
|
||||
messages = introductionManager2.getIntroductionMessages(
|
||||
contactId0From2);
|
||||
messages = introductionManager2.getMessages(contactId0From2);
|
||||
assertEquals(2, messages.size());
|
||||
assertMessagesAreAcked(messages);
|
||||
}
|
||||
@@ -1299,8 +1284,7 @@ public class IntroductionIntegrationTest
|
||||
private IntroductionRequest getIntroductionRequest(
|
||||
IntroductionManager manager, ContactId contactId)
|
||||
throws DbException {
|
||||
for (PrivateMessageHeader im : manager
|
||||
.getIntroductionMessages(contactId)) {
|
||||
for (PrivateMessageHeader im : manager.getMessages(contactId)) {
|
||||
if (im instanceof IntroductionRequest) {
|
||||
return (IntroductionRequest) im;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class GroupInvitationIntegrationTest
|
||||
assertFalse(item.isSubscribed());
|
||||
|
||||
Collection<PrivateMessageHeader> messages =
|
||||
groupInvitationManager1.getInvitationMessages(contactId0From1);
|
||||
groupInvitationManager1.getMessages(contactId0From1);
|
||||
assertEquals(1, messages.size());
|
||||
GroupInvitationRequest request =
|
||||
(GroupInvitationRequest) messages.iterator().next();
|
||||
@@ -118,7 +118,7 @@ public class GroupInvitationIntegrationTest
|
||||
.respondToInvitation(contactId0From1, privateGroup0, false);
|
||||
|
||||
Collection<PrivateMessageHeader> messages =
|
||||
groupInvitationManager1.getInvitationMessages(contactId0From1);
|
||||
groupInvitationManager1.getMessages(contactId0From1);
|
||||
assertEquals(2, messages.size());
|
||||
boolean foundResponse = false;
|
||||
for (PrivateMessageHeader m : messages) {
|
||||
@@ -134,7 +134,7 @@ public class GroupInvitationIntegrationTest
|
||||
sync1To0(1, true);
|
||||
|
||||
messages =
|
||||
groupInvitationManager0.getInvitationMessages(contactId1From0);
|
||||
groupInvitationManager0.getMessages(contactId1From0);
|
||||
assertEquals(2, messages.size());
|
||||
foundResponse = false;
|
||||
for (PrivateMessageHeader m : messages) {
|
||||
@@ -165,7 +165,7 @@ public class GroupInvitationIntegrationTest
|
||||
.respondToInvitation(contactId0From1, privateGroup0, true);
|
||||
|
||||
Collection<PrivateMessageHeader> messages =
|
||||
groupInvitationManager1.getInvitationMessages(contactId0From1);
|
||||
groupInvitationManager1.getMessages(contactId0From1);
|
||||
assertEquals(2, messages.size());
|
||||
boolean foundResponse = false;
|
||||
for (PrivateMessageHeader m : messages) {
|
||||
@@ -182,7 +182,7 @@ public class GroupInvitationIntegrationTest
|
||||
sync1To0(1, true);
|
||||
|
||||
messages =
|
||||
groupInvitationManager0.getInvitationMessages(contactId1From0);
|
||||
groupInvitationManager0.getMessages(contactId1From0);
|
||||
assertEquals(2, messages.size());
|
||||
foundResponse = false;
|
||||
for (PrivateMessageHeader m : messages) {
|
||||
@@ -217,7 +217,7 @@ public class GroupInvitationIntegrationTest
|
||||
Group g0 = groupInvitationManager1.getContactGroup(contact0From1);
|
||||
assertGroupCount(messageTracker1, g0.getId(), 1, 1, timestamp);
|
||||
PrivateMessageHeader m =
|
||||
groupInvitationManager1.getInvitationMessages(contactId0From1)
|
||||
groupInvitationManager1.getMessages(contactId0From1)
|
||||
.iterator().next();
|
||||
|
||||
groupInvitationManager1
|
||||
|
||||
@@ -702,7 +702,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
}});
|
||||
|
||||
Collection<PrivateMessageHeader> messages =
|
||||
groupInvitationManager.getInvitationMessages(contactId);
|
||||
groupInvitationManager.getMessages(contactId);
|
||||
assertEquals(2, messages.size());
|
||||
for (PrivateMessageHeader m : messages) {
|
||||
assertEquals(contactGroup.getId(), m.getGroupId());
|
||||
|
||||
@@ -148,7 +148,7 @@ public class BlogSharingIntegrationTest
|
||||
|
||||
// invitee has one invitation message from sharer
|
||||
List<PrivateMessageHeader> list = new ArrayList<>(
|
||||
blogSharingManager1.getInvitationMessages(contactId0From1));
|
||||
blogSharingManager1.getMessages(contactId0From1));
|
||||
assertEquals(2, list.size());
|
||||
// check other things are alright with the message
|
||||
for (PrivateMessageHeader m : list) {
|
||||
@@ -167,7 +167,7 @@ public class BlogSharingIntegrationTest
|
||||
}
|
||||
// sharer has own invitation message and response
|
||||
assertEquals(2,
|
||||
blogSharingManager0.getInvitationMessages(contactId1From0)
|
||||
blogSharingManager0.getMessages(contactId1From0)
|
||||
.size());
|
||||
// blog can not be shared again
|
||||
assertFalse(blogSharingManager0.canBeShared(blog2.getId(),
|
||||
@@ -219,7 +219,7 @@ public class BlogSharingIntegrationTest
|
||||
|
||||
// invitee has one invitation message from sharer
|
||||
List<PrivateMessageHeader> list = new ArrayList<>(
|
||||
blogSharingManager1.getInvitationMessages(contactId0From1));
|
||||
blogSharingManager1.getMessages(contactId0From1));
|
||||
assertEquals(2, list.size());
|
||||
// check other things are alright with the message
|
||||
for (PrivateMessageHeader m : list) {
|
||||
@@ -237,7 +237,7 @@ public class BlogSharingIntegrationTest
|
||||
}
|
||||
}
|
||||
// sharer has own invitation message and response
|
||||
assertEquals(2, blogSharingManager0.getInvitationMessages(
|
||||
assertEquals(2, blogSharingManager0.getMessages(
|
||||
contactId1From0).size());
|
||||
// blog can not be shared again
|
||||
assertFalse(blogSharingManager0.canBeShared(rssBlog.getId(),
|
||||
@@ -278,7 +278,7 @@ public class BlogSharingIntegrationTest
|
||||
|
||||
// invitee has one invitation message from sharer and one response
|
||||
List<PrivateMessageHeader> list = new ArrayList<>(
|
||||
blogSharingManager1.getInvitationMessages(contactId0From1));
|
||||
blogSharingManager1.getMessages(contactId0From1));
|
||||
assertEquals(2, list.size());
|
||||
// check things are alright with the message
|
||||
for (PrivateMessageHeader m : list) {
|
||||
@@ -296,7 +296,7 @@ public class BlogSharingIntegrationTest
|
||||
}
|
||||
// sharer has own invitation message and response
|
||||
assertEquals(2,
|
||||
blogSharingManager0.getInvitationMessages(contactId1From0)
|
||||
blogSharingManager0.getMessages(contactId1From0)
|
||||
.size());
|
||||
// blog can be shared again
|
||||
assertTrue(
|
||||
@@ -383,7 +383,7 @@ public class BlogSharingIntegrationTest
|
||||
|
||||
// make sure 1 knows that they have blog2 already
|
||||
Collection<PrivateMessageHeader> messages =
|
||||
blogSharingManager1.getInvitationMessages(contactId0From1);
|
||||
blogSharingManager1.getMessages(contactId0From1);
|
||||
assertEquals(2, messages.size());
|
||||
assertEquals(blog2, blogManager1.getBlog(blog2.getId()));
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ public class ForumSharingIntegrationTest
|
||||
|
||||
// invitee has one invitation message from sharer
|
||||
List<PrivateMessageHeader> list = new ArrayList<>(
|
||||
forumSharingManager1.getInvitationMessages(contactId0From1));
|
||||
forumSharingManager1.getMessages(contactId0From1));
|
||||
assertEquals(2, list.size());
|
||||
// check other things are alright with the forum message
|
||||
for (PrivateMessageHeader m : list) {
|
||||
@@ -152,7 +152,7 @@ public class ForumSharingIntegrationTest
|
||||
}
|
||||
// sharer has own invitation message and response
|
||||
assertEquals(2,
|
||||
forumSharingManager0.getInvitationMessages(contactId1From0)
|
||||
forumSharingManager0.getMessages(contactId1From0)
|
||||
.size());
|
||||
// forum can not be shared again
|
||||
Contact c1 = contactManager0.getContact(contactId1From0);
|
||||
@@ -189,7 +189,7 @@ public class ForumSharingIntegrationTest
|
||||
|
||||
// invitee has one invitation message from sharer and one response
|
||||
List<PrivateMessageHeader> list = new ArrayList<>(
|
||||
forumSharingManager1.getInvitationMessages(contactId0From1));
|
||||
forumSharingManager1.getMessages(contactId0From1));
|
||||
assertEquals(2, list.size());
|
||||
// check things are alright with the forum message
|
||||
for (PrivateMessageHeader m : list) {
|
||||
@@ -207,7 +207,7 @@ public class ForumSharingIntegrationTest
|
||||
}
|
||||
// sharer has own invitation message and response
|
||||
assertEquals(2,
|
||||
forumSharingManager0.getInvitationMessages(contactId1From0)
|
||||
forumSharingManager0.getMessages(contactId1From0)
|
||||
.size());
|
||||
// forum can be shared again
|
||||
Contact c1 = contactManager0.getContact(contactId1From0);
|
||||
@@ -485,9 +485,9 @@ public class ForumSharingIntegrationTest
|
||||
|
||||
// and both have each other's invitations (and no response)
|
||||
assertEquals(2, forumSharingManager0
|
||||
.getInvitationMessages(contactId1From0).size());
|
||||
.getMessages(contactId1From0).size());
|
||||
assertEquals(2, forumSharingManager1
|
||||
.getInvitationMessages(contactId0From1).size());
|
||||
.getMessages(contactId0From1).size());
|
||||
|
||||
// there are no more open invitations
|
||||
assertTrue(forumSharingManager0.getInvitations().isEmpty());
|
||||
@@ -743,7 +743,7 @@ public class ForumSharingIntegrationTest
|
||||
// get invitation MessageId for later
|
||||
MessageId invitationId = null;
|
||||
for (PrivateMessageHeader m : forumSharingManager1
|
||||
.getInvitationMessages(contactId0From1)) {
|
||||
.getMessages(contactId0From1)) {
|
||||
if (m instanceof ForumInvitationRequest) {
|
||||
invitationId = m.getId();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user