From e854a58a81ec90e419a4b3effa5a83caac05df90 Mon Sep 17 00:00:00 2001 From: jestin Date: Sun, 13 May 2012 08:54:38 +0000 Subject: Modified the tests to remove bus.getDomain(null) make Waiter and WaiterClient sons of WaitFor Added a few tests into svn --- tests/Unitaire.java | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/Unitaire.java (limited to 'tests/Unitaire.java') diff --git a/tests/Unitaire.java b/tests/Unitaire.java new file mode 100644 index 0000000..894bb88 --- /dev/null +++ b/tests/Unitaire.java @@ -0,0 +1,32 @@ +/** + * Ivy java library API tester. + * + * @author Yannick Jestin + * + * (c) ENAC + * + * usage: java Unitaire + * + */ +import fr.dgac.ivy.*; + +public class Unitaire { + + public static void main(final String[] args) { + Ivy bus = new Ivy("Test Unitaire" , "TU ready" , null); + final int PORT_TEST = 5000; + try { + bus.start(Ivy.getDomainArgs("IvyTest" , args)); + System.out.println("waiting 5 seconds for a coucou"); + System.out.println(((bus.waitForMsg("^coucou" , PORT_TEST)) != null) ? "coucou received" : "coucou not received"); + System.out.println("waiting 5 seconds for IvyProbe"); + System.out.println(((bus.waitForClient("IVYPROBE" , PORT_TEST)) != null) ? "Ivyprobe joined the bus" : "nobody came"); + System.out.println("random values: " + bus.getWBUId() + ", " + bus.getWBUId() + ", " + bus.getWBUId()); + bus.stop(); + } catch (IvyException ie) { + System.out.println("Ivy main test error"); + ie.printStackTrace(); + } + } + +} -- cgit v1.1