Unify all events related to private messages

This commit is contained in:
Torsten Grote
2018-09-05 15:57:40 -03:00
parent 61e18f104e
commit 29758b174a
27 changed files with 122 additions and 315 deletions

View File

@@ -24,14 +24,16 @@ import org.briarproject.bramble.api.sync.MessageId;
import org.briarproject.bramble.test.TestDatabaseModule;
import org.briarproject.briar.api.client.ProtocolStateException;
import org.briarproject.briar.api.client.SessionId;
import org.briarproject.briar.api.introduction.Introduction;
import org.briarproject.briar.api.introduction.IntroductionManager;
import org.briarproject.briar.api.introduction.IntroductionRequest;
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.briar.api.messaging.PrivateMessageHeader;
import org.briarproject.briar.api.messaging.PrivateRequest;
import org.briarproject.briar.api.messaging.PrivateResponse;
import org.briarproject.briar.test.BriarIntegrationTest;
import org.junit.Before;
import org.junit.Test;
@@ -1131,11 +1133,11 @@ public class IntroductionIntegrationTest
protected volatile Event latestEvent;
@SuppressWarnings("WeakerAccess")
IntroductionResponse getResponse() {
PrivateResponse<Introduction> getResponse() {
assertTrue(
latestEvent instanceof IntroductionResponseReceivedEvent);
return ((IntroductionResponseReceivedEvent) latestEvent)
.getIntroductionResponse();
.getResponse();
}
}
@@ -1163,7 +1165,7 @@ public class IntroductionIntegrationTest
IntroductionRequestReceivedEvent introEvent =
((IntroductionRequestReceivedEvent) e);
requestReceived = true;
IntroductionRequest ir = introEvent.getIntroductionRequest();
PrivateRequest<Introduction> ir = introEvent.getRequest();
ContactId contactId = introEvent.getContactId();
sessionId = ir.getSessionId();
long time = clock.currentTimeMillis();
@@ -1200,11 +1202,11 @@ public class IntroductionIntegrationTest
}
}
private IntroductionRequest getRequest() {
private PrivateRequest<Introduction> getRequest() {
assertTrue(
latestEvent instanceof IntroductionRequestReceivedEvent);
return ((IntroductionRequestReceivedEvent) latestEvent)
.getIntroductionRequest();
.getRequest();
}
}

View File

@@ -559,7 +559,7 @@ public class BlogSharingIntegrationTest
BlogInvitationRequestReceivedEvent event =
(BlogInvitationRequestReceivedEvent) e;
eventWaiter.assertEquals(contactId1From0, event.getContactId());
Blog b = event.getShareable();
Blog b = event.getRequest().getObject();
try {
Contact c = contactManager0.getContact(contactId1From0);
blogSharingManager0.respondToInvitation(b, c, true);
@@ -595,7 +595,7 @@ public class BlogSharingIntegrationTest
(BlogInvitationRequestReceivedEvent) e;
requestReceived = true;
if (!answer) return;
Blog b = event.getShareable();
Blog b = event.getRequest().getObject();
try {
eventWaiter.assertEquals(1,
blogSharingManager1.getInvitations().size());

View File

@@ -813,7 +813,7 @@ public class ForumSharingIntegrationTest
(ForumInvitationRequestReceivedEvent) e;
eventWaiter.assertEquals(contactId1From0, event.getContactId());
requestReceived = true;
Forum f = event.getShareable();
Forum f = event.getRequest().getObject();
try {
if (respond) {
Contact c = contactManager0.getContact(contactId1From0);
@@ -851,7 +851,7 @@ public class ForumSharingIntegrationTest
(ForumInvitationRequestReceivedEvent) e;
requestReceived = true;
if (!answer) return;
Forum f = event.getShareable();
Forum f = event.getRequest().getObject();
try {
if (respond) {
eventWaiter.assertEquals(1,