Class simu.test.TestCommunicator
All Packages Class Hierarchy This Package Previous Next Index
Class simu.test.TestCommunicator
java.lang.Object
|
+----simu.test.TestCommunicator
- public class TestCommunicator
- extends Object
- Version:
- 1.0 20-Mar-97
- Author:
- Andre Campeau
The TestCommunicator class is a test harness for the Communicator
class. Testing of both sending and receiving capabilities of the
Communicator is done.
See Also:
Communicator, TestSCPCommunicator
-
TestCommunicator()
-
-
main(String[])
- The main method executes a number of test scenarios.
-
Send(int, String, String[])
- The Send method connects with a dispatcher on the local host
that is listening on a well-known port, receives the new
anonymous port from the dispatcher, and finally opens another
connection on this anonymous port to send data (and possibly
receive a reply).
TestCommunicator
public TestCommunicator()
Send
public static void Send(int port,
String sendData,
String receiveData[])
- The Send method connects with a dispatcher on the local host
that is listening on a well-known port, receives the new
anonymous port from the dispatcher, and finally opens another
connection on this anonymous port to send data (and possibly
receive a reply).
This method exercises the dispatcher connection and send
capabilities of the Communicator class.
Preconditions: A dispatcher on the local host is listening on
a well-known port.
Postconditions: Data is sent (and any reply is received) to the
remote object over the socket connection.
- Parameters:
- port - The well-known port that the dispatcher
is listening on.
- sendData - The data to send to the remote end.
- receiveData[] - Any received data. This is an array of
size 1.
main
public static void main(String args[])
- The main method executes a number of test scenarios. These
scenarios are:
- Create a Communicator listener daemon thread and verify
that it can receive data and update a local Hashtable.
After the last test is executed, the contents of the
local Hashtable are printed to the standard output to
verify its contents.
- Send the data "SHIP LINKS SNE1 SNE2 UP" to the SCP and
verify that the data is entered into the SNED.
- Send the data "RECEIVE LOCAL SNE1 simIP" to the SCP and
verify that a reply is received by printing the simIP
to the standard output.
- Send the data "RECEIVE LINKS SNE1 SNE2" to the SCP and
verify that a reply is received by printing the link
status to the standard output.
This method exercises the dispatcher connection and send
capabilities of the Communicator class (by calling the Send
method), as well as the listener daemon capability of the
Communicator class.
Preconditions: The Simulator Control Program (SCP) is running
on the local host with its Dispatcher listening
on a well-known port.
Postconditions: The operation of the Communicator class is
verified. The operation of the Dispatcher and
SCPCommunicator classes is also verified
indirectly.
- Parameters:
- args[] - The listener port for the Communicator listener
daemon and the port that the SCP's Dispatcher
is listening on.
All Packages Class Hierarchy This Package Previous Next Index