Main Page | Compound List | File List | Compound Members

dndtester::DaqTests Class Reference

DaqTests what handles all tests. More...

List of all members.

Public Member Functions

 DaqTests (String hostname)
 Constructor.

String testCommand (String command) throws TestSuiteException
 testCommand attempts to test a command.

TestResult testCommand (String command, String result) throws TestSuiteException
 testCommand attempts to test a command.

TestResult testingCommand (PrintStream pstream, BufferedReader buf, final String command, final String responce) throws TestSuiteException
 testingCommand is a general purpose method to test commands.

String readingData () throws TestSuiteException
 readingData is a simple method to read one line of Data from the DAQ.

String testingCommand (PrintStream pstream, BufferedReader buf, String command) throws TestSuiteException
 This version of testingCommand only gets the responce of the DAQ to a command.

void disconnect ()
 Method that closes the sockets related to this class.

boolean openCloseBadPort (String command, DaqPanel repaintPanel, SSPanel sspanel) throws TestSuiteException
 openBadPort() tests the behavior of the DAQ when an invalid channel is requested.

boolean openClosePort (String command, String answer, DaqPanel repaintPanel, SSPanel sspanel) throws TestSuiteException
 Method used to test opening and closing ports.

boolean testStatus (String answer, DaqPanel repaintPanel, SSPanel sspanel) throws TestSuiteException
 Method used to test what the DAQ returns when 'daq-status' is send.

boolean testingUnknownCommands (DaqPanel repaintPanel, SSPanel sspanel) throws TestSuiteException
 Method used to see the behavior of sending an unkown command.

void flushBuffers (DaqPanel repaintPanel, SSPanel sspanel, boolean block) throws TestSuiteException
 Method used to flush the command and data buffers.

boolean testSuite (DaqPanel repaintPanel, SSPanel sspanel, JProgressBar bar, int runs) throws TestSuiteException
 This is the method that performs all the tests.


Static Public Member Functions

void setPorts (int commandPort)
 setPorts() sets the ports where the DAQ expects the connection.


Static Public Attributes

final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-DD'T'HH:mm:ss.SSS")
 Each time stamp must conform to the UTC encoding, dateFormat will parse a string in UTC encoding to a valid Date.


Protected Attributes

BufferedReader commReader = null
 The buffer reader used to read responces from the DAQ.

BufferedReader dataReader = null
 The buffer reader used to read data from the DAQ.

PrintStream commPStream = null
 The PrintStream used to send commands to the DAQ.

boolean validConnect = false
 Boolean set to true when all the components of DaqTests are ready to start testing.

Hashtable channelTable
 The hash table keeps track of all the channels the DAQ is running.


Static Protected Attributes

int DATAPORT = 55056
 Data port where the DAQ expects the connnection.

int COMMANDPORT = 55055
 Command port where the DAQ expects the connnection.


Private Attributes

InetAddress remoteAddr
 The InetAddress of the host where the DAQ is running.

Socket dataSocket = null
 The socket used to read data from the DAQ.

Socket commandSock = null
 The socket used to send commands to the DAQ. And read responces.

boolean dialog = false
 Boolean that is set to true when the thread about canceling the connection is running.

boolean connection = false
 Boolean that is set when the thread trying to connect is running.

JProgressBar progressBar = null
 DaqTests has the option of updating a progress bar when testSuite() is called.

int increment = 0
 The value to update the progress bar.


Detailed Description

DaqTests what handles all tests.

Class that handles the opening and closing connections with the DAQ. and the class the performs all tests.

Definition at line 25 of file DaqTests.java.


Constructor & Destructor Documentation

dndtester::DaqTests::DaqTests String  hostname  )  [inline]
 

Constructor.

DaqTests creates two threads. One is to attempt to establish a connection. The other thread gives the user the choice to cancel the connection in case its taking to long or in case some other error occured.

Parameters:
hostname is a String of the host were the DAQ is running. An IP address is acceptable.

Definition at line 80 of file DaqTests.java.

References channelTable, remoteAddr, and dndtester::DaqTests::DialogThread::setToKill().


Member Function Documentation

void dndtester::DaqTests::disconnect  )  [inline]
 

Method that closes the sockets related to this class.

Closes dataSocket and commandSock when they are valid sockets.

Definition at line 422 of file DaqTests.java.

void dndtester::DaqTests::flushBuffers DaqPanel  repaintPanel,
SSPanel  sspanel,
boolean  block
throws TestSuiteException [inline]
 

Method used to flush the command and data buffers.

Parameters:
repaintPanel a DaqPanel to repaint the GUI.
sspanel a SSPanel to log the results.
block boolean used if flushBuffers needs to wait for the DAQ, abnormal stop on test suite.

Definition at line 742 of file DaqTests.java.

boolean dndtester::DaqTests::openCloseBadPort String  command,
DaqPanel  repaintPanel,
SSPanel  sspanel
throws TestSuiteException [inline]
 

openBadPort() tests the behavior of the DAQ when an invalid channel is requested.

The behavior of what the DAQ should do when given an invalid port has not been fully establish this method is mainly to see that the connection is not lost. And also it trys to open an invalid channel, an string with a comman in it. At that poing the DAQ should return "Invalid port '[bad port]'".

Parameters:
command either "open" or "close".
repaintPanel the DaqPanel used to repaint the GUI.
sspanel the SSPanel where to log the results.
Exceptions:
TestSuiteException 

Definition at line 447 of file DaqTests.java.

References dndtester::TestResult::different, and dndtester::TestResult::pass.

boolean dndtester::DaqTests::openClosePort String  command,
String  answer,
DaqPanel  repaintPanel,
SSPanel  sspanel
throws TestSuiteException [inline]
 

Method used to test opening and closing ports.

channelTable must have all valid ports on remove DAQ otherwise all test will fail. This method makes sure that all ports are valid. Usually determined by the what the list list-channels returns. And makes sure that the DAQ returns the appropiate messages when a port is open or closed.

Parameters:
command either "open" or "close".
answer either "Streaming ..." or "Stopping .."
repaintPanel the DaqPanel used to repaint the GUI.
sspanel the SSPanel where to log the results.
Exceptions:
TestSuiteException 

Definition at line 498 of file DaqTests.java.

References dndtester::TestResult::different, and dndtester::TestResult::pass.

String dndtester::DaqTests::readingData  )  throws TestSuiteException [inline]
 

readingData is a simple method to read one line of Data from the DAQ.

Returns:
A String that is a time stamp set of Data.
Exceptions:
TestSuiteException. 

Definition at line 354 of file DaqTests.java.

void dndtester::DaqTests::setPorts int  commandPort  )  [inline, static]
 

setPorts() sets the ports where the DAQ expects the connection.

commandPort + 1 is the data port.

Parameters:
commandPort is where the DAQ expects a connection for commands.

Definition at line 650 of file DaqTests.java.

TestResult dndtester::DaqTests::testCommand String  command,
String  result
throws TestSuiteException [inline]
 

testCommand attempts to test a command.

Parameters:
command a String which is the command to test.
result the String the DAQ should return.
Returns:
A TestResult which is the responce of the DAQ to the command.
Exceptions:
TestSuiteException 

Definition at line 286 of file DaqTests.java.

String dndtester::DaqTests::testCommand String  command  )  throws TestSuiteException [inline]
 

testCommand attempts to test a command.

Parameters:
command a String which is the command to test.
Returns:
A String which is the responce of the DAQ to the command.
Exceptions:
TestSuiteException. 

Definition at line 274 of file DaqTests.java.

String dndtester::DaqTests::testingCommand PrintStream  pstream,
BufferedReader  buf,
String  command
throws TestSuiteException [inline]
 

This version of testingCommand only gets the responce of the DAQ to a command.

This method is used when we will like to know what the DAQ returns for some string.

Parameters:
pstream the PrintStream used to send commands to the DAQ.
buf a BufferedReader used to read responces from the DAQ.
command the string to be tested.
Returns:
A String which is the responce of the DAQ.

Definition at line 388 of file DaqTests.java.

TestResult dndtester::DaqTests::testingCommand PrintStream  pstream,
BufferedReader  buf,
final String  command,
final String  responce
throws TestSuiteException [inline]
 

testingCommand is a general purpose method to test commands.

It takes a PrintStream where to send the command and a BufferedReader where to read the responce. It then sends command in the PrintStream s and compares what the BufferedReader buf has with responce.

Parameters:
pstream a PrintStream
buf a BufferedReader
command a String.
responce a String.
Returns:
TestResult which contains the responce of the DAQ.
Exceptions:
TestSuiteException. 

Definition at line 304 of file DaqTests.java.

References dndtester::TestResult::different, and dndtester::TestResult::pass.

boolean dndtester::DaqTests::testingUnknownCommands DaqPanel  repaintPanel,
SSPanel  sspanel
throws TestSuiteException [inline]
 

Method used to see the behavior of sending an unkown command.

The correct behavior is that the DAQ should acknowlege the bad command by returning 'Unknown Command [the command]'.

Parameters:
repaintPanel a DaqPanel to repaint the GUI.
sspanel a SSPanel to log the results.
Returns:
A boolean which is false if the correct behavior is not met by the DAQ.
Exceptions:
TestSuiteException 

Definition at line 702 of file DaqTests.java.

References dndtester::TestResult::pass.

boolean dndtester::DaqTests::testStatus String  answer,
DaqPanel  repaintPanel,
SSPanel  sspanel
throws TestSuiteException [inline]
 

Method used to test what the DAQ returns when 'daq-status' is send.

It should return Running otherwise it will failed this test.

Parameters:
answer usually Running.
repaintPanel a DaqPanel to repaint the GUI.
sspanel a SSPanel to log the results.
Exceptions:
TestSuiteException 

Definition at line 663 of file DaqTests.java.

References dndtester::TestResult::different, and dndtester::TestResult::pass.

boolean dndtester::DaqTests::testSuite DaqPanel  repaintPanel,
SSPanel  sspanel,
JProgressBar  bar,
int  runs
throws TestSuiteException [inline]
 

This is the method that performs all the tests.

There are a total of 14 tests. It starts by testing the DAQ status. Then it tests some unknown commands. The third test is to make sure 'list-channels' returns channels in the correct format. Then it opens all the ports that 'list-channels' return and tests the status. The method then closes the ports and tests the status. Once again it opens all the ports and tests the data format about 1.05 times the number of ports just to make sure they are all used in the data. Finally, it closes all the porst and checks the status.

Parameters:
repaintPanel a DaqPanel used to update the GUI.
sspanel a SSPanel used to log the results.
bar the progress bar to update. If is null the it does not update anything.
runs the number of times this testSuite will be called in a row.
Exceptions:
TestSuiteException 

Definition at line 806 of file DaqTests.java.

References dndtester::TestResult::pass.


The documentation for this class was generated from the following file:
Generated on Mon Jul 28 13:59:25 2003 by doxygen 1.3.2