summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-01-15 19:00:09 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-01-15 19:00:09 +0100
commitaaf40b22ba16ab2079e97854d63ba8262bbdf860 (patch)
treef376a8d41c3936a7526f321cdfd08f4063cb727e
parent171341543525b950a1db1692bab10d251a2245dc (diff)
Add TestBroadcaster.
TestBroadcaster implements a single-threaded broadcaster suitable for testing.
-rw-r--r--same/src/test/java/com/orbekk/same/TestBroadcaster.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/same/src/test/java/com/orbekk/same/TestBroadcaster.java b/same/src/test/java/com/orbekk/same/TestBroadcaster.java
new file mode 100644
index 0000000..b76a44f
--- /dev/null
+++ b/same/src/test/java/com/orbekk/same/TestBroadcaster.java
@@ -0,0 +1,19 @@
+package com.orbekk.same;
+
+import java.util.List;
+
+public class TestBroadcaster implements Broadcaster {
+ private ConnectionManager connections;
+
+ public TestBroadcaster(ConnectionManager connections) {
+ this.connections = connections;
+ }
+
+ public void broadcast(final List<String> targets,
+ final ServiceOperation operation) {
+ for (String t : targets) {
+ ClientService client = connections.getClient(t);
+ operation.run(client);
+ }
+ }
+}