[core] Add API to add messages with attachments

This commit is contained in:
Torsten Grote
2018-11-05 10:32:38 -03:00
parent 483106e00c
commit cccaeeda6c
10 changed files with 37 additions and 8 deletions

View File

@@ -24,6 +24,7 @@ import org.junit.Test;
import javax.inject.Inject;
import static java.util.Collections.emptyList;
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_PUBLIC_KEY_LENGTH;
import static org.briarproject.bramble.api.record.Record.MAX_RECORD_PAYLOAD_BYTES;
@@ -58,7 +59,7 @@ public class MessageSizeIntegrationTest extends BriarTestCase {
long timestamp = Long.MAX_VALUE;
String text = getRandomString(MAX_PRIVATE_MESSAGE_TEXT_LENGTH);
PrivateMessage message = privateMessageFactory.createPrivateMessage(
groupId, timestamp, text);
groupId, timestamp, text, emptyList());
// Check the size of the serialised message
int length = message.getMessage().getRawLength();
assertTrue(length > UniqueId.LENGTH + 8

View File

@@ -41,6 +41,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
import static java.util.Collections.emptyList;
import static org.briarproject.bramble.api.transport.TransportConstants.TAG_LENGTH;
import static org.briarproject.bramble.test.TestPluginConfigModule.MAX_LATENCY;
import static org.briarproject.bramble.test.TestPluginConfigModule.TRANSPORT_ID;
@@ -121,7 +122,7 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
PrivateMessageFactory privateMessageFactory =
device.getPrivateMessageFactory();
PrivateMessage message = privateMessageFactory.createPrivateMessage(
groupId, System.currentTimeMillis(), "Hi!");
groupId, System.currentTimeMillis(), "Hi!", emptyList());
messagingManager.addLocalMessage(message);
}