Download Java Serial Stream Extension for Rational Robot

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Java Serial Stream Adapter
for IBM/Rational Robot & Test Manager©
Zyntax Consulting BV
2005/03/03
JSS Extension
1/20
Introduction
• Java is an established standard
• Applications written in Java need testing, too
• Messaging between client and server involves
passing of objects in a serialized format
• Object serialization is via a defined protocol
• Robot© generates scripts containing raw
binary data; serialization simply unsupported
• JSS Extension supports this serialization
2005/03/03
JSS Extension
2/20
Overview
Why the JSS
Our solution
Examples
Caveats
Future plans
Questions
2005/03/03
JSS Extension
3/20
Why the JSS (1)
• Robot© scripts have raw data:
sock_send
"`aced0005`sr`0015`dcslibrary.DCSRequest`
"heckSumI`0010`m_nRequestActionI`000d`m_n
"java/lang/Object;L`000f`m_strFunctionIdt
"_strLanguageq`007e00024c000e`m_strSessio
"nTypeq`007e00024c0011`m_strStationGroupq
"`007e00024c0011`m_strTimeZoneNameq`007e0
2005/03/03
JSS Extension
4/20
Why the JSS (2)
• Users want a high-level script they can
read, modify and replay:
jss_data(
jss_data(
jss_data(
jss_data(
2005/03/03
_string,
_string,
_string,
_ref,
"m_object.m_strSessionId",
"m_object.m_strSessionType",
"m_object.m_strStationId",
"m_strErrorCode",
JSS Extension
"71" ) +
"W" ) +
"W71" ) +
"NULL" ) +
5/20
Our solution (1)
• Requirements:
– Recording and playback
– Simple, easy-to-read scripts
– Quick implementation
• Experiences developing other adaptors:
– Integration with Robot nice, but hard
– Impossible to record customer protocol and
other protocols simultaneously
2005/03/03
JSS Extension
6/20
Our solution (2)
• Architecture overview
Raw
script
2005/03/03
JSS
JSS Extension
JSS
script
7/20
Our solution (3)
• Interception
protocol data
Client
HTTP
SQL
…
custom
raw data
Server
socket
(IP)
client machine
net
server
machine
Scripts are more readable with higher-level data
2005/03/03
JSS Extension
8/20
Our solution (4)
• JSS “under the hood”
Raw
script
GNU
Flex
JSS
non-java
java
JSS
parser
JSS
script
Detects and reassembles
Java object streams in VU
2005/03/03
JSS Extension
9/20
Our solution (5)
• Stream elements are translated to:
–
–
–
–
–
jss_begin() / jss_end() delimit stream
jss_new() for new objects / classes
jss_def() for class / object definition details
jss_data() for data
jss_raw() for unsupported details (mixed mode)
• During replay, data elements are merged into
serialized objects and sent to server
2005/03/03
JSS Extension
10/20
Our solution (6)
• Example:
sock_send
jss_begin( “5” ) +
jss_new( _object,
jss_def( _class,
jss_def( _class,
jss_def( _class,
jss_def( _class,
jss_def( _field_p,
jss_def( _field_p,
/* … */
jss_data( _bool,
jss_data( _float,
jss_end();
2005/03/03
“obj1”,
“obj1.<name>”,
“obj1.<uid>”,
“obj1.<flags>”,
“obj1.<num_flds>”,
“obj1.theBool”,
“obj1.theFloat”,
“” ) +
“AllPrim” ) +
“c73a9c3cb013e429” ) +
“SC_SERIALIZABLE” ) +
“2” ) +
“boolean” ) +
“float” ) +
“obj1.theBool”,
“obj1.theFloat”,
“TRUE” ) +
“1.23456” ) +
JSS Extension
11/20
Details (1)
• Supported VU encapsulations:
– sock_send
<rawdata>
– http_request
<request header>
<rawdata>
– http_requests where data is chunked
– #if 0
<rawdata>
#endif
2005/03/03
JSS Extension
12/20
Details (2)
• Nesting
jss_data(
jss_data(
jss_data(
jss_data(
_string,
_string,
_string,
_ref,
"m_object.m_strSessionId",
"m_object.m_strSessionType",
"m_object.m_strStationId",
"m_strErrorCode",
"71" ) +
"W" ) +
"W71" ) +
"NULL" ) +
• Arrays
jss_new(
/* … */
jss_data(
jss_data(
jss_data(
2005/03/03
_class,
"obj1.theIntArray",
"[I" ) +
_int,
_int,
_int,
"obj1.theIntArray.<size>",
"obj1.theIntArray[0]",
"obj1.theIntArray[1]",
“2" ) +
“516" ) +
“781" ) +
JSS Extension
13/20
Details (3)
• References
– to NULL
– to a previous string / object (0x7e####)
java_data( _string, "m_strSessionType", "W" ) +
java_data( _ref
, "m_strStationGroup", "0x7e0009" ) +
Prevents data repeating and infinite loops
for linked lists
– are automatically recalculated on replay
2005/03/03
JSS Extension
14/20
Details (4)
• Heuristic parser deals with data that is
further formatted:
– Content in ZIP format (standard Java I/O)
jss_deflate(
jss_begin( “order ID: 5” ) + /* … */
jss_end()
)
– Nested streams in binary blocks
jss_begin( “5” ) +
jss_blocks( 3, 1024,
jss_begin( “5” ) + …
2005/03/03
JSS Extension
15/20
Details (5)
• Multi-connection data often misunderstood by Robot. JSS re-assembles:
http_nrecv [“cmd_001"] 218 ;
/* 218 bytes /(unknown response length) */
jss_store( “zyntax_com_3", _response );
/* VU code to receive data on different connection */
/* VU code to change back to original connection */
http_nrecv [“cmd_002"] 48 ;
jss_store( “zyntax_com_3", _response );
full_response = jss_retrieve( “zyntax_com_3” );
2005/03/03
JSS Extension
16/20
Caveats
• Script generation:
– Manual edits may confuse FLEX module
– New encapsulations?
– Use WinDiff when in doubt
• Replay:
– Datapool use may change sizes, possibly
causing different numbers of packet
receives.
2005/03/03
JSS Extension
17/20
Future Plans
• Serialization in J2SE 1.5.0 (XML!)
• Other encapsulations for serial blocks?
• Similar protocols (RMI,…)
2005/03/03
JSS Extension
18/20
Conclusion
• JSS Extension
– Affordable, Quick to implement
and
– Switches focus to how application behaves under
multi-user load, if it meets requirements, etc.
• Technically
– Makes testing possible
– Allows understanding what application is doing
– Provides ability to generate realistic scripts
2005/03/03
JSS Extension
19/20
Questions
• Questions?
Visit
http://www.zyntax.com
Email [email protected]
Call
+31-20-6155033
Post a nice letter…
PO Box 51336
1007EH Amsterdam
The Netherlands
2005/03/03
JSS Extension
20/20