From da83e117b8ec556bf42488d5aeb889f6e2afc150 Mon Sep 17 00:00:00 2001 From: jestin Date: Wed, 5 Jun 2002 09:48:51 +0000 Subject: Premiers vecteurs de tests pour non regression. Version initiale. --- tests/Makefile | 13 +++++ tests/TESTBENCH | 14 +++++ tests/TestNet.java | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 182 insertions(+) create mode 100644 tests/Makefile create mode 100644 tests/TESTBENCH create mode 100644 tests/TestNet.java (limited to 'tests') diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..9d130b8 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,13 @@ +JIKESPATH=/usr/lib/j2re1.3/lib/rt.jar:/usr/share/java/repository:/usr/share/java/gnu.getopt.jar + +.SUFFIXES: .java .class +SRC = TestNet.java +OBJ = $(SRC:.java=.class) + +.java.class: + jikes $< + +all: $(OBJ) + +clean: + /bin/rm -f $(OBJ) diff --git a/tests/TESTBENCH b/tests/TESTBENCH new file mode 100644 index 0000000..3cc3a5c --- /dev/null +++ b/tests/TESTBENCH @@ -0,0 +1,14 @@ +How to check if it doesn't work ? + +- java -DIVY_DEBUG fr.dgac.ivy.Probe ... + +- check the rendez-vous, either in UDP broadcast or TCP multicast + * network available + * it works without ivy + * it works in ivy-c + * it should work in ivy-java + +- it should be symetric, whatever the order of the connections ( client A, + client B, client C vs A, C, B ... ) + +- the regexps should function properly, let's build a little testbench diff --git a/tests/TestNet.java b/tests/TestNet.java new file mode 100644 index 0000000..e65684a --- /dev/null +++ b/tests/TestNet.java @@ -0,0 +1,155 @@ +import java.lang.Thread; +import java.net.*; +import java.io.*; +import java.util.StringTokenizer; +import gnu.regexp.*; +import gnu.getopt.*; + +class TestNet implements Runnable { + private String domain; + private boolean watcherrunning = false; + private boolean isMulticastAddress = false; + private Thread broadcastListener ; + private DatagramSocket broadcast; /* supervision socket */ + // it can also be a MulticastSocket, which inherits from the previous + + public void run() { + byte buf[] = new byte[256]; + DatagramPacket packet=new DatagramPacket(buf, 256); + int port; + String s = "Server waiting for Broadcast on "+domain; + s+=(isMulticastAddress)?" (TCP multicast)":" (UDP broadcast)"; + System.out.println(s); + while( watcherrunning ) try { + broadcast.receive(packet); + String msg = new String(buf) ; + // clean up the buffer after each message + for (int i=0;i