From d5d548edaf6cf1ffb2d214b2bf0329ec341c42a1 Mon Sep 17 00:00:00 2001 From: jestin Date: Tue, 27 Jul 2004 16:23:00 +0000 Subject: major test rewrite to abide to the latest API. Updated tests for async msg handling and protect newline --- tests/ProbeBench.java | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/ProbeBench.java (limited to 'tests/ProbeBench.java') diff --git a/tests/ProbeBench.java b/tests/ProbeBench.java new file mode 100644 index 0000000..8884013 --- /dev/null +++ b/tests/ProbeBench.java @@ -0,0 +1,39 @@ +import java.io.* ; +import fr.dgac.ivy.* ; + +public class ProbeBench { + + public ProbeBench(int test) throws IvyException { + switch (test) { + case 1: test1(); break; + } + } + + /* + * Tests if the Probe exits on a die message + */ + public void test1() throws IvyException { + Probe p = new Probe(new BufferedReader(new InputStreamReader(System.in)),true,false,true); + Ivy bus1 = new Ivy("ProbeTest","ProbeTest ready",null); + bus1.start(Ivy.getDomain(null)); + System.out.println("starting the probe"); + p.start(bus1); + System.out.println("sleeping 5 seconds"); + try { Thread.sleep(5000); } catch (InterruptedException ie) { } + + Ivy bus2 = new Ivy("ProbeKiller","ProbeKiller ready",null); + bus2.start(Ivy.getDomain(null)); + System.out.println("starting the probe killer"); + new DieSender(bus2,"ProbeTest"); + System.out.println("sleeping 5 seconds"); + try { Thread.sleep(5000); } catch (InterruptedException ie) { } + bus2.stop(); + try { System.in.close(); } catch (java.io.IOException ioe ) { } + System.out.println("I should leave now"); + } + + public static void main(String[] args) throws IvyException { + new ProbeBench(1); + } + +} -- cgit v1.1