aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/BugTok.java15
-rw-r--r--tests/Makefile45
-rw-r--r--tests/TESTBENCH68
-rw-r--r--tests/TestApi.java9
4 files changed, 115 insertions, 22 deletions
diff --git a/tests/BugTok.java b/tests/BugTok.java
index c5bc445..004ac8b 100644
--- a/tests/BugTok.java
+++ b/tests/BugTok.java
@@ -1,3 +1,14 @@
+/**
+ * BugTok.
+ *
+ * @author Yannick Jestin <mailto:jestin@cena.fr>
+ *
+ * (c) CENA
+ *
+ * 1.2.3:
+ * - replace Vector.add by Vector.addElement() to maintain jdk1.1
+ * compatibility
+ */
import java.util.Vector ;
class BugTok {
@@ -7,10 +18,10 @@ class BugTok {
if (length!=0) while (true) {
index=s.indexOf(sep,last);
if (index==-1) {
- v.add(s.substring(last,length));
+ v.addElement(s.substring(last,length));
break;
} else if (index<s.length()) {
- v.add(s.substring(last,index));
+ v.addElement(s.substring(last,index));
last=index+1;
} else {
break;
diff --git a/tests/Makefile b/tests/Makefile
index c34121b..bb2a8db 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,21 +1,52 @@
-#RTPATH=/usr/lib/j2re1.3/lib/rt.jar
-RTPATH=/usr/lib/j2sdk1.4-bd/jre/lib/rt.jar
-JIKESPATH=:$(RTPATH):../lib/ivy-java.jar:/usr/share/java/repository
-CLASSPATH=-classpath ../lib/ivy-java.jar:.
-JAVAC= jikes -classpath $(JIKESPATH)
.SUFFIXES: .java .class
-SRC = TestNetSwing.java TestNet.java Bug.java BugTok.java BenchLocal.java ProbeBench.java DieSender.java TestApi.java
+SRC = TestNet.java Bug.java BugTok.java BenchLocal.java ProbeBench.java DieSender.java TestApi.java
OBJ = $(SRC:.java=.class)
+
#JAVAOPTS = -DIVY_PING
+# DONOTBUILD = TestNetSwing.java # Color(r,g,b,a) doesn't exist in jdk1.1
+
+######################################
+# Local installation
+######################################
+CLASSPATH=-classpath .
+JAVACOPTS= -deprecation
JAVAOPTS =
+JAVAC= javac
JAVA = java
+######################################
+# local Blackdown linux 118_v3 system
+######################################
+#CLASSPATH = -classpath .:/usr/local/jdk118_v3/lib/classes.zip:/home/jestin/java/Jars/swingall.jar
+#JAVACOPTS =
+#JAVAOPTS =
+#JAVA = /usr/local/jdk118_v3/bin/java
+#JAVAC = /usr/local/jdk118_v3/bin/javac
+
+######################################
+# local Blackdown linux 1.2.2
+######################################
+#CLASSPATH = -classpath .
+#JAVACOPTS = -deprecation
+#JAVAOPTS =
+#JAVA = /usr/local/jdk1.2.2/bin/java
+#JAVAC = /usr/local/jdk1.2.2/bin/javac
+
+######################################
+# local Blackdown linux 1.3.1
+######################################
+#CLASSPATH = -classpath .
+#JAVACOPTS = -deprecation
+#JAVAOPTS =
+#JAVA = /usr/local/j2sdk1.3.1/bin/java
+#JAVAC = /usr/local/j2sdk1.3.1/bin/javac
#LOCALNET=10.0.0.255:3456
+
LOCALNET=10.192.36.255:3456
MULTICAST=228.1.2.3:4567
.java.class:
- $(JAVAC) $<
+ $(JAVAC) $(JAVACOPTS) $(CLASSPATH) $<
all: $(OBJ) api unitaires test1 test2 probe
diff --git a/tests/TESTBENCH b/tests/TESTBENCH
index 81fc593..9e6383e 100644
--- a/tests/TESTBENCH
+++ b/tests/TESTBENCH
@@ -1,18 +1,60 @@
-How to check if it doesn't work ?
+-------------------------------------------------------------------------------
-- java -DIVY_DEBUG fr.dgac.ivy.Probe ...
+How to check if it doesn't work ? -> There is now a simple testbench.
+It can fail if the architecture doesn't support broadcast on loopback address
+( change the IVY_BUS variable, e.g.: on MacOSX.2, or Solaris ).
-- 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
+to test every feature $ make
+For the old API and regexp Check$ make test1
+For the new API Check $ make api
+For the end of input check $ make probe
+To be more robust $ repeat 100 make
-- it should be symetric, whatever the order of the connections ( client A,
- client B, client C vs A, C, B ... )
+Things that are yet to be written, but not easy:
+- automate tests with other implementations
+- check the network connectivity (UDP broadcast, multicast)
+- check the symmetry, 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
+-------------------------------------------------------------------------------
+How to launch the testbenchs.
+
+ First, recompile the class with the right library.
+ in src, make JAVAC=/path/to/javac JAVA=/path/to/java
+ in tests, make JAVAC=/path/to/javac JAVA=/path/to/java
+ in examples, make JAVAC=/path/to/javac JAVA=/path/to/java
+ It is possible to add an additionnal CLASSPATH make variable.
+
+ For simplicity's sake, I personnaly use links from src/fr to tests/fr and
+ to examples/fr
+
+ For older JDK (1.1) , you must add swingall.jar (available from sun's web
+ site) and classes.zip in your classpath. An example is provided in the
+ makefile.
+
+ Here is the list of commands I use and platforms I have tested successfully:
+
+ linux:
+
+ java version "1.4.1"
+ Java(TM) 2 Runtime Environment, Standard Edition (build
+ Blackdown-1.4.1-beta)
+ Java HotSpot(TM) Client VM (build Blackdown-1.4.1-beta, mixed mode)
+ all tests ok.
+
+ jdk1.1.8
+ java version "1.1.8"
+ be sure to recompile all the classes !!!
+ linux blackdown 1.1.8_v3
+ there is the JVM bug (see BUGS for details)
+
+ java version "1.2.2"
+ Classic VM (build Linux_JDK_1.2.2_FCS, native threads, sunwjit)
+ there is a possible JVM bug ( see BUGS for details ) leading to a
+ segmentation violation
+
+ java version "1.3.1"
+ Java(TM) 2 Runtime Environment, Standard Edition (build
+ Blackdown-1.3.1-FCS)
+ Java HotSpot(TM) Client VM (build Blackdown-1.3.1-FCS, mixed mode)
-- Probe:
- should exit on ^D
- should end when receiving a die message
diff --git a/tests/TestApi.java b/tests/TestApi.java
index 397208e..4902c82 100644
--- a/tests/TestApi.java
+++ b/tests/TestApi.java
@@ -20,6 +20,7 @@ class TestApi implements IvyMessageListener, IvyApplicationListener {
private String domain;
public TestApi(String domain) throws IvyException {
+ System.out.println("TestApi joining the bus");
bus = new Ivy("TestAPI",TestApiReadyMsg, null);
bus.addApplicationListener(this);
bus.bindMsg("^"+TestMsg+"$",this);
@@ -54,7 +55,9 @@ class TestApi implements IvyMessageListener, IvyApplicationListener {
System.out.println("[X] Die received");
test++;
System.out.println(test+ "/5 tests successful, good bye");
+ System.out.println("TestApi leaving the bus");
bus.stop();
+ System.out.println("TestApi has left");
}
class Sender implements IvyMessageListener {
@@ -62,6 +65,7 @@ class TestApi implements IvyMessageListener, IvyApplicationListener {
private String domain;
public Sender(String domain) {
try {
+ System.out.println("Sender joining the bus");
sbus = new Ivy("Sender","Sender ready", null);
sbus.bindMsg("^"+TestApiReadyMsg+"$",this);
sbus.start(this.domain=domain);
@@ -72,7 +76,9 @@ class TestApi implements IvyMessageListener, IvyApplicationListener {
public void receive(IvyClient c,String[] args) {
sbus.sendMsg(TestMsg);
c.sendDirectMsg(1,"bye bye");
+ System.out.println("Sender leaving the bus");
sbus.stop();
+ System.out.println("Sender has left the bus");
new Killer(domain);
}
}
@@ -81,6 +87,7 @@ class TestApi implements IvyMessageListener, IvyApplicationListener {
private Ivy kbus;
public Killer(String domain) {
try {
+ System.out.println("Killer joining the bus");
kbus = new Ivy("Killer","Killer ready", null);
kbus.bindMsg("^"+TestApiReadyMsg+"$",this);
kbus.start(domain);
@@ -90,7 +97,9 @@ class TestApi implements IvyMessageListener, IvyApplicationListener {
}
public void receive(IvyClient c,String[] args) {
c.sendDie("bye bye");
+ System.out.println("Killer leaving the bus");
kbus.stop();
+ System.out.println("Killer has left the bus");
}
}