mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +01:00
Refactor events based on InvitationRequestReceivedEvent
This commit is contained in:
@@ -547,7 +547,7 @@ public class BlogSharingIntegrationTest extends BriarIntegrationTest {
|
|||||||
BlogInvitationReceivedEvent event =
|
BlogInvitationReceivedEvent event =
|
||||||
(BlogInvitationReceivedEvent) e;
|
(BlogInvitationReceivedEvent) e;
|
||||||
eventWaiter.assertEquals(contactId1, event.getContactId());
|
eventWaiter.assertEquals(contactId1, event.getContactId());
|
||||||
Blog b = event.getBlog();
|
Blog b = event.getShareable();
|
||||||
try {
|
try {
|
||||||
Contact c = contactManager0.getContact(contactId1);
|
Contact c = contactManager0.getContact(contactId1);
|
||||||
blogSharingManager0.respondToInvitation(b, c, true);
|
blogSharingManager0.respondToInvitation(b, c, true);
|
||||||
@@ -589,7 +589,7 @@ public class BlogSharingIntegrationTest extends BriarIntegrationTest {
|
|||||||
(BlogInvitationReceivedEvent) e;
|
(BlogInvitationReceivedEvent) e;
|
||||||
requestReceived = true;
|
requestReceived = true;
|
||||||
if (!answer) return;
|
if (!answer) return;
|
||||||
Blog b = event.getBlog();
|
Blog b = event.getShareable();
|
||||||
try {
|
try {
|
||||||
eventWaiter.assertEquals(1,
|
eventWaiter.assertEquals(1,
|
||||||
blogSharingManager1.getInvitations().size());
|
blogSharingManager1.getInvitations().size());
|
||||||
|
|||||||
@@ -939,7 +939,7 @@ public class ForumSharingIntegrationTest extends BriarTestCase {
|
|||||||
(ForumInvitationReceivedEvent) e;
|
(ForumInvitationReceivedEvent) e;
|
||||||
eventWaiter.assertEquals(contactId1, event.getContactId());
|
eventWaiter.assertEquals(contactId1, event.getContactId());
|
||||||
requestReceived = true;
|
requestReceived = true;
|
||||||
Forum f = event.getForum();
|
Forum f = event.getShareable();
|
||||||
try {
|
try {
|
||||||
Contact c = contactManager0.getContact(contactId1);
|
Contact c = contactManager0.getContact(contactId1);
|
||||||
forumSharingManager0.respondToInvitation(f, c, true);
|
forumSharingManager0.respondToInvitation(f, c, true);
|
||||||
@@ -982,7 +982,7 @@ public class ForumSharingIntegrationTest extends BriarTestCase {
|
|||||||
(ForumInvitationReceivedEvent) e;
|
(ForumInvitationReceivedEvent) e;
|
||||||
requestReceived = true;
|
requestReceived = true;
|
||||||
if (!answer) return;
|
if (!answer) return;
|
||||||
Forum f = event.getForum();
|
Forum f = event.getShareable();
|
||||||
try {
|
try {
|
||||||
eventWaiter.assertEquals(1,
|
eventWaiter.assertEquals(1,
|
||||||
forumSharingManager1.getInvitations().size());
|
forumSharingManager1.getInvitations().size());
|
||||||
|
|||||||
@@ -5,17 +5,11 @@ import org.briarproject.api.contact.ContactId;
|
|||||||
import org.briarproject.api.sharing.InvitationRequest;
|
import org.briarproject.api.sharing.InvitationRequest;
|
||||||
|
|
||||||
public class BlogInvitationReceivedEvent extends
|
public class BlogInvitationReceivedEvent extends
|
||||||
InvitationRequestReceivedEvent {
|
InvitationRequestReceivedEvent<Blog> {
|
||||||
|
|
||||||
private final Blog blog;
|
|
||||||
|
|
||||||
public BlogInvitationReceivedEvent(Blog blog, ContactId contactId,
|
public BlogInvitationReceivedEvent(Blog blog, ContactId contactId,
|
||||||
InvitationRequest request) {
|
InvitationRequest request) {
|
||||||
super(contactId, request);
|
super(blog, contactId, request);
|
||||||
this.blog = blog;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Blog getBlog() {
|
|
||||||
return blog;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,18 +5,11 @@ import org.briarproject.api.forum.Forum;
|
|||||||
import org.briarproject.api.forum.ForumInvitationRequest;
|
import org.briarproject.api.forum.ForumInvitationRequest;
|
||||||
|
|
||||||
public class ForumInvitationReceivedEvent extends
|
public class ForumInvitationReceivedEvent extends
|
||||||
InvitationRequestReceivedEvent {
|
InvitationRequestReceivedEvent<Forum> {
|
||||||
|
|
||||||
private final Forum forum;
|
|
||||||
|
|
||||||
public ForumInvitationReceivedEvent(Forum forum, ContactId contactId,
|
public ForumInvitationReceivedEvent(Forum forum, ContactId contactId,
|
||||||
ForumInvitationRequest request) {
|
ForumInvitationRequest request) {
|
||||||
super(contactId, request);
|
super(forum, contactId, request);
|
||||||
this.forum = forum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Forum getForum() {
|
|
||||||
return forum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.briarproject.api.event;
|
||||||
|
|
||||||
|
import org.briarproject.api.contact.ContactId;
|
||||||
|
import org.briarproject.api.forum.ForumInvitationRequest;
|
||||||
|
import org.briarproject.api.privategroup.PrivateGroup;
|
||||||
|
|
||||||
|
public class GroupInvitationReceivedEvent extends
|
||||||
|
InvitationRequestReceivedEvent<PrivateGroup> {
|
||||||
|
|
||||||
|
public GroupInvitationReceivedEvent(PrivateGroup group, ContactId contactId,
|
||||||
|
ForumInvitationRequest request) {
|
||||||
|
super(group, contactId, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,14 +2,18 @@ package org.briarproject.api.event;
|
|||||||
|
|
||||||
import org.briarproject.api.contact.ContactId;
|
import org.briarproject.api.contact.ContactId;
|
||||||
import org.briarproject.api.sharing.InvitationRequest;
|
import org.briarproject.api.sharing.InvitationRequest;
|
||||||
|
import org.briarproject.api.sharing.Shareable;
|
||||||
|
|
||||||
public abstract class InvitationRequestReceivedEvent extends Event {
|
public abstract class InvitationRequestReceivedEvent<S extends Shareable>
|
||||||
|
extends Event {
|
||||||
|
|
||||||
|
private final S shareable;
|
||||||
private final ContactId contactId;
|
private final ContactId contactId;
|
||||||
private final InvitationRequest request;
|
private final InvitationRequest request;
|
||||||
|
|
||||||
InvitationRequestReceivedEvent(ContactId contactId,
|
InvitationRequestReceivedEvent(S shareable, ContactId contactId,
|
||||||
InvitationRequest request) {
|
InvitationRequest request) {
|
||||||
|
this.shareable = shareable;
|
||||||
this.contactId = contactId;
|
this.contactId = contactId;
|
||||||
this.request = request;
|
this.request = request;
|
||||||
}
|
}
|
||||||
@@ -21,4 +25,8 @@ public abstract class InvitationRequestReceivedEvent extends Event {
|
|||||||
public InvitationRequest getRequest() {
|
public InvitationRequest getRequest() {
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public S getShareable() {
|
||||||
|
return shareable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user