Test Programs

for the project on Design and Implementation of Basic RMI Mechanisms

by Kohei Honda

Department of Computer Science, Queen Mary and Westfield College, University of London
March 2000

For reference, I list the default remote object reference class here.

    RemoteObjectRef.java

Also for reference, I list here the link to registry programs.

Test (1) for sending local object graphs to a remote object and back

This is a zip code server, which maintains a list of city names and their corresponding zip codes (post codes). It can be initialised by a list of city-zip code pairs, after that we can either retrieve all of them or find the zip code of some city.

ZipCodeServer.java the interface for the server of zip codes (post codes).
ZipCodeServerImpl.java the implementation of the zip code server.
ZipCodeList.java A class used by ZipCodeServer

Note ZipCodeServerImpl.java does not have a main method. This is in accordance with the default testing procedure explained in Testing Method.

Here is a full code of a client program with which I wish to test your program.

ZipCodeClient.java

Test (2) for returning a reference to a remote object and then invoking it

This client and server allow us to receive a remote object reference as a result of a RMI and then invoke that object via RMI.

The original test was to have been a name server, but I have made it simpler as follows, which is essentially a ZipCodeServer which returns remote references. The ZipCodeRList server maintains a list of remote objects, each of which contains one city-zip code pair and a reference to the next remote object in the list. It can be asked "what is next", in which case, It returns a remote object reference to the next remote object in the list. It can also be asked to return its city-zip code pair or to add another remote object containing a given pair.

ZipCodeRList.java  (interface)
ZipCodeRListImpl.java  (implementation)

Here is a full code of a client program for ZipCodeRList with which I wish to test your program.

ZipCodeRListClient.java

The old test program

For those who wish to use the old test program, I also list their sources here. The reason for choosing not this but the above one is that the above one is simpler and is a little more fun for testing.

NameServer.java  (interface)
NameServerImpl.java (implementation)