From e42b592ab0adaa548d30073393a9319b96bceb71 Mon Sep 17 00:00:00 2001 From: jestin Date: Wed, 2 Aug 2006 16:24:10 +0000 Subject: toujours ibid --- tests/Request.java | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tests/Request.java (limited to 'tests') diff --git a/tests/Request.java b/tests/Request.java new file mode 100644 index 0000000..67c3096 --- /dev/null +++ b/tests/Request.java @@ -0,0 +1,69 @@ +/** + * Another Ivy java library API tester: requests + * + * @author Yannick Jestin + * + * (c) CENA + * + * usage: java Request + * + * Changelog + * 1.2.8 : first release + * + */ +import fr.dgac.ivy.*; + +class Request { + + public static void main(String[] args) throws IvyException { + String domain=Ivy.getDomainArgs("RequestTest",args); + new Request(domain); + } + + int nb=0; + private Ivy bus; + String id; + static int serial = 0; + private static final int NBCOMP = 5; + private static final int dodo = 0; + + public Request(String domain) throws IvyException { + bus = new Ivy("RequestTest","RequestTest ready", null); + id=bus.getWBUId(); + bus.bindMsg("^Computer\\d ready",new IvyMessageListener() { + public void receive(IvyClient ic,String[] args) { + try { bus.sendMsg("computesum id="+id+" a=3 b=4");} catch (IvyException _ ) { } + } + }); + bus.bindMsgOnce("^result id="+id+" value=([0-9]+)",new IvyMessageListener() { + public void receive(IvyClient ic,String[] args) { + System.out.println("result received: "+args[0]); + try {Thread.sleep(1000);} catch (InterruptedException _) { } + System.exit(0); + } + }); + bus.start(domain); + System.out.println("launching "+NBCOMP+" Computers"); + for (int i=0;i