Refactored IntroductionSucceededEvent into more generic ContactAddedRemotelyEvent

This commit is contained in:
Torsten Grote
2019-02-12 12:55:43 -02:00
parent 3384477499
commit 66cdf4f595
7 changed files with 33 additions and 34 deletions

View File

@@ -30,7 +30,7 @@ import org.briarproject.briar.api.client.SessionId;
import org.briarproject.briar.api.introduction.IntroductionRequest;
import org.briarproject.briar.api.introduction.event.IntroductionAbortedEvent;
import org.briarproject.briar.api.introduction.event.IntroductionRequestReceivedEvent;
import org.briarproject.briar.api.introduction.event.IntroductionSucceededEvent;
import org.briarproject.bramble.api.contact.event.ContactAddedRemotelyEvent;
import java.security.GeneralSecurityException;
import java.util.Map;
@@ -453,7 +453,7 @@ class IntroduceeProtocolEngine
s.getRemote().transportProperties);
// Broadcast IntroductionSucceededEvent, because contact got added
IntroductionSucceededEvent e = new IntroductionSucceededEvent(c);
ContactAddedRemotelyEvent e = new ContactAddedRemotelyEvent(c);
txn.attach(e);
} catch (ContactExistsException e) {
// Ignore this, because the other introducee might have deleted us.

View File

@@ -32,7 +32,7 @@ import org.briarproject.briar.api.introduction.IntroductionResponse;
import org.briarproject.briar.api.introduction.event.IntroductionAbortedEvent;
import org.briarproject.briar.api.introduction.event.IntroductionRequestReceivedEvent;
import org.briarproject.briar.api.introduction.event.IntroductionResponseReceivedEvent;
import org.briarproject.briar.api.introduction.event.IntroductionSucceededEvent;
import org.briarproject.bramble.api.contact.event.ContactAddedRemotelyEvent;
import org.briarproject.briar.test.BriarIntegrationTest;
import org.junit.Before;
import org.junit.Test;
@@ -1275,10 +1275,10 @@ public class IntroductionIntegrationTest
// only broadcast for DECLINE messages in introducee role
latestEvent = e;
eventWaiter.resume();
} else if (e instanceof IntroductionSucceededEvent) {
} else if (e instanceof ContactAddedRemotelyEvent) {
latestEvent = e;
succeeded = true;
Contact contact = ((IntroductionSucceededEvent) e).getContact();
Contact contact = ((ContactAddedRemotelyEvent) e).getContact();
eventWaiter
.assertFalse(contact.getId().equals(contactId0From1));
eventWaiter.resume();