ds.ov2.test
Class Check_data_transmission

java.lang.Object
  extended by ds.ov2.test.Check_data_transmission

 class Check_data_transmission
extends Object

Test the protocol layer by sending arguments and receiving results of varying sizes. The bytes sent and received are enumerated to detect bugs. Checks various corner cases, for instance total argument length of 509, 510 and 511 bytes.

CPP Preprocessing
no cpp preprocessing needed
Execution Environment:
host
Author:
Hendrik Tews
Version:
$Revision: 1.14 $
Last Commit:
$Date: 2009-06-02 13:27:57 $ by $Author: tews $

Field Summary
private  Data_protocol_host data
          Instance for running the data transmission protocol.
private  PrintWriter out
          Output channel for progress messages.
 
Constructor Summary
Check_data_transmission(Data_protocol_description data_protocol, CardChannel cc)
          Constructor.
 
Method Summary
 long check_with_sizes(String msg, int a1, int a2, int a3, int a4, int a5, int r1, int r2, int r3, int r4, int r5, boolean performance_test)
          Test the protocol layer by sending 5 arguments and receiving 5 results of the specified size.
 void run_ex()
          Run protocol layer checks.
 void run()
          Exception wrapper for run_ex().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

private PrintWriter out
Output channel for progress messages.


data

private Data_protocol_host data
Instance for running the data transmission protocol.

Constructor Detail

Check_data_transmission

public Check_data_transmission(Data_protocol_description data_protocol,
                               CardChannel cc)
Constructor. Initialize all fields.

Parameters:
data_protocol - data protocol description instance
cc - channel to the applet
Method Detail

check_with_sizes

public long check_with_sizes(String msg,
                             int a1,
                             int a2,
                             int a3,
                             int a4,
                             int a5,
                             int r1,
                             int r2,
                             int r3,
                             int r4,
                             int r5,
                             boolean performance_test)
                      throws CardException,
                             Data_protocol_host.Data_error
Test the protocol layer by sending 5 arguments and receiving 5 results of the specified size. Runs first the data size protocol to set the size of the Resizable_buffer's that are used as arguments and results. If performance_test is false the bytes in the transmission are enumerated to catch reordering bugs.

Parameters:
msg - identifier for progress messages
a1 - size of the first argument
a2 - size of the second argument
a3 - size of the third argument
a4 - size of the fourth argument
a5 - size of the fifth argument
r1 - size of the first result
r2 - size of the second result
r3 - size of the third result
r4 - size of the fourth result
r5 - size of the fifth result
performance_test - if true do not enumerate the bytes sent to obtain pure transmission times
Returns:
duration of the data transmission (without setting the sizes or allocating the buffers but with the protocol layer overhead) in nanoseconds
Throws:
Data_protocol_host.Data_error - if an error in the protocol layer is detected
CardException - on communication problems

run_ex

public void run_ex()
            throws CardException,
                   Data_protocol_host.Data_error
Run protocol layer checks. Check with a number of different argument and result sizes.

Throws:
Data_protocol_host.Data_error - if an error in the protocol layer is detected
CardException - on communication problems

run

public void run()
Exception wrapper for run_ex(). Run the protocol layer checks and print escaping exceptions.