|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.drda.TestProto
This class is used to test error conditions in the protocol. The protocol to send to the Net server is contained in a file encoded as calls to routines in ddmreader and ddmwriter. Additional commands have been added for testing purposes. To add tests, modify the file protocol.tests. Tests can also be done as separate files and given as an argument to this class.
Field Summary | |
private static CcsidManager |
ccsidManager
|
private static int |
CHECK_SQLCARD
|
private static int |
CHECKERROR
|
private static CodePointNameTable |
codePointNameTable
|
private static java.util.Hashtable |
codePointValueTable
|
private static java.util.Hashtable |
commandTable
|
private static int |
CREATE_DSS_OBJECT
|
private static int |
CREATE_DSS_REPLY
|
private static int |
CREATE_DSS_REQUEST
|
private java.lang.String |
current_filename
|
private static int |
DISPLAY
|
private static int |
END_DDM
|
private static int |
END_DDM_AND_DSS
|
private static int |
END_DSS
|
private static int |
END_TEST
|
private boolean |
failed
|
private static int |
FLUSH
|
private static int |
GET_CODEPOINT
|
private static int |
INCLUDE
|
private static int |
MARK_COLLECTION
|
private java.io.InputStream |
monitorIs
|
private java.io.OutputStream |
monitorOs
|
private java.net.Socket |
monitorSocket
|
private static int |
MORE_DATA
|
private static java.lang.String |
MULTIVAL_END
|
private static java.lang.String |
MULTIVAL_SEP
|
private static java.lang.String |
MULTIVAL_START
|
private static int |
READ_BOOLEAN
|
private static int |
READ_BYTE
|
private static int |
READ_BYTES
|
private static int |
READ_CODEPOINT
|
private static int |
READ_INT
|
private static int |
READ_LENGTH_AND_CODEPOINT
|
private static int |
READ_LONG
|
private static int |
READ_NETWORK_INT
|
private static int |
READ_NETWORK_SHORT
|
private static int |
READ_REPLY_DSS
|
private static int |
READ_SCALAR_1BYTE
|
private static int |
READ_SCALAR_2BYTES
|
private static int |
READ_SHORT
|
private static int |
READ_STRING
|
private DDMReader |
reader
|
private static int |
RESET
|
private static int |
SKIP_BYTES
|
private static int |
SKIP_DDM
|
private static int |
SKIP_DSS
|
private static int |
START_DDM
|
private java.io.StreamTokenizer |
tkn
|
private static int |
WRITE_BYTE
|
private static int |
WRITE_BYTES
|
private static int |
WRITE_CODEPOINT_4BYTES
|
private static int |
WRITE_DOUBLE
|
private static int |
WRITE_ENCODED_LDSTRING
|
private static int |
WRITE_ENCODED_STRING
|
private static int |
WRITE_FLOAT
|
private static int |
WRITE_INT
|
private static int |
WRITE_LONG
|
private static int |
WRITE_NETWORK_INT
|
private static int |
WRITE_NETWORK_SHORT
|
private static int |
WRITE_PADDED_STRING
|
private static int |
WRITE_SCALAR_1BYTE
|
private static int |
WRITE_SCALAR_2BYTES
|
private static int |
WRITE_SCALAR_BYTES
|
private static int |
WRITE_SCALAR_HEADER
|
private static int |
WRITE_SCALAR_PADDED_BYTES
|
private static int |
WRITE_SCALAR_PADDED_STRING
|
private static int |
WRITE_SCALAR_STRING
|
private static int |
WRITE_SHORT
|
private static int |
WRITE_STRING
|
private DDMWriter |
writer
|
Constructor Summary | |
TestProto(java.lang.String filename)
|
Method Summary | |
private void |
checkError()
Check error sent back to application requester |
private boolean |
checkIntOrCP(int val)
checks if value matches next int or cp. |
private void |
checkSQLCARD(int sqlCode,
java.lang.String sqlState)
Check the value of SQLCARD |
private void |
closeConnection()
Close connection to the network server |
private int |
convertHex(java.lang.String str)
Convert a token in hex format to int from the command file |
private void |
cpError(int cp,
int reqCP)
Codepoint error |
private int |
decodeCP(java.lang.String strval)
Translate a string codepoint such as ACCSEC to the equivalent int value |
private void |
fail(java.lang.String msg)
Print failure message and skip to the next test |
private byte[] |
getBytes()
Read an array of bytes from the command file A byte string can start with 0x in which case the bytes are interpreted in hex format or it can just be a string, in which case each char is interpreted as 2 byte UNICODE |
private void |
getConnection()
Set up a connection to the Network server |
private int |
getCP()
Read the string version of a CodePoint |
private byte[] |
getEBCDIC(java.lang.String str)
Translate a string to EBCDIC for use in the protocol |
private int |
getInt()
Read an int from the command file Negative numbers are preceded by "-" |
private int |
getIntOrCP()
Read an int or codepoint - codepoint is given as a string |
private java.lang.String |
getString()
Read a string from the command file |
private static void |
init()
Initialize hashtable for commands and set up a table to translate from the codepoint name to the codepoint value |
private void |
processCommand()
Process a command |
private void |
processFile(java.lang.String filename)
Process a command file |
private void |
processIncludeFile()
Process include file |
private void |
readLengthAndCodePoint()
Read length and codepoint and check against required values |
private void |
reset()
Reset connection for another test |
private void |
skipDdm()
Skip the a Ddm communication |
private void |
skipDss()
Skip a DSS communication |
private void |
writeEncodedLDString(java.lang.String str,
java.lang.String encoding,
int len)
Write length and encoded string |
private void |
writeEncodedString(java.lang.String str,
java.lang.String encoding)
Write an encoded string |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final CodePointNameTable codePointNameTable
private static final java.util.Hashtable codePointValueTable
private static final java.util.Hashtable commandTable
private static final CcsidManager ccsidManager
private static final int CREATE_DSS_REQUEST
private static final int CREATE_DSS_OBJECT
private static final int END_DSS
private static final int END_DDM_AND_DSS
private static final int START_DDM
private static final int END_DDM
private static final int WRITE_BYTE
private static final int WRITE_NETWORK_SHORT
private static final int WRITE_NETWORK_INT
private static final int WRITE_BYTES
private static final int WRITE_CODEPOINT_4BYTES
private static final int WRITE_SCALAR_1BYTE
private static final int WRITE_SCALAR_2BYTES
private static final int WRITE_SCALAR_BYTES
private static final int WRITE_SCALAR_HEADER
private static final int WRITE_SCALAR_STRING
private static final int WRITE_SCALAR_PADDED_STRING
private static final int WRITE_SCALAR_PADDED_BYTES
private static final int WRITE_SHORT
private static final int WRITE_INT
private static final int WRITE_LONG
private static final int WRITE_FLOAT
private static final int WRITE_DOUBLE
private static final int READ_REPLY_DSS
private static final int READ_LENGTH_AND_CODEPOINT
private static final int READ_CODEPOINT
private static final int MARK_COLLECTION
private static final int GET_CODEPOINT
private static final int READ_BYTE
private static final int READ_NETWORK_SHORT
private static final int READ_SHORT
private static final int READ_NETWORK_INT
private static final int READ_INT
private static final int READ_LONG
private static final int READ_BOOLEAN
private static final int READ_STRING
private static final int READ_BYTES
private static final int FLUSH
private static final int DISPLAY
private static final int CHECKERROR
private static final int RESET
private static final int CREATE_DSS_REPLY
private static final int SKIP_DSS
private static final int READ_SCALAR_2BYTES
private static final int READ_SCALAR_1BYTE
private static final int END_TEST
private static final int SKIP_DDM
private static final int INCLUDE
private static final int SKIP_BYTES
private static final int WRITE_PADDED_STRING
private static final int WRITE_STRING
private static final int WRITE_ENCODED_STRING
private static final int WRITE_ENCODED_LDSTRING
private static final int CHECK_SQLCARD
private static final int MORE_DATA
private static final java.lang.String MULTIVAL_START
private static final java.lang.String MULTIVAL_SEP
private static final java.lang.String MULTIVAL_END
private java.net.Socket monitorSocket
private java.io.InputStream monitorIs
private java.io.OutputStream monitorOs
private DDMWriter writer
private DDMReader reader
private boolean failed
private java.io.StreamTokenizer tkn
private java.lang.String current_filename
Constructor Detail |
public TestProto(java.lang.String filename)
Method Detail |
private void processIncludeFile() throws java.io.IOException, DRDAProtocolException
IOException,
- DRDAProtocolException error reading file or protocol
java.io.IOException
DRDAProtocolException
private void processFile(java.lang.String filename) throws java.io.IOException, DRDAProtocolException
filename
-
IOException,
- DRDAProtocolException error reading file or protocol
java.io.IOException
DRDAProtocolException
private void getConnection()
private void closeConnection()
private void reset()
private static void init()
private void processCommand() throws java.io.IOException, DRDAProtocolException
java.io.IOException
DRDAProtocolException
private void skipDss() throws DRDAProtocolException
DRDAProtocolException
private void skipDdm() throws DRDAProtocolException
DRDAProtocolException
private int getInt() throws java.io.IOException
java.io.IOException
private int convertHex(java.lang.String str) throws java.io.IOException
java.io.IOException
private boolean checkIntOrCP(int val) throws java.io.IOException
java.io.IOException
private int getIntOrCP() throws java.io.IOException
java.io.IOException
private byte[] getBytes() throws java.io.IOException
java.io.IOException
private java.lang.String getString() throws java.io.IOException
java.io.IOException
- error reading fileprivate int getCP() throws java.io.IOException
java.io.IOException
- error reading fileprivate int decodeCP(java.lang.String strval)
strval
- string codepoint
private void fail(java.lang.String msg) throws java.io.IOException
java.io.IOException
- error reading fileprivate void checkError() throws java.io.IOException, DRDAProtocolException
IOException,
- DRDAProtocolException error reading file or protocol
java.io.IOException
DRDAProtocolException
private void readLengthAndCodePoint() throws java.io.IOException, DRDAProtocolException
IOException,
- DRDAProtocolException error reading file or protocol
java.io.IOException
DRDAProtocolException
private void cpError(int cp, int reqCP) throws java.io.IOException
java.io.IOException
- error reading command fileprivate byte[] getEBCDIC(java.lang.String str)
str
- string to transform
private void writeEncodedString(java.lang.String str, java.lang.String encoding) throws java.io.IOException
str
- string to writeencoding
- Java encoding to use
java.io.IOException
private void writeEncodedLDString(java.lang.String str, java.lang.String encoding, int len) throws java.io.IOException
str
- string to writeencoding
- Java encoding to uselen
- Size of length value (2 or 4 bytes)
java.io.IOException
private void checkSQLCARD(int sqlCode, java.lang.String sqlState) throws java.io.IOException, DRDAProtocolException
sqlCode
- SQLCODE valuesqlState
- SQLSTATE value
IOException,
- DRDAProtocolException
java.io.IOException
DRDAProtocolException
|
Built on Mon 2007-06-04 09:58:47+0400, from revision ??? | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |