Renamed SimpleRegistry to Registry.
parent
9c52eff109
commit
d9272c9f94
|
@ -30,7 +30,7 @@ ext {
|
||||||
nexusPassword = project.hasProperty('nexusPassword') ? project.property('nexusPassword') : ""
|
nexusPassword = project.hasProperty('nexusPassword') ? project.property('nexusPassword') : ""
|
||||||
}
|
}
|
||||||
|
|
||||||
description = "Meerkat Voter SimpleRegistry application"
|
description = "Meerkat Voter Registry application"
|
||||||
|
|
||||||
// Your project version
|
// Your project version
|
||||||
version = "0.0"
|
version = "0.0"
|
||||||
|
|
|
@ -25,14 +25,14 @@ import java.util.List;
|
||||||
* Created by Vladimir Eliezer Tokarev on 1/8/2016.
|
* Created by Vladimir Eliezer Tokarev on 1/8/2016.
|
||||||
* Gives the ability to synchronously manage voters information
|
* Gives the ability to synchronously manage voters information
|
||||||
*/
|
*/
|
||||||
public class SimpleRegistry implements VoterRegistry{
|
public class Registry implements VoterRegistry{
|
||||||
|
|
||||||
protected DigitalSignature signer;
|
protected DigitalSignature signer;
|
||||||
protected AsyncBulletinBoardClient bulletinBoardClient ;
|
protected AsyncBulletinBoardClient bulletinBoardClient ;
|
||||||
protected Crypto.Signature signature;
|
protected Crypto.Signature signature;
|
||||||
protected InputStream certificateStream;
|
protected InputStream certificateStream;
|
||||||
|
|
||||||
public SimpleRegistry(DigitalSignature signer,
|
public Registry(DigitalSignature signer,
|
||||||
AsyncBulletinBoardClient communicator,
|
AsyncBulletinBoardClient communicator,
|
||||||
InputStream certificateStream) {
|
InputStream certificateStream) {
|
||||||
this.signer = signer;
|
this.signer = signer;
|
|
@ -1,9 +1,9 @@
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
import com.google.protobuf.InvalidProtocolBufferException;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
import meerkat.Registry;
|
||||||
import meerkat.Registry.CollectionMessagesUtils;
|
import meerkat.Registry.CollectionMessagesUtils;
|
||||||
import meerkat.Registry.RegistryTags;
|
import meerkat.Registry.RegistryTags;
|
||||||
import meerkat.SimpleRegistry;
|
|
||||||
import meerkat.bulletinboard.AsyncBulletinBoardClient;
|
import meerkat.bulletinboard.AsyncBulletinBoardClient;
|
||||||
import meerkat.bulletinboard.ThreadedBulletinBoardClient;
|
import meerkat.bulletinboard.ThreadedBulletinBoardClient;
|
||||||
import meerkat.crypto.concrete.ECDSASignature;
|
import meerkat.crypto.concrete.ECDSASignature;
|
||||||
|
@ -114,7 +114,7 @@ public class SimpleRegistryTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize SimpleRegistry object
|
* Initialize Registry object
|
||||||
*/
|
*/
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
SetSigner();
|
SetSigner();
|
||||||
|
@ -128,9 +128,9 @@ public class SimpleRegistryTest extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testSimpleRegistryCreation() {
|
public void testSimpleRegistryCreation() {
|
||||||
try {
|
try {
|
||||||
new SimpleRegistry(signer, bulletinBoardClient, certStream);
|
new Registry(signer, bulletinBoardClient, certStream);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
assert false : "While creating the SimpleRegistry exception have been thrown " + e;
|
assert false : "While creating the Registry exception have been thrown " + e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ public class SimpleRegistryTest extends TestCase {
|
||||||
String data = 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 registry = new Registry(signer, bulletinBoardClient, certStream);
|
||||||
registry.AddVoter(voterInfo, handler);
|
registry.AddVoter(voterInfo, handler);
|
||||||
|
|
||||||
jobSemaphore.acquire();
|
jobSemaphore.acquire();
|
||||||
|
@ -201,7 +201,7 @@ public class SimpleRegistryTest extends TestCase {
|
||||||
String id = new BigInteger(130, random).toString(32);
|
String id = new BigInteger(130, random).toString(32);
|
||||||
VoterID voterInfo = VoterID.newBuilder().setId(id).build();
|
VoterID voterInfo = VoterID.newBuilder().setId(id).build();
|
||||||
|
|
||||||
SimpleRegistry registry = new SimpleRegistry(signer, bulletinBoardClient, certStream);
|
Registry registry = new Registry(signer, bulletinBoardClient, certStream);
|
||||||
registry.SetVoted(voterInfo, handler);
|
registry.SetVoted(voterInfo, handler);
|
||||||
|
|
||||||
jobSemaphore.acquire();
|
jobSemaphore.acquire();
|
||||||
|
@ -231,7 +231,7 @@ public class SimpleRegistryTest extends TestCase {
|
||||||
.setVoterID(VoterID.newBuilder().setId(voterId))
|
.setVoterID(VoterID.newBuilder().setId(voterId))
|
||||||
.addGroupID(GroupID.newBuilder().setId(groupId)).build();
|
.addGroupID(GroupID.newBuilder().setId(groupId)).build();
|
||||||
|
|
||||||
SimpleRegistry registry = new SimpleRegistry(signer, bulletinBoardClient, certStream);
|
Registry registry = new Registry(signer, bulletinBoardClient, certStream);
|
||||||
registry.AddToGroups(voterInfo, handler);
|
registry.AddToGroups(voterInfo, handler);
|
||||||
|
|
||||||
jobSemaphore.acquire();
|
jobSemaphore.acquire();
|
||||||
|
@ -266,7 +266,7 @@ public class SimpleRegistryTest extends TestCase {
|
||||||
|
|
||||||
this.certStream = getClass().getResourceAsStream(CERT1_PEM_EXAMPLE);
|
this.certStream = getClass().getResourceAsStream(CERT1_PEM_EXAMPLE);
|
||||||
|
|
||||||
SimpleRegistry registry = new SimpleRegistry(signer, bulletinBoardClient,certStream);
|
Registry registry = new Registry(signer, bulletinBoardClient,certStream);
|
||||||
registry.AddToGroups(voterInfo, handler);
|
registry.AddToGroups(voterInfo, handler);
|
||||||
|
|
||||||
jobSemaphore.acquire();
|
jobSemaphore.acquire();
|
||||||
|
@ -293,7 +293,7 @@ public class SimpleRegistryTest extends TestCase {
|
||||||
VoterInfo voterInfo = VoterInfo.newBuilder().
|
VoterInfo voterInfo = VoterInfo.newBuilder().
|
||||||
setId(VoterID.newBuilder().setId(id)).setInfo(data).build();
|
setId(VoterID.newBuilder().setId(id)).setInfo(data).build();
|
||||||
|
|
||||||
SimpleRegistry registry = new SimpleRegistry(signer, bulletinBoardClient, certStream);
|
Registry registry = new Registry(signer, bulletinBoardClient, certStream);
|
||||||
registry.AddVoter(voterInfo, handler);
|
registry.AddVoter(voterInfo, handler);
|
||||||
|
|
||||||
jobSemaphore.acquire();
|
jobSemaphore.acquire();
|
||||||
|
|
Loading…
Reference in New Issue