mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 11:49:04 +01:00
[core] also support private messages in legacy format for selective deletion
This commit is contained in:
@@ -208,6 +208,32 @@ public class MessagingManagerIntegrationTest
|
||||
assertGroupCounts(c0, 0, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteLegacySubset() throws Exception {
|
||||
// send legacy message
|
||||
GroupId g = c0.getMessagingManager().getConversationId(contactId);
|
||||
PrivateMessage m0 = messageFactory.createLegacyPrivateMessage(g,
|
||||
clock.currentTimeMillis(), getRandomString(42));
|
||||
c0.getMessagingManager().addLocalMessage(m0);
|
||||
syncMessage(c0, c1, contactId, 1, true);
|
||||
|
||||
// message arrived on both sides
|
||||
assertEquals(1, getMessages(c0).size());
|
||||
assertEquals(1, getMessages(c1).size());
|
||||
|
||||
// delete message on both sides (deletes all, because returns true)
|
||||
Set<MessageId> toDelete = new HashSet<>();
|
||||
toDelete.add(m0.getMessage().getId());
|
||||
assertTrue(c0.getConversationManager()
|
||||
.deleteMessages(contactId, toDelete));
|
||||
assertTrue(c1.getConversationManager()
|
||||
.deleteMessages(contactId, toDelete));
|
||||
|
||||
// message was deleted
|
||||
assertEquals(0, getMessages(c0).size());
|
||||
assertEquals(0, getMessages(c1).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteAttachment() throws Exception {
|
||||
// send one message with attachment
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.briarproject.briar.api.blog.BlogFactory;
|
||||
import org.briarproject.briar.api.blog.BlogManager;
|
||||
import org.briarproject.briar.api.blog.BlogSharingManager;
|
||||
import org.briarproject.briar.api.client.MessageTracker;
|
||||
import org.briarproject.briar.api.conversation.ConversationManager;
|
||||
import org.briarproject.briar.api.forum.ForumManager;
|
||||
import org.briarproject.briar.api.forum.ForumSharingManager;
|
||||
import org.briarproject.briar.api.introduction.IntroductionManager;
|
||||
@@ -89,6 +90,8 @@ public interface BriarIntegrationTestComponent
|
||||
|
||||
ContactManager getContactManager();
|
||||
|
||||
ConversationManager getConversationManager();
|
||||
|
||||
DatabaseComponent getDatabaseComponent();
|
||||
|
||||
BlogManager getBlogManager();
|
||||
|
||||
Reference in New Issue
Block a user