aboutsummaryrefslogtreecommitdiff
path: root/tests/Killer.java
diff options
context:
space:
mode:
authorjestin2006-08-02 16:19:56 +0000
committerjestin2006-08-02 16:19:56 +0000
commitf7d01e0337800bcb54fea096604457f900cbf976 (patch)
tree5fbaf65bd1deb012e8446d95849b2775be6e49c3 /tests/Killer.java
parentfdb4cc200dca5db5b374fc40ab3723eb8bf96886 (diff)
downloadivy-java-f7d01e0337800bcb54fea096604457f900cbf976.zip
ivy-java-f7d01e0337800bcb54fea096604457f900cbf976.tar.gz
ivy-java-f7d01e0337800bcb54fea096604457f900cbf976.tar.bz2
ivy-java-f7d01e0337800bcb54fea096604457f900cbf976.tar.xz
a missing one in the Api Tester
Diffstat (limited to 'tests/Killer.java')
-rw-r--r--tests/Killer.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/Killer.java b/tests/Killer.java
new file mode 100644
index 0000000..4f95b1d
--- /dev/null
+++ b/tests/Killer.java
@@ -0,0 +1,39 @@
+/**
+ * Ivy java library API tester.
+ *
+ * @author Yannick Jestin <mailto:jestin@cena.fr>
+ *
+ * (c) CENA
+ *
+ */
+import fr.dgac.ivy.*;
+
+public class Killer implements IvyMessageListener {
+
+ private Ivy kbus;
+ private String killOnMsg;
+
+ public Killer(String domain,String killOnMsg) {
+ try {
+ System.out.println("Killer joining the bus");
+ kbus = new Ivy("Killer","Killer ready", null);
+ this.killOnMsg=killOnMsg;
+ kbus.bindMsg(killOnMsg,this);
+ kbus.start(domain);
+ } catch (IvyException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ public void receive(IvyClient c,String[] args) {
+ c.sendDie("bye bye ! you told me "+killOnMsg);
+ System.out.println("Killer leaving the bus");
+ kbus.stop();
+ System.out.println("Killer has left the bus");
+ }
+
+ public static void main(String[] args) throws IvyException {
+ new Killer(Ivy.getDomainArgs("Killer",args),"^coucou$");
+ }
+
+}