mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +01:00
Query message IDs rather than metadata when only IDs are needed.
This commit is contained in:
@@ -720,10 +720,8 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
public void testGetInvitations() throws Exception {
|
||||
BdfDictionary query = BdfDictionary.of(new BdfEntry("q", "u"));
|
||||
Message message2 = getMessage(contactGroup.getId());
|
||||
BdfDictionary meta2 = BdfDictionary.of(new BdfEntry("m2", "e"));
|
||||
Map<MessageId, BdfDictionary> results = new HashMap<>();
|
||||
results.put(message.getId(), meta);
|
||||
results.put(message2.getId(), meta2);
|
||||
Collection<MessageId> results =
|
||||
asList(message.getId(), message2.getId());
|
||||
long time1 = 1L, time2 = 2L;
|
||||
String groupName = getRandomString(MAX_GROUP_NAME_LENGTH);
|
||||
byte[] salt = getRandomBytes(GROUP_SALT_LENGTH);
|
||||
@@ -748,8 +746,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
oneOf(contactGroupFactory).createContactGroup(CLIENT_ID,
|
||||
MAJOR_VERSION, contact);
|
||||
will(returnValue(contactGroup));
|
||||
oneOf(clientHelper).getMessageMetadataAsDictionary(txn,
|
||||
contactGroup.getId(), query);
|
||||
oneOf(clientHelper).getMessageIds(txn, contactGroup.getId(), query);
|
||||
will(returnValue(results));
|
||||
// message 1
|
||||
oneOf(messageParser).getInviteMessage(txn, message.getId());
|
||||
|
||||
@@ -10,9 +10,9 @@ import org.briarproject.briar.api.privategroup.GroupMessage;
|
||||
import org.jmock.Expectations;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.briarproject.bramble.api.sync.Group.Visibility.INVISIBLE;
|
||||
import static org.briarproject.bramble.api.sync.Group.Visibility.SHARED;
|
||||
import static org.briarproject.bramble.api.sync.Group.Visibility.VISIBLE;
|
||||
@@ -757,15 +757,12 @@ public class InviteeProtocolEngineTest extends AbstractProtocolEngineTest {
|
||||
|
||||
private void expectMarkInvitesUnavailableToAnswer() throws Exception {
|
||||
BdfDictionary query = BdfDictionary.of(new BdfEntry("query", ""));
|
||||
BdfDictionary meta = BdfDictionary.of(new BdfEntry("meta", ""));
|
||||
Map<MessageId, BdfDictionary> invites =
|
||||
Collections.singletonMap(lastRemoteMessageId, meta);
|
||||
Collection<MessageId> invites = singletonList(lastRemoteMessageId);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(messageParser)
|
||||
.getInvitesAvailableToAnswerQuery(privateGroupId);
|
||||
will(returnValue(query));
|
||||
oneOf(clientHelper)
|
||||
.getMessageMetadataAsDictionary(txn, contactGroupId, query);
|
||||
oneOf(clientHelper).getMessageIds(txn, contactGroupId, query);
|
||||
will(returnValue(invites));
|
||||
}});
|
||||
expectMarkMessageAvailableToAnswer(lastRemoteMessageId, false);
|
||||
|
||||
Reference in New Issue
Block a user