mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Sync acks for initial messages when setting up integration tests.
This commit is contained in:
@@ -1314,7 +1314,7 @@ public class IntroductionIntegrationTest
|
||||
assertGroupCount(messageTracker1, g1.getId(), 2, 1);
|
||||
|
||||
// ACK last message
|
||||
sendAcks(c0, c1, contactId1From0, 1);
|
||||
ack0To1(1);
|
||||
|
||||
// introducee1 can now remove messages
|
||||
assertTrue(deleteAllMessages0From1().allDeleted());
|
||||
@@ -1427,14 +1427,14 @@ public class IntroductionIntegrationTest
|
||||
assertFalse(deleteAllMessages2From0().allDeleted());
|
||||
|
||||
// introducer can remove messages after getting ACK from introducee1
|
||||
sendAcks(c1, c0, contactId0From1, 1);
|
||||
ack1To0(1);
|
||||
assertTrue(deleteAllMessages1From0().allDeleted());
|
||||
assertEquals(0, getMessages1From0().size());
|
||||
// a second time nothing happens
|
||||
assertTrue(deleteAllMessages1From0().allDeleted());
|
||||
|
||||
// introducer can remove messages after getting ACK from introducee2
|
||||
sendAcks(c2, c0, contactId0From2, 1);
|
||||
ack2To0(1);
|
||||
assertTrue(deleteAllMessages2From0().allDeleted());
|
||||
assertEquals(0, getMessages2From0().size());
|
||||
// a second time nothing happens
|
||||
@@ -1491,7 +1491,7 @@ public class IntroductionIntegrationTest
|
||||
sync0To1(1, true);
|
||||
|
||||
// introducer can remove messages after getting ACK from introducee1
|
||||
sendAcks(c1, c0, contactId0From1, 1);
|
||||
ack1To0(1);
|
||||
assertTrue(deleteAllMessages1From0().allDeleted());
|
||||
assertEquals(0, getMessages1From0().size());
|
||||
// a second time nothing happens
|
||||
@@ -1512,7 +1512,7 @@ public class IntroductionIntegrationTest
|
||||
sync0To1(1, true);
|
||||
|
||||
// introducer can remove messages after getting ACK from introducee1
|
||||
sendAcks(c1, c0, contactId0From1, 1);
|
||||
ack1To0(1);
|
||||
assertTrue(deleteAllMessages1From0().allDeleted());
|
||||
assertEquals(0, getMessages1From0().size());
|
||||
assertTrue(deleteAllMessages1From0()
|
||||
@@ -1520,7 +1520,7 @@ public class IntroductionIntegrationTest
|
||||
|
||||
// introducer can remove messages after getting ACK from introducee2
|
||||
// if this succeeds, we still had the session object after delete above
|
||||
sendAcks(c2, c0, contactId0From2, 1);
|
||||
ack2To0(1);
|
||||
assertTrue(deleteAllMessages2From0().allDeleted());
|
||||
assertEquals(0, getMessages2From0().size());
|
||||
assertTrue(deleteAllMessages2From0()
|
||||
|
||||
@@ -599,7 +599,7 @@ public class GroupInvitationIntegrationTest
|
||||
assertEquals(2, getMessages0From1().size());
|
||||
|
||||
// creator sends ACK
|
||||
sendAcks(c0, c1, contactId1From0, 1);
|
||||
ack0To1(1);
|
||||
|
||||
// now invitee can also delete messages
|
||||
assertTrue(deleteAllMessages0From1().allDeleted());
|
||||
@@ -624,7 +624,7 @@ public class GroupInvitationIntegrationTest
|
||||
sync1To0(1, true);
|
||||
|
||||
// creator sends ACK
|
||||
sendAcks(c0, c1, contactId1From0, 1);
|
||||
ack0To1(1);
|
||||
|
||||
// asserting group counts
|
||||
assertGroupCount(messageTracker1, g0From1.getId(), 2, 1);
|
||||
@@ -691,7 +691,7 @@ public class GroupInvitationIntegrationTest
|
||||
assertGroupCount(messageTracker1, g0From1.getId(), 2, 1);
|
||||
|
||||
// 0 sends an ACK to their last message
|
||||
sendAcks(c0, c1, contactId1From0, 1);
|
||||
ack0To1(1);
|
||||
|
||||
// 1 can now delete all messages, as last one has been ACKed
|
||||
assertTrue(deleteMessages0From1(toDelete).allDeleted());
|
||||
|
||||
@@ -920,7 +920,7 @@ public class ForumSharingIntegrationTest
|
||||
assertGroupCount(messageTracker1, g0From1, 2, 1);
|
||||
|
||||
// 0 sends an ACK to their last message
|
||||
sendAcks(c0, c1, contactId1From0, 1);
|
||||
ack0To1(1);
|
||||
|
||||
// 1 can now delete all messages, as last one has been ACKed
|
||||
assertTrue(deleteAllMessages0From1().allDeleted());
|
||||
@@ -955,7 +955,7 @@ public class ForumSharingIntegrationTest
|
||||
sync0To1(1, true);
|
||||
|
||||
// 1 sends an ACK to their last message
|
||||
sendAcks(c1, c0, contactId0From1, 1);
|
||||
ack1To0(1);
|
||||
|
||||
// messages can now get deleted again
|
||||
assertTrue(deleteAllMessages1From0().allDeleted());
|
||||
@@ -988,7 +988,7 @@ public class ForumSharingIntegrationTest
|
||||
assertFalse(deleteAllMessages0From1().allDeleted());
|
||||
|
||||
// 0 sends an ACK to their last message
|
||||
sendAcks(c0, c1, contactId1From0, 1);
|
||||
ack0To1(1);
|
||||
|
||||
// 1 can now delete all messages, as last one has been ACKed
|
||||
assertTrue(deleteAllMessages0From1().allDeleted());
|
||||
@@ -1058,7 +1058,7 @@ public class ForumSharingIntegrationTest
|
||||
.hasInvitationSessionInProgress());
|
||||
|
||||
// 0 sends an ACK to their last message
|
||||
sendAcks(c0, c1, contactId1From0, 1);
|
||||
ack0To1(1);
|
||||
|
||||
// 1 can now delete all messages, as last one has been ACKed
|
||||
assertTrue(deleteMessages0From1(toDelete).allDeleted());
|
||||
|
||||
@@ -284,11 +284,14 @@ public abstract class BriarIntegrationTest<C extends BriarIntegrationTestCompone
|
||||
|
||||
// Sync initial client versioning updates
|
||||
sync0To1(1, true);
|
||||
sync0To2(1, true);
|
||||
sync1To0(1, true);
|
||||
sync2To0(1, true);
|
||||
sync0To1(1, true);
|
||||
ack1To0(1);
|
||||
|
||||
sync0To2(1, true);
|
||||
sync2To0(1, true);
|
||||
sync0To2(1, true);
|
||||
ack2To0(1);
|
||||
}
|
||||
|
||||
protected void addContacts1And2() throws Exception {
|
||||
@@ -307,9 +310,13 @@ public abstract class BriarIntegrationTest<C extends BriarIntegrationTestCompone
|
||||
// Sync initial client versioning updates
|
||||
sync1To2(1, true);
|
||||
sync2To1(1, true);
|
||||
sync1To2(haveTransportProperties ? 2 : 1, true);
|
||||
if (haveTransportProperties) {
|
||||
sync1To2(2, true);
|
||||
sync2To1(1, true);
|
||||
ack1To2(1);
|
||||
} else {
|
||||
sync1To2(1, true);
|
||||
ack2To1(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,6 +369,32 @@ public abstract class BriarIntegrationTest<C extends BriarIntegrationTestCompone
|
||||
syncMessage(c1, c2, contactId2From1, num, valid);
|
||||
}
|
||||
|
||||
protected void ack0To1(int num) throws Exception {
|
||||
sendAcks(c0, c1, contactId1From0, num);
|
||||
}
|
||||
|
||||
protected void ack0To2(int num) throws Exception {
|
||||
sendAcks(c0, c2, contactId2From0, num);
|
||||
}
|
||||
|
||||
protected void ack1To0(int num) throws Exception {
|
||||
sendAcks(c1, c0, contactId0From1, num);
|
||||
}
|
||||
|
||||
protected void ack2To0(int num) throws Exception {
|
||||
sendAcks(c2, c0, contactId0From2, num);
|
||||
}
|
||||
|
||||
protected void ack2To1(int num) throws Exception {
|
||||
assertNotNull(contactId1From2);
|
||||
sendAcks(c2, c1, contactId1From2, num);
|
||||
}
|
||||
|
||||
protected void ack1To2(int num) throws Exception {
|
||||
assertNotNull(contactId2From1);
|
||||
sendAcks(c1, c2, contactId2From1, num);
|
||||
}
|
||||
|
||||
protected void syncMessage(BriarIntegrationTestComponent fromComponent,
|
||||
BriarIntegrationTestComponent toComponent, ContactId toId, int num,
|
||||
boolean valid) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user