info.jedi.testsuite
Class Client

java.lang.Object
  |
  +--info.jedi.testsuite.Client

public class Client
extends java.lang.Object

This class is designed to test the parts.basic package and several classes that this package depends on. It is run from the command line with the following syntax:

 java info.jedi.testsuite.Client <server address> [<number of messages>]
 
The address is that of a machine where the Server class is running (run with java Server) The number of messages is an optional argument for testing reliability with many, many message sends (it has been tested successfully with 1,000,000 messages as this argument).

Only one client can properly test a single server at a time; not following this rule may result in test failure or even a VM crash.


Constructor Summary
Client(java.lang.String serverAddress, int serverPort, int numMessages)
          Creates a Client object that will test a server identified by its address and port and will send a certain number of simple messages in the process.
 
Method Summary
 void bounceFunction(Proxy next, int bouncesLeft)
          Recursively bounces a call between client and server, passing a Proxy representing this object and an ever decreasing index of how many recursive calls are left.
static void main(java.lang.String[] args)
          Handles command line invocations of the client side of the test suite.
 boolean runBaseTests()
          Runs the basic communication tests that try to send global method calls with different parameters.
 boolean runCountTests()
          Runs the counting tests.
 boolean runExceptionTests()
          Runs tests designed to fail in different ways.
 boolean runProxyTests()
          Uses the bounceFunction to bounce a call back and forth between the client and server 100 times.
 boolean runSemaphoreTests()
          Runs the semaphore tests, where 100 remote functions are called simultaneously, and all calls block until the 100th call has been received.
 boolean runTests()
          Runs all the tests in the suite, printing success or failure after all tests have been run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Client

public Client(java.lang.String serverAddress,
              int serverPort,
              int numMessages)
       throws java.lang.Exception
Creates a Client object that will test a server identified by its address and port and will send a certain number of simple messages in the process.
Throws:
java.lang.Exception - if there is trouble connecting to the server.
Method Detail

runBaseTests

public boolean runBaseTests()
                     throws java.lang.Exception
Runs the basic communication tests that try to send global method calls with different parameters.
Throws:
java.lang.Exception - if one of the global method calls throws an unexpected exception

runSemaphoreTests

public boolean runSemaphoreTests()
Runs the semaphore tests, where 100 remote functions are called simultaneously, and all calls block until the 100th call has been received.

runCountTests

public boolean runCountTests()
                      throws java.lang.Exception
Runs the counting tests. The number of messages passed to the constructor of Client is sent to the server, and the server keeps a running total of the number of messages. When this running total is returned from every method call to the client the client checks it against its loop variables to make sure each call made was received exactly once.
Throws:
java.lang.Exception - if one of the global method calls throws an unexpected exception

bounceFunction

public void bounceFunction(Proxy next,
                           int bouncesLeft)
                    throws java.lang.Exception
Recursively bounces a call between client and server, passing a Proxy representing this object and an ever decreasing index of how many recursive calls are left.
Throws:
java.lang.Exception - if one of the global method calls throws an unexpected exception

runProxyTests

public boolean runProxyTests()
Uses the bounceFunction to bounce a call back and forth between the client and server 100 times.

runExceptionTests

public boolean runExceptionTests()
Runs tests designed to fail in different ways. In addition to printing success anytime an exception was thrown when expected, this method prints the exception to standard out so that it can be visually checked for accuracy.

runTests

public boolean runTests()
                 throws java.lang.Exception
Runs all the tests in the suite, printing success or failure after all tests have been run.
Throws:
java.lang.Exception - if one of the global method calls throws an unexpected exception

main

public static void main(java.lang.String[] args)
Handles command line invocations of the client side of the test suite. See the class description for the usage.