improvements after dev comments

This commit is contained in:
Ernir Erlingsson
2016-11-01 13:33:12 +01:00
parent eaa393a7ed
commit 88272c5d61
3 changed files with 3 additions and 106 deletions

View File

@@ -537,109 +537,6 @@ public class IntroductionIntegrationTest extends BriarIntegrationTest {
}
}
@Test
public void testIntroductionToIdentitiesOfSameContact() throws Exception {
startLifecycles();
try {
// Get Identities
getDefaultIdentities();
author2 = authorFactory.createLocalAuthor(INTRODUCEE2,
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH),
TestUtils.getRandomBytes(123));
identityManager1.registerLocalAuthor(author2);
// Add introducees' authors as contacts
contactId1 = contactManager0.addContact(author1,
author0.getId(), master, clock.currentTimeMillis(), true,
true, true
);
contactId2 = contactManager0.addContact(author2,
author0.getId(), master, clock.currentTimeMillis(), true,
true, true
);
// Add introducer back
contactId0 = null;
ContactId contactId01 = contactManager1.addContact(author0,
author1.getId(), master, clock.currentTimeMillis(), false,
true, true
);
ContactId contactId02 = contactManager1.addContact(author0,
author2.getId(), master, clock.currentTimeMillis(), false,
true, true
);
// listen to events
addListeners(true, false);
// Add Transport Properties
TransportPropertyManager tpm0 = t0.getTransportPropertyManager();
TransportPropertyManager tpm1 = t1.getTransportPropertyManager();
TransportProperties tp = new TransportProperties(
Collections.singletonMap("key", "value"));
tpm0.mergeLocalProperties(TRANSPORT_ID, tp);
deliverMessage(sync0, contactId01, sync1, contactId1, "0 to 11");
deliverMessage(sync0, contactId02, sync1, contactId2, "0 to 12");
tpm1.mergeLocalProperties(TRANSPORT_ID, tp);
deliverMessage(sync1, contactId1, sync0, contactId01, "1 to 01");
deliverMessage(sync1, contactId2, sync0, contactId02, "1 to 02");
// make introduction
long time = clock.currentTimeMillis();
Contact introducee1 = contactManager0.getContact(contactId1);
Contact introducee2 = contactManager0.getContact(contactId2);
introductionManager0
.makeIntroduction(introducee1, introducee2, "Hi!", time);
// sync request messages
deliverMessage(sync0, contactId01, sync1, contactId1);
deliverMessage(sync0, contactId02, sync1, contactId2);
// wait for request to arrive
eventWaiter.await(TIMEOUT, 2);
assertTrue(listener1.requestReceived);
// sync responses
deliverMessage(sync1, contactId1, sync0, contactId01);
deliverMessage(sync1, contactId2, sync0, contactId02);
// wait for two responses to arrive
eventWaiter.await(TIMEOUT, 2);
assertTrue(listener0.response1Received);
assertTrue(listener0.response2Received);
// sync forwarded responses to introducees
deliverMessage(sync0, contactId01, sync1, contactId1);
deliverMessage(sync0, contactId02, sync1, contactId2);
// wait for "both" introducees to abort session
eventWaiter.await(TIMEOUT, 2);
assertTrue(listener1.aborted);
// sync abort message
deliverMessage(sync1, contactId1, sync0, contactId01);
deliverMessage(sync1, contactId2, sync0, contactId02);
// wait for introducer to abort session (gets event twice)
eventWaiter.await(TIMEOUT, 2);
assertTrue(listener0.aborted);
assertFalse(contactManager1
.contactExists(author1.getId(), author2.getId()));
assertFalse(contactManager1
.contactExists(author2.getId(), author1.getId()));
assertEquals(2, introductionManager0.getIntroductionMessages(
contactId1).size());
assertEquals(2, introductionManager0.getIntroductionMessages(
contactId2).size());
assertEquals(2, introductionManager1.getIntroductionMessages(
contactId01).size());
assertEquals(2, introductionManager1.getIntroductionMessages(
contactId02).size());
} finally {
stopLifecycles();
}
}
@Test
public void testSessionIdReuse() throws Exception {
startLifecycles();