Slight change to Message API

Bulletin_Board_Server_phase_1
Arbel Deutsch Peled 2015-11-22 12:22:21 +02:00
parent c68eba84d2
commit 03f1c3d483
9 changed files with 17 additions and 16 deletions

View File

@ -18,7 +18,7 @@ public class HelloProtoBuf {
UnsignedBulletinBoardMessage.Builder unsigned = UnsignedBulletinBoardMessage.newBuilder();
unsigned.setData(ByteString.copyFromUtf8("Hello World!"));
List<String> tags = Arrays.asList("Greetings", "FirstPrograms");
unsigned.addAllTags(tags);
unsigned.addAllTag(tags);
msg.setMsg(unsigned);
Crypto.Signature.Builder sig = Crypto.Signature.newBuilder();

View File

@ -137,7 +137,7 @@ public abstract class BulletinBoardSQLServer implements BulletinBoardServer{
try {
tagList = msg.getMsg().getTagsList();
tagList = msg.getMsg().getTagList();
tags = new String[tagList.size()];
tags = tagList.toArray(tags);

View File

@ -35,8 +35,8 @@ public class HelloProtoWebApp {
} else {
msg = BulletinBoardMessage.newBuilder()
.setMsg(UnsignedBulletinBoardMessage.newBuilder()
.addTags("Signature")
.addTags("Trustee")
.addTag("Signature")
.addTag("Trustee")
.setData(ByteString.copyFrom(b1)).build())
.addSig(Signature.newBuilder()
.setType(SignatureType.DSA)

View File

@ -35,8 +35,8 @@ public class HelloProtoIntegrationTest {
System.out.println(response.getMsg().getData());
assertThat(response.getMsg().getData().toStringUtf8(), is("Hello World!"));
assertThat(response.getMsg().getTagsCount(), is(2));
assertThat(response.getMsg().getTags(0), is("Greetings"));
assertThat(response.getMsg().getTags(1), is("FirstPrograms"));
assertThat(response.getMsg().getTagCount(), is(2));
assertThat(response.getMsg().getTag(0), is("Greetings"));
assertThat(response.getMsg().getTag(1), is("FirstPrograms"));
}
}

View File

@ -68,8 +68,8 @@ public class SQLiteServerIntegrationTest {
msg = BulletinBoardMessage.newBuilder()
.setMsg(UnsignedBulletinBoardMessage.newBuilder()
.addTags("Signature")
.addTags("Trustee")
.addTag("Signature")
.addTag("Trustee")
.setData(ByteString.copyFrom(b1))
.build())
.addSig(Signature.newBuilder()
@ -91,8 +91,8 @@ public class SQLiteServerIntegrationTest {
msg = BulletinBoardMessage.newBuilder()
.setMsg(UnsignedBulletinBoardMessage.newBuilder()
.addTags("Vote")
.addTags("Trustee")
.addTag("Vote")
.addTag("Trustee")
.setData(ByteString.copyFrom(b4))
.build())
.addSig(Signature.newBuilder()

View File

@ -12,7 +12,7 @@ public class Demo {
BulletinBoardMessage msg;
UnsignedBulletinBoardMessage msgContents = UnsignedBulletinBoardMessage.newBuilder()
.addTags("test")
.addTag("test")
.setData(ByteString.copyFromUtf8("some data"))
.build();

View File

@ -52,6 +52,7 @@ public interface DigitalSignature {
/**
* Sign the content that was added.
* Reset the DigitalSignature and make it available to sign a new message using the same key.
* @return
* @throws SignatureException
*/

View File

@ -19,7 +19,7 @@ message MessageID {
message UnsignedBulletinBoardMessage {
// Optional tags describing message
repeated string tags = 1;
repeated string tag = 1;
// The actual content of the message
bytes data = 2;

View File

@ -151,9 +151,9 @@ public class TestECDSASignature {
UnsignedBulletinBoardMessage.Builder unsignedMsgBuilder = UnsignedBulletinBoardMessage.newBuilder();
unsignedMsgBuilder.setData(ByteString.copyFromUtf8(HELLO_WORLD));
unsignedMsgBuilder.addTags("Tag1");
unsignedMsgBuilder.addTags("Tag2");
unsignedMsgBuilder.addTags("Tag3");
unsignedMsgBuilder.addTag("Tag1");
unsignedMsgBuilder.addTag("Tag2");
unsignedMsgBuilder.addTag("Tag3");
UnsignedBulletinBoardMessage usMsg = unsignedMsgBuilder.build();