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