org.ocap.test.OCAPTest.html Maven / Gradle / Ivy
OCAPTest
Overview
Package
Class
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
org.ocap.test
Class OCAPTest
java.lang.Object
org.ocap.test.OCAPTest
public class OCAPTest
- extends java.lang.Object
The purpose of this class is to provide a very simple communication
channel between the OCAP implementation under test (IUT) and the test server.
The functionality of this class is intentionally limited to
sending/receiving raw messages via TCP/IP or UDP/IP protocol.
This approach decouples the lower
communications channel from the higher messaging protocol used to exchange messages
between the test client and the test server. As a result, the implementation will
be isolated from any future messaging protocol changes which may be required
for future testing needs.
This class does not provide a means for concurrently executing test applications
to negotiate reservation of the interaction channel used to exchange message with
the test environment host. Test application authors should ensure that
concurrently executing test applications correctly interoperate in their use of
this channel.
The implementation of this class MUST use TCP/IP or UDP/IP protocol to establish a
socket connection to the test server via the RF connector labeled 'Cable In'
on the OCAP Host Device. See the getProtocol()
method.
Field Summary | |
---|---|
static int |
MAX_MESSAGE_LENGTH
Maximum length of messages exchanged between ATE and a test application. |
static byte |
MESSAGE_TERMINATION_BYTE
Message termination byte. |
static int |
TCP
Indicates that an OCAPTest instance is configured to use TCP/IP protocol. |
static int |
UDP
Indicates that an OCAPTest instance is configured to use UDP/IP protocol. |
Constructor Summary | |
---|---|
OCAPTest()
|
Method Summary | |
---|---|
static int |
getProtocol()
Returns a current protocol that is used by an OCAPTest instance. |
static byte[] |
receive()
Receive a byte array from ATE via TCP/IP. |
static byte[] |
receiveUDP()
Receive a message from ATE via UDP/IP. |
static void |
send(byte[] rawMessage)
Send a specified byte array to ATE via TCP/IP protocol. |
static void |
sendUDP(byte[] rawMessage)
Send rawMessage to ATE via UDP/IP. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
MESSAGE_TERMINATION_BYTE
public static final byte MESSAGE_TERMINATION_BYTE
- Message termination byte.
Used to identify the end of a sequence of message bytes
between ATE and a test application.
For the
send(byte[])
andreceive()
methods the specified rawMessage and the returned bytes shall not contain MESSAGE_TERMINATION_BYTE except indicating message termination. For thesendUDP(byte[])
andreceiveUDP()
methods the specified rawMessage and the returned bytes may contain MESSAGE_TERMINATION_BYTE to process acknowledge protocol.- See Also:
- Constant Field Values
MAX_MESSAGE_LENGTH
public static final int MAX_MESSAGE_LENGTH
- Maximum length of messages exchanged between
ATE and a test application.
- See Also:
- Constant Field Values
UDP
public static final int UDP
- Indicates that an OCAPTest instance is configured to use UDP/IP protocol.
- See Also:
- Constant Field Values
TCP
public static final int TCP
- Indicates that an OCAPTest instance is configured to use TCP/IP protocol.
- See Also:
- Constant Field Values
Constructor Detail |
---|
OCAPTest
public OCAPTest()
Method Detail |
---|
send
public static void send(byte[] rawMessage) throws java.io.IOException
- Send a specified byte array to ATE via TCP/IP protocol.
The message MUST NOT be altered before or while sending.
A test application specifies a byte array that is less than MAX_MESSAGE_LENGTH to the rawMessage parameter. The byte array shall not contain MESSAGE_TERMINATION_BYTE. This method SHALL NOT make any assumptions as to the format of the content of the rawMessage other than it can?t contain a byte with the value MESSAGE_TERMINATION_BYTE except message termination. After the specified rawMessage are sent,MESSAGE_TERMINATION_BYTE
will be sent by this method, indicating to the ATE that the rawMessage is complete, and ready for parsing.
In case of buffered connections, the buffer MUST be flushed upon exiting this method.- Parameters:
rawMessage
- a byte array of the raw message to be sent to ATE via TCP/IP protocol.- Throws:
java.lang.IllegalArgumentException
- If rawMessage contains a byte with the value MESSAGE_TERMINATION_BYTE.java.io.IOException
- If there is any problem with I/O operations or an interaction channel has not been initialized.
receive
public static byte[] receive() throws java.io.IOException
- Receive a byte array from ATE via TCP/IP.
The message MUST NOT be altered during or after reception.
This is a blocking method which waits for an entire of original message from ATE. The implementation should accumulate bytes from the test server until theMESSAGE_TERMINATION_BYTE
is received. The all received bytes MUST then be returned to the caller as abyte[]
. The termination character is not to be included in the returned byte array. There should be no other assumptions as to the format or content of the message bytes.
The maximum number of returned byte array isMAX_MESSAGE_LENGTH
. Any bytes received beyond MAX_MESSAGE_LENGTH should be discarded. In any event, this method must not return until aMESSAGE_TERMINATION_BYTE
has been encountered.- Returns:
- a byte array coming from ATE via TCP/IP protocol. The termination character is not included.
- Throws:
java.io.IOException
- If there is any problem with I/O operations or an interaction channel has not been initialized.
getProtocol
public static int getProtocol()
- Returns a current protocol that is used by an OCAPTest instance.
The current protocol shall matches with a protocol specified by a
ppp value of an ?ate:a.b.c.d:xxxx:ppp? message from ATE.
receiveUDP
public static byte[] receiveUDP() throws java.io.IOException
- Receive a message from ATE via UDP/IP. The ATE?s IP address is specified
by an ?ate:a.b.c.d:xxxx:ppp? message from ATE. This method simply returns
a payload bytes in a UDP packet without modification, i.e., the OCAPTest
doesn?t concatenate a sequence of messages. It is responsibility of a
caller of this method to concatenate received byte arrays into an
original message according to ATE acknowledge protocol.
This method blocks the thread of a caller until receiving a UDP packet.
- Returns:
- byte a payload bytes in a UDP packet. The byte length must be less than a max length limited by the interaction channel and it is responsibility of a caller of this method to do so.
- Throws:
java.io.IOException
- If there is any problem with I/O operations or an interaction channel has not been initialized.
sendUDP
public static void sendUDP(byte[] rawMessage) throws java.io.IOException
- Send rawMessage to ATE via UDP/IP. The ATE?s IP address is specified by
an ?ate:a.b.c.d:xxxx:ppp? message from ATE. This method shall not
divide the specified rawMessage into some UDP packets. The specified
rawMessage shall be sent in a single UDP packet.
- Parameters:
rawMessage
- byte data to be sent. The byte length must be less than a max length limited by the interaction channel and it is responsibility of a caller of this method to do so.- Throws:
java.io.IOException
- If there is any problem with I/O operations or an interaction channel has not been initialized.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |