diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-15 19:00:09 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-15 19:00:09 +0100 |
commit | aaf40b22ba16ab2079e97854d63ba8262bbdf860 (patch) | |
tree | f376a8d41c3936a7526f321cdfd08f4063cb727e /same/src/test/java | |
parent | 171341543525b950a1db1692bab10d251a2245dc (diff) |
Add TestBroadcaster.
TestBroadcaster implements a single-threaded broadcaster suitable for
testing.
Diffstat (limited to 'same/src/test/java')
-rw-r--r-- | same/src/test/java/com/orbekk/same/TestBroadcaster.java | 19 |
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); + } + } +} |