aboutsummaryrefslogtreecommitdiff
path: root/tests/ProbeBench.java
diff options
context:
space:
mode:
authorjestin2004-07-27 16:23:00 +0000
committerjestin2004-07-27 16:23:00 +0000
commitd5d548edaf6cf1ffb2d214b2bf0329ec341c42a1 (patch)
tree7bea89fe499bf27ecc37c1c5b0d58e4639c26421 /tests/ProbeBench.java
parentfd9c3e8ea4c7093bff92ec2162ca0be338024fa2 (diff)
downloadivy-java-d5d548edaf6cf1ffb2d214b2bf0329ec341c42a1.zip
ivy-java-d5d548edaf6cf1ffb2d214b2bf0329ec341c42a1.tar.gz
ivy-java-d5d548edaf6cf1ffb2d214b2bf0329ec341c42a1.tar.bz2
ivy-java-d5d548edaf6cf1ffb2d214b2bf0329ec341c42a1.tar.xz
major test rewrite to abide to the latest API. Updated tests for async msg
handling and protect newline
Diffstat (limited to 'tests/ProbeBench.java')
-rw-r--r--tests/ProbeBench.java39
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);
+ }
+
+}