Merge branch '1240-message-refactoring' into 'master'

Remove raw representation from Message class

See merge request briar/briar!915
This commit is contained in:
akwizgran
2018-09-18 13:30:26 +00:00
32 changed files with 176 additions and 130 deletions

View File

@@ -33,7 +33,6 @@ import static org.briarproject.bramble.api.properties.TransportPropertyConstants
import static org.briarproject.bramble.api.sync.ClientId.MAX_CLIENT_ID_LENGTH;
import static org.briarproject.bramble.api.sync.SyncConstants.MAX_GROUP_DESCRIPTOR_LENGTH;
import static org.briarproject.bramble.api.sync.SyncConstants.MAX_MESSAGE_BODY_LENGTH;
import static org.briarproject.bramble.api.sync.SyncConstants.MESSAGE_HEADER_LENGTH;
import static org.briarproject.bramble.util.StringUtils.getRandomString;
public class TestUtils {
@@ -132,13 +131,13 @@ public class TestUtils {
public static Message getMessage(GroupId groupId) {
int bodyLength = 1 + random.nextInt(MAX_MESSAGE_BODY_LENGTH);
return getMessage(groupId, MESSAGE_HEADER_LENGTH + bodyLength);
return getMessage(groupId, bodyLength);
}
public static Message getMessage(GroupId groupId, int rawLength) {
public static Message getMessage(GroupId groupId, int bodyLength) {
MessageId id = new MessageId(getRandomId());
byte[] raw = getRandomBytes(rawLength);
return new Message(id, groupId, timestamp, raw);
byte[] body = getRandomBytes(bodyLength);
return new Message(id, groupId, timestamp, body);
}
public static double getMedian(Collection<? extends Number> samples) {