gov.sandia.ccaffeine.dc.user_iface.examples
Class UseScriptToTestGui

java.lang.Object
  extended by gov.sandia.ccaffeine.dc.user_iface.examples.UseScriptToTestGui

public class UseScriptToTestGui
extends java.lang.Object

Simulator for a CCA Server

The constructor launches both the simulator and the cca client.

The purpose of the simulator is to test the cca client. Commands and data travel across a communication link between the server and the client. In a typical exchange, the client sends a query to the cca server; the cca server responds by sending the results of the query to the client. For example, the client can ask for a list of all the components that are in the palette.

The simulator's actions are controlled by the script file scriptToTestClient.xml. This file contains 3 types of instructions:
  writeToClient anyString
    the simulator uses the communication line
    to send anyString to the client.
  readFromClient anyString
    simulator waits for the client
    to use the communiction link to send anyString.
  command anyString
    simulator invokes a method on the client.


Nested Class Summary
protected  class UseScriptToTestGui.ThreadServerSocket
           
 
Field Summary
protected  int port
           
 
Constructor Summary
UseScriptToTestGui(int port)
          Launch the simulator and launch the client.
 
Method Summary
static void main(java.lang.String[] args)
          Launch the simulator and launch the cca client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

port

protected int port
Constructor Detail

UseScriptToTestGui

public UseScriptToTestGui(int port)
Launch the simulator and launch the client.

The simulator sets up a ServerSocket on a port. The ServerSocket waits for a cca client to request a connection. Once the connection is established, the simulator follows the instructions in the script file, scriptToTestClient.xml.

This constructor also launches a cca client. The cca client creates a client Socket. A connection request is then be sent to the simulator's ServerSocket. If the simulator accecpts the request, then a communication link is establed between the ServerSocket and the ccc client.

Parameters:
port - The simulator sets up a ServerSocket on this port.
Method Detail

main

public static void main(java.lang.String[] args)
Launch the simulator and launch the cca client.

Parameters:
args - The command line arguments. The first argument should be the port number that the simulator will use to set up a ServerSocket.