From 64a9356dc214f29241bbe4b3ebfd8ed41dc366b1 Mon Sep 17 00:00:00 2001 From: Vladimir Eliezer Tokarev Date: Fri, 26 Feb 2016 05:52:03 -0800 Subject: [PATCH] Change part of the code (java 8 usage) for gralde to be able to run the test and not fail. --- bulletin-board-server/meerkat | Bin 81920 -> 97280 bytes .../Registry/CollectionMessagesUtils.java | 24 ++++++++++-------- .../Registry/RelevantDataCallBack.java | 1 + .../src/test/java/SimpleRegistryTest.java | 24 ++++++++++++------ 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/bulletin-board-server/meerkat b/bulletin-board-server/meerkat index 1b73e91920474f1344df3b9508598f00b8544959..7257000a698a55e7a2a986ccdd81a57f7410f6f8 100644 GIT binary patch delta 13188 zcmch7d3;RQ7x+8(%}f?c77-B=Guac#WcDT25c^J%s3J4T?E5BCL}u(eucQ=Jw6yj_ z8%woSv=p@z)rC?@tCY5O%J0sdNu}S6)Ae;3&6m*4G0h0C5V!rkiOj*MuG#P!6$QdDjCqCrnjV1uLaksS{T2v8gG{i<*VwhXNkm2bjVoNo*&6dX3q6Bg@Y{i8<{|W5z#; z=uTZm$0&r>QuGum49|i)hc}+gB2x&oWu;E1)@9eIBnpGlXf~8e{uIukKERLNnZoCUyaf|8EUl$PQXm%a1yX?n z_a!sctrGpLa`Bjy7SaN#us|r`OGOgs#(dpM7R{o6!@bmK{PyqDcj({h;^NNH9E|Dd zi)QY$X&uX^Kk*Zcqwmqz>F?;{^e1)k37hCFj2j%m0)&i^3Ul#O*Kig9Dv5>x_(4J* zdPP$&nCtD5!&}gwVk9*lZrI*kj(LdlXLJtJ~lq9G0@?N+a^<|QW4sZMZ@qKA z#Kx${W;0L6UgEVpICJRYfdeKaN3ES*#Y9H^lJ?=bE;iBbo(KA8XD7J_8<=yiy~#^h z^tZFV&5@hG#CFTDAL@5!QBjBXKW=>OO$Bp%w)a85q1HP6xM7edzF#nCi0Us}*wLv) zvR@`#{IXwuJ-eS|#-H(h4<2m$`6E*#UT9m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jZVZr4E$VOBMGVnaX^MdiSkVhe8N)h>B xjYX8t_394{Q*HbW?lxj5Rmefj`N27V!l#f8raRz&x&q diff --git a/voter-registry/src/main/java/meerkat/Registry/CollectionMessagesUtils.java b/voter-registry/src/main/java/meerkat/Registry/CollectionMessagesUtils.java index c52f071..33b8ca5 100644 --- a/voter-registry/src/main/java/meerkat/Registry/CollectionMessagesUtils.java +++ b/voter-registry/src/main/java/meerkat/Registry/CollectionMessagesUtils.java @@ -7,11 +7,7 @@ import meerkat.protobuf.BulletinBoardAPI.MessageFilter; import meerkat.protobuf.BulletinBoardAPI.MessageFilterList; import java.text.ParseException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; +import java.util.*; /** * TODO: add logging to this utils @@ -34,9 +30,13 @@ public abstract class CollectionMessagesUtils { * @param messages list * @return List */ - public static List ConvertToVoterRegistryMessages( - List messages){ - return messages.stream().map(VoterRegistryMessage::new).collect(Collectors.toList()); + public static List ConvertToVoterRegistryMessages(List messages){ + List voterMessages = new ArrayList<>(); + for (int i = 0 ; i < messages.size() ; i++) + { + voterMessages.add(new VoterRegistryMessage(messages.get(i))); + } + return voterMessages; } /** @@ -71,11 +71,13 @@ public abstract class CollectionMessagesUtils { */ public static List GetListOfGroupIds(Map groupIdToMessage) { List groupsIds = new ArrayList<>(); - - groupIdToMessage.values().stream().filter(VoterRegistryMessage::IsGroupAdding).forEach(message -> { + Iterator entries = groupIdToMessage.entrySet().iterator(); + while (entries.hasNext()) { + Map.Entry tuple = (Map.Entry) entries.next(); + VoterRegistryMessage message = (VoterRegistryMessage) tuple.getValue(); String groupId = message.GetWantedTagFromBasicMessage(RegistryTags.GROUP_ID_TAG.toString()); groupsIds.add(groupId); - }); + } return groupsIds; } diff --git a/voter-registry/src/main/java/meerkat/Registry/RelevantDataCallBack.java b/voter-registry/src/main/java/meerkat/Registry/RelevantDataCallBack.java index c6cff8f..47308e0 100644 --- a/voter-registry/src/main/java/meerkat/Registry/RelevantDataCallBack.java +++ b/voter-registry/src/main/java/meerkat/Registry/RelevantDataCallBack.java @@ -79,6 +79,7 @@ public class RelevantDataCallBack implements ClientCallback msg) { try { List messages = ConvertToVoterRegistryMessages(validate(msg)); + if(isAddToGroupsList(msg)) { Map map = GetLatestGroupsActions(messages); List groupsOfUser = GetListOfGroupIds(map); diff --git a/voter-registry/src/test/java/SimpleRegistryTest.java b/voter-registry/src/test/java/SimpleRegistryTest.java index 9b75d29..60ce8c3 100644 --- a/voter-registry/src/test/java/SimpleRegistryTest.java +++ b/voter-registry/src/test/java/SimpleRegistryTest.java @@ -2,15 +2,17 @@ import com.google.protobuf.InvalidProtocolBufferException; import junit.framework.TestCase; import meerkat.Registry.CollectionMessagesUtils; import meerkat.Registry.RegistryTags; -import meerkat.VoterRegistry; import meerkat.SimpleRegistry; -import meerkat.protobuf.VoterRegistry.*; import meerkat.VoterRegistryMessage; import meerkat.bulletinboard.BulletinBoardClient; import meerkat.bulletinboard.ThreadedBulletinBoardClient; import meerkat.crypto.concrete.ECDSASignature; import meerkat.protobuf.BulletinBoardAPI.BulletinBoardMessage; import meerkat.protobuf.BulletinBoardAPI.MessageFilterList; +import meerkat.protobuf.VoterRegistry.GroupID; +import meerkat.protobuf.VoterRegistry.VoterGroup; +import meerkat.protobuf.VoterRegistry.VoterID; +import meerkat.protobuf.VoterRegistry.VoterInfo; import meerkat.protobuf.Voting; import java.io.InputStream; @@ -45,7 +47,7 @@ public class SimpleRegistryTest extends TestCase { public static String KEYFILE_PASSWORD = "secret"; Semaphore jobSemaphore; - class DummyRegistryCallBackHandler implements VoterRegistry.RegistryCallBack{ + class DummyRegistryCallBackHandler implements meerkat.VoterRegistry.RegistryCallBack{ public int counter; public T data; @@ -167,7 +169,8 @@ public class SimpleRegistryTest extends TestCase { String id = new BigInteger(130, random).toString(32); String data = new BigInteger(130, random).toString(32); - VoterInfo voterInfo = VoterInfo.newBuilder().setId(VoterID.newBuilder().setId(id)).setInfo(data).build(); + VoterInfo voterInfo = VoterInfo.newBuilder(). + setId(VoterID.newBuilder().setId(id)).setInfo(data).build(); SimpleRegistry registry = new SimpleRegistry(signer, bulletinBoardClient, certStream); registry.AddVoter(voterInfo, handler); @@ -223,7 +226,8 @@ public class SimpleRegistryTest extends TestCase { String voterId = new BigInteger(130, random).toString(32); String groupId = new BigInteger(130, random).toString(32); - VoterGroup voterInfo = VoterGroup.newBuilder().setVoterId(VoterID.newBuilder().setId(voterId)) + VoterGroup voterInfo = VoterGroup.newBuilder() + .setVoterId(VoterID.newBuilder().setId(voterId)) .setGroupId(GroupID.newBuilder().setId(groupId)).build(); SimpleRegistry registry = new SimpleRegistry(signer, bulletinBoardClient, certStream); @@ -256,7 +260,8 @@ public class SimpleRegistryTest extends TestCase { String voterId = new BigInteger(130, random).toString(32); String groupId = new BigInteger(130, random).toString(32); - VoterGroup voterInfo = VoterGroup.newBuilder().setVoterId(VoterID.newBuilder().setId(voterId)) + VoterGroup voterInfo = VoterGroup.newBuilder() + .setVoterId(VoterID.newBuilder().setId(voterId)) .setGroupId(GroupID.newBuilder().setId(groupId)).build(); this.certStream = getClass().getResourceAsStream(CERT1_PEM_EXAMPLE); @@ -285,7 +290,8 @@ public class SimpleRegistryTest extends TestCase { String id = new BigInteger(130, random).toString(32); String data = new BigInteger(130, random).toString(32); - VoterInfo voterInfo = VoterInfo.newBuilder().setId(VoterID.newBuilder().setId(id)).setInfo(data).build(); + VoterInfo voterInfo = VoterInfo.newBuilder(). + setId(VoterID.newBuilder().setId(id)).setInfo(data).build(); SimpleRegistry registry = new SimpleRegistry(signer, bulletinBoardClient, certStream); registry.AddVoter(voterInfo, handler); @@ -296,9 +302,11 @@ public class SimpleRegistryTest extends TestCase { DummyRegistryCallBackHandler personalHandler = new DummyRegistryCallBackHandler<>(); registry.GetPersonIDDetails(VoterID.newBuilder().setId(id).build(), personalHandler); - jobSemaphore.acquire(); + + jobSemaphore.acquire(1); assertEquals(RegistryTags.ID_TAG + id, personalHandler.data.GetWantedTagFromBasicMessage(RegistryTags.ID_TAG.toString())); assertEquals(data,personalHandler.data.base.getData().toStringUtf8()); } } +