|
|
|
@ -1,26 +1,21 @@
|
|
|
|
|
import com.google.protobuf.InvalidProtocolBufferException;
|
|
|
|
|
import junit.framework.TestCase;
|
|
|
|
|
import meerkat.RegistryMessages;
|
|
|
|
|
import meerkat.SimpleRegistry;
|
|
|
|
|
import meerkat.VoterRegistryMessage;
|
|
|
|
|
import meerkat.bulletinboard.BulletinBoardClient;
|
|
|
|
|
import meerkat.bulletinboard.SimpleBulletinBoardClient;
|
|
|
|
|
import meerkat.crypto.concrete.ECElGamalEncryption;
|
|
|
|
|
import meerkat.crypto.concrete.ECElGamalUtils;
|
|
|
|
|
import meerkat.crypto.concrete.ECDSASignature;
|
|
|
|
|
import meerkat.protobuf.BulletinBoardAPI;
|
|
|
|
|
import meerkat.protobuf.ConcreteCrypto;
|
|
|
|
|
import meerkat.protobuf.Voting;
|
|
|
|
|
import org.factcenter.qilin.primitives.concrete.ECElGamal;
|
|
|
|
|
import org.factcenter.qilin.primitives.concrete.ECGroup;
|
|
|
|
|
import util.RegistryTags;
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
|
import java.math.BigInteger;
|
|
|
|
|
import java.security.SecureRandom;
|
|
|
|
|
import java.security.spec.InvalidKeySpecException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import static util.CollectionMessagesUtils.ConvertToVoterRegistryMessages;
|
|
|
|
|
import static util.CollectionMessagesUtils.GetUnsignedBulletinBoardMessages;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created by Vladimir Eliezer Tokarev on 1/16/2016.
|
|
|
|
@ -30,27 +25,10 @@ import static util.CollectionMessagesUtils.GetUnsignedBulletinBoardMessages;
|
|
|
|
|
*/
|
|
|
|
|
public class SimpleRegistryTest extends TestCase {
|
|
|
|
|
|
|
|
|
|
private ECElGamalEncryption signatory;
|
|
|
|
|
private SimpleBulletinBoardClient communicator;
|
|
|
|
|
private ECDSASignature signatory;
|
|
|
|
|
private BulletinBoardClient communicator;
|
|
|
|
|
private static String BULLETIN_BOARD_SERVER_ADDRESS = "http://localhost:8081";
|
|
|
|
|
private SecureRandom random = new SecureRandom();
|
|
|
|
|
private List<List<String>> votersData;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates the ElGamal encryption object
|
|
|
|
|
*/
|
|
|
|
|
private void ElGamalSetup() {
|
|
|
|
|
try {
|
|
|
|
|
ECGroup group = new ECGroup("secp256k1");
|
|
|
|
|
BigInteger sk = ECElGamal.generateSecretKey(group, random);
|
|
|
|
|
ECElGamal.SK key = new ECElGamal.SK(group, sk);
|
|
|
|
|
ConcreteCrypto.ElGamalPublicKey serializedPk = ECElGamalUtils.serializePk(group, key);
|
|
|
|
|
signatory = new ECElGamalEncryption();
|
|
|
|
|
signatory.init(serializedPk);
|
|
|
|
|
} catch (InvalidKeySpecException e) {
|
|
|
|
|
assertTrue(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates the communication object (the bulletinBoardClient)
|
|
|
|
@ -63,18 +41,12 @@ public class SimpleRegistryTest extends TestCase {
|
|
|
|
|
.build());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SimpleRegistryCallBackHandlers RegistryAnswersHandlerSetup() {
|
|
|
|
|
return new SimpleRegistryCallBackHandlers();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initialize SimpleRegistry object
|
|
|
|
|
*/
|
|
|
|
|
public void setUp() {
|
|
|
|
|
ElGamalSetup();
|
|
|
|
|
signatory = new ECDSASignature();
|
|
|
|
|
CommunicatorSetup();
|
|
|
|
|
votersData = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -88,171 +60,121 @@ public class SimpleRegistryTest extends TestCase {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates list of lists of strings for different testing purposes
|
|
|
|
|
* @param actionDataNumber number of string in a list
|
|
|
|
|
* @param numberOfInstances number of lists in a list
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private void setActionsData(int actionDataNumber, int numberOfInstances)
|
|
|
|
|
{
|
|
|
|
|
System.out.println("- Creating "+ numberOfInstances +" ids and personal data strings for adding different voters.");
|
|
|
|
|
if (votersData != null){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
votersData = new ArrayList<>();
|
|
|
|
|
for (int i = 0 ; i < numberOfInstances ; i++ ){
|
|
|
|
|
List<String> data = new ArrayList<>();
|
|
|
|
|
for (int j = 0 ; j < actionDataNumber ; j++){
|
|
|
|
|
data.add(new BigInteger(130, random).toString(32));
|
|
|
|
|
}
|
|
|
|
|
votersData.add(data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Counts the amount of posted messaages that have their tags in voterData
|
|
|
|
|
* @param votersData List<List<String>> of information about voters (tags etc...)
|
|
|
|
|
* @param tags List<String> of tags
|
|
|
|
|
* @return int
|
|
|
|
|
* @throws InvalidProtocolBufferException
|
|
|
|
|
*/
|
|
|
|
|
private int countActualAddedMessages(List<List<String>> votersData, List<String> tags, SimpleRegistry registry) throws InvalidProtocolBufferException {
|
|
|
|
|
System.out.println("- Check that the server have the new voters data:");
|
|
|
|
|
|
|
|
|
|
BulletinBoardAPI.MessageFilterList filters = registry.GetRelevantMessagesFilters(tags);
|
|
|
|
|
List<VoterRegistryMessage> messages =
|
|
|
|
|
ConvertToVoterRegistryMessages(GetUnsignedBulletinBoardMessages(communicator.readMessages(filters)));
|
|
|
|
|
|
|
|
|
|
assert messages.size() > 0 : " The filtered messages are empty ( wrong filtering or server down)";
|
|
|
|
|
int addedMessagesCounter = 0;
|
|
|
|
|
|
|
|
|
|
for (List<String> voterData : votersData) {
|
|
|
|
|
for (VoterRegistryMessage message : messages) {
|
|
|
|
|
String addedVoterId = message.GetWantedTagFromBasicMessage(RegistryTags.ID_TAG);
|
|
|
|
|
String addedVoterData = new String(message.base.getData().toByteArray());
|
|
|
|
|
|
|
|
|
|
if (voterData.size() == 2 && addedVoterId.contains(voterData.get(0)) && addedVoterData.contains(voterData.get(1))) {
|
|
|
|
|
addedMessagesCounter++;
|
|
|
|
|
}
|
|
|
|
|
else if (addedVoterId.contains(voterData.get(0)) ){
|
|
|
|
|
addedMessagesCounter++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return addedMessagesCounter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Call methodToCheck voterData as list of params
|
|
|
|
|
* @param methodToCheck the name of the wanted method
|
|
|
|
|
* @param numberOfParamsWithoutHandler the amount of params to pass to the wanted method
|
|
|
|
|
* @param handler object which method will be called as callback from SimpleRegistry
|
|
|
|
|
* @param registry the simpleRegistry object
|
|
|
|
|
* @param voterData List of string which is the params to pass to the wantedMethod
|
|
|
|
|
*/
|
|
|
|
|
private void CallWantedMethod(String methodToCheck, int numberOfParamsWithoutHandler,
|
|
|
|
|
SimpleRegistryCallBackHandlers handler, SimpleRegistry registry,
|
|
|
|
|
List<String> voterData) {
|
|
|
|
|
try {
|
|
|
|
|
if (numberOfParamsWithoutHandler == 1)
|
|
|
|
|
{
|
|
|
|
|
java.lang.reflect.Method method =
|
|
|
|
|
registry.getClass().getMethod(methodToCheck,String.class, RegistryCallBack.class);
|
|
|
|
|
method.invoke(registry, voterData.get(0), handler);
|
|
|
|
|
assertTrue(handler.ActionSucceed);
|
|
|
|
|
}else {
|
|
|
|
|
java.lang.reflect.Method method =
|
|
|
|
|
registry.getClass().getMethod( methodToCheck, String.class, String.class, RegistryCallBack.class);
|
|
|
|
|
method.invoke(registry, voterData.get(0), voterData.get(1), handler);
|
|
|
|
|
assertTrue(handler.ActionSucceed);
|
|
|
|
|
}
|
|
|
|
|
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates new Registry information then sends it to the server then checks the server
|
|
|
|
|
* have all sent data
|
|
|
|
|
* @param methodToCheck the name of the method we want to call in SimpleRegistry
|
|
|
|
|
* @param numberOfParamsToPass the number of params to pass to the methodToCheck
|
|
|
|
|
* @param numberOfChecks the amount of checks to run
|
|
|
|
|
* @param tags list of String that represent the tags to filter on the messages
|
|
|
|
|
* @return Returns the information that was send in the created messages
|
|
|
|
|
* @throws InvalidProtocolBufferException
|
|
|
|
|
*/
|
|
|
|
|
private List<List<String>> checkMessagesPostedSuccessfully(String methodToCheck, int numberOfParamsToPass, int numberOfChecks, List<String> tags) throws InvalidProtocolBufferException {
|
|
|
|
|
SimpleRegistryCallBackHandlers handler = RegistryAnswersHandlerSetup();
|
|
|
|
|
System.out.println("Starting testing the " + methodToCheck + " capability.");
|
|
|
|
|
setActionsData(numberOfParamsToPass, numberOfChecks);
|
|
|
|
|
|
|
|
|
|
SimpleRegistry registry = new SimpleRegistry(signatory, communicator);
|
|
|
|
|
|
|
|
|
|
System.out.println("- Check that all the callbacks have been called successfully after voters adding:");
|
|
|
|
|
for (List<String> voterData : votersData) {
|
|
|
|
|
CallWantedMethod(methodToCheck, numberOfParamsToPass, handler, registry, voterData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println("- Check that for every data added, the callback have been called:");
|
|
|
|
|
assertEquals(numberOfChecks, handler.counter);
|
|
|
|
|
int addedMessagesCounter = countActualAddedMessages(votersData, tags, registry);
|
|
|
|
|
|
|
|
|
|
assert addedMessagesCounter == numberOfChecks : "The number of added messages actually is " + addedMessagesCounter;
|
|
|
|
|
System.out.println("Ended addVoter testing.");
|
|
|
|
|
return votersData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test that add voter creates new correct bulletin board message and adds the voter
|
|
|
|
|
*/
|
|
|
|
|
public void testAddVoter() throws InvalidProtocolBufferException {
|
|
|
|
|
checkMessagesPostedSuccessfully("AddVoter", 2, 3,
|
|
|
|
|
new ArrayList<String>(){{add(RegistryTags.VOTER_ENTRY_TAG.toString());}});
|
|
|
|
|
DummyRegistryCallBackHandler<Boolean> handler = new DummyRegistryCallBackHandler<>();
|
|
|
|
|
|
|
|
|
|
RegistryMessages.VoterInfo voterInfo = RegistryMessages.VoterInfo.newBuilder().
|
|
|
|
|
setId(RegistryMessages.VoterID.newBuilder()
|
|
|
|
|
.setId(RegistryTags.ID_TAG + new BigInteger(130, random).toString(32)))
|
|
|
|
|
.setInfo(new BigInteger(130, random).toString(32)).build();
|
|
|
|
|
|
|
|
|
|
SimpleRegistry registry = new SimpleRegistry(signatory, communicator);
|
|
|
|
|
registry.AddVoter(voterInfo, handler);
|
|
|
|
|
|
|
|
|
|
assertEquals(handler.counter , 0);
|
|
|
|
|
|
|
|
|
|
List<String> tags = new ArrayList<>();
|
|
|
|
|
tags.add("AddVoter");
|
|
|
|
|
|
|
|
|
|
BulletinBoardAPI.MessageFilterList filters = registry.GetRelevantMessagesFilters(tags);
|
|
|
|
|
DummyBulletinBoardCallBackHandler bulletinHandler = new DummyBulletinBoardCallBackHandler();
|
|
|
|
|
communicator.readMessages(filters, bulletinHandler);
|
|
|
|
|
|
|
|
|
|
List<BulletinBoardAPI.BulletinBoardMessage> messages = bulletinHandler.getMessages();
|
|
|
|
|
|
|
|
|
|
assert messages.contains(voterInfo) : "The server don't have the new user data.";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test that set voted posts creates correct bulletin board message and sets that the user have been voted
|
|
|
|
|
*/
|
|
|
|
|
public void testSetVoted() throws InvalidProtocolBufferException {
|
|
|
|
|
checkMessagesPostedSuccessfully("SetVoted", 1, 3,
|
|
|
|
|
new ArrayList<String>(){{add(RegistryTags.VOTE_ACTION_TAG.toString());}});
|
|
|
|
|
DummyRegistryCallBackHandler<Boolean> handler = new DummyRegistryCallBackHandler<>();
|
|
|
|
|
|
|
|
|
|
RegistryMessages.VoterID voterInfo = RegistryMessages.VoterID.newBuilder()
|
|
|
|
|
.setId(RegistryTags.ID_TAG + new BigInteger(130, random).toString(32)).build();
|
|
|
|
|
|
|
|
|
|
SimpleRegistry registry = new SimpleRegistry(signatory, communicator);
|
|
|
|
|
registry.SetVoted(voterInfo, handler);
|
|
|
|
|
|
|
|
|
|
assertEquals(handler.counter , 0);
|
|
|
|
|
|
|
|
|
|
List<String> tags = new ArrayList<>();
|
|
|
|
|
tags.add("SetVoted");
|
|
|
|
|
|
|
|
|
|
BulletinBoardAPI.MessageFilterList filters = registry.GetRelevantMessagesFilters(tags);
|
|
|
|
|
DummyBulletinBoardCallBackHandler bulletinHandler = new DummyBulletinBoardCallBackHandler();
|
|
|
|
|
communicator.readMessages(filters, bulletinHandler);
|
|
|
|
|
|
|
|
|
|
List<BulletinBoardAPI.BulletinBoardMessage> messages = bulletinHandler.getMessages();
|
|
|
|
|
|
|
|
|
|
assert messages.contains(voterInfo) : "The server don't have the new user id.";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test that add to group creates correct bulletin board message and adds a user to a group
|
|
|
|
|
*/
|
|
|
|
|
public void testRemoveFromGroup() throws InvalidProtocolBufferException {
|
|
|
|
|
checkMessagesPostedSuccessfully("RemoveFromGroup", 2, 3, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test that get groups retrieves the right groups the user are in
|
|
|
|
|
*/
|
|
|
|
|
public void testAddToGroup() throws InvalidProtocolBufferException {
|
|
|
|
|
checkMessagesPostedSuccessfully("AddToGroup", 2, 4, null);
|
|
|
|
|
DummyRegistryCallBackHandler<Boolean> handler = new DummyRegistryCallBackHandler<>();
|
|
|
|
|
|
|
|
|
|
RegistryMessages.VoterGroup voterInfo = RegistryMessages.VoterGroup.newBuilder()
|
|
|
|
|
.setVoterId(RegistryMessages.VoterID.newBuilder()
|
|
|
|
|
.setId((RegistryTags.ID_TAG + new BigInteger(130, random).toString(32))))
|
|
|
|
|
.setGroupId(RegistryMessages.GroupID.newBuilder()
|
|
|
|
|
.setId((RegistryTags.GROUP_ID_TAG + new BigInteger(130, random).toString(32)))).build();
|
|
|
|
|
|
|
|
|
|
SimpleRegistry registry = new SimpleRegistry(signatory, communicator);
|
|
|
|
|
registry.AddToGroup(voterInfo, handler);
|
|
|
|
|
|
|
|
|
|
assertEquals(handler.counter , 0);
|
|
|
|
|
|
|
|
|
|
List<String> tags = new ArrayList<>();
|
|
|
|
|
tags.add("AddToGroup");
|
|
|
|
|
|
|
|
|
|
BulletinBoardAPI.MessageFilterList filters = registry.GetRelevantMessagesFilters(tags);
|
|
|
|
|
DummyBulletinBoardCallBackHandler bulletinHandler = new DummyBulletinBoardCallBackHandler();
|
|
|
|
|
communicator.readMessages(filters, bulletinHandler);
|
|
|
|
|
|
|
|
|
|
List<BulletinBoardAPI.BulletinBoardMessage> messages = bulletinHandler.getMessages();
|
|
|
|
|
|
|
|
|
|
assert messages.contains(voterInfo) : "The server don't have the new user added to group.";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test that remove from group creates correct bulletin board message and removes the user from a group
|
|
|
|
|
*/
|
|
|
|
|
public void testGetGroups() throws InvalidProtocolBufferException, InterruptedException {
|
|
|
|
|
System.out.println("Starting testing the GetGroups capability.");
|
|
|
|
|
List<List<String>> votersData = checkMessagesPostedSuccessfully("AddToGroup", 2, 3, null);
|
|
|
|
|
DummyRegistryCallBackHandler<List<BulletinBoardAPI.BulletinBoardMessage>> handler =
|
|
|
|
|
new DummyRegistryCallBackHandler<>();
|
|
|
|
|
|
|
|
|
|
RegistryMessages.VoterGroup voterInfo = RegistryMessages.VoterGroup.newBuilder()
|
|
|
|
|
.setVoterId(RegistryMessages.VoterID.newBuilder()
|
|
|
|
|
.setId((RegistryTags.ID_TAG + new BigInteger(130, random).toString(32))))
|
|
|
|
|
.setGroupId(RegistryMessages.GroupID.newBuilder()
|
|
|
|
|
.setId((RegistryTags.GROUP_ID_TAG + new BigInteger(130, random).toString(32)))).build();
|
|
|
|
|
|
|
|
|
|
SimpleRegistry registry = new SimpleRegistry(signatory, communicator);
|
|
|
|
|
SimpleRegistryCallBackHandlers handler = RegistryAnswersHandlerSetup();
|
|
|
|
|
registry.AddToGroup(voterInfo, handler);
|
|
|
|
|
|
|
|
|
|
System.out.println("- Checks that every group id we added to every voter really exists:");
|
|
|
|
|
for (List<String> voterData : votersData){
|
|
|
|
|
registry.GetGroups(voterData.get(1), handler);
|
|
|
|
|
assertEquals(handler.counter , 0);
|
|
|
|
|
|
|
|
|
|
assert handler.ActionSucceed : " The SimpleRegistry could not complete the GetGroups action ";
|
|
|
|
|
assert handler.WantedInformation.contains(RegistryTags.GROUP_ID_TAG + voterData.get(1))
|
|
|
|
|
: " The SimpleRegistry cloud not get the right group of the user " + voterData.get(1);
|
|
|
|
|
}
|
|
|
|
|
System.out.println("Ended GetGroups testing.");
|
|
|
|
|
List<String> tags = new ArrayList<>();
|
|
|
|
|
tags.add("AddToGroup");
|
|
|
|
|
|
|
|
|
|
BulletinBoardAPI.MessageFilterList filters = registry.GetRelevantMessagesFilters(tags);
|
|
|
|
|
DummyBulletinBoardCallBackHandler bulletinHandler = new DummyBulletinBoardCallBackHandler();
|
|
|
|
|
communicator.readMessages(filters, bulletinHandler);
|
|
|
|
|
|
|
|
|
|
List<BulletinBoardAPI.BulletinBoardMessage> messages = bulletinHandler.getMessages();
|
|
|
|
|
|
|
|
|
|
assert messages.contains(voterInfo) : "The server don't have the new user added to group.";
|
|
|
|
|
List<VoterRegistryMessage> voterMessages = ConvertToVoterRegistryMessages(handler.data);
|
|
|
|
|
assertTrue(voterMessages.get(0).GetWantedTagFromBasicMessage(RegistryTags.ID_TAG).contains(voterInfo.getVoterId().getId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -261,24 +183,29 @@ public class SimpleRegistryTest extends TestCase {
|
|
|
|
|
* Test that the personal data outputted about the user is right
|
|
|
|
|
*/
|
|
|
|
|
public void testGetPersonalIDDetails() throws InvalidProtocolBufferException, InterruptedException {
|
|
|
|
|
System.out.println("Starting testing the GetPersonIDDetails capability:");
|
|
|
|
|
List<List<String>> addedVotersInformation = checkMessagesPostedSuccessfully("AddVoter", 2, 3,
|
|
|
|
|
new ArrayList<String>(){{add(RegistryTags.VOTER_ENTRY_TAG.toString());}});
|
|
|
|
|
DummyRegistryCallBackHandler<List<BulletinBoardAPI.BulletinBoardMessage>> handler = new DummyRegistryCallBackHandler<>();
|
|
|
|
|
|
|
|
|
|
RegistryMessages.VoterInfo voterInfo = RegistryMessages.VoterInfo.newBuilder().
|
|
|
|
|
setId(RegistryMessages.VoterID.newBuilder()
|
|
|
|
|
.setId(RegistryTags.ID_TAG + new BigInteger(130, random).toString(32)))
|
|
|
|
|
.setInfo(new BigInteger(130, random).toString(32)).build();
|
|
|
|
|
|
|
|
|
|
SimpleRegistry registry = new SimpleRegistry(signatory, communicator);
|
|
|
|
|
SimpleRegistryCallBackHandlers handler = RegistryAnswersHandlerSetup();
|
|
|
|
|
registry.AddVoter(voterInfo, handler);
|
|
|
|
|
|
|
|
|
|
System.out.println("- Check that every added voter can be retrieved by SimpleRegistry:");
|
|
|
|
|
assertEquals(handler.counter , 0);
|
|
|
|
|
|
|
|
|
|
for (List<String> voterInformation : addedVotersInformation) {
|
|
|
|
|
registry.GetPersonIDDetails(voterInformation.get(0), handler);
|
|
|
|
|
List<String> tags = new ArrayList<>();
|
|
|
|
|
tags.add("AddVoter");
|
|
|
|
|
|
|
|
|
|
assert handler.ActionSucceed : " Getting personal data for voter with id : "
|
|
|
|
|
+ voterInformation.get(0) + " failed";
|
|
|
|
|
assert handler.WantedInformation.get(0).contains(voterInformation.get(0))
|
|
|
|
|
: " Voter with id " + voterInformation.get(0) + " have bot been added to the voter db.";
|
|
|
|
|
}
|
|
|
|
|
assert handler.counter == 3 : " The callback method have not been called 3 times";
|
|
|
|
|
System.out.println("Ended the GetPersonIDDetails capability");
|
|
|
|
|
BulletinBoardAPI.MessageFilterList filters = registry.GetRelevantMessagesFilters(tags);
|
|
|
|
|
DummyBulletinBoardCallBackHandler bulletinHandler = new DummyBulletinBoardCallBackHandler();
|
|
|
|
|
communicator.readMessages(filters, bulletinHandler);
|
|
|
|
|
|
|
|
|
|
List<BulletinBoardAPI.BulletinBoardMessage> messages = bulletinHandler.getMessages();
|
|
|
|
|
|
|
|
|
|
assert messages.contains(voterInfo) : "The server don't have the new user data.";
|
|
|
|
|
List<VoterRegistryMessage> voterMessages = ConvertToVoterRegistryMessages(handler.data);
|
|
|
|
|
assertTrue(voterMessages.get(0).GetWantedTagFromBasicMessage(RegistryTags.ID_TAG).contains(voterInfo.getId().getId()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|