mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +01:00
ConversationManager: Address review issues
This commit is contained in:
@@ -368,13 +368,16 @@ public class IntroductionIntegrationTest
|
||||
.getMessageHeaders(txn, contactId1From0));
|
||||
assertEquals(2, messages.size());
|
||||
messages = withinTransactionReturns(db0,
|
||||
txn -> introductionManager0.getMessageHeaders(txn, contactId2From0));
|
||||
txn -> introductionManager0
|
||||
.getMessageHeaders(txn, contactId2From0));
|
||||
assertEquals(2, messages.size());
|
||||
messages = withinTransactionReturns(db1,
|
||||
txn -> introductionManager1.getMessageHeaders(txn, contactId0From1));
|
||||
assertEquals(3,messages.size());
|
||||
txn -> introductionManager1
|
||||
.getMessageHeaders(txn, contactId0From1));
|
||||
assertEquals(3, messages.size());
|
||||
messages = withinTransactionReturns(db2,
|
||||
txn -> introductionManager2.getMessageHeaders(txn, contactId0From2));
|
||||
txn -> introductionManager2
|
||||
.getMessageHeaders(txn, contactId0From2));
|
||||
assertEquals(3, messages.size());
|
||||
assertFalse(listener0.aborted);
|
||||
assertFalse(listener1.aborted);
|
||||
|
||||
@@ -408,7 +408,7 @@ public class PrivateGroupManagerIntegrationTest
|
||||
groupManager2.addPrivateGroup(txn, privateGroup0, joinMsg2, false);
|
||||
// share the group with 0
|
||||
db2.setGroupVisibility(txn,
|
||||
contactId0From1, privateGroup0.getId(), SHARED); // TODO contactId
|
||||
contactId0From2, privateGroup0.getId(), SHARED);
|
||||
});
|
||||
|
||||
// sync join messages
|
||||
|
||||
@@ -478,11 +478,11 @@ public class ForumSharingIntegrationTest
|
||||
.contains(contact0From1));
|
||||
|
||||
// and both have each other's invitations (and no response)
|
||||
assertEquals(2, withinTransactionReturns(db0, txn2 ->
|
||||
forumSharingManager0.getMessageHeaders(txn2, contactId1From0))
|
||||
assertEquals(2, withinTransactionReturns(db0, txn ->
|
||||
forumSharingManager0.getMessageHeaders(txn, contactId1From0))
|
||||
.size());
|
||||
assertEquals(2, withinTransactionReturns(db1, txn2 ->
|
||||
forumSharingManager1.getMessageHeaders(txn2, contactId0From1))
|
||||
assertEquals(2, withinTransactionReturns(db1, txn ->
|
||||
forumSharingManager1.getMessageHeaders(txn, contactId0From1))
|
||||
.size());
|
||||
|
||||
// there are no more open invitations
|
||||
@@ -561,11 +561,11 @@ public class ForumSharingIntegrationTest
|
||||
withinTransaction(db2, txn -> db2.addGroup(txn, forum0.getGroup()));
|
||||
|
||||
// add listeners
|
||||
listener0 = new SharerListener();
|
||||
listener0 = new SharerListener(true);
|
||||
c0.getEventBus().addListener(listener0);
|
||||
listener1 = new InviteeListener(true, false);
|
||||
c1.getEventBus().addListener(listener1);
|
||||
listener2 = new SharerListener();
|
||||
listener2 = new SharerListener(true);
|
||||
c2.getEventBus().addListener(listener2);
|
||||
|
||||
// send invitation
|
||||
@@ -790,13 +790,22 @@ public class ForumSharingIntegrationTest
|
||||
@NotNullByDefault
|
||||
private class SharerListener implements EventListener {
|
||||
|
||||
private final boolean accept;
|
||||
private volatile boolean requestReceived = false;
|
||||
private volatile boolean responseReceived = false;
|
||||
|
||||
private SharerListener(boolean accept) {
|
||||
this.accept = accept;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eventOccurred(Event e) {
|
||||
if (e instanceof ForumInvitationResponseReceivedEvent) {
|
||||
ForumInvitationResponseReceivedEvent event =
|
||||
(ForumInvitationResponseReceivedEvent) e;
|
||||
responseReceived = true;
|
||||
eventWaiter.assertEquals(accept,
|
||||
event.getMessageHeader().wasAccepted());
|
||||
eventWaiter.resume();
|
||||
}
|
||||
// this is only needed for tests where a forum is re-shared
|
||||
@@ -868,17 +877,19 @@ public class ForumSharingIntegrationTest
|
||||
ForumInvitationResponseReceivedEvent event =
|
||||
(ForumInvitationResponseReceivedEvent) e;
|
||||
eventWaiter.assertEquals(contactId0From1, event.getContactId());
|
||||
eventWaiter.assertEquals(accept,
|
||||
event.getMessageHeader().wasAccepted());
|
||||
eventWaiter.resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void listenToEvents(boolean accept) throws DbException {
|
||||
listener0 = new SharerListener();
|
||||
private void listenToEvents(boolean accept) {
|
||||
listener0 = new SharerListener(accept);
|
||||
c0.getEventBus().addListener(listener0);
|
||||
listener1 = new InviteeListener(accept);
|
||||
c1.getEventBus().addListener(listener1);
|
||||
listener2 = new SharerListener();
|
||||
listener2 = new SharerListener(accept);
|
||||
c2.getEventBus().addListener(listener2);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user