From aaf40b22ba16ab2079e97854d63ba8262bbdf860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Sun, 15 Jan 2012 19:00:09 +0100 Subject: Add TestBroadcaster. TestBroadcaster implements a single-threaded broadcaster suitable for testing. --- .../test/java/com/orbekk/same/TestBroadcaster.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 same/src/test/java/com/orbekk/same/TestBroadcaster.java (limited to 'same/src/test/java') 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 targets, + final ServiceOperation operation) { + for (String t : targets) { + ClientService client = connections.getClient(t); + operation.run(client); + } + } +} -- cgit v1.2.3