diff options
Diffstat (limited to 'tests/ProbeBench.java')
-rw-r--r-- | tests/ProbeBench.java | 39 |
1 files changed, 39 insertions, 0 deletions
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); + } + +} |