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. |
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. 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.
Definition at line 80 of file DaqTests.java. References channelTable, remoteAddr, and dndtester::DaqTests::DialogThread::setToKill(). |
|
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. |
|
Method used to flush the command and data buffers.
Definition at line 742 of file DaqTests.java. |
|
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]'".
Definition at line 447 of file DaqTests.java. References dndtester::TestResult::different, and dndtester::TestResult::pass. |
|
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.
Definition at line 498 of file DaqTests.java. References dndtester::TestResult::different, and dndtester::TestResult::pass. |
|
readingData is a simple method to read one line of Data from the DAQ.
Definition at line 354 of file DaqTests.java. |
|
setPorts() sets the ports where the DAQ expects the connection. commandPort + 1 is the data port.
Definition at line 650 of file DaqTests.java. |
|
testCommand attempts to test a command.
Definition at line 286 of file DaqTests.java. |
|
testCommand attempts to test a command.
Definition at line 274 of file DaqTests.java. |
|
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.
Definition at line 388 of file DaqTests.java. |
|
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.
Definition at line 304 of file DaqTests.java. References dndtester::TestResult::different, and dndtester::TestResult::pass. |
|
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]'.
Definition at line 702 of file DaqTests.java. References dndtester::TestResult::pass. |
|
Method used to test what the DAQ returns when 'daq-status' is send. It should return Running otherwise it will failed this test.
Definition at line 663 of file DaqTests.java. References dndtester::TestResult::different, and dndtester::TestResult::pass. |
|
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.
Definition at line 806 of file DaqTests.java. References dndtester::TestResult::pass. |