aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/gnunet/voting/BallotTool.java
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2013-10-29 02:37:48 +0000
committerFlorian Dold <florian.dold@gmail.com>2013-10-29 02:37:48 +0000
commit56991ab6ca6a639cc9cfa6bd3b9a195a95f13d69 (patch)
tree17e6e85abef96fe8e1c135b80fd3d8d51731d38c /src/main/java/org/gnunet/voting/BallotTool.java
parent93c0e940bcfc83681cce859aac7f07c4470fe88a (diff)
downloadgnunet-java-56991ab6ca6a639cc9cfa6bd3b9a195a95f13d69.tar.gz
gnunet-java-56991ab6ca6a639cc9cfa6bd3b9a195a95f13d69.zip
- automatic test for voting
- signed messages
Diffstat (limited to 'src/main/java/org/gnunet/voting/BallotTool.java')
-rw-r--r--src/main/java/org/gnunet/voting/BallotTool.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/org/gnunet/voting/BallotTool.java b/src/main/java/org/gnunet/voting/BallotTool.java
index 23e7f4a..4883acc 100644
--- a/src/main/java/org/gnunet/voting/BallotTool.java
+++ b/src/main/java/org/gnunet/voting/BallotTool.java
@@ -241,7 +241,7 @@ public class BallotTool extends Program {
241 currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); 241 currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size()));
242 System.out.println("registering ballot with authority " + currentAuthority.toString()); 242 System.out.println("registering ballot with authority " + currentAuthority.toString());
243 mesh = new Mesh(getConfiguration(), new BallotTunnelEndHandler(), new BallotRegisterReceiver()); 243 mesh = new Mesh(getConfiguration(), new BallotTunnelEndHandler(), new BallotRegisterReceiver());
244 tunnel = mesh.createTunnel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true, null); 244 tunnel = mesh.createTunnel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true);
245 BallotRegisterRequestMessage m = new BallotRegisterRequestMessage(); 245 BallotRegisterRequestMessage m = new BallotRegisterRequestMessage();
246 CompressedConfig ccfg = new CompressedConfig(ballot.toConfiguration()); 246 CompressedConfig ccfg = new CompressedConfig(ballot.toConfiguration());
247 m.compressedBallotConfig = ccfg.compressedData; 247 m.compressedBallotConfig = ccfg.compressedData;
@@ -250,7 +250,8 @@ public class BallotTool extends Program {
250 } 250 }
251 if (issue) { 251 if (issue) {
252 if (null == ego) { 252 if (null == ego) {
253 System.out.println("no ego given"); 253 System.err.println("no ego given");
254 setReturnValue(1);
254 return; 255 return;
255 } 256 }
256 ballot.issue(ego.getPrivateKey()); 257 ballot.issue(ego.getPrivateKey());
@@ -259,7 +260,8 @@ public class BallotTool extends Program {
259 } 260 }
260 if (select != null) { 261 if (select != null) {
261 if (null == ego) { 262 if (null == ego) {
262 System.out.println("no ego given"); 263 System.err.println("no ego given");
264 setReturnValue(1);
263 return; 265 return;
264 } 266 }
265 ballot.encodeChoice(select, ego.getPrivateKey()); 267 ballot.encodeChoice(select, ego.getPrivateKey());
@@ -301,6 +303,7 @@ public class BallotTool extends Program {
301 List<PeerIdentity> remainingAuthorities = ballot.getAuthorities(); 303 List<PeerIdentity> remainingAuthorities = ballot.getAuthorities();
302 if (remainingAuthorities.isEmpty()) { 304 if (remainingAuthorities.isEmpty()) {
303 System.err.println("no authorities available"); 305 System.err.println("no authorities available");
306 setReturnValue(2);
304 return; 307 return;
305 } 308 }
306 Random r = new Random(); 309 Random r = new Random();
@@ -358,6 +361,7 @@ public class BallotTool extends Program {
358 361
359 public static void main(String args[]) { 362 public static void main(String args[]) {
360 Program tool = new BallotTool(args); 363 Program tool = new BallotTool(args);
361 tool.start(); 364 int ret = tool.start();
365 System.exit(ret);
362 } 366 }
363} 367}